summaryrefslogtreecommitdiff
path: root/op_crates
diff options
context:
space:
mode:
Diffstat (limited to 'op_crates')
-rw-r--r--op_crates/console/01_colors.js94
-rw-r--r--op_crates/console/02_console.js1796
-rw-r--r--op_crates/console/Cargo.toml17
-rw-r--r--op_crates/console/README.md5
-rw-r--r--op_crates/console/lib.deno_console.d.ts29
-rw-r--r--op_crates/console/lib.rs19
-rw-r--r--op_crates/crypto/01_crypto.js50
-rw-r--r--op_crates/crypto/Cargo.toml19
-rw-r--r--op_crates/crypto/README.md5
-rw-r--r--op_crates/crypto/lib.deno_crypto.d.ts26
-rw-r--r--op_crates/crypto/lib.rs56
-rw-r--r--op_crates/fetch/01_fetch_util.js21
-rw-r--r--op_crates/fetch/11_streams.js3885
-rw-r--r--op_crates/fetch/11_streams_types.d.ts49
-rw-r--r--op_crates/fetch/20_headers.js449
-rw-r--r--op_crates/fetch/21_formdata.js552
-rw-r--r--op_crates/fetch/22_body.js338
-rw-r--r--op_crates/fetch/22_http_client.js41
-rw-r--r--op_crates/fetch/23_request.js524
-rw-r--r--op_crates/fetch/23_response.js415
-rw-r--r--op_crates/fetch/26_fetch.js307
-rw-r--r--op_crates/fetch/Cargo.toml26
-rw-r--r--op_crates/fetch/README.md5
-rw-r--r--op_crates/fetch/internal.d.ts113
-rw-r--r--op_crates/fetch/lib.deno_fetch.d.ts708
-rw-r--r--op_crates/fetch/lib.rs497
-rw-r--r--op_crates/file/01_file.js412
-rw-r--r--op_crates/file/02_filereader.js414
-rw-r--r--op_crates/file/03_blob_url.js63
-rw-r--r--op_crates/file/Cargo.toml18
-rw-r--r--op_crates/file/README.md5
-rw-r--r--op_crates/file/internal.d.ts18
-rw-r--r--op_crates/file/lib.deno_file.d.ts40
-rw-r--r--op_crates/file/lib.rs120
-rw-r--r--op_crates/timers/01_timers.js579
-rw-r--r--op_crates/timers/Cargo.toml18
-rw-r--r--op_crates/timers/README.md5
-rw-r--r--op_crates/timers/lib.rs191
-rw-r--r--op_crates/url/00_url.js409
-rw-r--r--op_crates/url/Cargo.toml27
-rw-r--r--op_crates/url/README.md5
-rw-r--r--op_crates/url/benches/url_ops.rs35
-rw-r--r--op_crates/url/internal.d.ts14
-rw-r--r--op_crates/url/lib.deno_url.d.ts175
-rw-r--r--op_crates/url/lib.rs173
-rw-r--r--op_crates/web/00_infra.js203
-rw-r--r--op_crates/web/01_dom_exception.js148
-rw-r--r--op_crates/web/01_mimesniff.js190
-rw-r--r--op_crates/web/02_event.js1212
-rw-r--r--op_crates/web/03_abort_signal.js128
-rw-r--r--op_crates/web/04_global_interfaces.js70
-rw-r--r--op_crates/web/08_text_encoding.js4564
-rw-r--r--op_crates/web/12_location.js393
-rw-r--r--op_crates/web/Cargo.toml20
-rw-r--r--op_crates/web/README.md5
-rw-r--r--op_crates/web/internal.d.ts73
-rw-r--r--op_crates/web/lib.deno_web.d.ts314
-rw-r--r--op_crates/web/lib.rs26
-rw-r--r--op_crates/webgpu/01_webgpu.js5048
-rw-r--r--op_crates/webgpu/02_idl_types.js1926
-rw-r--r--op_crates/webgpu/Cargo.toml21
-rw-r--r--op_crates/webgpu/README.md35
-rw-r--r--op_crates/webgpu/binding.rs352
-rw-r--r--op_crates/webgpu/buffer.rs239
-rw-r--r--op_crates/webgpu/bundle.rs460
-rw-r--r--op_crates/webgpu/command_encoder.rs723
-rw-r--r--op_crates/webgpu/compute_pass.rs366
-rw-r--r--op_crates/webgpu/error.rs294
-rw-r--r--op_crates/webgpu/lib.deno_webgpu.d.ts1126
-rw-r--r--op_crates/webgpu/lib.rs871
-rw-r--r--op_crates/webgpu/pipeline.rs643
-rw-r--r--op_crates/webgpu/queue.rs159
-rw-r--r--op_crates/webgpu/render_pass.rs677
-rw-r--r--op_crates/webgpu/sampler.rs125
-rw-r--r--op_crates/webgpu/shader.rs79
-rw-r--r--op_crates/webgpu/texture.rs249
-rw-r--r--op_crates/webgpu/webgpu.idl1023
-rw-r--r--op_crates/webidl/00_webidl.js919
-rw-r--r--op_crates/webidl/Cargo.toml17
-rw-r--r--op_crates/webidl/README.md6
-rw-r--r--op_crates/webidl/internal.d.ts303
-rw-r--r--op_crates/webidl/lib.rs14
-rw-r--r--op_crates/websocket/01_websocket.js401
-rw-r--r--op_crates/websocket/Cargo.toml24
-rw-r--r--op_crates/websocket/README.md5
-rw-r--r--op_crates/websocket/lib.deno_websocket.d.ts112
-rw-r--r--op_crates/websocket/lib.rs367
87 files changed, 0 insertions, 36697 deletions
diff --git a/op_crates/console/01_colors.js b/op_crates/console/01_colors.js
deleted file mode 100644
index 66dcb6e23..000000000
--- a/op_crates/console/01_colors.js
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-"use strict";
-
-((window) => {
- function code(open, close) {
- return {
- open: `\x1b[${open}m`,
- close: `\x1b[${close}m`,
- regexp: new RegExp(`\\x1b\\[${close}m`, "g"),
- };
- }
-
- function run(str, code) {
- return `${code.open}${str.replace(code.regexp, code.open)}${code.close}`;
- }
-
- function bold(str) {
- return run(str, code(1, 22));
- }
-
- function italic(str) {
- return run(str, code(3, 23));
- }
-
- function yellow(str) {
- return run(str, code(33, 39));
- }
-
- function cyan(str) {
- return run(str, code(36, 39));
- }
-
- function red(str) {
- return run(str, code(31, 39));
- }
-
- function green(str) {
- return run(str, code(32, 39));
- }
-
- function bgRed(str) {
- return run(str, code(41, 49));
- }
-
- function white(str) {
- return run(str, code(37, 39));
- }
-
- function gray(str) {
- return run(str, code(90, 39));
- }
-
- function magenta(str) {
- return run(str, code(35, 39));
- }
-
- function dim(str) {
- return run(str, code(2, 22));
- }
-
- // https://github.com/chalk/ansi-regex/blob/2b56fb0c7a07108e5b54241e8faec160d393aedb/index.js
- const ANSI_PATTERN = new RegExp(
- [
- "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
- "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))",
- ].join("|"),
- "g",
- );
-
- function stripColor(string) {
- return string.replace(ANSI_PATTERN, "");
- }
-
- function maybeColor(fn) {
- return !(globalThis.Deno?.noColor ?? false) ? fn : (s) => s;
- }
-
- window.__bootstrap.colors = {
- bold,
- italic,
- yellow,
- cyan,
- red,
- green,
- bgRed,
- white,
- gray,
- magenta,
- dim,
- stripColor,
- maybeColor,
- };
-})(this);
diff --git a/op_crates/console/02_console.js b/op_crates/console/02_console.js
deleted file mode 100644
index 2c0dcf434..000000000
--- a/op_crates/console/02_console.js
+++ /dev/null
@@ -1,1796 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-"use strict";
-
-((window) => {
- const core = window.Deno.core;
- const colors = window.__bootstrap.colors;
-
- function isInvalidDate(x) {
- return isNaN(x.getTime());
- }
-
- function hasOwnProperty(obj, v) {
- if (obj == null) {
- return false;
- }
- return Object.prototype.hasOwnProperty.call(obj, v);
- }
-
- function propertyIsEnumerable(obj, prop) {
- if (
- obj == null ||
- typeof obj.propertyIsEnumerable !== "function"
- ) {
- return false;
- }
-
- return obj.propertyIsEnumerable(prop);
- }
-
- // Copyright Joyent, Inc. and other Node contributors. MIT license.
- // Forked from Node's lib/internal/cli_table.js
-
- function isTypedArray(x) {
- return ArrayBuffer.isView(x) && !(x instanceof DataView);
- }
-
- const tableChars = {
- middleMiddle: "─",
- rowMiddle: "┼",
- topRight: "┐",
- topLeft: "┌",
- leftMiddle: "├",
- topMiddle: "┬",
- bottomRight: "┘",
- bottomLeft: "└",
- bottomMiddle: "┴",
- rightMiddle: "┤",
- left: "│ ",
- right: " │",
- middle: " │ ",
- };
-
- function isFullWidthCodePoint(code) {
- // Code points are partially derived from:
- // http://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt
- return (
- code >= 0x1100 &&
- (code <= 0x115f || // Hangul Jamo
- code === 0x2329 || // LEFT-POINTING ANGLE BRACKET
- code === 0x232a || // RIGHT-POINTING ANGLE BRACKET
- // CJK Radicals Supplement .. Enclosed CJK Letters and Months
- (code >= 0x2e80 && code <= 0x3247 && code !== 0x303f) ||
- // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
- (code >= 0x3250 && code <= 0x4dbf) ||
- // CJK Unified Ideographs .. Yi Radicals
- (code >= 0x4e00 && code <= 0xa4c6) ||
- // Hangul Jamo Extended-A
- (code >= 0xa960 && code <= 0xa97c) ||
- // Hangul Syllables
- (code >= 0xac00 && code <= 0xd7a3) ||
- // CJK Compatibility Ideographs
- (code >= 0xf900 && code <= 0xfaff) ||
- // Vertical Forms
- (code >= 0xfe10 && code <= 0xfe19) ||
- // CJK Compatibility Forms .. Small Form Variants
- (code >= 0xfe30 && code <= 0xfe6b) ||
- // Halfwidth and Fullwidth Forms
- (code >= 0xff01 && code <= 0xff60) ||
- (code >= 0xffe0 && code <= 0xffe6) ||
- // Kana Supplement
- (code >= 0x1b000 && code <= 0x1b001) ||
- // Enclosed Ideographic Supplement
- (code >= 0x1f200 && code <= 0x1f251) ||
- // Miscellaneous Symbols and Pictographs 0x1f300 - 0x1f5ff
- // Emoticons 0x1f600 - 0x1f64f
- (code >= 0x1f300 && code <= 0x1f64f) ||
- // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
- (code >= 0x20000 && code <= 0x3fffd))
- );
- }
-
- function getStringWidth(str) {
- str = colors.stripColor(str).normalize("NFC");
- let width = 0;
-
- for (const ch of str) {
- width += isFullWidthCodePoint(ch.codePointAt(0)) ? 2 : 1;
- }
-
- return width;
- }
-
- function renderRow(row, columnWidths) {
- let out = tableChars.left;
- for (let i = 0; i < row.length; i++) {
- const cell = row[i];
- const len = getStringWidth(cell);
- const needed = (columnWidths[i] - len) / 2;
- // round(needed) + ceil(needed) will always add up to the amount
- // of spaces we need while also left justifying the output.
- out += `${" ".repeat(needed)}${cell}${" ".repeat(Math.ceil(needed))}`;
- if (i !== row.length - 1) {
- out += tableChars.middle;
- }
- }
- out += tableChars.right;
- return out;
- }
-
- function cliTable(head, columns) {
- const rows = [];
- const columnWidths = head.map((h) => getStringWidth(h));
- const longestColumn = columns.reduce(
- (n, a) => Math.max(n, a.length),
- 0,
- );
-
- for (let i = 0; i < head.length; i++) {
- const column = columns[i];
- for (let j = 0; j < longestColumn; j++) {
- if (rows[j] === undefined) {
- rows[j] = [];
- }
- const value = (rows[j][i] = hasOwnProperty(column, j) ? column[j] : "");
- const width = columnWidths[i] || 0;
- const counted = getStringWidth(value);
- columnWidths[i] = Math.max(width, counted);
- }
- }
-
- const divider = columnWidths.map((i) =>
- tableChars.middleMiddle.repeat(i + 2)
- );
-
- let result = `${tableChars.topLeft}${divider.join(tableChars.topMiddle)}` +
- `${tableChars.topRight}\n${renderRow(head, columnWidths)}\n` +
- `${tableChars.leftMiddle}${divider.join(tableChars.rowMiddle)}` +
- `${tableChars.rightMiddle}\n`;
-
- for (const row of rows) {
- result += `${renderRow(row, columnWidths)}\n`;
- }
-
- result +=
- `${tableChars.bottomLeft}${divider.join(tableChars.bottomMiddle)}` +
- tableChars.bottomRight;
-
- return result;
- }
- /* End of forked part */
-
- const DEFAULT_INSPECT_OPTIONS = {
- depth: 4,
- indentLevel: 0,
- sorted: false,
- trailingComma: false,
- compact: true,
- iterableLimit: 100,
- showProxy: false,
- colors: false,
- getters: false,
- showHidden: false,
- };
-
- const DEFAULT_INDENT = " "; // Default indent string
-
- const LINE_BREAKING_LENGTH = 80;
- const MIN_GROUP_LENGTH = 6;
- const STR_ABBREVIATE_SIZE = 100;
-
- const PROMISE_STRING_BASE_LENGTH = 12;
-
- class CSI {
- static kClear = "\x1b[1;1H";
- static kClearScreenDown = "\x1b[0J";
- }
-
- function getClassInstanceName(instance) {
- if (typeof instance != "object") {
- return "";
- }
- const constructor = instance?.constructor;
- if (typeof constructor == "function") {
- return constructor.name ?? "";
- }
- return "";
- }
-
- function maybeColor(fn, inspectOptions) {
- return inspectOptions.colors ? fn : (s) => s;
- }
-
- function inspectFunction(value, level, inspectOptions) {
- const cyan = maybeColor(colors.cyan, inspectOptions);
- if (customInspect in value && typeof value[customInspect] === "function") {
- return String(value[customInspect]());
- }
- // Might be Function/AsyncFunction/GeneratorFunction/AsyncGeneratorFunction
- let cstrName = Object.getPrototypeOf(value)?.constructor?.name;
- if (!cstrName) {
- // If prototype is removed or broken,
- // use generic 'Function' instead.
- cstrName = "Function";
- }
-
- // Our function may have properties, so we want to format those
- // as if our function was an object
- // If we didn't find any properties, we will just append an
- // empty suffix.
- let suffix = ``;
- if (
- Object.keys(value).length > 0 ||
- Object.getOwnPropertySymbols(value).length > 0
- ) {
- const propString = inspectRawObject(value, level, inspectOptions);
- // Filter out the empty string for the case we only have
- // non-enumerable symbols.
- if (
- propString.length > 0 &&
- propString !== "{}"
- ) {
- suffix = ` ${propString}`;
- }
- }
-
- if (value.name && value.name !== "anonymous") {
- // from MDN spec
- return cyan(`[${cstrName}: ${value.name}]`) + suffix;
- }
- return cyan(`[${cstrName}]`) + suffix;
- }
-
- function inspectIterable(
- value,
- level,
- options,
- inspectOptions,
- ) {
- const cyan = maybeColor(colors.cyan, inspectOptions);
- if (level >= inspectOptions.depth) {
- return cyan(`[${options.typeName}]`);
- }
-
- const entries = [];
-
- const iter = value.entries();
- let entriesLength = 0;
- const next = () => {
- return iter.next();
- };
- for (const el of iter) {
- if (entriesLength < inspectOptions.iterableLimit) {
- entries.push(
- options.entryHandler(
- el,
- level + 1,
- inspectOptions,
- next.bind(iter),
- ),
- );
- }
- entriesLength++;
- }
-
- if (options.sort) {
- entries.sort();
- }
-
- if (entriesLength > inspectOptions.iterableLimit) {
- const nmore = entriesLength - inspectOptions.iterableLimit;
- entries.push(`... ${nmore} more items`);
- }
-
- const iPrefix = `${options.displayName ? options.displayName + " " : ""}`;
-
- const initIndentation = `\n${DEFAULT_INDENT.repeat(level + 1)}`;
- const entryIndentation = `,\n${DEFAULT_INDENT.repeat(level + 1)}`;
- const closingIndentation = `${inspectOptions.trailingComma ? "," : ""}\n${
- DEFAULT_INDENT.repeat(level)
- }`;
-
- let iContent;
- if (options.group && entries.length > MIN_GROUP_LENGTH) {
- const groups = groupEntries(entries, level, value);
- iContent = `${initIndentation}${
- groups.join(entryIndentation)
- }${closingIndentation}`;
- } else {
- iContent = entries.length === 0 ? "" : ` ${entries.join(", ")} `;
- if (
- colors.stripColor(iContent).length > LINE_BREAKING_LENGTH ||
- !inspectOptions.compact
- ) {
- iContent = `${initIndentation}${
- entries.join(entryIndentation)
- }${closingIndentation}`;
- }
- }
-
- return `${iPrefix}${options.delims[0]}${iContent}${options.delims[1]}`;
- }
-
- // Ported from Node.js
- // Copyright Node.js contributors. All rights reserved.
- function groupEntries(
- entries,
- level,
- value,
- iterableLimit = 100,
- ) {
- let totalLength = 0;
- let maxLength = 0;
- let entriesLength = entries.length;
- if (iterableLimit < entriesLength) {
- // This makes sure the "... n more items" part is not taken into account.
- entriesLength--;
- }
- const separatorSpace = 2; // Add 1 for the space and 1 for the separator.
- const dataLen = new Array(entriesLength);
- // Calculate the total length of all output entries and the individual max
- // entries length of all output entries.
- // IN PROGRESS: Colors are being taken into account.
- for (let i = 0; i < entriesLength; i++) {
- // Taking colors into account: removing the ANSI color
- // codes from the string before measuring its length
- const len = colors.stripColor(entries[i]).length;
- dataLen[i] = len;
- totalLength += len + separatorSpace;
- if (maxLength < len) maxLength = len;
- }
- // Add two to `maxLength` as we add a single whitespace character plus a comma
- // in-between two entries.
- const actualMax = maxLength + separatorSpace;
- // Check if at least three entries fit next to each other and prevent grouping
- // of arrays that contains entries of very different length (i.e., if a single
- // entry is longer than 1/5 of all other entries combined). Otherwise the
- // space in-between small entries would be enormous.
- if (
- actualMax * 3 + (level + 1) < LINE_BREAKING_LENGTH &&
- (totalLength / actualMax > 5 || maxLength <= 6)
- ) {
- const approxCharHeights = 2.5;
- const averageBias = Math.sqrt(actualMax - totalLength / entries.length);
- const biasedMax = Math.max(actualMax - 3 - averageBias, 1);
- // Dynamically check how many columns seem possible.
- const columns = Math.min(
- // Ideally a square should be drawn. We expect a character to be about 2.5
- // times as high as wide. This is the area formula to calculate a square
- // which contains n rectangles of size `actualMax * approxCharHeights`.
- // Divide that by `actualMax` to receive the correct number of columns.
- // The added bias increases the columns for short entries.
- Math.round(
- Math.sqrt(approxCharHeights * biasedMax * entriesLength) / biasedMax,
- ),
- // Do not exceed the breakLength.
- Math.floor((LINE_BREAKING_LENGTH - (level + 1)) / actualMax),
- // Limit the columns to a maximum of fifteen.
- 15,
- );
- // Return with the original output if no grouping should happen.
- if (columns <= 1) {
- return entries;
- }
- const tmp = [];
- const maxLineLength = [];
- for (let i = 0; i < columns; i++) {
- let lineMaxLength = 0;
- for (let j = i; j < entries.length; j += columns) {
- if (dataLen[j] > lineMaxLength) lineMaxLength = dataLen[j];
- }
- lineMaxLength += separatorSpace;
- maxLineLength[i] = lineMaxLength;
- }
- let order = "padStart";
- if (value !== undefined) {
- for (let i = 0; i < entries.length; i++) {
- if (
- typeof value[i] !== "number" &&
- typeof value[i] !== "bigint"
- ) {
- order = "padEnd";
- break;
- }
- }
- }
- // Each iteration creates a single line of grouped entries.
- for (let i = 0; i < entriesLength; i += columns) {
- // The last lines may contain less entries than columns.
- const max = Math.min(i + columns, entriesLength);
- let str = "";
- let j = i;
- for (; j < max - 1; j++) {
- const lengthOfColorCodes = entries[j].length - dataLen[j];
- const padding = maxLineLength[j - i] + lengthOfColorCodes;
- str += `${entries[j]}, `[order](padding, " ");
- }
- if (order === "padStart") {
- const lengthOfColorCodes = entries[j].length - dataLen[j];
- const padding = maxLineLength[j - i] +
- lengthOfColorCodes -
- separatorSpace;
- str += entries[j].padStart(padding, " ");
- } else {
- str += entries[j];
- }
- tmp.push(str);
- }
- if (iterableLimit < entries.length) {
- tmp.push(entries[entriesLength]);
- }
- entries = tmp;
- }
- return entries;
- }
-
- function _inspectValue(
- value,
- level,
- inspectOptions,
- ) {
- const proxyDetails = core.getProxyDetails(value);
- if (proxyDetails != null) {
- return inspectOptions.showProxy
- ? inspectProxy(proxyDetails, level, inspectOptions)
- : inspectValue(proxyDetails[0], level, inspectOptions);
- }
-
- const green = maybeColor(colors.green, inspectOptions);
- const yellow = maybeColor(colors.yellow, inspectOptions);
- const dim = maybeColor(colors.dim, inspectOptions);
- const cyan = maybeColor(colors.cyan, inspectOptions);
- const bold = maybeColor(colors.bold, inspectOptions);
- const red = maybeColor(colors.red, inspectOptions);
-
- switch (typeof value) {
- case "string":
- return green(quoteString(value));
- case "number": // Numbers are yellow
- // Special handling of -0
- return yellow(Object.is(value, -0) ? "-0" : `${value}`);
- case "boolean": // booleans are yellow
- return yellow(String(value));
- case "undefined": // undefined is dim
- return dim(String(value));
- case "symbol": // Symbols are green
- return green(maybeQuoteSymbol(value));
- case "bigint": // Bigints are yellow
- return yellow(`${value}n`);
- case "function": // Function string is cyan
- if (ctxHas(value)) {
- // Circular string is cyan
- return cyan("[Circular]");
- }
-
- return inspectFunction(value, level, inspectOptions);
- case "object": // null is bold
- if (value === null) {
- return bold("null");
- }
-
- if (ctxHas(value)) {
- // Circular string is cyan
- return cyan("[Circular]");
- }
- return inspectObject(value, level, inspectOptions);
- default:
- // Not implemented is red
- return red("[Not Implemented]");
- }
- }
-
- function inspectValue(
- value,
- level,
- inspectOptions,
- ) {
- CTX_STACK.push(value);
- let x;
- try {
- x = _inspectValue(value, level, inspectOptions);
- } finally {
- CTX_STACK.pop();
- }
- return x;
- }
-
- // We can match Node's quoting behavior exactly by swapping the double quote and
- // single quote in this array. That would give preference to single quotes.
- // However, we prefer double quotes as the default.
- const QUOTES = ['"', "'", "`"];
-
- /** Surround the string in quotes.
- *
- * The quote symbol is chosen by taking the first of the `QUOTES` array which
- * does not occur in the string. If they all occur, settle with `QUOTES[0]`.
- *
- * Insert a backslash before any occurrence of the chosen quote symbol and
- * before any backslash.
- */
- function quoteString(string) {
- const quote = QUOTES.find((c) => !string.includes(c)) ?? QUOTES[0];
- const escapePattern = new RegExp(`(?=[${quote}\\\\])`, "g");
- string = string.replace(escapePattern, "\\");
- string = replaceEscapeSequences(string);
- return `${quote}${string}${quote}`;
- }
-
- // Replace escape sequences that can modify output.
- function replaceEscapeSequences(string) {
- return string
- .replace(/[\b]/g, "\\b")
- .replace(/\f/g, "\\f")
- .replace(/\n/g, "\\n")
- .replace(/\r/g, "\\r")
- .replace(/\t/g, "\\t")
- .replace(/\v/g, "\\v")
- .replace(
- // deno-lint-ignore no-control-regex
- /[\x00-\x1f\x7f-\x9f]/g,
- (c) => "\\x" + c.charCodeAt(0).toString(16).padStart(2, "0"),
- );
- }
-
- // Surround a string with quotes when it is required (e.g the string not a valid identifier).
- function maybeQuoteString(string) {
- if (/^[a-zA-Z_][a-zA-Z_0-9]*$/.test(string)) {
- return replaceEscapeSequences(string);
- }
-
- return quoteString(string);
- }
-
- // Surround a symbol's description in quotes when it is required (e.g the description has non printable characters).
- function maybeQuoteSymbol(symbol) {
- if (symbol.description === undefined) {
- return symbol.toString();
- }
-
- if (/^[a-zA-Z_][a-zA-Z_.0-9]*$/.test(symbol.description)) {
- return symbol.toString();
- }
-
- return `Symbol(${quoteString(symbol.description)})`;
- }
-
- const CTX_STACK = [];
- function ctxHas(x) {
- // Only check parent contexts
- return CTX_STACK.slice(0, CTX_STACK.length - 1).includes(x);
- }
-
- // Print strings when they are inside of arrays or objects with quotes
- function inspectValueWithQuotes(
- value,
- level,
- inspectOptions,
- ) {
- const green = maybeColor(colors.green, inspectOptions);
- switch (typeof value) {
- case "string": {
- const trunc = value.length > STR_ABBREVIATE_SIZE
- ? value.slice(0, STR_ABBREVIATE_SIZE) + "..."
- : value;
- return green(quoteString(trunc)); // Quoted strings are green
- }
- default:
- return inspectValue(value, level, inspectOptions);
- }
- }
-
- function inspectArray(
- value,
- level,
- inspectOptions,
- ) {
- const dim = maybeColor(colors.dim, inspectOptions);
- const options = {
- typeName: "Array",
- displayName: "",
- delims: ["[", "]"],
- entryHandler: (entry, level, inspectOptions, next) => {
- const [index, val] = entry;
- let i = index;
- if (!value.hasOwnProperty(i)) {
- i++;
- while (!value.hasOwnProperty(i) && i < value.length) {
- next();
- i++;
- }
- const emptyItems = i - index;
- const ending = emptyItems > 1 ? "s" : "";
- return dim(`<${emptyItems} empty item${ending}>`);
- } else {
- return inspectValueWithQuotes(val, level, inspectOptions);
- }
- },
- group: inspectOptions.compact,
- sort: false,
- };
- return inspectIterable(value, level, options, inspectOptions);
- }
-
- function inspectTypedArray(
- typedArrayName,
- value,
- level,
- inspectOptions,
- ) {
- const valueLength = value.length;
- const options = {
- typeName: typedArrayName,
- displayName: `${typedArrayName}(${valueLength})`,
- delims: ["[", "]"],
- entryHandler: (entry, level, inspectOptions) => {
- const val = entry[1];
- return inspectValueWithQuotes(val, level + 1, inspectOptions);
- },
- group: inspectOptions.compact,
- sort: false,
- };
- return inspectIterable(value, level, options, inspectOptions);
- }
-
- function inspectSet(
- value,
- level,
- inspectOptions,
- ) {
- const options = {
- typeName: "Set",
- displayName: "Set",
- delims: ["{", "}"],
- entryHandler: (entry, level, inspectOptions) => {
- const val = entry[1];
- return inspectValueWithQuotes(val, level + 1, inspectOptions);
- },
- group: false,
- sort: inspectOptions.sorted,
- };
- return inspectIterable(value, level, options, inspectOptions);
- }
-
- function inspectMap(
- value,
- level,
- inspectOptions,
- ) {
- const options = {
- typeName: "Map",
- displayName: "Map",
- delims: ["{", "}"],
- entryHandler: (entry, level, inspectOptions) => {
- const [key, val] = entry;
- return `${
- inspectValueWithQuotes(
- key,
- level + 1,
- inspectOptions,
- )
- } => ${inspectValueWithQuotes(val, level + 1, inspectOptions)}`;
- },
- group: false,
- sort: inspectOptions.sorted,
- };
- return inspectIterable(
- value,
- level,
- options,
- inspectOptions,
- );
- }
-
- function inspectWeakSet(inspectOptions) {
- const cyan = maybeColor(colors.cyan, inspectOptions);
- return `WeakSet { ${cyan("[items unknown]")} }`; // as seen in Node, with cyan color
- }
-
- function inspectWeakMap(inspectOptions) {
- const cyan = maybeColor(colors.cyan, inspectOptions);
- return `WeakMap { ${cyan("[items unknown]")} }`; // as seen in Node, with cyan color
- }
-
- function inspectDate(value, inspectOptions) {
- // without quotes, ISO format, in magenta like before
- const magenta = maybeColor(colors.magenta, inspectOptions);
- return magenta(isInvalidDate(value) ? "Invalid Date" : value.toISOString());
- }
-
- function inspectRegExp(value, inspectOptions) {
- const red = maybeColor(colors.red, inspectOptions);
- return red(value.toString()); // RegExps are red
- }
-
- function inspectStringObject(value, inspectOptions) {
- const cyan = maybeColor(colors.cyan, inspectOptions);
- return cyan(`[String: "${value.toString()}"]`); // wrappers are in cyan
- }
-
- function inspectBooleanObject(value, inspectOptions) {
- const cyan = maybeColor(colors.cyan, inspectOptions);
- return cyan(`[Boolean: ${value.toString()}]`); // wrappers are in cyan
- }
-
- function inspectNumberObject(value, inspectOptions) {
- const cyan = maybeColor(colors.cyan, inspectOptions);
- return cyan(`[Number: ${value.toString()}]`); // wrappers are in cyan
- }
-
- const PromiseState = {
- Pending: 0,
- Fulfilled: 1,
- Rejected: 2,
- };
-
- function inspectPromise(
- value,
- level,
- inspectOptions,
- ) {
- const cyan = maybeColor(colors.cyan, inspectOptions);
- const red = maybeColor(colors.red, inspectOptions);
-
- const [state, result] = core.getPromiseDetails(value);
-
- if (state === PromiseState.Pending) {
- return `Promise { ${cyan("<pending>")} }`;
- }
-
- const prefix = state === PromiseState.Fulfilled
- ? ""
- : `${red("<rejected>")} `;
-
- const str = `${prefix}${
- inspectValueWithQuotes(
- result,
- level + 1,
- inspectOptions,
- )
- }`;
-
- if (str.length + PROMISE_STRING_BASE_LENGTH > LINE_BREAKING_LENGTH) {
- return `Promise {\n${DEFAULT_INDENT.repeat(level + 1)}${str}\n}`;
- }
-
- return `Promise { ${str} }`;
- }
-
- function inspectProxy(
- targetAndHandler,
- level,
- inspectOptions,
- ) {
- return `Proxy ${inspectArray(targetAndHandler, level, inspectOptions)}`;
- }
-
- function inspectRawObject(
- value,
- level,
- inspectOptions,
- ) {
- const cyan = maybeColor(colors.cyan, inspectOptions);
-
- if (level >= inspectOptions.depth) {
- return cyan("[Object]"); // wrappers are in cyan
- }
-
- let baseString;
-
- let shouldShowDisplayName = false;
- let displayName = value[
- Symbol.toStringTag
- ];
- if (!displayName) {
- displayName = getClassInstanceName(value);
- }
- if (
- displayName && displayName !== "Object" && displayName !== "anonymous"
- ) {
- shouldShowDisplayName = true;
- }
-
- const entries = [];
- const stringKeys = Object.keys(value);
- const symbolKeys = Object.getOwnPropertySymbols(value);
- if (inspectOptions.sorted) {
- stringKeys.sort();
- symbolKeys.sort((s1, s2) =>
- (s1.description ?? "").localeCompare(s2.description ?? "")
- );
- }
-
- const red = maybeColor(colors.red, inspectOptions);
-
- for (const key of stringKeys) {
- if (inspectOptions.getters) {
- let propertyValue;
- let error = null;
- try {
- propertyValue = value[key];
- } catch (error_) {
- error = error_;
- }
- const inspectedValue = error == null
- ? inspectValueWithQuotes(
- propertyValue,
- level + 1,
- inspectOptions,
- )
- : red(`[Thrown ${error.name}: ${error.message}]`);
- entries.push(`${maybeQuoteString(key)}: ${inspectedValue}`);
- } else {
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
- if (descriptor.get !== undefined && descriptor.set !== undefined) {
- entries.push(`${maybeQuoteString(key)}: [Getter/Setter]`);
- } else if (descriptor.get !== undefined) {
- entries.push(`${maybeQuoteString(key)}: [Getter]`);
- } else {
- entries.push(
- `${maybeQuoteString(key)}: ${
- inspectValueWithQuotes(value[key], level + 1, inspectOptions)
- }`,
- );
- }
- }
- }
-
- for (const key of symbolKeys) {
- if (
- !inspectOptions.showHidden &&
- !propertyIsEnumerable(value, key)
- ) {
- continue;
- }
-
- if (inspectOptions.getters) {
- let propertyValue;
- let error;
- try {
- propertyValue = value[key];
- } catch (error_) {
- error = error_;
- }
- const inspectedValue = error == null
- ? inspectValueWithQuotes(
- propertyValue,
- level + 1,
- inspectOptions,
- )
- : red(`Thrown ${error.name}: ${error.message}`);
- entries.push(`[${maybeQuoteSymbol(key)}]: ${inspectedValue}`);
- } else {
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
- if (descriptor.get !== undefined && descriptor.set !== undefined) {
- entries.push(`[${maybeQuoteSymbol(key)}]: [Getter/Setter]`);
- } else if (descriptor.get !== undefined) {
- entries.push(`[${maybeQuoteSymbol(key)}]: [Getter]`);
- } else {
- entries.push(
- `[${maybeQuoteSymbol(key)}]: ${
- inspectValueWithQuotes(value[key], level + 1, inspectOptions)
- }`,
- );
- }
- }
- }
-
- // Making sure color codes are ignored when calculating the total length
- const totalLength = entries.length + level +
- colors.stripColor(entries.join("")).length;
-
- if (entries.length === 0) {
- baseString = "{}";
- } else if (totalLength > LINE_BREAKING_LENGTH || !inspectOptions.compact) {
- const entryIndent = DEFAULT_INDENT.repeat(level + 1);
- const closingIndent = DEFAULT_INDENT.repeat(level);
- baseString = `{\n${entryIndent}${entries.join(`,\n${entryIndent}`)}${
- inspectOptions.trailingComma ? "," : ""
- }\n${closingIndent}}`;
- } else {
- baseString = `{ ${entries.join(", ")} }`;
- }
-
- if (shouldShowDisplayName) {
- baseString = `${displayName} ${baseString}`;
- }
-
- return baseString;
- }
-
- function inspectObject(
- value,
- level,
- inspectOptions,
- ) {
- if (customInspect in value && typeof value[customInspect] === "function") {
- return String(value[customInspect]());
- }
- // This non-unique symbol is used to support op_crates, ie.
- // in op_crates/web we don't want to depend on unique "Deno.customInspect"
- // symbol defined in the public API. Internal only, shouldn't be used
- // by users.
- const nonUniqueCustomInspect = Symbol.for("Deno.customInspect");
- if (
- nonUniqueCustomInspect in value &&
- typeof value[nonUniqueCustomInspect] === "function"
- ) {
- // TODO(nayeemrmn): `inspect` is passed as an argument because custom
- // inspect implementations in `op_crates` need it, but may not have access
- // to the `Deno` namespace in web workers. Remove when the `Deno`
- // namespace is always enabled.
- return String(value[nonUniqueCustomInspect](inspect));
- }
- if (value instanceof Error) {
- return String(value.stack);
- } else if (Array.isArray(value)) {
- return inspectArray(value, level, inspectOptions);
- } else if (value instanceof Number) {
- return inspectNumberObject(value, inspectOptions);
- } else if (value instanceof Boolean) {
- return inspectBooleanObject(value, inspectOptions);
- } else if (value instanceof String) {
- return inspectStringObject(value, inspectOptions);
- } else if (value instanceof Promise) {
- return inspectPromise(value, level, inspectOptions);
- } else if (value instanceof RegExp) {
- return inspectRegExp(value, inspectOptions);
- } else if (value instanceof Date) {
- return inspectDate(value, inspectOptions);
- } else if (value instanceof Set) {
- return inspectSet(value, level, inspectOptions);
- } else if (value instanceof Map) {
- return inspectMap(value, level, inspectOptions);
- } else if (value instanceof WeakSet) {
- return inspectWeakSet(inspectOptions);
- } else if (value instanceof WeakMap) {
- return inspectWeakMap(inspectOptions);
- } else if (isTypedArray(value)) {
- return inspectTypedArray(
- Object.getPrototypeOf(value).constructor.name,
- value,
- level,
- inspectOptions,
- );
- } else {
- // Otherwise, default object formatting
- return inspectRawObject(value, level, inspectOptions);
- }
- }
-
- const colorKeywords = new Map([
- ["black", "#000000"],
- ["silver", "#c0c0c0"],
- ["gray", "#808080"],
- ["white", "#ffffff"],
- ["maroon", "#800000"],
- ["red", "#ff0000"],
- ["purple", "#800080"],
- ["fuchsia", "#ff00ff"],
- ["green", "#008000"],
- ["lime", "#00ff00"],
- ["olive", "#808000"],
- ["yellow", "#ffff00"],
- ["navy", "#000080"],
- ["blue", "#0000ff"],
- ["teal", "#008080"],
- ["aqua", "#00ffff"],
- ["orange", "#ffa500"],
- ["aliceblue", "#f0f8ff"],
- ["antiquewhite", "#faebd7"],
- ["aquamarine", "#7fffd4"],
- ["azure", "#f0ffff"],
- ["beige", "#f5f5dc"],
- ["bisque", "#ffe4c4"],
- ["blanchedalmond", "#ffebcd"],
- ["blueviolet", "#8a2be2"],
- ["brown", "#a52a2a"],
- ["burlywood", "#deb887"],
- ["cadetblue", "#5f9ea0"],
- ["chartreuse", "#7fff00"],
- ["chocolate", "#d2691e"],
- ["coral", "#ff7f50"],
- ["cornflowerblue", "#6495ed"],
- ["cornsilk", "#fff8dc"],
- ["crimson", "#dc143c"],
- ["cyan", "#00ffff"],
- ["darkblue", "#00008b"],
- ["darkcyan", "#008b8b"],
- ["darkgoldenrod", "#b8860b"],
- ["darkgray", "#a9a9a9"],
- ["darkgreen", "#006400"],
- ["darkgrey", "#a9a9a9"],
- ["darkkhaki", "#bdb76b"],
- ["darkmagenta", "#8b008b"],
- ["darkolivegreen", "#556b2f"],
- ["darkorange", "#ff8c00"],
- ["darkorchid", "#9932cc"],
- ["darkred", "#8b0000"],
- ["darksalmon", "#e9967a"],
- ["darkseagreen", "#8fbc8f"],
- ["darkslateblue", "#483d8b"],
- ["darkslategray", "#2f4f4f"],
- ["darkslategrey", "#2f4f4f"],
- ["darkturquoise", "#00ced1"],
- ["darkviolet", "#9400d3"],
- ["deeppink", "#ff1493"],
- ["deepskyblue", "#00bfff"],
- ["dimgray", "#696969"],
- ["dimgrey", "#696969"],
- ["dodgerblue", "#1e90ff"],
- ["firebrick", "#b22222"],
- ["floralwhite", "#fffaf0"],
- ["forestgreen", "#228b22"],
- ["gainsboro", "#dcdcdc"],
- ["ghostwhite", "#f8f8ff"],
- ["gold", "#ffd700"],
- ["goldenrod", "#daa520"],
- ["greenyellow", "#adff2f"],
- ["grey", "#808080"],
- ["honeydew", "#f0fff0"],
- ["hotpink", "#ff69b4"],
- ["indianred", "#cd5c5c"],
- ["indigo", "#4b0082"],
- ["ivory", "#fffff0"],
- ["khaki", "#f0e68c"],
- ["lavender", "#e6e6fa"],
- ["lavenderblush", "#fff0f5"],
- ["lawngreen", "#7cfc00"],
- ["lemonchiffon", "#fffacd"],
- ["lightblue", "#add8e6"],
- ["lightcoral", "#f08080"],
- ["lightcyan", "#e0ffff"],
- ["lightgoldenrodyellow", "#fafad2"],
- ["lightgray", "#d3d3d3"],
- ["lightgreen", "#90ee90"],
- ["lightgrey", "#d3d3d3"],
- ["lightpink", "#ffb6c1"],
- ["lightsalmon", "#ffa07a"],
- ["lightseagreen", "#20b2aa"],
- ["lightskyblue", "#87cefa"],
- ["lightslategray", "#778899"],
- ["lightslategrey", "#778899"],
- ["lightsteelblue", "#b0c4de"],
- ["lightyellow", "#ffffe0"],
- ["limegreen", "#32cd32"],
- ["linen", "#faf0e6"],
- ["magenta", "#ff00ff"],
- ["mediumaquamarine", "#66cdaa"],
- ["mediumblue", "#0000cd"],
- ["mediumorchid", "#ba55d3"],
- ["mediumpurple", "#9370db"],
- ["mediumseagreen", "#3cb371"],
- ["mediumslateblue", "#7b68ee"],
- ["mediumspringgreen", "#00fa9a"],
- ["mediumturquoise", "#48d1cc"],
- ["mediumvioletred", "#c71585"],
- ["midnightblue", "#191970"],
- ["mintcream", "#f5fffa"],
- ["mistyrose", "#ffe4e1"],
- ["moccasin", "#ffe4b5"],
- ["navajowhite", "#ffdead"],
- ["oldlace", "#fdf5e6"],
- ["olivedrab", "#6b8e23"],
- ["orangered", "#ff4500"],
- ["orchid", "#da70d6"],
- ["palegoldenrod", "#eee8aa"],
- ["palegreen", "#98fb98"],
- ["paleturquoise", "#afeeee"],
- ["palevioletred", "#db7093"],
- ["papayawhip", "#ffefd5"],
- ["peachpuff", "#ffdab9"],
- ["peru", "#cd853f"],
- ["pink", "#ffc0cb"],
- ["plum", "#dda0dd"],
- ["powderblue", "#b0e0e6"],
- ["rosybrown", "#bc8f8f"],
- ["royalblue", "#4169e1"],
- ["saddlebrown", "#8b4513"],
- ["salmon", "#fa8072"],
- ["sandybrown", "#f4a460"],
- ["seagreen", "#2e8b57"],
- ["seashell", "#fff5ee"],
- ["sienna", "#a0522d"],
- ["skyblue", "#87ceeb"],
- ["slateblue", "#6a5acd"],
- ["slategray", "#708090"],
- ["slategrey", "#708090"],
- ["snow", "#fffafa"],
- ["springgreen", "#00ff7f"],
- ["steelblue", "#4682b4"],
- ["tan", "#d2b48c"],
- ["thistle", "#d8bfd8"],
- ["tomato", "#ff6347"],
- ["turquoise", "#40e0d0"],
- ["violet", "#ee82ee"],
- ["wheat", "#f5deb3"],
- ["whitesmoke", "#f5f5f5"],
- ["yellowgreen", "#9acd32"],
- ["rebeccapurple", "#663399"],
- ]);
-
- function parseCssColor(colorString) {
- if (colorKeywords.has(colorString)) {
- colorString = colorKeywords.get(colorString);
- }
- // deno-fmt-ignore
- const hashMatch = colorString.match(/^#([\dA-Fa-f]{2})([\dA-Fa-f]{2})([\dA-Fa-f]{2})([\dA-Fa-f]{2})?$/);
- if (hashMatch != null) {
- return [
- Number(`0x${hashMatch[1]}`),
- Number(`0x${hashMatch[2]}`),
- Number(`0x${hashMatch[3]}`),
- ];
- }
- // deno-fmt-ignore
- const smallHashMatch = colorString.match(/^#([\dA-Fa-f])([\dA-Fa-f])([\dA-Fa-f])([\dA-Fa-f])?$/);
- if (smallHashMatch != null) {
- return [
- Number(`0x${smallHashMatch[1]}0`),
- Number(`0x${smallHashMatch[2]}0`),
- Number(`0x${smallHashMatch[3]}0`),
- ];
- }
- // deno-fmt-ignore
- const rgbMatch = colorString.match(/^rgba?\(\s*([+\-]?\d*\.?\d+)\s*,\s*([+\-]?\d*\.?\d+)\s*,\s*([+\-]?\d*\.?\d+)\s*(,\s*([+\-]?\d*\.?\d+)\s*)?\)$/);
- if (rgbMatch != null) {
- return [
- Math.round(Math.max(0, Math.min(255, Number(rgbMatch[1])))),
- Math.round(Math.max(0, Math.min(255, Number(rgbMatch[2])))),
- Math.round(Math.max(0, Math.min(255, Number(rgbMatch[3])))),
- ];
- }
- // deno-fmt-ignore
- const hslMatch = colorString.match(/^hsla?\(\s*([+\-]?\d*\.?\d+)\s*,\s*([+\-]?\d*\.?\d+)%\s*,\s*([+\-]?\d*\.?\d+)%\s*(,\s*([+\-]?\d*\.?\d+)\s*)?\)$/);
- if (hslMatch != null) {
- // https://www.rapidtables.com/convert/color/hsl-to-rgb.html
- let h = Number(hslMatch[1]) % 360;
- if (h < 0) {
- h += 360;
- }
- const s = Math.max(0, Math.min(100, Number(hslMatch[2]))) / 100;
- const l = Math.max(0, Math.min(100, Number(hslMatch[3]))) / 100;
- const c = (1 - Math.abs(2 * l - 1)) * s;
- const x = c * (1 - Math.abs((h / 60) % 2 - 1));
- const m = l - c / 2;
- let r_;
- let g_;
- let b_;
- if (h < 60) {
- [r_, g_, b_] = [c, x, 0];
- } else if (h < 120) {
- [r_, g_, b_] = [x, c, 0];
- } else if (h < 180) {
- [r_, g_, b_] = [0, c, x];
- } else if (h < 240) {
- [r_, g_, b_] = [0, x, c];
- } else if (h < 300) {
- [r_, g_, b_] = [x, 0, c];
- } else {
- [r_, g_, b_] = [c, 0, x];
- }
- return [
- Math.round((r_ + m) * 255),
- Math.round((g_ + m) * 255),
- Math.round((b_ + m) * 255),
- ];
- }
- return null;
- }
-
- function getDefaultCss() {
- return {
- backgroundColor: null,
- color: null,
- fontWeight: null,
- fontStyle: null,
- textDecorationColor: null,
- textDecorationLine: [],
- };
- }
-
- function parseCss(cssString) {
- const css = getDefaultCss();
-
- const rawEntries = [];
- let inValue = false;
- let currentKey = null;
- let parenthesesDepth = 0;
- let currentPart = "";
- for (let i = 0; i < cssString.length; i++) {
- const c = cssString[i];
- if (c == "(") {
- parenthesesDepth++;
- } else if (parenthesesDepth > 0) {
- if (c == ")") {
- parenthesesDepth--;
- }
- } else if (inValue) {
- if (c == ";") {
- const value = currentPart.trim();
- if (value != "") {
- rawEntries.push([currentKey, value]);
- }
- currentKey = null;
- currentPart = "";
- inValue = false;
- continue;
- }
- } else if (c == ":") {
- currentKey = currentPart.trim();
- currentPart = "";
- inValue = true;
- continue;
- }
- currentPart += c;
- }
- if (inValue && parenthesesDepth == 0) {
- const value = currentPart.trim();
- if (value != "") {
- rawEntries.push([currentKey, value]);
- }
- currentKey = null;
- currentPart = "";
- }
-
- for (const [key, value] of rawEntries) {
- if (key == "background-color") {
- const color = parseCssColor(value);
- if (color != null) {
- css.backgroundColor = color;
- }
- } else if (key == "color") {
- const color = parseCssColor(value);
- if (color != null) {
- css.color = color;
- }
- } else if (key == "font-weight") {
- if (value == "bold") {
- css.fontWeight = value;
- }
- } else if (key == "font-style") {
- if (["italic", "oblique", "oblique 14deg"].includes(value)) {
- css.fontStyle = "italic";
- }
- } else if (key == "text-decoration-line") {
- css.textDecorationLine = [];
- for (const lineType of value.split(/\s+/g)) {
- if (["line-through", "overline", "underline"].includes(lineType)) {
- css.textDecorationLine.push(lineType);
- }
- }
- } else if (key == "text-decoration-color") {
- const color = parseCssColor(value);
- if (color != null) {
- css.textDecorationColor = color;
- }
- } else if (key == "text-decoration") {
- css.textDecorationColor = null;
- css.textDecorationLine = [];
- for (const arg of value.split(/\s+/g)) {
- const maybeColor = parseCssColor(arg);
- if (maybeColor != null) {
- css.textDecorationColor = maybeColor;
- } else if (["line-through", "overline", "underline"].includes(arg)) {
- css.textDecorationLine.push(arg);
- }
- }
- }
- }
-
- return css;
- }
-
- function colorEquals(color1, color2) {
- return color1?.[0] == color2?.[0] && color1?.[1] == color2?.[1] &&
- color1?.[2] == color2?.[2];
- }
-
- function cssToAnsi(css, prevCss = null) {
- prevCss = prevCss ?? getDefaultCss();
- let ansi = "";
- if (!colorEquals(css.backgroundColor, prevCss.backgroundColor)) {
- if (css.backgroundColor != null) {
- const [r, g, b] = css.backgroundColor;
- ansi += `\x1b[48;2;${r};${g};${b}m`;
- } else {
- ansi += "\x1b[49m";
- }
- }
- if (!colorEquals(css.color, prevCss.color)) {
- if (css.color != null) {
- const [r, g, b] = css.color;
- ansi += `\x1b[38;2;${r};${g};${b}m`;
- } else {
- ansi += "\x1b[39m";
- }
- }
- if (css.fontWeight != prevCss.fontWeight) {
- if (css.fontWeight == "bold") {
- ansi += `\x1b[1m`;
- } else {
- ansi += "\x1b[22m";
- }
- }
- if (css.fontStyle != prevCss.fontStyle) {
- if (css.fontStyle == "italic") {
- ansi += `\x1b[3m`;
- } else {
- ansi += "\x1b[23m";
- }
- }
- if (!colorEquals(css.textDecorationColor, prevCss.textDecorationColor)) {
- if (css.textDecorationColor != null) {
- const [r, g, b] = css.textDecorationColor;
- ansi += `\x1b[58;2;${r};${g};${b}m`;
- } else {
- ansi += "\x1b[59m";
- }
- }
- if (
- css.textDecorationLine.includes("line-through") !=
- prevCss.textDecorationLine.includes("line-through")
- ) {
- if (css.textDecorationLine.includes("line-through")) {
- ansi += "\x1b[9m";
- } else {
- ansi += "\x1b[29m";
- }
- }
- if (
- css.textDecorationLine.includes("overline") !=
- prevCss.textDecorationLine.includes("overline")
- ) {
- if (css.textDecorationLine.includes("overline")) {
- ansi += "\x1b[53m";
- } else {
- ansi += "\x1b[55m";
- }
- }
- if (
- css.textDecorationLine.includes("underline") !=
- prevCss.textDecorationLine.includes("underline")
- ) {
- if (css.textDecorationLine.includes("underline")) {
- ansi += "\x1b[4m";
- } else {
- ansi += "\x1b[24m";
- }
- }
- return ansi;
- }
-
- function inspectArgs(args, inspectOptions = {}) {
- const noColor = globalThis.Deno?.noColor ?? true;
- const rInspectOptions = { ...DEFAULT_INSPECT_OPTIONS, ...inspectOptions };
- const first = args[0];
- let a = 0;
- let string = "";
-
- if (typeof first == "string" && args.length > 1) {
- a++;
- // Index of the first not-yet-appended character. Use this so we only
- // have to append to `string` when a substitution occurs / at the end.
- let appendedChars = 0;
- let usedStyle = false;
- let prevCss = null;
- for (let i = 0; i < first.length - 1; i++) {
- if (first[i] == "%") {
- const char = first[++i];
- if (a < args.length) {
- let formattedArg = null;
- if (char == "s") {
- // Format as a string.
- formattedArg = String(args[a++]);
- } else if (["d", "i"].includes(char)) {
- // Format as an integer.
- const value = args[a++];
- if (typeof value == "bigint") {
- formattedArg = `${value}n`;
- } else if (typeof value == "number") {
- formattedArg = `${parseInt(String(value))}`;
- } else {
- formattedArg = "NaN";
- }
- } else if (char == "f") {
- // Format as a floating point value.
- const value = args[a++];
- if (typeof value == "number") {
- formattedArg = `${value}`;
- } else {
- formattedArg = "NaN";
- }
- } else if (["O", "o"].includes(char)) {
- // Format as an object.
- formattedArg = inspectValue(
- args[a++],
- 0,
- rInspectOptions,
- );
- } else if (char == "c") {
- const value = args[a++];
- if (!noColor) {
- const css = parseCss(value);
- formattedArg = cssToAnsi(css, prevCss);
- if (formattedArg != "") {
- usedStyle = true;
- prevCss = css;
- }
- } else {
- formattedArg = "";
- }
- }
-
- if (formattedArg != null) {
- string += first.slice(appendedChars, i - 1) + formattedArg;
- appendedChars = i + 1;
- }
- }
- if (char == "%") {
- string += first.slice(appendedChars, i - 1) + "%";
- appendedChars = i + 1;
- }
- }
- }
- string += first.slice(appendedChars);
- if (usedStyle) {
- string += "\x1b[0m";
- }
- }
-
- for (; a < args.length; a++) {
- if (a > 0) {
- string += " ";
- }
- if (typeof args[a] == "string") {
- string += args[a];
- } else {
- // Use default maximum depth for null or undefined arguments.
- string += inspectValue(args[a], 0, rInspectOptions);
- }
- }
-
- if (rInspectOptions.indentLevel > 0) {
- const groupIndent = DEFAULT_INDENT.repeat(rInspectOptions.indentLevel);
- string = groupIndent + string.replaceAll("\n", `\n${groupIndent}`);
- }
-
- return string;
- }
-
- const countMap = new Map();
- const timerMap = new Map();
- const isConsoleInstance = Symbol("isConsoleInstance");
-
- function getConsoleInspectOptions() {
- return {
- ...DEFAULT_INSPECT_OPTIONS,
- colors: !(globalThis.Deno?.noColor ?? false),
- };
- }
-
- class Console {
- #printFunc = null;
- [isConsoleInstance] = false;
-
- constructor(printFunc) {
- this.#printFunc = printFunc;
- this.indentLevel = 0;
- this[isConsoleInstance] = true;
-
- // ref https://console.spec.whatwg.org/#console-namespace
- // For historical web-compatibility reasons, the namespace object for
- // console must have as its [[Prototype]] an empty object, created as if
- // by ObjectCreate(%ObjectPrototype%), instead of %ObjectPrototype%.
- const console = Object.create({}, {
- [Symbol.toStringTag]: {
- enumerable: false,
- writable: false,
- configurable: true,
- value: "console",
- },
- });
- Object.assign(console, this);
- return console;
- }
-
- log = (...args) => {
- this.#printFunc(
- inspectArgs(args, {
- ...getConsoleInspectOptions(),
- indentLevel: this.indentLevel,
- }) + "\n",
- 1,
- );
- };
-
- debug = (...args) => {
- this.#printFunc(
- inspectArgs(args, {
- ...getConsoleInspectOptions(),
- indentLevel: this.indentLevel,
- }) + "\n",
- 0,
- );
- };
-
- info = (...args) => {
- this.#printFunc(
- inspectArgs(args, {
- ...getConsoleInspectOptions(),
- indentLevel: this.indentLevel,
- }) + "\n",
- 1,
- );
- };
-
- dir = (obj, options = {}) => {
- this.#printFunc(
- inspectArgs([obj], { ...getConsoleInspectOptions(), ...options }) +
- "\n",
- 1,
- );
- };
-
- dirxml = this.dir;
-
- warn = (...args) => {
- this.#printFunc(
- inspectArgs(args, {
- ...getConsoleInspectOptions(),
- indentLevel: this.indentLevel,
- }) + "\n",
- 2,
- );
- };
-
- error = (...args) => {
- this.#printFunc(
- inspectArgs(args, {
- ...getConsoleInspectOptions(),
- indentLevel: this.indentLevel,
- }) + "\n",
- 3,
- );
- };
-
- assert = (condition = false, ...args) => {
- if (condition) {
- return;
- }
-
- if (args.length === 0) {
- this.error("Assertion failed");
- return;
- }
-
- const [first, ...rest] = args;
-
- if (typeof first === "string") {
- this.error(`Assertion failed: ${first}`, ...rest);
- return;
- }
-
- this.error(`Assertion failed:`, ...args);
- };
-
- count = (label = "default") => {
- label = String(label);
-
- if (countMap.has(label)) {
- const current = countMap.get(label) || 0;
- countMap.set(label, current + 1);
- } else {
- countMap.set(label, 1);
- }
-
- this.info(`${label}: ${countMap.get(label)}`);
- };
-
- countReset = (label = "default") => {
- label = String(label);
-
- if (countMap.has(label)) {
- countMap.set(label, 0);
- } else {
- this.warn(`Count for '${label}' does not exist`);
- }
- };
-
- table = (data, properties) => {
- if (properties !== undefined && !Array.isArray(properties)) {
- throw new Error(
- "The 'properties' argument must be of type Array. " +
- "Received type string",
- );
- }
-
- if (data === null || typeof data !== "object") {
- return this.log(data);
- }
-
- const stringifyValue = (value) =>
- inspectValueWithQuotes(value, 0, {
- ...DEFAULT_INSPECT_OPTIONS,
- depth: 1,
- });
- const toTable = (header, body) => this.log(cliTable(header, body));
-
- let resultData;
- const isSet = data instanceof Set;
- const isMap = data instanceof Map;
- const valuesKey = "Values";
- const indexKey = isSet || isMap ? "(iter idx)" : "(idx)";
-
- if (data instanceof Set) {
- resultData = [...data];
- } else if (data instanceof Map) {
- let idx = 0;
- resultData = {};
-
- data.forEach((v, k) => {
- resultData[idx] = { Key: k, Values: v };
- idx++;
- });
- } else {
- resultData = data;
- }
-
- const keys = Object.keys(resultData);
- const numRows = keys.length;
-
- const objectValues = properties
- ? Object.fromEntries(
- properties.map((name) => [name, new Array(numRows).fill("")]),
- )
- : {};
- const indexKeys = [];
- const values = [];
-
- let hasPrimitives = false;
- keys.forEach((k, idx) => {
- const value = resultData[k];
- const primitive = value === null ||
- (typeof value !== "function" && typeof value !== "object");
- if (properties === undefined && primitive) {
- hasPrimitives = true;
- values.push(stringifyValue(value));
- } else {
- const valueObj = value || {};
- const keys = properties || Object.keys(valueObj);
- for (const k of keys) {
- if (!primitive && k in valueObj) {
- if (!(k in objectValues)) {
- objectValues[k] = new Array(numRows).fill("");
- }
- objectValues[k][idx] = stringifyValue(valueObj[k]);
- }
- }
- values.push("");
- }
-
- indexKeys.push(k);
- });
-
- const headerKeys = Object.keys(objectValues);
- const bodyValues = Object.values(objectValues);
- const header = [
- indexKey,
- ...(properties ||
- [...headerKeys, !isMap && hasPrimitives && valuesKey]),
- ].filter(Boolean);
- const body = [indexKeys, ...bodyValues, values];
-
- toTable(header, body);
- };
-
- time = (label = "default") => {
- label = String(label);
-
- if (timerMap.has(label)) {
- this.warn(`Timer '${label}' already exists`);
- return;
- }
-
- timerMap.set(label, Date.now());
- };
-
- timeLog = (label = "default", ...args) => {
- label = String(label);
-
- if (!timerMap.has(label)) {
- this.warn(`Timer '${label}' does not exists`);
- return;
- }
-
- const startTime = timerMap.get(label);
- const duration = Date.now() - startTime;
-
- this.info(`${label}: ${duration}ms`, ...args);
- };
-
- timeEnd = (label = "default") => {
- label = String(label);
-
- if (!timerMap.has(label)) {
- this.warn(`Timer '${label}' does not exists`);
- return;
- }
-
- const startTime = timerMap.get(label);
- timerMap.delete(label);
- const duration = Date.now() - startTime;
-
- this.info(`${label}: ${duration}ms`);
- };
-
- group = (...label) => {
- if (label.length > 0) {
- this.log(...label);
- }
- this.indentLevel += 2;
- };
-
- groupCollapsed = this.group;
-
- groupEnd = () => {
- if (this.indentLevel > 0) {
- this.indentLevel -= 2;
- }
- };
-
- clear = () => {
- this.indentLevel = 0;
- this.#printFunc(CSI.kClear, 1);
- this.#printFunc(CSI.kClearScreenDown, 1);
- };
-
- trace = (...args) => {
- const message = inspectArgs(
- args,
- { ...getConsoleInspectOptions(), indentLevel: 0 },
- );
- const err = {
- name: "Trace",
- message,
- };
- Error.captureStackTrace(err, this.trace);
- this.error(err.stack);
- };
-
- static [Symbol.hasInstance](instance) {
- return instance[isConsoleInstance];
- }
- }
-
- const customInspect = Symbol("Deno.customInspect");
-
- function inspect(
- value,
- inspectOptions = {},
- ) {
- return inspectValue(value, 0, {
- ...DEFAULT_INSPECT_OPTIONS,
- ...inspectOptions,
- // TODO(nayeemrmn): Indent level is not supported.
- indentLevel: 0,
- });
- }
-
- // Expose these fields to internalObject for tests.
- window.__bootstrap.internals = {
- ...window.__bootstrap.internals ?? {},
- Console,
- cssToAnsi,
- inspectArgs,
- parseCss,
- parseCssColor,
- };
-
- window.__bootstrap.console = {
- CSI,
- inspectArgs,
- Console,
- customInspect,
- inspect,
- };
-})(this);
diff --git a/op_crates/console/Cargo.toml b/op_crates/console/Cargo.toml
deleted file mode 100644
index a3964a1f4..000000000
--- a/op_crates/console/Cargo.toml
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-[package]
-name = "deno_console"
-version = "0.5.0"
-edition = "2018"
-description = "Implementation of Console API for Deno"
-authors = ["the Deno authors"]
-license = "MIT"
-readme = "README.md"
-repository = "https://github.com/denoland/deno"
-
-[lib]
-path = "lib.rs"
-
-[dependencies]
-deno_core = { version = "0.86.0", path = "../../core" }
diff --git a/op_crates/console/README.md b/op_crates/console/README.md
deleted file mode 100644
index 2f8fb448a..000000000
--- a/op_crates/console/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# deno_console
-
-This crate implements the Console API.
-
-Spec: https://console.spec.whatwg.org/
diff --git a/op_crates/console/lib.deno_console.d.ts b/op_crates/console/lib.deno_console.d.ts
deleted file mode 100644
index d6cb1e99b..000000000
--- a/op_crates/console/lib.deno_console.d.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// deno-lint-ignore-file no-explicit-any
-
-/// <reference no-default-lib="true" />
-/// <reference lib="esnext" />
-
-declare interface Console {
- assert(condition?: boolean, ...data: any[]): void;
- clear(): void;
- count(label?: string): void;
- countReset(label?: string): void;
- debug(...data: any[]): void;
- dir(item?: any, options?: any): void;
- dirxml(...data: any[]): void;
- error(...data: any[]): void;
- group(...data: any[]): void;
- groupCollapsed(...data: any[]): void;
- groupEnd(): void;
- info(...data: any[]): void;
- log(...data: any[]): void;
- table(tabularData?: any, properties?: string[]): void;
- time(label?: string): void;
- timeEnd(label?: string): void;
- timeLog(label?: string, ...data: any[]): void;
- timeStamp(label?: string): void;
- trace(...data: any[]): void;
- warn(...data: any[]): void;
-}
diff --git a/op_crates/console/lib.rs b/op_crates/console/lib.rs
deleted file mode 100644
index 4f64bb108..000000000
--- a/op_crates/console/lib.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::include_js_files;
-use deno_core::Extension;
-use std::path::PathBuf;
-
-pub fn init() -> Extension {
- Extension::builder()
- .js(include_js_files!(
- prefix "deno:op_crates/console",
- "01_colors.js",
- "02_console.js",
- ))
- .build()
-}
-
-pub fn get_declaration() -> PathBuf {
- PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("lib.deno_console.d.ts")
-}
diff --git a/op_crates/crypto/01_crypto.js b/op_crates/crypto/01_crypto.js
deleted file mode 100644
index dba6b0091..000000000
--- a/op_crates/crypto/01_crypto.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-"use strict";
-
-((window) => {
- const core = window.Deno.core;
-
- function getRandomValues(arrayBufferView) {
- if (!ArrayBuffer.isView(arrayBufferView)) {
- throw new TypeError(
- "Argument 1 does not implement interface ArrayBufferView",
- );
- }
- if (
- !(
- arrayBufferView instanceof Int8Array ||
- arrayBufferView instanceof Uint8Array ||
- arrayBufferView instanceof Int16Array ||
- arrayBufferView instanceof Uint16Array ||
- arrayBufferView instanceof Int32Array ||
- arrayBufferView instanceof Uint32Array ||
- arrayBufferView instanceof Uint8ClampedArray
- )
- ) {
- throw new DOMException(
- "The provided ArrayBufferView is not an integer array type",
- "TypeMismatchError",
- );
- }
- if (arrayBufferView.byteLength > 65536) {
- throw new DOMException(
- `The ArrayBufferView's byte length (${arrayBufferView.byteLength}) exceeds the number of bytes of entropy available via this API (65536)`,
- "QuotaExceededError",
- );
- }
- const ui8 = new Uint8Array(
- arrayBufferView.buffer,
- arrayBufferView.byteOffset,
- arrayBufferView.byteLength,
- );
- core.opSync("op_crypto_get_random_values", null, ui8);
- return arrayBufferView;
- }
-
- window.crypto = {
- getRandomValues,
- };
- window.__bootstrap.crypto = {
- getRandomValues,
- };
-})(this);
diff --git a/op_crates/crypto/Cargo.toml b/op_crates/crypto/Cargo.toml
deleted file mode 100644
index 91f60aa9c..000000000
--- a/op_crates/crypto/Cargo.toml
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-[package]
-name = "deno_crypto"
-version = "0.19.0"
-edition = "2018"
-description = "Web Cryptography API implementation for Deno"
-authors = ["the Deno authors"]
-license = "MIT"
-readme = "README.md"
-repository = "https://github.com/denoland/deno"
-
-[lib]
-path = "lib.rs"
-
-[dependencies]
-deno_core = { version = "0.86.0", path = "../../core" }
-rand = "0.8.3"
-
diff --git a/op_crates/crypto/README.md b/op_crates/crypto/README.md
deleted file mode 100644
index be0724458..000000000
--- a/op_crates/crypto/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# deno_crypto
-
-This crate implements the Web Cryptography API.
-
-Spec: https://www.w3.org/TR/WebCryptoAPI/
diff --git a/op_crates/crypto/lib.deno_crypto.d.ts b/op_crates/crypto/lib.deno_crypto.d.ts
deleted file mode 100644
index a00757e71..000000000
--- a/op_crates/crypto/lib.deno_crypto.d.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-/// <reference no-default-lib="true" />
-/// <reference lib="esnext" />
-
-declare var crypto: Crypto;
-
-declare interface Crypto {
- readonly subtle: null;
- getRandomValues<
- T extends
- | Int8Array
- | Int16Array
- | Int32Array
- | Uint8Array
- | Uint16Array
- | Uint32Array
- | Uint8ClampedArray
- | Float32Array
- | Float64Array
- | DataView
- | null,
- >(
- array: T,
- ): T;
-}
diff --git a/op_crates/crypto/lib.rs b/op_crates/crypto/lib.rs
deleted file mode 100644
index 543220548..000000000
--- a/op_crates/crypto/lib.rs
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::error::null_opbuf;
-use deno_core::error::AnyError;
-use deno_core::include_js_files;
-use deno_core::op_sync;
-use deno_core::Extension;
-use deno_core::OpState;
-use deno_core::ZeroCopyBuf;
-use rand::rngs::StdRng;
-use rand::thread_rng;
-use rand::Rng;
-use rand::SeedableRng;
-use std::path::PathBuf;
-
-pub use rand; // Re-export rand
-
-pub fn init(maybe_seed: Option<u64>) -> Extension {
- Extension::builder()
- .js(include_js_files!(
- prefix "deno:op_crates/crypto",
- "01_crypto.js",
- ))
- .ops(vec![(
- "op_crypto_get_random_values",
- op_sync(op_crypto_get_random_values),
- )])
- .state(move |state| {
- if let Some(seed) = maybe_seed {
- state.put(StdRng::seed_from_u64(seed));
- }
- Ok(())
- })
- .build()
-}
-
-pub fn op_crypto_get_random_values(
- state: &mut OpState,
- _args: (),
- zero_copy: Option<ZeroCopyBuf>,
-) -> Result<(), AnyError> {
- let mut zero_copy = zero_copy.ok_or_else(null_opbuf)?;
- let maybe_seeded_rng = state.try_borrow_mut::<StdRng>();
- if let Some(seeded_rng) = maybe_seeded_rng {
- seeded_rng.fill(&mut *zero_copy);
- } else {
- let mut rng = thread_rng();
- rng.fill(&mut *zero_copy);
- }
-
- Ok(())
-}
-
-pub fn get_declaration() -> PathBuf {
- PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("lib.deno_crypto.d.ts")
-}
diff --git a/op_crates/fetch/01_fetch_util.js b/op_crates/fetch/01_fetch_util.js
deleted file mode 100644
index ff76421a1..000000000
--- a/op_crates/fetch/01_fetch_util.js
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-"use strict";
-
-((window) => {
- function requiredArguments(
- name,
- length,
- required,
- ) {
- if (length < required) {
- const errMsg = `${name} requires at least ${required} argument${
- required === 1 ? "" : "s"
- }, but only ${length} present`;
- throw new TypeError(errMsg);
- }
- }
-
- window.__bootstrap.fetchUtil = {
- requiredArguments,
- };
-})(this);
diff --git a/op_crates/fetch/11_streams.js b/op_crates/fetch/11_streams.js
deleted file mode 100644
index 8bbf34898..000000000
--- a/op_crates/fetch/11_streams.js
+++ /dev/null
@@ -1,3885 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// @ts-check
-/// <reference path="./11_streams_types.d.ts" />
-/// <reference path="./lib.deno_fetch.d.ts" />
-/// <reference lib="esnext" />
-"use strict";
-
-((window) => {
- class AssertionError extends Error {
- constructor(msg) {
- super(msg);
- this.name = "AssertionError";
- }
- }
-
- /**
- * @param {unknown} cond
- * @param {string=} msg
- * @returns {asserts cond}
- */
- function assert(cond, msg = "Assertion failed.") {
- if (!cond) {
- throw new AssertionError(msg);
- }
- }
-
- /** @template T */
- class Deferred {
- /** @type {Promise<T>} */
- #promise;
- /** @type {(reject?: any) => void} */
- #reject;
- /** @type {(value: T | PromiseLike<T>) => void} */
- #resolve;
- /** @type {"pending" | "fulfilled"} */
- #state = "pending";
-
- constructor() {
- this.#promise = new Promise((resolve, reject) => {
- this.#resolve = resolve;
- this.#reject = reject;
- });
- }
-
- /** @returns {Promise<T>} */
- get promise() {
- return this.#promise;
- }
-
- /** @returns {"pending" | "fulfilled"} */
- get state() {
- return this.#state;
- }
-
- /** @param {any=} reason */
- reject(reason) {
- // already settled promises are a no-op
- if (this.#state !== "pending") {
- return;
- }
- this.#state = "fulfilled";
- this.#reject(reason);
- }
-
- /** @param {T | PromiseLike<T>} value */
- resolve(value) {
- // already settled promises are a no-op
- if (this.#state !== "pending") {
- return;
- }
- this.#state = "fulfilled";
- this.#resolve(value);
- }
- }
-
- /**
- * @param {(...args: any[]) => any} fn
- * @param {boolean} enforcePromise
- * @returns {(...args: any[]) => any}
- */
- function reflectApply(fn, enforcePromise) {
- if (typeof fn !== "function") {
- throw new TypeError("The property must be a function.");
- }
- return function (...args) {
- if (enforcePromise) {
- try {
- return resolvePromiseWith(Reflect.apply(fn, this, args));
- } catch (err) {
- return Promise.reject(err);
- }
- }
- return Reflect.apply(fn, this, args);
- };
- }
-
- /**
- * @template I
- * @template O
- * @param {Transformer<I, O>} transformer
- * @returns {Transformer<I, O>}
- */
- function convertTransformer(transformer) {
- const transformerDict = Object.create(null);
- if (transformer === null) {
- return transformerDict;
- }
- if ("flush" in transformer) {
- transformerDict.flush = reflectApply(transformer.flush, true);
- }
- if ("readableType" in transformer) {
- transformerDict.readableType = transformer.readableType;
- }
- if ("start" in transformer) {
- transformerDict.start = reflectApply(transformer.start, false);
- }
- if ("transform" in transformer) {
- transformerDict.transform = reflectApply(transformer.transform, true);
- }
- if ("writableType" in transformer) {
- transformerDict.writableType = transformer.writableType;
- }
- return transformerDict;
- }
-
- /**
- * @template W
- * @param {UnderlyingSink<W>} underlyingSink
- * @returns {UnderlyingSink<W>}
- */
- function convertUnderlyingSink(underlyingSink) {
- const underlyingSinkDict = Object.create(null);
- if (underlyingSink === null) {
- return underlyingSinkDict;
- }
- if ("abort" in underlyingSink) {
- underlyingSinkDict.abort = reflectApply(underlyingSink.abort, true);
- }
- if ("close" in underlyingSink) {
- underlyingSinkDict.close = reflectApply(underlyingSink.close, true);
- }
- if ("start" in underlyingSink) {
- underlyingSinkDict.start = reflectApply(underlyingSink.start, false);
- }
- if (underlyingSink.type) {
- underlyingSinkDict.type = underlyingSink.type;
- }
- if ("write" in underlyingSink) {
- underlyingSinkDict.write = reflectApply(underlyingSink.write, true);
- }
- return underlyingSinkDict;
- }
-
- /**
- * @template R
- * @param {UnderlyingSource<R>} underlyingSource
- * @returns {UnderlyingSource<R>}
- */
- function convertUnderlyingSource(underlyingSource) {
- const underlyingSourceDict = Object.create(null);
- if (underlyingSource === null) {
- throw new TypeError("Underlying source cannot be null");
- }
- if (underlyingSource === undefined) {
- return underlyingSourceDict;
- }
- if ("cancel" in underlyingSource) {
- underlyingSourceDict.cancel = reflectApply(underlyingSource.cancel, true);
- }
- if ("pull" in underlyingSource) {
- underlyingSourceDict.pull = reflectApply(underlyingSource.pull, true);
- }
- if ("start" in underlyingSource) {
- underlyingSourceDict.start = reflectApply(underlyingSource.start, false);
- }
- if (underlyingSource.type !== undefined) {
- if (underlyingSourceDict.type === null) {
- throw new TypeError("type cannot be null");
- }
- const type = String(underlyingSource.type);
- if (type !== "bytes") {
- throw new TypeError("invalid underlying source type");
- }
- underlyingSourceDict.type = type;
- }
- return underlyingSourceDict;
- }
-
- const originalPromise = Promise;
- const originalPromiseThen = Promise.prototype.then;
-
- /**
- * @template T
- * @template TResult1
- * @template TResult2
- * @param {Promise<T>} promise
- * @param {(value: T) => TResult1 | PromiseLike<TResult1>} onFulfilled
- * @param {(reason: any) => TResult2 | PromiseLike<TResult2>=} onRejected
- * @returns {Promise<TResult1 | TResult2>}
- */
- function performPromiseThen(promise, onFulfilled, onRejected) {
- return originalPromiseThen.call(promise, onFulfilled, onRejected);
- }
-
- /**
- * @template T
- * @param {T | PromiseLike<T>} value
- * @returns {Promise<T>}
- */
- function resolvePromiseWith(value) {
- return new originalPromise((resolve) => resolve(value));
- }
-
- /** @param {any} e */
- function rethrowAssertionErrorRejection(e) {
- if (e && e instanceof AssertionError) {
- queueMicrotask(() => {
- console.error(`Internal Error: ${e.stack}`);
- });
- }
- }
-
- /** @param {Promise<any>} promise */
- function setPromiseIsHandledToTrue(promise) {
- performPromiseThen(promise, undefined, rethrowAssertionErrorRejection);
- }
-
- /**
- * @template T
- * @template TResult1
- * @template TResult2
- * @param {Promise<T>} promise
- * @param {(value: T) => TResult1 | PromiseLike<TResult1>} fulfillmentHandler
- * @param {(reason: any) => TResult2 | PromiseLike<TResult2>=} rejectionHandler
- * @returns {Promise<TResult1 | TResult2>}
- */
- function transformPromiseWith(promise, fulfillmentHandler, rejectionHandler) {
- return performPromiseThen(promise, fulfillmentHandler, rejectionHandler);
- }
-
- /**
- * @template T
- * @template TResult
- * @param {Promise<T>} promise
- * @param {(value: T) => TResult | PromiseLike<TResult>} onFulfilled
- * @returns {void}
- */
- function uponFulfillment(promise, onFulfilled) {
- uponPromise(promise, onFulfilled);
- }
-
- /**
- * @template T
- * @template TResult
- * @param {Promise<T>} promise
- * @param {(value: T) => TResult | PromiseLike<TResult>} onRejected
- * @returns {void}
- */
- function uponRejection(promise, onRejected) {
- uponPromise(promise, undefined, onRejected);
- }
-
- /**
- * @template T
- * @template TResult1
- * @template TResult2
- * @param {Promise<T>} promise
- * @param {(value: T) => TResult1 | PromiseLike<TResult1>} onFulfilled
- * @param {(reason: any) => TResult2 | PromiseLike<TResult2>=} onRejected
- * @returns {void}
- */
- function uponPromise(promise, onFulfilled, onRejected) {
- performPromiseThen(
- performPromiseThen(promise, onFulfilled, onRejected),
- undefined,
- rethrowAssertionErrorRejection,
- );
- }
-
- const isFakeDetached = Symbol("<<detached>>");
-
- /**
- * @param {ArrayBufferLike} O
- * @returns {boolean}
- */
- function isDetachedBuffer(O) {
- return isFakeDetached in O;
- }
-
- /**
- * @param {ArrayBufferLike} O
- * @returns {ArrayBufferLike}
- */
- function transferArrayBuffer(O) {
- assert(!isDetachedBuffer(O));
- const transferredIshVersion = O.slice(0);
- Object.defineProperty(O, "byteLength", {
- get() {
- return 0;
- },
- });
- O[isFakeDetached] = true;
- return transferredIshVersion;
- }
-
- const _abortAlgorithm = Symbol("[[abortAlgorithm]]");
- const _abortSteps = Symbol("[[AbortSteps]]");
- const _autoAllocateChunkSize = Symbol("[[autoAllocateChunkSize]]");
- const _backpressure = Symbol("[[backpressure]]");
- const _backpressureChangePromise = Symbol("[[backpressureChangePromise]]");
- const _byobRequest = Symbol("[[byobRequest]]");
- const _cancelAlgorithm = Symbol("[[cancelAlgorithm]]");
- const _cancelSteps = Symbol("[[CancelSteps]]");
- const _close = Symbol("close sentinel");
- const _closeAlgorithm = Symbol("[[closeAlgorithm]]");
- const _closedPromise = Symbol("[[closedPromise]]");
- const _closeRequest = Symbol("[[closeRequest]]");
- const _closeRequested = Symbol("[[closeRequested]]");
- const _controller = Symbol("[[controller]]");
- const _detached = Symbol("[[Detached]]");
- const _disturbed = Symbol("[[disturbed]]");
- const _errorSteps = Symbol("[[ErrorSteps]]");
- const _flushAlgorithm = Symbol("[[flushAlgorithm]]");
- const _globalObject = Symbol("[[globalObject]]");
- const _inFlightCloseRequest = Symbol("[[inFlightCloseRequest]]");
- const _inFlightWriteRequest = Symbol("[[inFlightWriteRequest]]");
- const _pendingAbortRequest = Symbol("[pendingAbortRequest]");
- const _preventCancel = Symbol("[[preventCancel]]");
- const _pullAgain = Symbol("[[pullAgain]]");
- const _pullAlgorithm = Symbol("[[pullAlgorithm]]");
- const _pulling = Symbol("[[pulling]]");
- const _pullSteps = Symbol("[[PullSteps]]");
- const _queue = Symbol("[[queue]]");
- const _queueTotalSize = Symbol("[[queueTotalSize]]");
- const _readable = Symbol("[[readable]]");
- const _reader = Symbol("[[reader]]");
- const _readRequests = Symbol("[[readRequests]]");
- const _readyPromise = Symbol("[[readyPromise]]");
- const _started = Symbol("[[started]]");
- const _state = Symbol("[[state]]");
- const _storedError = Symbol("[[storedError]]");
- const _strategyHWM = Symbol("[[strategyHWM]]");
- const _strategySizeAlgorithm = Symbol("[[strategySizeAlgorithm]]");
- const _stream = Symbol("[[stream]]");
- const _transformAlgorithm = Symbol("[[transformAlgorithm]]");
- const _writable = Symbol("[[writable]]");
- const _writeAlgorithm = Symbol("[[writeAlgorithm]]");
- const _writer = Symbol("[[writer]]");
- const _writeRequests = Symbol("[[writeRequests]]");
-
- /**
- * @template R
- * @param {ReadableStream<R>} stream
- * @returns {ReadableStreamDefaultReader<R>}
- */
- function acquireReadableStreamDefaultReader(stream) {
- return new ReadableStreamDefaultReader(stream);
- }
-
- /**
- * @template W
- * @param {WritableStream<W>} stream
- * @returns {WritableStreamDefaultWriter<W>}
- */
- function acquireWritableStreamDefaultWriter(stream) {
- return new WritableStreamDefaultWriter(stream);
- }
-
- /**
- * @template R
- * @param {() => void} startAlgorithm
- * @param {() => Promise<void>} pullAlgorithm
- * @param {(reason: any) => Promise<void>} cancelAlgorithm
- * @param {number=} highWaterMark
- * @param {((chunk: R) => number)=} sizeAlgorithm
- * @returns {ReadableStream<R>}
- */
- function createReadableStream(
- startAlgorithm,
- pullAlgorithm,
- cancelAlgorithm,
- highWaterMark = 1,
- sizeAlgorithm = () => 1,
- ) {
- assert(isNonNegativeNumber(highWaterMark));
- /** @type {ReadableStream} */
- const stream = Object.create(ReadableStream.prototype);
- initializeReadableStream(stream);
- const controller = Object.create(ReadableStreamDefaultController.prototype);
- setUpReadableStreamDefaultController(
- stream,
- controller,
- startAlgorithm,
- pullAlgorithm,
- cancelAlgorithm,
- highWaterMark,
- sizeAlgorithm,
- );
- return stream;
- }
-
- /**
- * @template W
- * @param {(controller: WritableStreamDefaultController<W>) => Promise<void>} startAlgorithm
- * @param {(chunk: W) => Promise<void>} writeAlgorithm
- * @param {() => Promise<void>} closeAlgorithm
- * @param {(reason: any) => Promise<void>} abortAlgorithm
- * @param {number} highWaterMark
- * @param {(chunk: W) => number} sizeAlgorithm
- * @returns {WritableStream<W>}
- */
- function createWritableStream(
- startAlgorithm,
- writeAlgorithm,
- closeAlgorithm,
- abortAlgorithm,
- highWaterMark,
- sizeAlgorithm,
- ) {
- assert(isNonNegativeNumber(highWaterMark));
- const stream = Object.create(WritableStream.prototype);
- initializeWritableStream(stream);
- const controller = Object.create(WritableStreamDefaultController.prototype);
- setUpWritableStreamDefaultController(
- stream,
- controller,
- startAlgorithm,
- writeAlgorithm,
- closeAlgorithm,
- abortAlgorithm,
- highWaterMark,
- sizeAlgorithm,
- );
- return stream;
- }
-
- /**
- * @template T
- * @param {{ [_queue]: Array<ValueWithSize<T>>, [_queueTotalSize]: number }} container
- * @returns {T}
- */
- function dequeueValue(container) {
- assert(_queue in container && _queueTotalSize in container);
- assert(container[_queue].length);
- const valueWithSize = container[_queue].shift();
- container[_queueTotalSize] -= valueWithSize.size;
- if (container[_queueTotalSize] < 0) {
- container[_queueTotalSize] = 0;
- }
- return valueWithSize.value;
- }
-
- /**
- * @template T
- * @param {{ [_queue]: Array<ValueWithSize<T | _close>>, [_queueTotalSize]: number }} container
- * @param {T} value
- * @param {number} size
- * @returns {void}
- */
- function enqueueValueWithSize(container, value, size) {
- assert(_queue in container && _queueTotalSize in container);
- if (isNonNegativeNumber(size) === false) {
- throw RangeError("chunk size isn't a positive number");
- }
- if (size === Infinity) {
- throw RangeError("chunk size is invalid");
- }
- container[_queue].push({ value, size });
- container[_queueTotalSize] += size;
- }
-
- /**
- * @param {QueuingStrategy} strategy
- * @param {number} defaultHWM
- */
- function extractHighWaterMark(strategy, defaultHWM) {
- if (!("highWaterMark" in strategy)) {
- return defaultHWM;
- }
- const highWaterMark = Number(strategy.highWaterMark);
- if (Number.isNaN(highWaterMark) || highWaterMark < 0) {
- throw RangeError(
- `Expected highWaterMark to be a positive number or Infinity, got "${highWaterMark}".`,
- );
- }
- return highWaterMark;
- }
-
- /**
- * @template T
- * @param {QueuingStrategy<T>} strategy
- * @return {(chunk: T) => number}
- */
- function extractSizeAlgorithm(strategy) {
- const { size } = strategy;
-
- if (!size) {
- return () => 1;
- }
- return (chunk) => size(chunk);
- }
-
- /**
- * @param {ReadableStream} stream
- * @returns {void}
- */
- function initializeReadableStream(stream) {
- stream[_state] = "readable";
- stream[_reader] = stream[_storedError] = undefined;
- stream[_disturbed] = false;
- }
-
- /**
- * @template I
- * @template O
- * @param {TransformStream<I, O>} stream
- * @param {Deferred<void>} startPromise
- * @param {number} writableHighWaterMark
- * @param {(chunk: I) => number} writableSizeAlgorithm
- * @param {number} readableHighWaterMark
- * @param {(chunk: O) => number} readableSizeAlgorithm
- */
- function initializeTransformStream(
- stream,
- startPromise,
- writableHighWaterMark,
- writableSizeAlgorithm,
- readableHighWaterMark,
- readableSizeAlgorithm,
- ) {
- function startAlgorithm() {
- return startPromise.promise;
- }
-
- function writeAlgorithm(chunk) {
- return transformStreamDefaultSinkWriteAlgorithm(stream, chunk);
- }
-
- function abortAlgorithm(reason) {
- return transformStreamDefaultSinkAbortAlgorithm(stream, reason);
- }
-
- function closeAlgorithm() {
- return transformStreamDefaultSinkCloseAlgorithm(stream);
- }
-
- stream[_writable] = createWritableStream(
- startAlgorithm,
- writeAlgorithm,
- closeAlgorithm,
- abortAlgorithm,
- writableHighWaterMark,
- writableSizeAlgorithm,
- );
-
- function pullAlgorithm() {
- return transformStreamDefaultSourcePullAlgorithm(stream);
- }
-
- function cancelAlgorithm(reason) {
- transformStreamErrorWritableAndUnblockWrite(stream, reason);
- return resolvePromiseWith(undefined);
- }
-
- stream[_readable] = createReadableStream(
- startAlgorithm,
- pullAlgorithm,
- cancelAlgorithm,
- readableHighWaterMark,
- readableSizeAlgorithm,
- );
-
- stream[_backpressure] = stream[_backpressureChangePromise] = undefined;
- transformStreamSetBackpressure(stream, true);
- stream[_controller] = undefined;
- }
-
- /** @param {WritableStream} stream */
- function initializeWritableStream(stream) {
- stream[_state] = "writable";
- stream[_storedError] = stream[_writer] = stream[_controller] =
- stream[_inFlightWriteRequest] = stream[_closeRequest] =
- stream[_inFlightCloseRequest] = stream[_pendingAbortRequest] =
- undefined;
- stream[_writeRequests] = [];
- stream[_backpressure] = false;
- }
-
- /**
- * @param {unknown} v
- * @returns {v is number}
- */
- function isNonNegativeNumber(v) {
- if (typeof v !== "number") {
- return false;
- }
- if (Number.isNaN(v)) {
- return false;
- }
- if (v < 0) {
- return false;
- }
- return true;
- }
-
- /**
- * @param {unknown} value
- * @returns {value is ReadableStream}
- */
- function isReadableStream(value) {
- return !(typeof value !== "object" || value === null ||
- !(_controller in value));
- }
-
- /**
- * @param {ReadableStream} stream
- * @returns {boolean}
- */
- function isReadableStreamLocked(stream) {
- if (stream[_reader] === undefined) {
- return false;
- }
- return true;
- }
-
- /**
- * @param {unknown} value
- * @returns {value is ReadableStreamDefaultReader}
- */
- function isReadableStreamDefaultReader(value) {
- return !(typeof value !== "object" || value === null ||
- !(_readRequests in value));
- }
-
- /**
- * @param {ReadableStream} stream
- * @returns {boolean}
- */
- function isReadableStreamDisturbed(stream) {
- assert(isReadableStream(stream));
- return stream[_disturbed];
- }
-
- /**
- * @param {unknown} value
- * @returns {value is WritableStream}
- */
- function isWritableStream(value) {
- return !(typeof value !== "object" || value === null ||
- !(_controller in value));
- }
-
- /**
- * @param {WritableStream} stream
- * @returns {boolean}
- */
- function isWritableStreamLocked(stream) {
- if (stream[_writer] === undefined) {
- return false;
- }
- return true;
- }
-
- /**
- * @template T
- * @param {{ [_queue]: Array<ValueWithSize<T | _close>>, [_queueTotalSize]: number }} container
- * @returns {T | _close}
- */
- function peekQueueValue(container) {
- assert(_queue in container && _queueTotalSize in container);
- assert(container[_queue].length);
- const valueWithSize = container[_queue][0];
- return valueWithSize.value;
- }
-
- /**
- * @param {ReadableByteStreamController} controller
- * @returns {void}
- */
- function readableByteStreamControllerCallPullIfNeeded(controller) {
- const shouldPull = readableByteStreamControllerShouldCallPull(controller);
- if (!shouldPull) {
- return;
- }
- if (controller[_pulling]) {
- controller[_pullAgain] = true;
- return;
- }
- assert(controller[_pullAgain] === false);
- controller[_pulling] = true;
- /** @type {Promise<void>} */
- const pullPromise = controller[_pullAlgorithm](controller);
- setPromiseIsHandledToTrue(
- pullPromise.then(
- () => {
- controller[_pulling] = false;
- if (controller[_pullAgain]) {
- controller[_pullAgain] = false;
- readableByteStreamControllerCallPullIfNeeded(controller);
- }
- },
- (e) => {
- readableByteStreamControllerError(controller, e);
- },
- ),
- );
- }
-
- /**
- * @param {ReadableByteStreamController} controller
- * @returns {void}
- */
- function readableByteStreamControllerClearAlgorithms(controller) {
- controller[_pullAlgorithm] = undefined;
- controller[_cancelAlgorithm] = undefined;
- }
-
- /**
- * @param {ReadableByteStreamController} controller
- * @param {any} e
- */
- function readableByteStreamControllerError(controller, e) {
- /** @type {ReadableStream<ArrayBuffer>} */
- const stream = controller[_stream];
- if (stream[_state] !== "readable") {
- return;
- }
- // 3. Perform ! ReadableByteStreamControllerClearPendingPullIntos(controller).
- resetQueue(controller);
- readableByteStreamControllerClearAlgorithms(controller);
- readableStreamError(stream, e);
- }
-
- /**
- * @param {ReadableByteStreamController} controller
- * @returns {void}
- */
- function readableByteStreamControllerClose(controller) {
- /** @type {ReadableStream<ArrayBuffer>} */
- const stream = controller[_stream];
- if (controller[_closeRequested] || stream[_state] !== "readable") {
- return;
- }
- if (controller[_queueTotalSize] > 0) {
- controller[_closeRequested] = true;
- return;
- }
- // 3.13.6.4 If controller.[[pendingPullIntos]] is not empty, (BYOB Support)
- readableByteStreamControllerClearAlgorithms(controller);
- readableStreamClose(stream);
- }
-
- /**
- * @param {ReadableByteStreamController} controller
- * @param {ArrayBufferView} chunk
- */
- function readableByteStreamControllerEnqueue(controller, chunk) {
- /** @type {ReadableStream<ArrayBuffer>} */
- const stream = controller[_stream];
- if (
- controller[_closeRequested] ||
- controller[_stream][_state] !== "readable"
- ) {
- return;
- }
-
- const { buffer, byteOffset, byteLength } = chunk;
- const transferredBuffer = transferArrayBuffer(buffer);
- if (readableStreamHasDefaultReader(stream)) {
- if (readableStreamGetNumReadRequests(stream) === 0) {
- readableByteStreamControllerEnqueueChunkToQueue(
- controller,
- transferredBuffer,
- byteOffset,
- byteLength,
- );
- } else {
- assert(controller[_queue].length === 0);
- const transferredView = new Uint8Array(
- transferredBuffer,
- byteOffset,
- byteLength,
- );
- readableStreamFulfillReadRequest(stream, transferredView, false);
- }
- // 8 Otherwise, if ! ReadableStreamHasBYOBReader(stream) is true,
- } else {
- assert(isReadableStreamLocked(stream) === false);
- readableByteStreamControllerEnqueueChunkToQueue(
- controller,
- transferredBuffer,
- byteOffset,
- byteLength,
- );
- }
- readableByteStreamControllerCallPullIfNeeded(controller);
- }
-
- /**
- * @param {ReadableByteStreamController} controller
- * @param {ArrayBufferLike} buffer
- * @param {number} byteOffset
- * @param {number} byteLength
- * @returns {void}
- */
- function readableByteStreamControllerEnqueueChunkToQueue(
- controller,
- buffer,
- byteOffset,
- byteLength,
- ) {
- controller[_queue].push({ buffer, byteOffset, byteLength });
- controller[_queueTotalSize] += byteLength;
- }
-
- /**
- * @param {ReadableByteStreamController} controller
- * @returns {number | null}
- */
- function readableByteStreamControllerGetDesiredSize(controller) {
- const state = controller[_stream][_state];
- if (state === "errored") {
- return null;
- }
- if (state === "closed") {
- return 0;
- }
- return controller[_strategyHWM] - controller[_queueTotalSize];
- }
-
- /**
- * @param {{ [_queue]: any[], [_queueTotalSize]: number }} container
- * @returns {void}
- */
- function resetQueue(container) {
- container[_queue] = [];
- container[_queueTotalSize] = 0;
- }
-
- /**
- * @param {ReadableByteStreamController} controller
- * @returns {void}
- */
- function readableByteStreamControllerHandleQueueDrain(controller) {
- assert(controller[_stream][_state] === "readable");
- if (
- controller[_queueTotalSize] === 0 && controller[_closeRequested]
- ) {
- readableByteStreamControllerClearAlgorithms(controller);
- readableStreamClose(controller[_stream]);
- } else {
- readableByteStreamControllerCallPullIfNeeded(controller);
- }
- }
-
- /**
- * @param {ReadableByteStreamController} controller
- * @returns {boolean}
- */
- function readableByteStreamControllerShouldCallPull(controller) {
- /** @type {ReadableStream<ArrayBuffer>} */
- const stream = controller[_stream];
- if (
- stream[_state] !== "readable" ||
- controller[_closeRequested] ||
- !controller[_started]
- ) {
- return false;
- }
- if (
- readableStreamHasDefaultReader(stream) &&
- readableStreamGetNumReadRequests(stream) > 0
- ) {
- return true;
- }
- // 3.13.25.6 If ! ReadableStreamHasBYOBReader(stream) is true and !
- // ReadableStreamGetNumReadIntoRequests(stream) > 0, return true.
- const desiredSize = readableByteStreamControllerGetDesiredSize(controller);
- assert(desiredSize !== null);
- return desiredSize > 0;
- }
-
- /**
- * @template R
- * @param {ReadableStream<R>} stream
- * @param {ReadRequest<R>} readRequest
- * @returns {void}
- */
- function readableStreamAddReadRequest(stream, readRequest) {
- assert(isReadableStreamDefaultReader(stream[_reader]));
- assert(stream[_state] === "readable");
- stream[_reader][_readRequests].push(readRequest);
- }
-
- /**
- * @template R
- * @param {ReadableStream<R>} stream
- * @param {any=} reason
- * @returns {Promise<void>}
- */
- function readableStreamCancel(stream, reason) {
- stream[_disturbed] = true;
- if (stream[_state] === "closed") {
- return resolvePromiseWith(undefined);
- }
- if (stream[_state] === "errored") {
- return Promise.reject(stream[_storedError]);
- }
- readableStreamClose(stream);
- /** @type {Promise<void>} */
- const sourceCancelPromise = stream[_controller][_cancelSteps](reason);
- return sourceCancelPromise.then(() => undefined);
- }
-
- /**
- * @template R
- * @param {ReadableStream<R>} stream
- * @returns {void}
- */
- function readableStreamClose(stream) {
- assert(stream[_state] === "readable");
- stream[_state] = "closed";
- /** @type {ReadableStreamDefaultReader<R> | undefined} */
- const reader = stream[_reader];
- if (!reader) {
- return;
- }
- if (isReadableStreamDefaultReader(reader)) {
- /** @type {Array<ReadRequest<R>>} */
- const readRequests = reader[_readRequests];
- for (const readRequest of readRequests) {
- readRequest.closeSteps();
- }
- reader[_readRequests] = [];
- }
- // This promise can be double resolved.
- // See: https://github.com/whatwg/streams/issues/1100
- reader[_closedPromise].resolve(undefined);
- }
-
- /** @param {ReadableStreamDefaultController<any>} controller */
- function readableStreamDefaultControllerCallPullIfNeeded(controller) {
- const shouldPull = readableStreamDefaultcontrollerShouldCallPull(
- controller,
- );
- if (shouldPull === false) {
- return;
- }
- if (controller[_pulling] === true) {
- controller[_pullAgain] = true;
- return;
- }
- assert(controller[_pullAgain] === false);
- controller[_pulling] = true;
- const pullPromise = controller[_pullAlgorithm](controller);
- uponFulfillment(pullPromise, () => {
- controller[_pulling] = false;
- if (controller[_pullAgain] === true) {
- controller[_pullAgain] = false;
- readableStreamDefaultControllerCallPullIfNeeded(controller);
- }
- });
- uponRejection(pullPromise, (e) => {
- readableStreamDefaultControllerError(controller, e);
- });
- }
-
- /**
- * @param {ReadableStreamDefaultController<any>} controller
- * @returns {boolean}
- */
- function readableStreamDefaultControllerCanCloseOrEnqueue(controller) {
- const state = controller[_stream][_state];
- if (controller[_closeRequested] === false && state === "readable") {
- return true;
- } else {
- return false;
- }
- }
-
- /** @param {ReadableStreamDefaultController<any>} controller */
- function readableStreamDefaultControllerClearAlgorithms(controller) {
- controller[_pullAlgorithm] = undefined;
- controller[_cancelAlgorithm] = undefined;
- controller[_strategySizeAlgorithm] = undefined;
- }
-
- /** @param {ReadableStreamDefaultController<any>} controller */
- function readableStreamDefaultControllerClose(controller) {
- if (
- readableStreamDefaultControllerCanCloseOrEnqueue(controller) === false
- ) {
- return;
- }
- const stream = controller[_stream];
- controller[_closeRequested] = true;
- if (controller[_queue].length === 0) {
- readableStreamDefaultControllerClearAlgorithms(controller);
- readableStreamClose(stream);
- }
- }
-
- /**
- * @template R
- * @param {ReadableStreamDefaultController<R>} controller
- * @param {R} chunk
- * @returns {void}
- */
- function readableStreamDefaultControllerEnqueue(controller, chunk) {
- if (
- readableStreamDefaultControllerCanCloseOrEnqueue(controller) === false
- ) {
- return;
- }
- const stream = controller[_stream];
- if (
- isReadableStreamLocked(stream) === true &&
- readableStreamGetNumReadRequests(stream) > 0
- ) {
- readableStreamFulfillReadRequest(stream, chunk, false);
- } else {
- let chunkSize;
- try {
- chunkSize = controller[_strategySizeAlgorithm](chunk);
- } catch (e) {
- readableStreamDefaultControllerError(controller, e);
- throw e;
- }
-
- try {
- enqueueValueWithSize(controller, chunk, chunkSize);
- } catch (e) {
- readableStreamDefaultControllerError(controller, e);
- throw e;
- }
- }
- readableStreamDefaultControllerCallPullIfNeeded(controller);
- }
-
- /**
- * @param {ReadableStreamDefaultController<any>} controller
- * @param {any} e
- */
- function readableStreamDefaultControllerError(controller, e) {
- const stream = controller[_stream];
- if (stream[_state] !== "readable") {
- return;
- }
- resetQueue(controller);
- readableStreamDefaultControllerClearAlgorithms(controller);
- readableStreamError(stream, e);
- }
-
- /**
- * @param {ReadableStreamDefaultController<any>} controller
- * @returns {number | null}
- */
- function readableStreamDefaultControllerGetDesiredSize(controller) {
- const state = controller[_stream][_state];
- if (state === "errored") {
- return null;
- }
- if (state === "closed") {
- return 0;
- }
- return controller[_strategyHWM] - controller[_queueTotalSize];
- }
-
- /** @param {ReadableStreamDefaultController} controller */
- function readableStreamDefaultcontrollerHasBackpressure(controller) {
- if (readableStreamDefaultcontrollerShouldCallPull(controller) === true) {
- return false;
- } else {
- return true;
- }
- }
-
- /**
- * @param {ReadableStreamDefaultController<any>} controller
- * @returns {boolean}
- */
- function readableStreamDefaultcontrollerShouldCallPull(controller) {
- const stream = controller[_stream];
- if (
- readableStreamDefaultControllerCanCloseOrEnqueue(controller) === false
- ) {
- return false;
- }
- if (controller[_started] === false) {
- return false;
- }
- if (
- isReadableStreamLocked(stream) &&
- readableStreamGetNumReadRequests(stream) > 0
- ) {
- return true;
- }
- const desiredSize = readableStreamDefaultControllerGetDesiredSize(
- controller,
- );
- assert(desiredSize !== null);
- if (desiredSize > 0) {
- return true;
- }
- return false;
- }
-
- /**
- * @template R
- * @param {ReadableStreamDefaultReader<R>} reader
- * @param {ReadRequest<R>} readRequest
- * @returns {void}
- */
- function readableStreamDefaultReaderRead(reader, readRequest) {
- const stream = reader[_stream];
- assert(stream);
- stream[_disturbed] = true;
- if (stream[_state] === "closed") {
- readRequest.closeSteps();
- } else if (stream[_state] === "errored") {
- readRequest.errorSteps(stream[_storedError]);
- } else {
- assert(stream[_state] === "readable");
- stream[_controller][_pullSteps](readRequest);
- }
- }
-
- /**
- * @template R
- * @param {ReadableStream<R>} stream
- * @param {any} e
- */
- function readableStreamError(stream, e) {
- assert(stream[_state] === "readable");
- stream[_state] = "errored";
- stream[_storedError] = e;
- /** @type {ReadableStreamDefaultReader<R> | undefined} */
- const reader = stream[_reader];
- if (reader === undefined) {
- return;
- }
- if (isReadableStreamDefaultReader(reader)) {
- /** @type {Array<ReadRequest<R>>} */
- const readRequests = reader[_readRequests];
- for (const readRequest of readRequests) {
- readRequest.errorSteps(e);
- }
- reader[_readRequests] = [];
- }
- // 3.5.6.8 Otherwise, support BYOB Reader
- /** @type {Deferred<void>} */
- const closedPromise = reader[_closedPromise];
- closedPromise.reject(e);
- setPromiseIsHandledToTrue(closedPromise.promise);
- }
-
- /**
- * @template R
- * @param {ReadableStream<R>} stream
- * @param {R} chunk
- * @param {boolean} done
- */
- function readableStreamFulfillReadRequest(stream, chunk, done) {
- assert(readableStreamHasDefaultReader(stream) === true);
- /** @type {ReadableStreamDefaultReader<R>} */
- const reader = stream[_reader];
- assert(reader[_readRequests].length);
- /** @type {ReadRequest<R>} */
- const readRequest = reader[_readRequests].shift();
- if (done) {
- readRequest.closeSteps();
- } else {
- readRequest.chunkSteps(chunk);
- }
- }
-
- /**
- * @param {ReadableStream} stream
- * @return {number}
- */
- function readableStreamGetNumReadRequests(stream) {
- assert(readableStreamHasDefaultReader(stream) === true);
- return stream[_reader][_readRequests].length;
- }
-
- /**
- * @param {ReadableStream} stream
- * @returns {boolean}
- */
- function readableStreamHasDefaultReader(stream) {
- const reader = stream[_reader];
- if (reader === undefined) {
- return false;
- }
- if (isReadableStreamDefaultReader(reader)) {
- return true;
- }
- return false;
- }
-
- /**
- * @template T
- * @param {ReadableStream<T>} source
- * @param {WritableStream<T>} dest
- * @param {boolean} preventClose
- * @param {boolean} preventAbort
- * @param {boolean} preventCancel
- * @param {AbortSignal=} signal
- * @returns {Promise<void>}
- */
- function readableStreamPipeTo(
- source,
- dest,
- preventClose,
- preventAbort,
- preventCancel,
- signal,
- ) {
- assert(isReadableStream(source));
- assert(isWritableStream(dest));
- assert(
- typeof preventClose === "boolean" && typeof preventAbort === "boolean" &&
- typeof preventCancel === "boolean",
- );
- assert(signal === undefined || signal instanceof AbortSignal);
- assert(!isReadableStreamLocked(source));
- assert(!isWritableStreamLocked(dest));
- const reader = acquireReadableStreamDefaultReader(source);
- const writer = acquireWritableStreamDefaultWriter(dest);
- source[_disturbed] = true;
- let shuttingDown = false;
- let currentWrite = resolvePromiseWith(undefined);
- /** @type {Deferred<void>} */
- const promise = new Deferred();
- /** @type {() => void} */
- let abortAlgorithm;
- if (signal) {
- abortAlgorithm = () => {
- const error = new DOMException("Aborted", "AbortError");
- /** @type {Array<() => Promise<void>>} */
- const actions = [];
- if (preventAbort === false) {
- actions.push(() => {
- if (dest[_state] === "writable") {
- return writableStreamAbort(dest, error);
- } else {
- return resolvePromiseWith(undefined);
- }
- });
- }
- if (preventCancel === false) {
- actions.push(() => {
- if (source[_state] === "readable") {
- return readableStreamCancel(source, error);
- } else {
- return resolvePromiseWith(undefined);
- }
- });
- }
- shutdownWithAction(
- () => Promise.all(actions.map((action) => action())),
- true,
- error,
- );
- };
-
- if (signal.aborted) {
- abortAlgorithm();
- return promise.promise;
- }
- signal.addEventListener("abort", abortAlgorithm);
- }
-
- function pipeLoop() {
- return new Promise((resolveLoop, rejectLoop) => {
- /** @param {boolean} done */
- function next(done) {
- if (done) {
- resolveLoop();
- } else {
- uponPromise(pipeStep(), next, rejectLoop);
- }
- }
- next(false);
- });
- }
-
- /** @returns {Promise<boolean>} */
- function pipeStep() {
- if (shuttingDown === true) {
- return resolvePromiseWith(true);
- }
-
- return transformPromiseWith(writer[_readyPromise].promise, () => {
- return new Promise((resolveRead, rejectRead) => {
- readableStreamDefaultReaderRead(
- reader,
- {
- chunkSteps(chunk) {
- currentWrite = transformPromiseWith(
- writableStreamDefaultWriterWrite(writer, chunk),
- undefined,
- () => {},
- );
- resolveRead(false);
- },
- closeSteps() {
- resolveRead(true);
- },
- errorSteps: rejectRead,
- },
- );
- });
- });
- }
-
- isOrBecomesErrored(
- source,
- reader[_closedPromise].promise,
- (storedError) => {
- if (preventAbort === false) {
- shutdownWithAction(
- () => writableStreamAbort(dest, storedError),
- true,
- storedError,
- );
- } else {
- shutdown(true, storedError);
- }
- },
- );
-
- isOrBecomesErrored(dest, writer[_closedPromise].promise, (storedError) => {
- if (preventCancel === false) {
- shutdownWithAction(
- () => readableStreamCancel(source, storedError),
- true,
- storedError,
- );
- } else {
- shutdown(true, storedError);
- }
- });
-
- isOrBecomesClosed(source, reader[_closedPromise].promise, () => {
- if (preventClose === false) {
- shutdownWithAction(() =>
- writableStreamDefaultWriterCloseWithErrorPropagation(writer)
- );
- } else {
- shutdown();
- }
- });
-
- if (
- writableStreamCloseQueuedOrInFlight(dest) === true ||
- dest[_state] === "closed"
- ) {
- const destClosed = new TypeError(
- "The destination writable stream closed before all the data could be piped to it.",
- );
- if (preventCancel === false) {
- shutdownWithAction(
- () => readableStreamCancel(source, destClosed),
- true,
- destClosed,
- );
- } else {
- shutdown(true, destClosed);
- }
- }
-
- setPromiseIsHandledToTrue(pipeLoop());
-
- return promise.promise;
-
- /** @returns {Promise<void>} */
- function waitForWritesToFinish() {
- const oldCurrentWrite = currentWrite;
- return transformPromiseWith(
- currentWrite,
- () =>
- oldCurrentWrite !== currentWrite
- ? waitForWritesToFinish()
- : undefined,
- );
- }
-
- /**
- * @param {ReadableStream | WritableStream} stream
- * @param {Promise<any>} promise
- * @param {(e: any) => void} action
- */
- function isOrBecomesErrored(stream, promise, action) {
- if (stream[_state] === "errored") {
- action(stream[_storedError]);
- } else {
- uponRejection(promise, action);
- }
- }
-
- /**
- * @param {ReadableStream} stream
- * @param {Promise<any>} promise
- * @param {() => void} action
- */
- function isOrBecomesClosed(stream, promise, action) {
- if (stream[_state] === "closed") {
- action();
- } else {
- uponFulfillment(promise, action);
- }
- }
-
- /**
- * @param {() => Promise<void[] | void>} action
- * @param {boolean=} originalIsError
- * @param {any=} originalError
- */
- function shutdownWithAction(action, originalIsError, originalError) {
- function doTheRest() {
- uponPromise(
- action(),
- () => finalize(originalIsError, originalError),
- (newError) => finalize(true, newError),
- );
- }
-
- if (shuttingDown === true) {
- return;
- }
- shuttingDown = true;
-
- if (
- dest[_state] === "writable" &&
- writableStreamCloseQueuedOrInFlight(dest) === false
- ) {
- uponFulfillment(waitForWritesToFinish(), doTheRest);
- } else {
- doTheRest();
- }
- }
-
- /**
- * @param {boolean=} isError
- * @param {any=} error
- */
- function shutdown(isError, error) {
- if (shuttingDown) {
- return;
- }
- shuttingDown = true;
- if (
- dest[_state] === "writable" &&
- writableStreamCloseQueuedOrInFlight(dest) === false
- ) {
- uponFulfillment(
- waitForWritesToFinish(),
- () => finalize(isError, error),
- );
- } else {
- finalize(isError, error);
- }
- }
-
- /**
- * @param {boolean=} isError
- * @param {any=} error
- */
- function finalize(isError, error) {
- writableStreamDefaultWriterRelease(writer);
- readableStreamReaderGenericRelease(reader);
-
- if (signal !== undefined) {
- signal.removeEventListener("abort", abortAlgorithm);
- }
- if (isError) {
- promise.reject(error);
- } else {
- promise.resolve(undefined);
- }
- }
- }
-
- /**
- * @param {ReadableStreamGenericReader<any>} reader
- * @param {any} reason
- * @returns {Promise<void>}
- */
- function readableStreamReaderGenericCancel(reader, reason) {
- const stream = reader[_stream];
- assert(stream !== undefined);
- return readableStreamCancel(stream, reason);
- }
-
- /**
- * @template R
- * @param {ReadableStreamDefaultReader<R>} reader
- * @param {ReadableStream<R>} stream
- */
- function readableStreamReaderGenericInitialize(reader, stream) {
- reader[_stream] = stream;
- stream[_reader] = reader;
- if (stream[_state] === "readable") {
- reader[_closedPromise] = new Deferred();
- } else if (stream[_state] === "closed") {
- reader[_closedPromise] = new Deferred();
- reader[_closedPromise].resolve(undefined);
- } else {
- assert(stream[_state] === "errored");
- reader[_closedPromise] = new Deferred();
- reader[_closedPromise].reject(stream[_storedError]);
- setPromiseIsHandledToTrue(reader[_closedPromise].promise);
- }
- }
-
- /**
- * @template R
- * @param {ReadableStreamGenericReader<R>} reader
- */
- function readableStreamReaderGenericRelease(reader) {
- assert(reader[_stream] !== undefined);
- assert(reader[_stream][_reader] === reader);
- if (reader[_stream][_state] === "readable") {
- reader[_closedPromise].reject(
- new TypeError(
- "Reader was released and can no longer be used to monitor the stream's closedness.",
- ),
- );
- } else {
- reader[_closedPromise] = new Deferred();
- reader[_closedPromise].reject(
- new TypeError(
- "Reader was released and can no longer be used to monitor the stream's closedness.",
- ),
- );
- }
- setPromiseIsHandledToTrue(reader[_closedPromise].promise);
- reader[_stream][_reader] = undefined;
- reader[_stream] = undefined;
- }
-
- /**
- * @template R
- * @param {ReadableStream<R>} stream
- * @param {boolean} cloneForBranch2
- * @returns {[ReadableStream<R>, ReadableStream<R>]}
- */
- function readableStreamTee(stream, cloneForBranch2) {
- assert(isReadableStream(stream));
- assert(typeof cloneForBranch2 === "boolean");
- const reader = acquireReadableStreamDefaultReader(stream);
- let reading = false;
- let canceled1 = false;
- let canceled2 = false;
- /** @type {any} */
- let reason1;
- /** @type {any} */
- let reason2;
- /** @type {ReadableStream<R>} */
- // deno-lint-ignore prefer-const
- let branch1;
- /** @type {ReadableStream<R>} */
- // deno-lint-ignore prefer-const
- let branch2;
-
- /** @type {Deferred<void>} */
- const cancelPromise = new Deferred();
-
- function pullAlgorithm() {
- if (reading === true) {
- return resolvePromiseWith(undefined);
- }
- reading = true;
- /** @type {ReadRequest<R>} */
- const readRequest = {
- chunkSteps(value) {
- queueMicrotask(() => {
- reading = false;
- const value1 = value;
- const value2 = value;
-
- if (canceled1 === false) {
- readableStreamDefaultControllerEnqueue(
- /** @type {ReadableStreamDefaultController<any>} */ (branch1[
- _controller
- ]),
- value1,
- );
- }
- if (canceled2 === false) {
- readableStreamDefaultControllerEnqueue(
- /** @type {ReadableStreamDefaultController<any>} */ (branch2[
- _controller
- ]),
- value2,
- );
- }
- });
- },
- closeSteps() {
- reading = false;
- if (canceled1 === false) {
- readableStreamDefaultControllerClose(
- /** @type {ReadableStreamDefaultController<any>} */ (branch1[
- _controller
- ]),
- );
- }
- if (canceled2 === false) {
- readableStreamDefaultControllerClose(
- /** @type {ReadableStreamDefaultController<any>} */ (branch2[
- _controller
- ]),
- );
- }
- cancelPromise.resolve(undefined);
- },
- errorSteps() {
- reading = false;
- },
- };
- readableStreamDefaultReaderRead(reader, readRequest);
- return resolvePromiseWith(undefined);
- }
-
- /**
- * @param {any} reason
- * @returns {Promise<void>}
- */
- function cancel1Algorithm(reason) {
- canceled1 = true;
- reason1 = reason;
- if (canceled2 === true) {
- const compositeReason = [reason1, reason2];
- const cancelResult = readableStreamCancel(stream, compositeReason);
- cancelPromise.resolve(cancelResult);
- }
- return cancelPromise.promise;
- }
-
- /**
- * @param {any} reason
- * @returns {Promise<void>}
- */
- function cancel2Algorithm(reason) {
- canceled2 = true;
- reason2 = reason;
- if (canceled1 === true) {
- const compositeReason = [reason1, reason2];
- const cancelResult = readableStreamCancel(stream, compositeReason);
- cancelPromise.resolve(cancelResult);
- }
- return cancelPromise.promise;
- }
-
- function startAlgorithm() {}
-
- branch1 = createReadableStream(
- startAlgorithm,
- pullAlgorithm,
- cancel1Algorithm,
- );
- branch2 = createReadableStream(
- startAlgorithm,
- pullAlgorithm,
- cancel2Algorithm,
- );
-
- uponRejection(reader[_closedPromise].promise, (r) => {
- readableStreamDefaultControllerError(
- /** @type {ReadableStreamDefaultController<any>} */ (branch1[
- _controller
- ]),
- r,
- );
- readableStreamDefaultControllerError(
- /** @type {ReadableStreamDefaultController<any>} */ (branch2[
- _controller
- ]),
- r,
- );
- cancelPromise.resolve(undefined);
- });
-
- return [branch1, branch2];
- }
-
- /**
- * @param {ReadableStream<ArrayBuffer>} stream
- * @param {ReadableByteStreamController} controller
- * @param {() => void} startAlgorithm
- * @param {() => Promise<void>} pullAlgorithm
- * @param {(reason: any) => Promise<void>} cancelAlgorithm
- * @param {number} highWaterMark
- * @param {number | undefined} autoAllocateChunkSize
- */
- function setUpReadableByteStreamController(
- stream,
- controller,
- startAlgorithm,
- pullAlgorithm,
- cancelAlgorithm,
- highWaterMark,
- autoAllocateChunkSize,
- ) {
- assert(stream[_controller] === undefined);
- if (autoAllocateChunkSize !== undefined) {
- assert(Number.isInteger(autoAllocateChunkSize));
- assert(autoAllocateChunkSize >= 0);
- }
- controller[_stream] = stream;
- controller[_pullAgain] = controller[_pulling] = false;
- controller[_byobRequest] = undefined;
- resetQueue(controller);
- controller[_closeRequested] = controller[_started] = false;
- controller[_strategyHWM] = highWaterMark;
- controller[_pullAlgorithm] = pullAlgorithm;
- controller[_cancelAlgorithm] = cancelAlgorithm;
- controller[_autoAllocateChunkSize] = autoAllocateChunkSize;
- // 12. Set controller.[[pendingPullIntos]] to a new empty list.
- stream[_controller] = controller;
- const startResult = startAlgorithm();
- const startPromise = resolvePromiseWith(startResult);
- setPromiseIsHandledToTrue(
- startPromise.then(
- () => {
- controller[_started] = true;
- assert(controller[_pulling] === false);
- assert(controller[_pullAgain] === false);
- readableByteStreamControllerCallPullIfNeeded(controller);
- },
- (r) => {
- readableByteStreamControllerError(controller, r);
- },
- ),
- );
- }
-
- /**
- * @param {ReadableStream<ArrayBuffer>} stream
- * @param {UnderlyingSource<ArrayBuffer>} underlyingSource
- * @param {UnderlyingSource<ArrayBuffer>} underlyingSourceDict
- * @param {number} highWaterMark
- */
- function setUpReadableByteStreamControllerFromUnderlyingSource(
- stream,
- underlyingSource,
- underlyingSourceDict,
- highWaterMark,
- ) {
- const controller = new ReadableByteStreamController();
- /** @type {() => void} */
- let startAlgorithm = () => undefined;
- /** @type {() => Promise<void>} */
- let pullAlgorithm = () => resolvePromiseWith(undefined);
- /** @type {(reason: any) => Promise<void>} */
- let cancelAlgorithm = (_reason) => resolvePromiseWith(undefined);
- if ("start" in underlyingSourceDict) {
- startAlgorithm = () =>
- underlyingSourceDict.start.call(underlyingSource, controller);
- }
- if ("pull" in underlyingSourceDict) {
- pullAlgorithm = () =>
- underlyingSourceDict.pull.call(underlyingSource, controller);
- }
- if ("cancel" in underlyingSourceDict) {
- cancelAlgorithm = (reason) =>
- underlyingSourceDict.cancel.call(underlyingSource, reason);
- }
- // 3.13.27.6 Let autoAllocateChunkSize be ? GetV(underlyingByteSource, "autoAllocateChunkSize").
- /** @type {undefined} */
- const autoAllocateChunkSize = undefined;
- setUpReadableByteStreamController(
- stream,
- controller,
- startAlgorithm,
- pullAlgorithm,
- cancelAlgorithm,
- highWaterMark,
- autoAllocateChunkSize,
- );
- }
-
- /**
- * @template R
- * @param {ReadableStream<R>} stream
- * @param {ReadableStreamDefaultController<R>} controller
- * @param {(controller: ReadableStreamDefaultController<R>) => void | Promise<void>} startAlgorithm
- * @param {(controller: ReadableStreamDefaultController<R>) => Promise<void>} pullAlgorithm
- * @param {(reason: any) => Promise<void>} cancelAlgorithm
- * @param {number} highWaterMark
- * @param {(chunk: R) => number} sizeAlgorithm
- */
- function setUpReadableStreamDefaultController(
- stream,
- controller,
- startAlgorithm,
- pullAlgorithm,
- cancelAlgorithm,
- highWaterMark,
- sizeAlgorithm,
- ) {
- assert(stream[_controller] === undefined);
- controller[_stream] = stream;
- resetQueue(controller);
- controller[_started] = controller[_closeRequested] =
- controller[_pullAgain] = controller[_pulling] = false;
- controller[_strategySizeAlgorithm] = sizeAlgorithm;
- controller[_strategyHWM] = highWaterMark;
- controller[_pullAlgorithm] = pullAlgorithm;
- controller[_cancelAlgorithm] = cancelAlgorithm;
- stream[_controller] = controller;
- const startResult = startAlgorithm(controller);
- const startPromise = resolvePromiseWith(startResult);
- uponPromise(startPromise, () => {
- controller[_started] = true;
- assert(controller[_pulling] === false);
- assert(controller[_pullAgain] === false);
- readableStreamDefaultControllerCallPullIfNeeded(controller);
- }, (r) => {
- readableStreamDefaultControllerError(controller, r);
- });
- }
-
- /**
- * @template R
- * @param {ReadableStream<R>} stream
- * @param {UnderlyingSource<R>} underlyingSource
- * @param {UnderlyingSource<R>} underlyingSourceDict
- * @param {number} highWaterMark
- * @param {(chunk: R) => number} sizeAlgorithm
- */
- function setUpReadableStreamDefaultControllerFromUnderlyingSource(
- stream,
- underlyingSource,
- underlyingSourceDict,
- highWaterMark,
- sizeAlgorithm,
- ) {
- const controller = new ReadableStreamDefaultController();
- /** @type {(controller: ReadableStreamDefaultController<R>) => Promise<void>} */
- let startAlgorithm = () => undefined;
- /** @type {(controller: ReadableStreamDefaultController<R>) => Promise<void>} */
- let pullAlgorithm = () => resolvePromiseWith(undefined);
- /** @type {(reason?: any) => Promise<void>} */
- let cancelAlgorithm = () => resolvePromiseWith(undefined);
- if ("start" in underlyingSourceDict) {
- startAlgorithm = () =>
- underlyingSourceDict.start.call(underlyingSource, controller);
- }
- if ("pull" in underlyingSourceDict) {
- pullAlgorithm = () =>
- underlyingSourceDict.pull.call(underlyingSource, controller);
- }
- if ("cancel" in underlyingSourceDict) {
- cancelAlgorithm = (reason) =>
- underlyingSourceDict.cancel.call(underlyingSource, reason);
- }
- setUpReadableStreamDefaultController(
- stream,
- controller,
- startAlgorithm,
- pullAlgorithm,
- cancelAlgorithm,
- highWaterMark,
- sizeAlgorithm,
- );
- }
-
- /**
- * @template R
- * @param {ReadableStreamDefaultReader<R>} reader
- * @param {ReadableStream<R>} stream
- */
- function setUpReadableStreamDefaultReader(reader, stream) {
- if (isReadableStreamLocked(stream)) {
- throw new TypeError("ReadableStream is locked.");
- }
- readableStreamReaderGenericInitialize(reader, stream);
- reader[_readRequests] = [];
- }
-
- /**
- * @template O
- * @param {TransformStream<any, O>} stream
- * @param {TransformStreamDefaultController<O>} controller
- * @param {(chunk: O, controller: TransformStreamDefaultController<O>) => Promise<void>} transformAlgorithm
- * @param {(controller: TransformStreamDefaultController<O>) => Promise<void>} flushAlgorithm
- */
- function setUpTransformStreamDefaultController(
- stream,
- controller,
- transformAlgorithm,
- flushAlgorithm,
- ) {
- assert(stream instanceof TransformStream);
- assert(stream[_controller] === undefined);
- controller[_stream] = stream;
- stream[_controller] = controller;
- controller[_transformAlgorithm] = transformAlgorithm;
- controller[_flushAlgorithm] = flushAlgorithm;
- }
-
- /**
- * @template I
- * @template O
- * @param {TransformStream<I, O>} stream
- * @param {Transformer<I, O>} transformer
- * @param {Transformer<I, O>} transformerDict
- */
- function setUpTransformStreamDefaultControllerFromTransformer(
- stream,
- transformer,
- transformerDict,
- ) {
- /** @type {TransformStreamDefaultController<O>} */
- const controller = new TransformStreamDefaultController();
- /** @type {(chunk: O, controller: TransformStreamDefaultController<O>) => Promise<void>} */
- let transformAlgorithm = (chunk) => {
- try {
- transformStreamDefaultControllerEnqueue(controller, chunk);
- } catch (e) {
- return Promise.reject(e);
- }
- return resolvePromiseWith(undefined);
- };
- /** @type {(controller: TransformStreamDefaultController<O>) => Promise<void>} */
- let flushAlgorithm = () => resolvePromiseWith(undefined);
- if ("transform" in transformerDict) {
- transformAlgorithm = (chunk, controller) =>
- transformerDict.transform.call(transformer, chunk, controller);
- }
- if ("flush" in transformerDict) {
- flushAlgorithm = (controller) =>
- transformerDict.flush.call(transformer, controller);
- }
- setUpTransformStreamDefaultController(
- stream,
- controller,
- transformAlgorithm,
- flushAlgorithm,
- );
- }
-
- /**
- * @template W
- * @param {WritableStream<W>} stream
- * @param {WritableStreamDefaultController<W>} controller
- * @param {(controller: WritableStreamDefaultController<W>) => Promise<void>} startAlgorithm
- * @param {(chunk: W, controller: WritableStreamDefaultController<W>) => Promise<void>} writeAlgorithm
- * @param {() => Promise<void>} closeAlgorithm
- * @param {(reason?: any) => Promise<void>} abortAlgorithm
- * @param {number} highWaterMark
- * @param {(chunk: W) => number} sizeAlgorithm
- */
- function setUpWritableStreamDefaultController(
- stream,
- controller,
- startAlgorithm,
- writeAlgorithm,
- closeAlgorithm,
- abortAlgorithm,
- highWaterMark,
- sizeAlgorithm,
- ) {
- assert(isWritableStream(stream));
- assert(stream[_controller] === undefined);
- controller[_stream] = stream;
- stream[_controller] = controller;
- resetQueue(controller);
- controller[_started] = false;
- controller[_strategySizeAlgorithm] = sizeAlgorithm;
- controller[_strategyHWM] = highWaterMark;
- controller[_writeAlgorithm] = writeAlgorithm;
- controller[_closeAlgorithm] = closeAlgorithm;
- controller[_abortAlgorithm] = abortAlgorithm;
- const backpressure = writableStreamDefaultControllerGetBackpressure(
- controller,
- );
- writableStreamUpdateBackpressure(stream, backpressure);
- const startResult = startAlgorithm(controller);
- const startPromise = resolvePromiseWith(startResult);
- uponPromise(startPromise, () => {
- assert(stream[_state] === "writable" || stream[_state] === "erroring");
- controller[_started] = true;
- writableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
- }, (r) => {
- assert(stream[_state] === "writable" || stream[_state] === "erroring");
- controller[_started] = true;
- writableStreamDealWithRejection(stream, r);
- });
- }
-
- /**
- * @template W
- * @param {WritableStream<W>} stream
- * @param {UnderlyingSink<W>} underlyingSink
- * @param {UnderlyingSink<W>} underlyingSinkDict
- * @param {number} highWaterMark
- * @param {(chunk: W) => number} sizeAlgorithm
- */
- function setUpWritableStreamDefaultControllerFromUnderlyingSink(
- stream,
- underlyingSink,
- underlyingSinkDict,
- highWaterMark,
- sizeAlgorithm,
- ) {
- const controller = new WritableStreamDefaultController();
- let startAlgorithm = () => undefined;
- /** @type {(chunk: W) => Promise<void>} */
- let writeAlgorithm = () => resolvePromiseWith(undefined);
- let closeAlgorithm = () => resolvePromiseWith(undefined);
- /** @type {(reason?: any) => Promise<void>} */
- let abortAlgorithm = () => resolvePromiseWith(undefined);
- if ("start" in underlyingSinkDict) {
- startAlgorithm = () =>
- underlyingSinkDict.start.call(underlyingSink, controller);
- }
- if ("write" in underlyingSinkDict) {
- writeAlgorithm = (chunk) =>
- underlyingSinkDict.write.call(underlyingSink, chunk, controller);
- }
- if ("close" in underlyingSinkDict) {
- closeAlgorithm = () => underlyingSinkDict.close.call(underlyingSink);
- }
- if ("abort" in underlyingSinkDict) {
- abortAlgorithm = (reason) =>
- underlyingSinkDict.abort.call(underlyingSink, reason);
- }
- setUpWritableStreamDefaultController(
- stream,
- controller,
- startAlgorithm,
- writeAlgorithm,
- closeAlgorithm,
- abortAlgorithm,
- highWaterMark,
- sizeAlgorithm,
- );
- }
-
- /**
- * @template W
- * @param {WritableStreamDefaultWriter<W>} writer
- * @param {WritableStream<W>} stream
- */
- function setUpWritableStreamDefaultWriter(writer, stream) {
- if (isWritableStreamLocked(stream) === true) {
- throw new TypeError("The stream is already locked.");
- }
- writer[_stream] = stream;
- stream[_writer] = writer;
- const state = stream[_state];
- if (state === "writable") {
- if (
- writableStreamCloseQueuedOrInFlight(stream) === false &&
- stream[_backpressure] === true
- ) {
- writer[_readyPromise] = new Deferred();
- } else {
- writer[_readyPromise] = new Deferred();
- writer[_readyPromise].resolve(undefined);
- }
- writer[_closedPromise] = new Deferred();
- } else if (state === "erroring") {
- writer[_readyPromise] = new Deferred();
- writer[_readyPromise].reject(stream[_storedError]);
- setPromiseIsHandledToTrue(writer[_readyPromise].promise);
- writer[_closedPromise] = new Deferred();
- } else if (state === "closed") {
- writer[_readyPromise] = new Deferred();
- writer[_readyPromise].resolve(undefined);
- writer[_closedPromise] = new Deferred();
- writer[_closedPromise].resolve(undefined);
- } else {
- assert(state === "errored");
- const storedError = stream[_storedError];
- writer[_readyPromise] = new Deferred();
- writer[_readyPromise].reject(storedError);
- setPromiseIsHandledToTrue(writer[_readyPromise].promise);
- writer[_closedPromise] = new Deferred();
- writer[_closedPromise].reject(storedError);
- setPromiseIsHandledToTrue(writer[_closedPromise].promise);
- }
- }
-
- /** @param {TransformStreamDefaultController} controller */
- function transformStreamDefaultControllerClearAlgorithms(controller) {
- controller[_transformAlgorithm] = undefined;
- controller[_flushAlgorithm] = undefined;
- }
-
- /**
- * @template O
- * @param {TransformStreamDefaultController<O>} controller
- * @param {O} chunk
- */
- function transformStreamDefaultControllerEnqueue(controller, chunk) {
- const stream = controller[_stream];
- const readableController = stream[_readable][_controller];
- if (
- readableStreamDefaultControllerCanCloseOrEnqueue(
- /** @type {ReadableStreamDefaultController<O>} */ (readableController),
- ) === false
- ) {
- throw new TypeError("Readable stream is unavailable.");
- }
- try {
- readableStreamDefaultControllerEnqueue(
- /** @type {ReadableStreamDefaultController<O>} */ (readableController),
- chunk,
- );
- } catch (e) {
- transformStreamErrorWritableAndUnblockWrite(stream, e);
- throw stream[_readable][_storedError];
- }
- const backpressure = readableStreamDefaultcontrollerHasBackpressure(
- /** @type {ReadableStreamDefaultController<O>} */ (readableController),
- );
- if (backpressure !== stream[_backpressure]) {
- assert(backpressure === true);
- transformStreamSetBackpressure(stream, true);
- }
- }
-
- /**
- * @param {TransformStreamDefaultController} controller
- * @param {any=} e
- */
- function transformStreamDefaultControllerError(controller, e) {
- transformStreamError(controller[_stream], e);
- }
-
- /**
- * @template O
- * @param {TransformStreamDefaultController<O>} controller
- * @param {any} chunk
- * @returns {Promise<void>}
- */
- function transformStreamDefaultControllerPerformTransform(controller, chunk) {
- const transformPromise = controller[_transformAlgorithm](chunk, controller);
- return transformPromiseWith(transformPromise, undefined, (r) => {
- transformStreamError(controller[_stream], r);
- throw r;
- });
- }
-
- /** @param {TransformStreamDefaultController} controller */
- function transformStreamDefaultControllerTerminate(controller) {
- const stream = controller[_stream];
- const readableController = stream[_readable][_controller];
- readableStreamDefaultControllerClose(
- /** @type {ReadableStreamDefaultController} */ (readableController),
- );
- const error = new TypeError("The stream has been terminated.");
- transformStreamErrorWritableAndUnblockWrite(stream, error);
- }
-
- /**
- * @param {TransformStream} stream
- * @param {any=} reason
- * @returns {Promise<void>}
- */
- function transformStreamDefaultSinkAbortAlgorithm(stream, reason) {
- transformStreamError(stream, reason);
- return resolvePromiseWith(undefined);
- }
-
- /**
- * @template I
- * @template O
- * @param {TransformStream<I, O>} stream
- * @returns {Promise<void>}
- */
- function transformStreamDefaultSinkCloseAlgorithm(stream) {
- const readable = stream[_readable];
- const controller = stream[_controller];
- const flushPromise = controller[_flushAlgorithm](controller);
- transformStreamDefaultControllerClearAlgorithms(controller);
- return transformPromiseWith(flushPromise, () => {
- if (readable[_state] === "errored") {
- throw readable[_storedError];
- }
- readableStreamDefaultControllerClose(
- /** @type {ReadableStreamDefaultController} */ (readable[_controller]),
- );
- }, (r) => {
- transformStreamError(stream, r);
- throw readable[_storedError];
- });
- }
-
- /**
- * @template I
- * @template O
- * @param {TransformStream<I, O>} stream
- * @param {I} chunk
- * @returns {Promise<void>}
- */
- function transformStreamDefaultSinkWriteAlgorithm(stream, chunk) {
- assert(stream[_writable][_state] === "writable");
- const controller = stream[_controller];
- if (stream[_backpressure] === true) {
- const backpressureChangePromise = stream[_backpressureChangePromise];
- assert(backpressureChangePromise !== undefined);
- return transformPromiseWith(backpressureChangePromise.promise, () => {
- const writable = stream[_writable];
- const state = writable[_state];
- if (state === "erroring") {
- throw writable[_storedError];
- }
- assert(state === "writable");
- return transformStreamDefaultControllerPerformTransform(
- controller,
- chunk,
- );
- });
- }
- return transformStreamDefaultControllerPerformTransform(controller, chunk);
- }
-
- /**
- * @param {TransformStream} stream
- * @returns {Promise<void>}
- */
- function transformStreamDefaultSourcePullAlgorithm(stream) {
- assert(stream[_backpressure] === true);
- assert(stream[_backpressureChangePromise] !== undefined);
- transformStreamSetBackpressure(stream, false);
- return stream[_backpressureChangePromise].promise;
- }
-
- /**
- * @param {TransformStream} stream
- * @param {any=} e
- */
- function transformStreamError(stream, e) {
- readableStreamDefaultControllerError(
- /** @type {ReadableStreamDefaultController} */ (stream[_readable][
- _controller
- ]),
- e,
- );
- transformStreamErrorWritableAndUnblockWrite(stream, e);
- }
-
- /**
- * @param {TransformStream} stream
- * @param {any=} e
- */
- function transformStreamErrorWritableAndUnblockWrite(stream, e) {
- transformStreamDefaultControllerClearAlgorithms(stream[_controller]);
- writableStreamDefaultControllerErrorIfNeeded(
- stream[_writable][_controller],
- e,
- );
- if (stream[_backpressure] === true) {
- transformStreamSetBackpressure(stream, false);
- }
- }
-
- /**
- * @param {TransformStream} stream
- * @param {boolean} backpressure
- */
- function transformStreamSetBackpressure(stream, backpressure) {
- assert(stream[_backpressure] !== backpressure);
- if (stream[_backpressureChangePromise] !== undefined) {
- stream[_backpressureChangePromise].resolve(undefined);
- }
- stream[_backpressureChangePromise] = new Deferred();
- stream[_backpressure] = backpressure;
- }
-
- /**
- * @param {WritableStream} stream
- * @param {any=} reason
- * @returns {Promise<void>}
- */
- function writableStreamAbort(stream, reason) {
- const state = stream[_state];
- if (state === "closed" || state === "errored") {
- return resolvePromiseWith(undefined);
- }
- if (stream[_pendingAbortRequest] !== undefined) {
- return stream[_pendingAbortRequest].deferred.promise;
- }
- assert(state === "writable" || state === "erroring");
- let wasAlreadyErroring = false;
- if (state === "erroring") {
- wasAlreadyErroring = true;
- reason = undefined;
- }
- /** Deferred<void> */
- const deferred = new Deferred();
- stream[_pendingAbortRequest] = {
- deferred,
- reason,
- wasAlreadyErroring,
- };
- if (wasAlreadyErroring === false) {
- writableStreamStartErroring(stream, reason);
- }
- return deferred.promise;
- }
-
- /**
- * @param {WritableStream} stream
- * @returns {Promise<void>}
- */
- function writableStreamAddWriteRequest(stream) {
- assert(isWritableStreamLocked(stream) === true);
- assert(stream[_state] === "writable");
- /** @type {Deferred<void>} */
- const deferred = new Deferred();
- stream[_writeRequests].push(deferred);
- return deferred.promise;
- }
-
- /**
- * @param {WritableStream} stream
- * @returns {Promise<void>}
- */
- function writableStreamClose(stream) {
- const state = stream[_state];
- if (state === "closed" || state === "errored") {
- return Promise.reject(
- new TypeError("Writable stream is closed or errored."),
- );
- }
- assert(state === "writable" || state === "erroring");
- assert(writableStreamCloseQueuedOrInFlight(stream) === false);
- /** @type {Deferred<void>} */
- const deferred = new Deferred();
- stream[_closeRequest] = deferred;
- const writer = stream[_writer];
- if (
- writer !== undefined && stream[_backpressure] === true &&
- state === "writable"
- ) {
- writer[_readyPromise].resolve(undefined);
- }
- writableStreamDefaultControllerClose(stream[_controller]);
- return deferred.promise;
- }
-
- /**
- * @param {WritableStream} stream
- * @returns {boolean}
- */
- function writableStreamCloseQueuedOrInFlight(stream) {
- if (
- stream[_closeRequest] === undefined &&
- stream[_inFlightCloseRequest] === undefined
- ) {
- return false;
- }
- return true;
- }
-
- /**
- * @param {WritableStream} stream
- * @param {any=} error
- */
- function writableStreamDealWithRejection(stream, error) {
- const state = stream[_state];
- if (state === "writable") {
- writableStreamStartErroring(stream, error);
- return;
- }
- assert(state === "erroring");
- writableStreamFinishErroring(stream);
- }
-
- /**
- * @template W
- * @param {WritableStreamDefaultController<W>} controller
- */
- function writableStreamDefaultControllerAdvanceQueueIfNeeded(controller) {
- const stream = controller[_stream];
- if (controller[_started] === false) {
- return;
- }
- if (stream[_inFlightWriteRequest] !== undefined) {
- return;
- }
- const state = stream[_state];
- assert(state !== "closed" && state !== "errored");
- if (state === "erroring") {
- writableStreamFinishErroring(stream);
- return;
- }
- if (controller[_queue].length === 0) {
- return;
- }
- const value = peekQueueValue(controller);
- if (value === _close) {
- writableStreamDefaultControllerProcessClose(controller);
- } else {
- writableStreamDefaultControllerProcessWrite(controller, value);
- }
- }
-
- function writableStreamDefaultControllerClearAlgorithms(controller) {
- controller[_writeAlgorithm] = undefined;
- controller[_closeAlgorithm] = undefined;
- controller[_abortAlgorithm] = undefined;
- controller[_strategySizeAlgorithm] = undefined;
- }
-
- /** @param {WritableStreamDefaultController} controller */
- function writableStreamDefaultControllerClose(controller) {
- enqueueValueWithSize(controller, _close, 0);
- writableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
- }
-
- /**
- * @param {WritableStreamDefaultController} controller
- * @param {any} error
- */
- function writableStreamDefaultControllerError(controller, error) {
- const stream = controller[_stream];
- assert(stream[_state] === "writable");
- writableStreamDefaultControllerClearAlgorithms(controller);
- writableStreamStartErroring(stream, error);
- }
-
- /**
- * @param {WritableStreamDefaultController} controller
- * @param {any} error
- */
- function writableStreamDefaultControllerErrorIfNeeded(controller, error) {
- if (controller[_stream][_state] === "writable") {
- writableStreamDefaultControllerError(controller, error);
- }
- }
-
- /**
- * @param {WritableStreamDefaultController} controller
- * @returns {boolean}
- */
- function writableStreamDefaultControllerGetBackpressure(controller) {
- const desiredSize = writableStreamDefaultControllerGetDesiredSize(
- controller,
- );
- return desiredSize <= 0;
- }
-
- /**
- * @template W
- * @param {WritableStreamDefaultController<W>} controller
- * @param {W} chunk
- * @returns {number}
- */
- function writableStreamDefaultControllerGetChunkSize(controller, chunk) {
- let value;
- try {
- value = controller[_strategySizeAlgorithm](chunk);
- } catch (e) {
- writableStreamDefaultControllerErrorIfNeeded(controller, e);
- return 1;
- }
- return value;
- }
-
- /**
- * @param {WritableStreamDefaultController} controller
- * @returns {number}
- */
- function writableStreamDefaultControllerGetDesiredSize(controller) {
- return controller[_strategyHWM] - controller[_queueTotalSize];
- }
-
- /** @param {WritableStreamDefaultController} controller */
- function writableStreamDefaultControllerProcessClose(controller) {
- const stream = controller[_stream];
- writableStreamMarkCloseRequestInFlight(stream);
- dequeueValue(controller);
- assert(controller[_queue].length === 0);
- const sinkClosePromise = controller[_closeAlgorithm]();
- writableStreamDefaultControllerClearAlgorithms(controller);
- uponPromise(sinkClosePromise, () => {
- writableStreamFinishInFlightClose(stream);
- }, (reason) => {
- writableStreamFinishInFlightCloseWithError(stream, reason);
- });
- }
-
- /**
- * @template W
- * @param {WritableStreamDefaultController<W>} controller
- * @param {W} chunk
- */
- function writableStreamDefaultControllerProcessWrite(controller, chunk) {
- const stream = controller[_stream];
- writableStreamMarkFirstWriteRequestInFlight(stream);
- const sinkWritePromise = controller[_writeAlgorithm](chunk, controller);
- uponPromise(sinkWritePromise, () => {
- writableStreamFinishInFlightWrite(stream);
- const state = stream[_state];
- assert(state === "writable" || state === "erroring");
- dequeueValue(controller);
- if (
- writableStreamCloseQueuedOrInFlight(stream) === false &&
- state === "writable"
- ) {
- const backpressure = writableStreamDefaultControllerGetBackpressure(
- controller,
- );
- writableStreamUpdateBackpressure(stream, backpressure);
- }
- writableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
- }, (reason) => {
- if (stream[_state] === "writable") {
- writableStreamDefaultControllerClearAlgorithms(controller);
- }
- writableStreamFinishInFlightWriteWithError(stream, reason);
- });
- }
-
- /**
- * @template W
- * @param {WritableStreamDefaultController<W>} controller
- * @param {W} chunk
- * @param {number} chunkSize
- */
- function writableStreamDefaultControllerWrite(controller, chunk, chunkSize) {
- try {
- enqueueValueWithSize(controller, chunk, chunkSize);
- } catch (e) {
- writableStreamDefaultControllerErrorIfNeeded(controller, e);
- return;
- }
- const stream = controller[_stream];
- if (
- writableStreamCloseQueuedOrInFlight(stream) === false &&
- stream[_state] === "writable"
- ) {
- const backpressure = writableStreamDefaultControllerGetBackpressure(
- controller,
- );
- writableStreamUpdateBackpressure(stream, backpressure);
- }
- writableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
- }
-
- /**
- * @param {WritableStreamDefaultWriter} writer
- * @param {any=} reason
- * @returns {Promise<void>}
- */
- function writableStreamDefaultWriterAbort(writer, reason) {
- const stream = writer[_stream];
- assert(stream !== undefined);
- return writableStreamAbort(stream, reason);
- }
-
- /**
- * @param {WritableStreamDefaultWriter} writer
- * @returns {Promise<void>}
- */
- function writableStreamDefaultWriterClose(writer) {
- const stream = writer[_stream];
- assert(stream !== undefined);
- return writableStreamClose(stream);
- }
-
- /**
- * @param {WritableStreamDefaultWriter} writer
- * @returns {Promise<void>}
- */
- function writableStreamDefaultWriterCloseWithErrorPropagation(writer) {
- const stream = writer[_stream];
- assert(stream !== undefined);
- const state = stream[_state];
- if (
- writableStreamCloseQueuedOrInFlight(stream) === true || state === "closed"
- ) {
- return resolvePromiseWith(undefined);
- }
- if (state === "errored") {
- return Promise.reject(stream[_storedError]);
- }
- assert(state === "writable" || state === "erroring");
- return writableStreamDefaultWriterClose(writer);
- }
-
- /**
- * @param {WritableStreamDefaultWriter} writer
- * @param {any=} error
- */
- function writableStreamDefaultWriterEnsureClosedPromiseRejected(
- writer,
- error,
- ) {
- if (writer[_closedPromise].state === "pending") {
- writer[_closedPromise].reject(error);
- } else {
- writer[_closedPromise] = new Deferred();
- writer[_closedPromise].reject(error);
- }
- setPromiseIsHandledToTrue(writer[_closedPromise].promise);
- }
-
- /**
- * @param {WritableStreamDefaultWriter} writer
- * @param {any=} error
- */
- function writableStreamDefaultWriterEnsureReadyPromiseRejected(
- writer,
- error,
- ) {
- if (writer[_readyPromise].state === "pending") {
- writer[_readyPromise].reject(error);
- } else {
- writer[_readyPromise] = new Deferred();
- writer[_readyPromise].reject(error);
- }
- setPromiseIsHandledToTrue(writer[_readyPromise].promise);
- }
-
- /**
- * @param {WritableStreamDefaultWriter} writer
- * @returns {number | null}
- */
- function writableStreamDefaultWriterGetDesiredSize(writer) {
- const stream = writer[_stream];
- const state = stream[_state];
- if (state === "errored" || state === "erroring") {
- return null;
- }
- if (state === "closed") {
- return 0;
- }
- return writableStreamDefaultControllerGetDesiredSize(stream[_controller]);
- }
-
- /** @param {WritableStreamDefaultWriter} writer */
- function writableStreamDefaultWriterRelease(writer) {
- const stream = writer[_stream];
- assert(stream !== undefined);
- assert(stream[_writer] === writer);
- const releasedError = new TypeError(
- "The writer has already been released.",
- );
- writableStreamDefaultWriterEnsureReadyPromiseRejected(
- writer,
- releasedError,
- );
- writableStreamDefaultWriterEnsureClosedPromiseRejected(
- writer,
- releasedError,
- );
- stream[_writer] = undefined;
- writer[_stream] = undefined;
- }
-
- /**
- * @template W
- * @param {WritableStreamDefaultWriter<W>} writer
- * @param {W} chunk
- * @returns {Promise<void>}
- */
- function writableStreamDefaultWriterWrite(writer, chunk) {
- const stream = writer[_stream];
- assert(stream !== undefined);
- const controller = stream[_controller];
- const chunkSize = writableStreamDefaultControllerGetChunkSize(
- controller,
- chunk,
- );
- if (stream !== writer[_stream]) {
- return Promise.reject(new TypeError("Writer's stream is unexpected."));
- }
- const state = stream[_state];
- if (state === "errored") {
- return Promise.reject(stream[_storedError]);
- }
- if (
- writableStreamCloseQueuedOrInFlight(stream) === true || state === "closed"
- ) {
- return Promise.reject(
- new TypeError("The stream is closing or is closed."),
- );
- }
- if (state === "erroring") {
- return Promise.reject(stream[_storedError]);
- }
- assert(state === "writable");
- const promise = writableStreamAddWriteRequest(stream);
- writableStreamDefaultControllerWrite(controller, chunk, chunkSize);
- return promise;
- }
-
- /** @param {WritableStream} stream */
- function writableStreamFinishErroring(stream) {
- assert(stream[_state] === "erroring");
- assert(writableStreamHasOperationMarkedInFlight(stream) === false);
- stream[_state] = "errored";
- stream[_controller][_errorSteps]();
- const storedError = stream[_storedError];
- for (const writeRequest of stream[_writeRequests]) {
- writeRequest.reject(storedError);
- }
- stream[_writeRequests] = [];
- if (stream[_pendingAbortRequest] === undefined) {
- writableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
- return;
- }
- const abortRequest = stream[_pendingAbortRequest];
- stream[_pendingAbortRequest] = undefined;
- if (abortRequest.wasAlreadyErroring === true) {
- abortRequest.deferred.reject(storedError);
- writableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
- return;
- }
- const promise = stream[_controller][_abortSteps](abortRequest.reason);
- uponPromise(promise, () => {
- abortRequest.deferred.resolve(undefined);
- writableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
- }, (reason) => {
- abortRequest.deferred.reject(reason);
- writableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
- });
- }
-
- /** @param {WritableStream} stream */
- function writableStreamFinishInFlightClose(stream) {
- assert(stream[_inFlightCloseRequest] !== undefined);
- stream[_inFlightCloseRequest].resolve(undefined);
- stream[_inFlightCloseRequest] = undefined;
- const state = stream[_state];
- assert(state === "writable" || state === "erroring");
- if (state === "erroring") {
- stream[_storedError] = undefined;
- if (stream[_pendingAbortRequest] !== undefined) {
- stream[_pendingAbortRequest].deferred.resolve(undefined);
- stream[_pendingAbortRequest] = undefined;
- }
- }
- stream[_state] = "closed";
- const writer = stream[_writer];
- if (writer !== undefined) {
- writer[_closedPromise].resolve(undefined);
- }
- assert(stream[_pendingAbortRequest] === undefined);
- assert(stream[_storedError] === undefined);
- }
-
- /**
- * @param {WritableStream} stream
- * @param {any=} error
- */
- function writableStreamFinishInFlightCloseWithError(stream, error) {
- assert(stream[_inFlightCloseRequest] !== undefined);
- stream[_inFlightCloseRequest].reject(error);
- stream[_inFlightCloseRequest] = undefined;
- assert(stream[_state] === "writable" || stream[_state] === "erroring");
- if (stream[_pendingAbortRequest] !== undefined) {
- stream[_pendingAbortRequest].deferred.reject(error);
- stream[_pendingAbortRequest] = undefined;
- }
- writableStreamDealWithRejection(stream, error);
- }
-
- /** @param {WritableStream} stream */
- function writableStreamFinishInFlightWrite(stream) {
- assert(stream[_inFlightWriteRequest] !== undefined);
- stream[_inFlightWriteRequest].resolve(undefined);
- stream[_inFlightWriteRequest] = undefined;
- }
-
- /**
- * @param {WritableStream} stream
- * @param {any=} error
- */
- function writableStreamFinishInFlightWriteWithError(stream, error) {
- assert(stream[_inFlightWriteRequest] !== undefined);
- stream[_inFlightWriteRequest].reject(error);
- stream[_inFlightWriteRequest] = undefined;
- assert(stream[_state] === "writable" || stream[_state] === "erroring");
- writableStreamDealWithRejection(stream, error);
- }
-
- /**
- * @param {WritableStream} stream
- * @returns {boolean}
- */
- function writableStreamHasOperationMarkedInFlight(stream) {
- if (
- stream[_inFlightWriteRequest] === undefined &&
- stream[_controller][_inFlightCloseRequest] === undefined
- ) {
- return false;
- }
- return true;
- }
-
- /** @param {WritableStream} stream */
- function writableStreamMarkCloseRequestInFlight(stream) {
- assert(stream[_inFlightCloseRequest] === undefined);
- assert(stream[_closeRequest] !== undefined);
- stream[_inFlightCloseRequest] = stream[_closeRequest];
- stream[_closeRequest] = undefined;
- }
-
- /**
- * @template W
- * @param {WritableStream<W>} stream
- * */
- function writableStreamMarkFirstWriteRequestInFlight(stream) {
- assert(stream[_inFlightWriteRequest] === undefined);
- assert(stream[_writeRequests].length);
- const writeRequest = stream[_writeRequests].shift();
- stream[_inFlightWriteRequest] = writeRequest;
- }
-
- /** @param {WritableStream} stream */
- function writableStreamRejectCloseAndClosedPromiseIfNeeded(stream) {
- assert(stream[_state] === "errored");
- if (stream[_closeRequest] !== undefined) {
- assert(stream[_inFlightCloseRequest] === undefined);
- stream[_closeRequest].reject(stream[_storedError]);
- stream[_closeRequest] = undefined;
- }
- const writer = stream[_writer];
- if (writer !== undefined) {
- writer[_closedPromise].reject(stream[_storedError]);
- setPromiseIsHandledToTrue(writer[_closedPromise].promise);
- }
- }
-
- /**
- * @param {WritableStream} stream
- * @param {any=} reason
- */
- function writableStreamStartErroring(stream, reason) {
- assert(stream[_storedError] === undefined);
- assert(stream[_state] === "writable");
- const controller = stream[_controller];
- assert(controller);
- stream[_state] = "erroring";
- stream[_storedError] = reason;
- const writer = stream[_writer];
- if (writer) {
- writableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason);
- }
- if (
- writableStreamHasOperationMarkedInFlight(stream) === false &&
- controller[_started] === true
- ) {
- writableStreamFinishErroring(stream);
- }
- }
-
- /**
- * @param {WritableStream} stream
- * @param {boolean} backpressure
- */
- function writableStreamUpdateBackpressure(stream, backpressure) {
- assert(stream[_state] === "writable");
- assert(writableStreamCloseQueuedOrInFlight(stream) === false);
- const writer = stream[_writer];
- if (writer !== undefined && backpressure !== stream[_backpressure]) {
- if (backpressure === true) {
- writer[_readyPromise] = new Deferred();
- } else {
- assert(backpressure === false);
- writer[_readyPromise].resolve(undefined);
- }
- }
- stream[_backpressure] = backpressure;
- }
-
- /**
- * @template T
- * @param {T} value
- * @param {boolean} done
- * @returns {IteratorResult<T>}
- */
- function createIteratorResult(value, done) {
- const result = Object.create(null);
- Object.defineProperties(result, {
- value: { value, writable: true, enumerable: true, configurable: true },
- done: {
- value: done,
- writable: true,
- enumerable: true,
- configurable: true,
- },
- });
- return result;
- }
-
- /** @type {AsyncIterator<unknown, unknown>} */
- const asyncIteratorPrototype = Object.getPrototypeOf(
- Object.getPrototypeOf(async function* () {}).prototype,
- );
-
- /** @type {AsyncIterator<unknown>} */
- const readableStreamAsyncIteratorPrototype = Object.setPrototypeOf({
- /** @returns {Promise<IteratorResult<unknown>>} */
- next() {
- /** @type {ReadableStreamDefaultReader} */
- const reader = this[_reader];
- if (reader[_stream] === undefined) {
- return Promise.reject(
- new TypeError(
- "Cannot get the next iteration result once the reader has been released.",
- ),
- );
- }
- /** @type {Deferred<IteratorResult<any>>} */
- const promise = new Deferred();
- /** @type {ReadRequest} */
- const readRequest = {
- chunkSteps(chunk) {
- promise.resolve(createIteratorResult(chunk, false));
- },
- closeSteps() {
- readableStreamReaderGenericRelease(reader);
- promise.resolve(createIteratorResult(undefined, true));
- },
- errorSteps(e) {
- readableStreamReaderGenericRelease(reader);
- promise.reject(e);
- },
- };
- readableStreamDefaultReaderRead(reader, readRequest);
- return promise.promise;
- },
- /**
- * @param {unknown} arg
- * @returns {Promise<IteratorResult<unknown>>}
- */
- async return(arg) {
- /** @type {ReadableStreamDefaultReader} */
- const reader = this[_reader];
- if (reader[_stream] === undefined) {
- return createIteratorResult(undefined, true);
- }
- assert(reader[_readRequests].length === 0);
- if (this[_preventCancel] === false) {
- const result = readableStreamReaderGenericCancel(reader, arg);
- readableStreamReaderGenericRelease(reader);
- await result;
- return createIteratorResult(arg, true);
- }
- readableStreamReaderGenericRelease(reader);
- return createIteratorResult(undefined, true);
- },
- }, asyncIteratorPrototype);
-
- class ByteLengthQueuingStrategy {
- /** @type {number} */
- highWaterMark;
-
- /** @param {{ highWaterMark: number }} init */
- constructor(init) {
- if (
- typeof init !== "object" || init === null || !("highWaterMark" in init)
- ) {
- throw new TypeError(
- "init must be an object that contains a property named highWaterMark",
- );
- }
- const { highWaterMark } = init;
- this[_globalObject] = window;
- this.highWaterMark = Number(highWaterMark);
- }
-
- /** @returns {(chunk: ArrayBufferView) => number} */
- get size() {
- initializeByteLengthSizeFunction(this[_globalObject]);
- return byteSizeFunctionWeakMap.get(this[_globalObject]);
- }
- }
-
- /** @type {WeakMap<typeof globalThis, (chunk: ArrayBufferView) => number>} */
- const byteSizeFunctionWeakMap = new WeakMap();
-
- function initializeByteLengthSizeFunction(globalObject) {
- if (byteSizeFunctionWeakMap.has(globalObject)) {
- return;
- }
- byteSizeFunctionWeakMap.set(globalObject, function size(chunk) {
- return chunk.byteLength;
- });
- }
-
- class CountQueuingStrategy {
- /** @type {number} */
- highWaterMark;
-
- /** @param {{ highWaterMark: number }} init */
- constructor(init) {
- if (
- typeof init !== "object" || init === null || !("highWaterMark" in init)
- ) {
- throw new TypeError(
- "init must be an object that contains a property named highWaterMark",
- );
- }
- const { highWaterMark } = init;
- this[_globalObject] = window;
- this.highWaterMark = Number(highWaterMark);
- }
-
- /** @returns {(chunk: any) => 1} */
- get size() {
- initializeCountSizeFunction(this[_globalObject]);
- return countSizeFunctionWeakMap.get(this[_globalObject]);
- }
- }
-
- /** @type {WeakMap<typeof globalThis, () => 1>} */
- const countSizeFunctionWeakMap = new WeakMap();
-
- /** @param {typeof globalThis} globalObject */
- function initializeCountSizeFunction(globalObject) {
- if (countSizeFunctionWeakMap.has(globalObject)) {
- return;
- }
- countSizeFunctionWeakMap.set(globalObject, function size() {
- return 1;
- });
- }
-
- /** @template R */
- class ReadableStream {
- /** @type {ReadableStreamDefaultController | ReadableByteStreamController} */
- [_controller];
- /** @type {boolean} */
- [_detached];
- /** @type {boolean} */
- [_disturbed];
- /** @type {ReadableStreamDefaultReader | undefined} */
- [_reader];
- /** @type {"readable" | "closed" | "errored"} */
- [_state];
- /** @type {any} */
- [_storedError];
-
- /**
- * @param {UnderlyingSource<R>=} underlyingSource
- * @param {QueuingStrategy<R>=} strategy
- */
- constructor(underlyingSource, strategy = {}) {
- const underlyingSourceDict = convertUnderlyingSource(underlyingSource);
- initializeReadableStream(this);
- if (underlyingSourceDict.type === "bytes") {
- if (strategy.size !== undefined) {
- throw new RangeError(
- `When underlying source is "bytes", strategy.size must be undefined.`,
- );
- }
- const highWaterMark = extractHighWaterMark(strategy, 0);
- setUpReadableByteStreamControllerFromUnderlyingSource(
- // @ts-ignore cannot easily assert this is ReadableStream<ArrayBuffer>
- this,
- underlyingSource,
- underlyingSourceDict,
- highWaterMark,
- );
- } else {
- assert(!("type" in underlyingSourceDict));
- const sizeAlgorithm = extractSizeAlgorithm(strategy);
- const highWaterMark = extractHighWaterMark(strategy, 1);
- setUpReadableStreamDefaultControllerFromUnderlyingSource(
- this,
- underlyingSource,
- underlyingSourceDict,
- highWaterMark,
- sizeAlgorithm,
- );
- }
- }
-
- /** @returns {boolean} */
- get locked() {
- return isReadableStreamLocked(this);
- }
-
- /**
- * @param {any=} reason
- * @returns {Promise<void>}
- */
- cancel(reason) {
- if (isReadableStreamLocked(this)) {
- Promise.reject(new TypeError("Cannot cancel a locked ReadableStream."));
- }
- return readableStreamCancel(this, reason);
- }
-
- /**
- * @deprecated TODO(@kitsonk): Remove in Deno 1.8
- * @param {ReadableStreamIteratorOptions=} options
- * @returns {AsyncIterableIterator<R>}
- */
- getIterator(options = {}) {
- return this[Symbol.asyncIterator](options);
- }
-
- /**
- * @param {ReadableStreamGetReaderOptions=} options
- * @returns {ReadableStreamDefaultReader<R>}
- */
- getReader(options = {}) {
- if (typeof options !== "object") {
- throw new TypeError("options must be an object");
- }
- if (options === null) {
- options = {};
- }
- /** @type {any} */
- let { mode } = options;
- if (mode === undefined) {
- return acquireReadableStreamDefaultReader(this);
- }
- mode = String(mode);
- if (mode !== "byob") {
- throw new TypeError("Invalid mode.");
- }
- // 3. Return ? AcquireReadableStreamBYOBReader(this).
- throw new RangeError(`Unsupported mode "${String(mode)}"`);
- }
-
- /**
- * @template T
- * @param {{ readable: ReadableStream<T>, writable: WritableStream<R> }} transform
- * @param {PipeOptions=} options
- * @returns {ReadableStream<T>}
- */
- pipeThrough(
- transform,
- { preventClose, preventAbort, preventCancel, signal } = {},
- ) {
- if (!isReadableStream(this)) {
- throw new TypeError("this must be a ReadableStream");
- }
- const { readable } = transform;
- if (!isReadableStream(readable)) {
- throw new TypeError("readable must be a ReadableStream");
- }
- const { writable } = transform;
- if (!isWritableStream(writable)) {
- throw new TypeError("writable must be a WritableStream");
- }
- if (isReadableStreamLocked(this)) {
- throw new TypeError("ReadableStream is already locked.");
- }
- if (signal !== undefined && !(signal instanceof AbortSignal)) {
- throw new TypeError("signal must be an AbortSignal");
- }
- if (isWritableStreamLocked(writable)) {
- throw new TypeError("Target WritableStream is already locked.");
- }
- const promise = readableStreamPipeTo(
- this,
- writable,
- Boolean(preventClose),
- Boolean(preventAbort),
- Boolean(preventCancel),
- signal,
- );
- setPromiseIsHandledToTrue(promise);
- return readable;
- }
-
- /**
- * @param {WritableStream<R>} destination
- * @param {PipeOptions=} options
- * @returns {Promise<void>}
- */
- pipeTo(
- destination,
- {
- preventClose = false,
- preventAbort = false,
- preventCancel = false,
- signal,
- } = {},
- ) {
- if (isReadableStreamLocked(this)) {
- return Promise.reject(
- new TypeError("ReadableStream is already locked."),
- );
- }
- if (isWritableStreamLocked(destination)) {
- return Promise.reject(
- new TypeError("destination WritableStream is already locked."),
- );
- }
- return readableStreamPipeTo(
- this,
- destination,
- preventClose,
- preventAbort,
- preventCancel,
- signal,
- );
- }
-
- /** @returns {[ReadableStream<R>, ReadableStream<R>]} */
- tee() {
- return readableStreamTee(this, false);
- }
-
- /**
- * @param {ReadableStreamIteratorOptions=} options
- * @returns {AsyncIterableIterator<R>}
- */
- [Symbol.asyncIterator]({ preventCancel } = {}) {
- /** @type {AsyncIterableIterator<R>} */
- const iterator = Object.create(readableStreamAsyncIteratorPrototype);
- const reader = acquireReadableStreamDefaultReader(this);
- iterator[_reader] = reader;
- iterator[_preventCancel] = preventCancel;
- return iterator;
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${inspect({ locked: this.locked })}`;
- }
- }
-
- /** @template R */
- class ReadableStreamGenericReader {
- /** @type {Deferred<void>} */
- [_closedPromise];
- /** @type {ReadableStream<R> | undefined} */
- [_stream];
-
- get closed() {
- return this[_closedPromise].promise;
- }
-
- /**
- * @param {any} reason
- * @returns {Promise<void>}
- */
- cancel(reason) {
- if (this[_stream] === undefined) {
- return Promise.reject(
- new TypeError("Reader has no associated stream."),
- );
- }
- return readableStreamReaderGenericCancel(this, reason);
- }
- }
-
- /** @template R */
- class ReadableStreamDefaultReader extends ReadableStreamGenericReader {
- /** @type {ReadRequest[]} */
- [_readRequests];
-
- /** @param {ReadableStream<R>} stream */
- constructor(stream) {
- if (!(stream instanceof ReadableStream)) {
- throw new TypeError("stream is not a ReadableStream");
- }
- super();
- setUpReadableStreamDefaultReader(this, stream);
- }
-
- /** @returns {Promise<ReadableStreamReadResult<R>>} */
- read() {
- if (this[_stream] === undefined) {
- return Promise.reject(
- new TypeError("Reader has no associated stream."),
- );
- }
- /** @type {Deferred<ReadableStreamReadResult<R>>} */
- const promise = new Deferred();
- /** @type {ReadRequest<R>} */
- const readRequest = {
- chunkSteps(chunk) {
- promise.resolve({ value: chunk, done: false });
- },
- closeSteps() {
- promise.resolve({ value: undefined, done: true });
- },
- errorSteps(e) {
- promise.reject(e);
- },
- };
- readableStreamDefaultReaderRead(this, readRequest);
- return promise.promise;
- }
-
- /** @returns {void} */
- releaseLock() {
- if (this[_stream] === undefined) {
- return;
- }
- if (this[_readRequests].length) {
- throw new TypeError(
- "There are pending read requests, so the reader cannot be release.",
- );
- }
- readableStreamReaderGenericRelease(this);
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${inspect({ closed: this.closed })}`;
- }
- }
-
- class ReadableByteStreamController {
- /** @type {number | undefined} */
- [_autoAllocateChunkSize];
- /** @type {null} */
- [_byobRequest];
- /** @type {(reason: any) => Promise<void>} */
- [_cancelAlgorithm];
- /** @type {boolean} */
- [_closeRequested];
- /** @type {boolean} */
- [_pullAgain];
- /** @type {(controller: this) => Promise<void>} */
- [_pullAlgorithm];
- /** @type {boolean} */
- [_pulling];
- /** @type {ReadableByteStreamQueueEntry[]} */
- [_queue];
- /** @type {number} */
- [_queueTotalSize];
- /** @type {boolean} */
- [_started];
- /** @type {number} */
- [_strategyHWM];
- /** @type {ReadableStream<ArrayBuffer>} */
- [_stream];
-
- get byobRequest() {
- return undefined;
- }
-
- /** @returns {number | null} */
- get desiredSize() {
- return readableByteStreamControllerGetDesiredSize(this);
- }
-
- /** @returns {void} */
- close() {
- if (this[_closeRequested] === true) {
- throw new TypeError("Closed already requested.");
- }
- if (this[_stream][_state] !== "readable") {
- throw new TypeError(
- "ReadableByteStreamController's stream is not in a readable state.",
- );
- }
- readableByteStreamControllerClose(this);
- }
-
- /**
- * @param {ArrayBufferView} chunk
- * @returns {void}
- */
- enqueue(chunk) {
- if (chunk.byteLength === 0) {
- throw new TypeError("chunk must have a non-zero byteLength.");
- }
- if (chunk.buffer.byteLength === 0) {
- throw new TypeError("chunk's buffer must have a non-zero byteLength.");
- }
- if (this[_closeRequested] === true) {
- throw new TypeError(
- "Cannot enqueue chunk after a close has been requested.",
- );
- }
- if (this[_stream][_state] !== "readable") {
- throw new TypeError(
- "Cannot enqueue chunk when underlying stream is not readable.",
- );
- }
- return readableByteStreamControllerEnqueue(this, chunk);
- }
-
- /**
- * @param {any=} e
- * @returns {void}
- */
- error(e) {
- readableByteStreamControllerError(this, e);
- }
-
- /**
- * @param {any} reason
- * @returns {Promise<void>}
- */
- [_cancelSteps](reason) {
- // 4.7.4. CancelStep 1. If this.[[pendingPullIntos]] is not empty,
- resetQueue(this);
- const result = this[_cancelAlgorithm](reason);
- readableByteStreamControllerClearAlgorithms(this);
- return result;
- }
-
- /**
- * @param {ReadRequest<ArrayBuffer>} readRequest
- * @returns {void}
- */
- [_pullSteps](readRequest) {
- /** @type {ReadableStream<ArrayBuffer>} */
- const stream = this[_stream];
- assert(readableStreamHasDefaultReader(stream));
- if (this[_queueTotalSize] > 0) {
- assert(readableStreamGetNumReadRequests(stream) === 0);
- const entry = this[_queue].shift();
- this[_queueTotalSize] -= entry.byteLength;
- readableByteStreamControllerHandleQueueDrain(this);
- const view = new Uint8Array(
- entry.buffer,
- entry.byteOffset,
- entry.byteLength,
- );
- readRequest.chunkSteps(view);
- return;
- }
- // 4. Let autoAllocateChunkSize be this.[[autoAllocateChunkSize]].
- // 5. If autoAllocateChunkSize is not undefined,
- readableStreamAddReadRequest(stream, readRequest);
- readableByteStreamControllerCallPullIfNeeded(this);
- }
- }
-
- /** @template R */
- class ReadableStreamDefaultController {
- /** @type {(reason: any) => Promise<void>} */
- [_cancelAlgorithm];
- /** @type {boolean} */
- [_closeRequested];
- /** @type {boolean} */
- [_pullAgain];
- /** @type {(controller: this) => Promise<void>} */
- [_pullAlgorithm];
- /** @type {boolean} */
- [_pulling];
- /** @type {Array<ValueWithSize<R>>} */
- [_queue];
- /** @type {number} */
- [_queueTotalSize];
- /** @type {boolean} */
- [_started];
- /** @type {number} */
- [_strategyHWM];
- /** @type {(chunk: R) => number} */
- [_strategySizeAlgorithm];
- /** @type {ReadableStream<R>} */
- [_stream];
-
- /** @returns {number | null} */
- get desiredSize() {
- return readableStreamDefaultControllerGetDesiredSize(this);
- }
-
- /** @returns {void} */
- close() {
- if (readableStreamDefaultControllerCanCloseOrEnqueue(this) === false) {
- throw new TypeError("The stream controller cannot close or enqueue.");
- }
- readableStreamDefaultControllerClose(this);
- }
-
- /**
- * @param {R} chunk
- * @returns {void}
- */
- enqueue(chunk) {
- if (readableStreamDefaultControllerCanCloseOrEnqueue(this) === false) {
- throw new TypeError("The stream controller cannot close or enqueue.");
- }
- readableStreamDefaultControllerEnqueue(this, chunk);
- }
-
- /**
- * @param {any=} e
- * @returns {void}
- */
- error(e) {
- readableStreamDefaultControllerError(this, e);
- }
-
- /**
- * @param {any} reason
- * @returns {Promise<void>}
- */
- [_cancelSteps](reason) {
- resetQueue(this);
- const result = this[_cancelAlgorithm](reason);
- readableStreamDefaultControllerClearAlgorithms(this);
- return result;
- }
-
- /**
- * @param {ReadRequest<R>} readRequest
- * @returns {void}
- */
- [_pullSteps](readRequest) {
- const stream = this[_stream];
- if (this[_queue].length) {
- const chunk = dequeueValue(this);
- if (this[_closeRequested] && this[_queue].length === 0) {
- readableStreamDefaultControllerClearAlgorithms(this);
- readableStreamClose(stream);
- } else {
- readableStreamDefaultControllerCallPullIfNeeded(this);
- }
- readRequest.chunkSteps(chunk);
- } else {
- readableStreamAddReadRequest(stream, readRequest);
- readableStreamDefaultControllerCallPullIfNeeded(this);
- }
- }
- }
-
- /**
- * @template I
- * @template O
- */
- class TransformStream {
- /** @type {boolean} */
- [_backpressure];
- /** @type {Deferred<void>} */
- [_backpressureChangePromise];
- /** @type {TransformStreamDefaultController<O>} */
- [_controller];
- /** @type {boolean} */
- [_detached];
- /** @type {ReadableStream<O>} */
- [_readable];
- /** @type {WritableStream<I>} */
- [_writable];
-
- /**
- *
- * @param {Transformer<I, O>} transformer
- * @param {QueuingStrategy<I>} writableStrategy
- * @param {QueuingStrategy<O>} readableStrategy
- */
- constructor(
- transformer = null,
- writableStrategy = {},
- readableStrategy = {},
- ) {
- const transformerDict = convertTransformer(transformer);
- if (transformerDict.readableType) {
- throw new RangeError("readableType transformers not supported.");
- }
- if (transformerDict.writableType) {
- throw new RangeError("writableType transformers not supported.");
- }
- const readableHighWaterMark = extractHighWaterMark(readableStrategy, 0);
- const readableSizeAlgorithm = extractSizeAlgorithm(readableStrategy);
- const writableHighWaterMark = extractHighWaterMark(writableStrategy, 1);
- const writableSizeAlgorithm = extractSizeAlgorithm(writableStrategy);
- /** @type {Deferred<void>} */
- const startPromise = new Deferred();
- initializeTransformStream(
- this,
- startPromise,
- writableHighWaterMark,
- writableSizeAlgorithm,
- readableHighWaterMark,
- readableSizeAlgorithm,
- );
- setUpTransformStreamDefaultControllerFromTransformer(
- this,
- transformer,
- transformerDict,
- );
- if ("start" in transformerDict) {
- startPromise.resolve(
- transformerDict.start.call(transformer, this[_controller]),
- );
- } else {
- startPromise.resolve(undefined);
- }
- }
-
- /** @returns {ReadableStream<O>} */
- get readable() {
- return this[_readable];
- }
-
- /** @returns {WritableStream<I>} */
- get writable() {
- return this[_writable];
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({ readable: this.readable, writable: this.writable })
- }`;
- }
- }
-
- /** @template O */
- class TransformStreamDefaultController {
- /** @type {(controller: this) => Promise<void>} */
- [_flushAlgorithm];
- /** @type {TransformStream<O>} */
- [_stream];
- /** @type {(chunk: O, controller: this) => Promise<void>} */
- [_transformAlgorithm];
-
- /** @returns {number | null} */
- get desiredSize() {
- const readableController = this[_stream][_readable][_controller];
- return readableStreamDefaultControllerGetDesiredSize(
- /** @type {ReadableStreamDefaultController<O>} */ (readableController),
- );
- }
-
- /**
- * @param {O} chunk
- * @returns {void}
- */
- enqueue(chunk) {
- transformStreamDefaultControllerEnqueue(this, chunk);
- }
-
- /**
- * @param {any=} reason
- * @returns {void}
- */
- error(reason) {
- transformStreamDefaultControllerError(this, reason);
- }
-
- /** @returns {void} */
- terminate() {
- transformStreamDefaultControllerTerminate(this);
- }
- }
-
- /** @template W */
- class WritableStream {
- /** @type {boolean} */
- [_backpressure];
- /** @type {Deferred<void> | undefined} */
- [_closeRequest];
- /** @type {WritableStreamDefaultController<W>} */
- [_controller];
- /** @type {boolean} */
- [_detached];
- /** @type {Deferred<void> | undefined} */
- [_inFlightWriteRequest];
- /** @type {Deferred<void> | undefined} */
- [_inFlightCloseRequest];
- /** @type {PendingAbortRequest | undefined} */
- [_pendingAbortRequest];
- /** @type {"writable" | "closed" | "erroring" | "errored"} */
- [_state];
- /** @type {any} */
- [_storedError];
- /** @type {WritableStreamDefaultWriter<W>} */
- [_writer];
- /** @type {Deferred<void>[]} */
- [_writeRequests];
-
- /**
- * @param {UnderlyingSink<W>=} underlyingSink
- * @param {QueuingStrategy<W>=} strategy
- */
- constructor(underlyingSink = null, strategy = {}) {
- const underlyingSinkDict = convertUnderlyingSink(underlyingSink);
- if (underlyingSinkDict.type != null) {
- throw new RangeError(
- 'WritableStream does not support "type" in the underlying sink.',
- );
- }
- initializeWritableStream(this);
- const sizeAlgorithm = extractSizeAlgorithm(strategy);
- const highWaterMark = extractHighWaterMark(strategy, 1);
- setUpWritableStreamDefaultControllerFromUnderlyingSink(
- this,
- underlyingSink,
- underlyingSinkDict,
- highWaterMark,
- sizeAlgorithm,
- );
- }
-
- /** @returns {boolean} */
- get locked() {
- return isWritableStreamLocked(this);
- }
-
- /**
- * @param {any=} reason
- * @returns {Promise<void>}
- */
- abort(reason) {
- if (isWritableStreamLocked(this)) {
- return Promise.reject(
- new TypeError(
- "The writable stream is locked, therefore cannot be aborted.",
- ),
- );
- }
- return writableStreamAbort(this, reason);
- }
-
- /** @returns {Promise<void>} */
- close() {
- if (isWritableStreamLocked(this)) {
- return Promise.reject(
- new TypeError(
- "The writable stream is locked, therefore cannot be closed.",
- ),
- );
- }
- if (writableStreamCloseQueuedOrInFlight(this) === true) {
- return Promise.reject(
- new TypeError("The writable stream is already closing."),
- );
- }
- return writableStreamClose(this);
- }
-
- /** @returns {WritableStreamDefaultWriter<W>} */
- getWriter() {
- return acquireWritableStreamDefaultWriter(this);
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${inspect({ locked: this.locked })}`;
- }
- }
-
- /** @template W */
- class WritableStreamDefaultWriter {
- /** @type {Deferred<void>} */
- [_closedPromise];
-
- /** @type {Deferred<void>} */
- [_readyPromise];
-
- /** @type {WritableStream<W>} */
- [_stream];
-
- constructor(stream) {
- setUpWritableStreamDefaultWriter(this, stream);
- }
-
- /** @returns {Promise<void>} */
- get closed() {
- return this[_closedPromise].promise;
- }
-
- /** @returns {number} */
- get desiredSize() {
- if (this[_stream] === undefined) {
- throw new TypeError(
- "A writable stream is not associated with the writer.",
- );
- }
- return writableStreamDefaultWriterGetDesiredSize(this);
- }
-
- /** @returns {Promise<void>} */
- get ready() {
- return this[_readyPromise].promise;
- }
-
- /**
- * @param {any} reason
- * @returns {Promise<void>}
- */
- abort(reason) {
- if (this[_stream] === undefined) {
- return Promise.reject(
- new TypeError("A writable stream is not associated with the writer."),
- );
- }
- return writableStreamDefaultWriterAbort(this, reason);
- }
-
- /** @returns {Promise<void>} */
- close() {
- const stream = this[_stream];
- if (stream === undefined) {
- return Promise.reject(
- new TypeError("A writable stream is not associated with the writer."),
- );
- }
- if (writableStreamCloseQueuedOrInFlight(stream) === true) {
- return Promise.reject(
- new TypeError("The associated stream is already closing."),
- );
- }
- return writableStreamDefaultWriterClose(this);
- }
-
- /** @returns {void} */
- releaseLock() {
- const stream = this[_stream];
- if (stream === undefined) {
- return;
- }
- assert(stream[_writer] !== undefined);
- writableStreamDefaultWriterRelease(this);
- }
-
- /**
- * @param {W} chunk
- * @returns {Promise<void>}
- */
- write(chunk) {
- if (this[_stream] === undefined) {
- return Promise.reject(
- new TypeError("A writable stream is not associate with the writer."),
- );
- }
- return writableStreamDefaultWriterWrite(this, chunk);
- }
- }
-
- /** @template W */
- class WritableStreamDefaultController {
- /** @type {(reason?: any) => Promise<void>} */
- [_abortAlgorithm];
- /** @type {() => Promise<void>} */
- [_closeAlgorithm];
- /** @type {ValueWithSize<W | _close>[]} */
- [_queue];
- /** @type {number} */
- [_queueTotalSize];
- /** @type {boolean} */
- [_started];
- /** @type {number} */
- [_strategyHWM];
- /** @type {(chunk: W) => number} */
- [_strategySizeAlgorithm];
- /** @type {WritableStream<W>} */
- [_stream];
- /** @type {(chunk: W, controller: this) => Promise<void>} */
- [_writeAlgorithm];
-
- /**
- * @param {any=} e
- * @returns {void}
- */
- error(e) {
- const state = this[_stream][_state];
- if (state !== "writable") {
- return;
- }
- writableStreamDefaultControllerError(this, e);
- }
-
- /**
- * @param {any=} reason
- * @returns {Promise<void>}
- */
- [_abortSteps](reason) {
- const result = this[_abortAlgorithm](reason);
- writableStreamDefaultControllerClearAlgorithms(this);
- return result;
- }
-
- [_errorSteps]() {
- resetQueue(this);
- }
- }
-
- window.__bootstrap.streams = {
- // Non-Public
- isReadableStreamDisturbed,
- // Exposed in global runtime scope
- ByteLengthQueuingStrategy,
- CountQueuingStrategy,
- ReadableStream,
- ReadableStreamDefaultReader,
- TransformStream,
- WritableStream,
- WritableStreamDefaultWriter,
- };
-})(this);
diff --git a/op_crates/fetch/11_streams_types.d.ts b/op_crates/fetch/11_streams_types.d.ts
deleted file mode 100644
index a4c54363f..000000000
--- a/op_crates/fetch/11_streams_types.d.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// ** Internal Interfaces **
-
-interface PendingAbortRequest {
- deferred: Deferred<void>;
- // deno-lint-ignore no-explicit-any
- reason: any;
- wasAlreadyErroring: boolean;
-}
-
-// deno-lint-ignore no-explicit-any
-interface ReadRequest<R = any> {
- chunkSteps: (chunk: R) => void;
- closeSteps: () => void;
- // deno-lint-ignore no-explicit-any
- errorSteps: (error: any) => void;
-}
-
-interface ReadableByteStreamQueueEntry {
- buffer: ArrayBufferLike;
- byteOffset: number;
- byteLength: number;
-}
-
-interface ReadableStreamGetReaderOptions {
- mode?: "byob";
-}
-
-interface ReadableStreamIteratorOptions {
- preventCancel?: boolean;
-}
-
-interface ValueWithSize<T> {
- value: T;
- size: number;
-}
-
-interface VoidFunction {
- (): void;
-}
-
-// ** Ambient Definitions and Interfaces not provided by fetch **
-
-declare function queueMicrotask(callback: VoidFunction): void;
-
-declare namespace Deno {
- function inspect(value: unknown, options?: Record<string, unknown>): string;
-}
diff --git a/op_crates/fetch/20_headers.js b/op_crates/fetch/20_headers.js
deleted file mode 100644
index 94e1c4076..000000000
--- a/op_crates/fetch/20_headers.js
+++ /dev/null
@@ -1,449 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// @ts-check
-/// <reference path="../webidl/internal.d.ts" />
-/// <reference path="../web/internal.d.ts" />
-/// <reference path="../file/internal.d.ts" />
-/// <reference path="../file/lib.deno_file.d.ts" />
-/// <reference path="./internal.d.ts" />
-/// <reference path="./11_streams_types.d.ts" />
-/// <reference path="./lib.deno_fetch.d.ts" />
-/// <reference lib="esnext" />
-"use strict";
-
-((window) => {
- const webidl = window.__bootstrap.webidl;
- const {
- HTTP_TAB_OR_SPACE_PREFIX_RE,
- HTTP_TAB_OR_SPACE_SUFFIX_RE,
- HTTP_WHITESPACE_PREFIX_RE,
- HTTP_WHITESPACE_SUFFIX_RE,
- HTTP_TOKEN_CODE_POINT_RE,
- byteLowerCase,
- collectSequenceOfCodepoints,
- collectHttpQuotedString,
- } = window.__bootstrap.infra;
-
- const _headerList = Symbol("header list");
- const _iterableHeaders = Symbol("iterable headers");
- const _guard = Symbol("guard");
-
- /**
- * @typedef Header
- * @type {[string, string]}
- */
-
- /**
- * @typedef HeaderList
- * @type {Header[]}
- */
-
- /**
- * @param {string} potentialValue
- * @returns {string}
- */
- function normalizeHeaderValue(potentialValue) {
- potentialValue = potentialValue.replaceAll(HTTP_WHITESPACE_PREFIX_RE, "");
- potentialValue = potentialValue.replaceAll(HTTP_WHITESPACE_SUFFIX_RE, "");
- return potentialValue;
- }
-
- /**
- * @param {Headers} headers
- * @param {HeadersInit} object
- */
- function fillHeaders(headers, object) {
- if (Array.isArray(object)) {
- for (const header of object) {
- if (header.length !== 2) {
- throw new TypeError(
- `Invalid header. Length must be 2, but is ${header.length}`,
- );
- }
- appendHeader(headers, header[0], header[1]);
- }
- } else {
- for (const key of Object.keys(object)) {
- appendHeader(headers, key, object[key]);
- }
- }
- }
-
- /**
- * https://fetch.spec.whatwg.org/#concept-headers-append
- * @param {Headers} headers
- * @param {string} name
- * @param {string} value
- */
- function appendHeader(headers, name, value) {
- // 1.
- value = normalizeHeaderValue(value);
-
- // 2.
- if (!HTTP_TOKEN_CODE_POINT_RE.test(name)) {
- throw new TypeError("Header name is not valid.");
- }
- if (
- value.includes("\x00") || value.includes("\x0A") || value.includes("\x0D")
- ) {
- throw new TypeError("Header value is not valid.");
- }
-
- // 3.
- if (headers[_guard] == "immutable") {
- throw new TypeError("Headers are immutable.");
- }
-
- // 7.
- const list = headers[_headerList];
- const lowercaseName = byteLowerCase(name);
- for (let i = 0; i < list.length; i++) {
- if (byteLowerCase(list[i][0]) === lowercaseName) {
- name = list[i][0];
- break;
- }
- }
- list.push([name, value]);
- }
-
- /**
- * https://fetch.spec.whatwg.org/#concept-header-list-get
- * @param {HeaderList} list
- * @param {string} name
- */
- function getHeader(list, name) {
- const lowercaseName = byteLowerCase(name);
- const entries = list.filter((entry) =>
- byteLowerCase(entry[0]) === lowercaseName
- ).map((entry) => entry[1]);
- if (entries.length === 0) {
- return null;
- } else {
- return entries.join("\x2C\x20");
- }
- }
-
- /**
- * https://fetch.spec.whatwg.org/#concept-header-list-get-decode-split
- * @param {HeaderList} list
- * @param {string} name
- * @returns {string[] | null}
- */
- function getDecodeSplitHeader(list, name) {
- const initialValue = getHeader(list, name);
- if (initialValue === null) return null;
- const input = initialValue;
- let position = 0;
- const values = [];
- let value = "";
- while (position < initialValue.length) {
- // 7.1. collect up to " or ,
- const res = collectSequenceOfCodepoints(
- initialValue,
- position,
- (c) => c !== "\u0022" && c !== "\u002C",
- );
- value += res.result;
- position = res.position;
-
- if (position < initialValue.length) {
- if (input[position] === "\u0022") {
- const res = collectHttpQuotedString(input, position, false);
- value += res.result;
- position = res.position;
- if (position < initialValue.length) {
- continue;
- }
- } else {
- if (input[position] !== "\u002C") throw new TypeError("Unreachable");
- position += 1;
- }
- }
-
- value = value.replaceAll(HTTP_TAB_OR_SPACE_PREFIX_RE, "");
- value = value.replaceAll(HTTP_TAB_OR_SPACE_SUFFIX_RE, "");
-
- values.push(value);
- value = "";
- }
- return values;
- }
-
- class Headers {
- /** @type {HeaderList} */
- [_headerList] = [];
- /** @type {"immutable" | "request" | "request-no-cors" | "response" | "none"} */
- [_guard];
-
- get [_iterableHeaders]() {
- const list = this[_headerList];
-
- const headers = [];
- const headerNamesSet = new Set();
- for (const entry of list) {
- headerNamesSet.add(byteLowerCase(entry[0]));
- }
- const names = [...headerNamesSet].sort();
- for (const name of names) {
- // The following if statement, and if block of the following statement
- // are not spec compliant. `set-cookie` is the only header that can not
- // be concatentated, so must be given to the user as multiple headers.
- // The else block of the if statement is spec compliant again.
- if (name == "set-cookie") {
- const setCookie = list.filter((entry) =>
- byteLowerCase(entry[0]) === "set-cookie"
- );
- if (setCookie.length === 0) throw new TypeError("Unreachable");
- for (const entry of setCookie) {
- headers.push([name, entry[1]]);
- }
- } else {
- const value = getHeader(list, name);
- if (value === null) throw new TypeError("Unreachable");
- headers.push([name, value]);
- }
- }
- return headers;
- }
-
- /** @param {HeadersInit} [init] */
- constructor(init = undefined) {
- const prefix = "Failed to construct 'Event'";
- if (init !== undefined) {
- init = webidl.converters["HeadersInit"](init, {
- prefix,
- context: "Argument 1",
- });
- }
-
- this[webidl.brand] = webidl.brand;
- this[_guard] = "none";
- if (init !== undefined) {
- fillHeaders(this, init);
- }
- }
-
- /**
- * @param {string} name
- * @param {string} value
- */
- append(name, value) {
- webidl.assertBranded(this, Headers);
- const prefix = "Failed to execute 'append' on 'Headers'";
- webidl.requiredArguments(arguments.length, 2, { prefix });
- name = webidl.converters["ByteString"](name, {
- prefix,
- context: "Argument 1",
- });
- value = webidl.converters["ByteString"](value, {
- prefix,
- context: "Argument 2",
- });
- appendHeader(this, name, value);
- }
-
- /**
- * @param {string} name
- */
- delete(name) {
- const prefix = "Failed to execute 'delete' on 'Headers'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- name = webidl.converters["ByteString"](name, {
- prefix,
- context: "Argument 1",
- });
-
- if (!HTTP_TOKEN_CODE_POINT_RE.test(name)) {
- throw new TypeError("Header name is not valid.");
- }
- if (this[_guard] == "immutable") {
- throw new TypeError("Headers are immutable.");
- }
-
- const list = this[_headerList];
- const lowercaseName = byteLowerCase(name);
- for (let i = 0; i < list.length; i++) {
- if (byteLowerCase(list[i][0]) === lowercaseName) {
- list.splice(i, 1);
- i--;
- }
- }
- }
-
- /**
- * @param {string} name
- */
- get(name) {
- const prefix = "Failed to execute 'get' on 'Headers'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- name = webidl.converters["ByteString"](name, {
- prefix,
- context: "Argument 1",
- });
-
- if (!HTTP_TOKEN_CODE_POINT_RE.test(name)) {
- throw new TypeError("Header name is not valid.");
- }
-
- const list = this[_headerList];
- return getHeader(list, name);
- }
-
- /**
- * @param {string} name
- */
- has(name) {
- const prefix = "Failed to execute 'has' on 'Headers'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- name = webidl.converters["ByteString"](name, {
- prefix,
- context: "Argument 1",
- });
-
- if (!HTTP_TOKEN_CODE_POINT_RE.test(name)) {
- throw new TypeError("Header name is not valid.");
- }
-
- const list = this[_headerList];
- const lowercaseName = byteLowerCase(name);
- for (let i = 0; i < list.length; i++) {
- if (byteLowerCase(list[i][0]) === lowercaseName) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * @param {string} name
- * @param {string} value
- */
- set(name, value) {
- webidl.assertBranded(this, Headers);
- const prefix = "Failed to execute 'set' on 'Headers'";
- webidl.requiredArguments(arguments.length, 2, { prefix });
- name = webidl.converters["ByteString"](name, {
- prefix,
- context: "Argument 1",
- });
- value = webidl.converters["ByteString"](value, {
- prefix,
- context: "Argument 2",
- });
-
- value = normalizeHeaderValue(value);
-
- // 2.
- if (!HTTP_TOKEN_CODE_POINT_RE.test(name)) {
- throw new TypeError("Header name is not valid.");
- }
- if (
- value.includes("\x00") || value.includes("\x0A") ||
- value.includes("\x0D")
- ) {
- throw new TypeError("Header value is not valid.");
- }
-
- if (this[_guard] == "immutable") {
- throw new TypeError("Headers are immutable.");
- }
-
- const list = this[_headerList];
- const lowercaseName = byteLowerCase(name);
- let added = false;
- for (let i = 0; i < list.length; i++) {
- if (byteLowerCase(list[i][0]) === lowercaseName) {
- if (!added) {
- list[i][1] = value;
- added = true;
- } else {
- list.splice(i, 1);
- i--;
- }
- }
- }
- if (!added) {
- list.push([name, value]);
- }
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- const headers = {};
- for (const header of this) {
- headers[header[0]] = header[1];
- }
- return `Headers ${inspect(headers)}`;
- }
-
- get [Symbol.toStringTag]() {
- return "Headers";
- }
- }
-
- webidl.mixinPairIterable("Headers", Headers, _iterableHeaders, 0, 1);
-
- webidl.converters["sequence<ByteString>"] = webidl
- .createSequenceConverter(webidl.converters["ByteString"]);
- webidl.converters["sequence<sequence<ByteString>>"] = webidl
- .createSequenceConverter(webidl.converters["sequence<ByteString>"]);
- webidl.converters["record<ByteString, ByteString>"] = webidl
- .createRecordConverter(
- webidl.converters["ByteString"],
- webidl.converters["ByteString"],
- );
- webidl.converters["HeadersInit"] = (V, opts) => {
- // Union for (sequence<sequence<ByteString>> or record<ByteString, ByteString>)
- if (typeof V === "object" && V !== null) {
- if (V[Symbol.iterator] !== undefined) {
- return webidl.converters["sequence<sequence<ByteString>>"](V, opts);
- }
- return webidl.converters["record<ByteString, ByteString>"](V, opts);
- }
- throw webidl.makeException(
- TypeError,
- "The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)'",
- opts,
- );
- };
- webidl.converters["Headers"] = webidl.createInterfaceConverter(
- "Headers",
- Headers,
- );
-
- /**
- * @param {HeaderList} list
- * @param {"immutable" | "request" | "request-no-cors" | "response" | "none"} guard
- * @returns {Headers}
- */
- function headersFromHeaderList(list, guard) {
- const headers = webidl.createBranded(Headers);
- headers[_headerList] = list;
- headers[_guard] = guard;
- return headers;
- }
-
- /**
- * @param {Headers}
- * @returns {HeaderList}
- */
- function headerListFromHeaders(headers) {
- return headers[_headerList];
- }
-
- /**
- * @param {Headers}
- * @returns {"immutable" | "request" | "request-no-cors" | "response" | "none"}
- */
- function guardFromHeaders(headers) {
- return headers[_guard];
- }
-
- window.__bootstrap.headers = {
- Headers,
- headersFromHeaderList,
- headerListFromHeaders,
- fillHeaders,
- getDecodeSplitHeader,
- guardFromHeaders,
- };
-})(this);
diff --git a/op_crates/fetch/21_formdata.js b/op_crates/fetch/21_formdata.js
deleted file mode 100644
index c50cf4cf7..000000000
--- a/op_crates/fetch/21_formdata.js
+++ /dev/null
@@ -1,552 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// @ts-check
-/// <reference path="../webidl/internal.d.ts" />
-/// <reference path="../web/internal.d.ts" />
-/// <reference path="../file/internal.d.ts" />
-/// <reference path="../file/lib.deno_file.d.ts" />
-/// <reference path="./internal.d.ts" />
-/// <reference path="./11_streams_types.d.ts" />
-/// <reference path="./lib.deno_fetch.d.ts" />
-/// <reference lib="esnext" />
-"use strict";
-
-((window) => {
- const webidl = globalThis.__bootstrap.webidl;
- const { Blob, File, _byteSequence } = globalThis.__bootstrap.file;
-
- const entryList = Symbol("entry list");
-
- /**
- * @param {string} name
- * @param {string | Blob} value
- * @param {string | undefined} filename
- * @returns {FormDataEntry}
- */
- function createEntry(name, value, filename) {
- if (value instanceof Blob && !(value instanceof File)) {
- value = new File([value[_byteSequence]], "blob", { type: value.type });
- }
- if (value instanceof File && filename !== undefined) {
- value = new File([value[_byteSequence]], filename, {
- type: value.type,
- lastModified: value.lastModified,
- });
- }
- return {
- name,
- // @ts-expect-error because TS is not smart enough
- value,
- };
- }
-
- /**
- * @typedef FormDataEntry
- * @property {string} name
- * @property {FormDataEntryValue} value
- */
-
- class FormData {
- get [Symbol.toStringTag]() {
- return "FormData";
- }
-
- /** @type {FormDataEntry[]} */
- [entryList] = [];
-
- /** @param {void} form */
- constructor(form) {
- if (form !== undefined) {
- webidl.illegalConstructor();
- }
- this[webidl.brand] = webidl.brand;
- }
-
- /**
- * @param {string} name
- * @param {string | Blob} valueOrBlobValue
- * @param {string} [filename]
- * @returns {void}
- */
- append(name, valueOrBlobValue, filename) {
- webidl.assertBranded(this, FormData);
- const prefix = "Failed to execute 'append' on 'FormData'";
- webidl.requiredArguments(arguments.length, 2, { prefix });
-
- name = webidl.converters["USVString"](name, {
- prefix,
- context: "Argument 1",
- });
- if (valueOrBlobValue instanceof Blob) {
- valueOrBlobValue = webidl.converters["Blob"](valueOrBlobValue, {
- prefix,
- context: "Argument 2",
- });
- if (filename !== undefined) {
- filename = webidl.converters["USVString"](filename, {
- prefix,
- context: "Argument 3",
- });
- }
- } else {
- valueOrBlobValue = webidl.converters["USVString"](valueOrBlobValue, {
- prefix,
- context: "Argument 2",
- });
- }
-
- const entry = createEntry(name, valueOrBlobValue, filename);
-
- this[entryList].push(entry);
- }
-
- /**
- * @param {string} name
- * @returns {void}
- */
- delete(name) {
- webidl.assertBranded(this, FormData);
- const prefix = "Failed to execute 'name' on 'FormData'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
-
- name = webidl.converters["USVString"](name, {
- prefix,
- context: "Argument 1",
- });
-
- const list = this[entryList];
- for (let i = 0; i < list.length; i++) {
- if (list[i].name === name) {
- list.splice(i, 1);
- i--;
- }
- }
- }
-
- /**
- * @param {string} name
- * @returns {FormDataEntryValue | null}
- */
- get(name) {
- webidl.assertBranded(this, FormData);
- const prefix = "Failed to execute 'get' on 'FormData'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
-
- name = webidl.converters["USVString"](name, {
- prefix,
- context: "Argument 1",
- });
-
- for (const entry of this[entryList]) {
- if (entry.name === name) return entry.value;
- }
- return null;
- }
-
- /**
- * @param {string} name
- * @returns {FormDataEntryValue[]}
- */
- getAll(name) {
- webidl.assertBranded(this, FormData);
- const prefix = "Failed to execute 'getAll' on 'FormData'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
-
- name = webidl.converters["USVString"](name, {
- prefix,
- context: "Argument 1",
- });
-
- const returnList = [];
- for (const entry of this[entryList]) {
- if (entry.name === name) returnList.push(entry.value);
- }
- return returnList;
- }
-
- /**
- * @param {string} name
- * @returns {boolean}
- */
- has(name) {
- webidl.assertBranded(this, FormData);
- const prefix = "Failed to execute 'has' on 'FormData'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
-
- name = webidl.converters["USVString"](name, {
- prefix,
- context: "Argument 1",
- });
-
- for (const entry of this[entryList]) {
- if (entry.name === name) return true;
- }
- return false;
- }
-
- /**
- * @param {string} name
- * @param {string | Blob} valueOrBlobValue
- * @param {string} [filename]
- * @returns {void}
- */
- set(name, valueOrBlobValue, filename) {
- webidl.assertBranded(this, FormData);
- const prefix = "Failed to execute 'set' on 'FormData'";
- webidl.requiredArguments(arguments.length, 2, { prefix });
-
- name = webidl.converters["USVString"](name, {
- prefix,
- context: "Argument 1",
- });
- if (valueOrBlobValue instanceof Blob) {
- valueOrBlobValue = webidl.converters["Blob"](valueOrBlobValue, {
- prefix,
- context: "Argument 2",
- });
- if (filename !== undefined) {
- filename = webidl.converters["USVString"](filename, {
- prefix,
- context: "Argument 3",
- });
- }
- } else {
- valueOrBlobValue = webidl.converters["USVString"](valueOrBlobValue, {
- prefix,
- context: "Argument 2",
- });
- }
-
- const entry = createEntry(name, valueOrBlobValue, filename);
-
- const list = this[entryList];
- let added = false;
- for (let i = 0; i < list.length; i++) {
- if (list[i].name === name) {
- if (!added) {
- list[i] = entry;
- added = true;
- } else {
- list.splice(i, 1);
- i--;
- }
- }
- }
- if (!added) {
- list.push(entry);
- }
- }
- }
-
- webidl.mixinPairIterable("FormData", FormData, entryList, "name", "value");
-
- const encoder = new TextEncoder();
-
- class MultipartBuilder {
- /**
- * @param {FormData} formData
- */
- constructor(formData) {
- this.entryList = formData[entryList];
- this.boundary = this.#createBoundary();
- /** @type {Uint8Array[]} */
- this.chunks = [];
- }
-
- /**
- * @returns {string}
- */
- getContentType() {
- return `multipart/form-data; boundary=${this.boundary}`;
- }
-
- /**
- * @returns {Uint8Array}
- */
- getBody() {
- for (const { name, value } of this.entryList) {
- if (value instanceof File) {
- this.#writeFile(name, value);
- } else this.#writeField(name, value);
- }
-
- this.chunks.push(encoder.encode(`\r\n--${this.boundary}--`));
-
- let totalLength = 0;
- for (const chunk of this.chunks) {
- totalLength += chunk.byteLength;
- }
-
- const finalBuffer = new Uint8Array(totalLength);
- let i = 0;
- for (const chunk of this.chunks) {
- finalBuffer.set(chunk, i);
- i += chunk.byteLength;
- }
-
- return finalBuffer;
- }
-
- #createBoundary = () => {
- return (
- "----------" +
- Array.from(Array(32))
- .map(() => Math.random().toString(36)[2] || 0)
- .join("")
- );
- };
-
- /**
- * @param {[string, string][]} headers
- * @returns {void}
- */
- #writeHeaders = (headers) => {
- let buf = (this.chunks.length === 0) ? "" : "\r\n";
-
- buf += `--${this.boundary}\r\n`;
- for (const [key, value] of headers) {
- buf += `${key}: ${value}\r\n`;
- }
- buf += `\r\n`;
-
- this.chunks.push(encoder.encode(buf));
- };
-
- /**
- * @param {string} field
- * @param {string} filename
- * @param {string} [type]
- * @returns {void}
- */
- #writeFileHeaders = (
- field,
- filename,
- type,
- ) => {
- /** @type {[string, string][]} */
- const headers = [
- [
- "Content-Disposition",
- `form-data; name="${field}"; filename="${filename}"`,
- ],
- ["Content-Type", type || "application/octet-stream"],
- ];
- return this.#writeHeaders(headers);
- };
-
- /**
- * @param {string} field
- * @returns {void}
- */
- #writeFieldHeaders = (field) => {
- /** @type {[string, string][]} */
- const headers = [["Content-Disposition", `form-data; name="${field}"`]];
- return this.#writeHeaders(headers);
- };
-
- /**
- * @param {string} field
- * @param {string} value
- * @returns {void}
- */
- #writeField = (field, value) => {
- this.#writeFieldHeaders(field);
- this.chunks.push(encoder.encode(value));
- };
-
- /**
- * @param {string} field
- * @param {File} value
- * @returns {void}
- */
- #writeFile = (field, value) => {
- this.#writeFileHeaders(field, value.name, value.type);
- this.chunks.push(value[_byteSequence]);
- };
- }
-
- /**
- * @param {FormData} formdata
- * @returns {{body: Uint8Array, contentType: string}}
- */
- function encodeFormData(formdata) {
- const builder = new MultipartBuilder(formdata);
- return {
- body: builder.getBody(),
- contentType: builder.getContentType(),
- };
- }
-
- /**
- * @param {string} value
- * @returns {Map<string, string>}
- */
- function parseContentDisposition(value) {
- /** @type {Map<string, string>} */
- const params = new Map();
- // Forced to do so for some Map constructor param mismatch
- value
- .split(";")
- .slice(1)
- .map((s) => s.trim().split("="))
- .filter((arr) => arr.length > 1)
- .map(([k, v]) => [k, v.replace(/^"([^"]*)"$/, "$1")])
- .forEach(([k, v]) => params.set(k, v));
- return params;
- }
-
- const LF = "\n".codePointAt(0);
- const CR = "\r".codePointAt(0);
- const decoder = new TextDecoder("utf-8");
-
- class MultipartParser {
- /**
- * @param {Uint8Array} body
- * @param {string | undefined} boundary
- */
- constructor(body, boundary) {
- if (!boundary) {
- throw new TypeError("multipart/form-data must provide a boundary");
- }
-
- this.boundary = `--${boundary}`;
- this.body = body;
- this.boundaryChars = encoder.encode(this.boundary);
- }
-
- /**
- * @param {string} headersText
- * @returns {{ headers: Headers, disposition: Map<string, string> }}
- */
- #parseHeaders = (headersText) => {
- const headers = new Headers();
- const rawHeaders = headersText.split("\r\n");
- for (const rawHeader of rawHeaders) {
- const sepIndex = rawHeader.indexOf(":");
- if (sepIndex < 0) {
- continue; // Skip this header
- }
- const key = rawHeader.slice(0, sepIndex);
- const value = rawHeader.slice(sepIndex + 1);
- headers.set(key, value);
- }
-
- const disposition = parseContentDisposition(
- headers.get("Content-Disposition") ?? "",
- );
-
- return { headers, disposition };
- };
-
- /**
- * @returns {FormData}
- */
- parse() {
- // Body must be at least 2 boundaries + \r\n + -- on the last boundary.
- if (this.body.length < (this.boundary.length * 2) + 4) {
- throw new TypeError("Form data too short to be valid.");
- }
-
- const formData = new FormData();
- let headerText = "";
- let boundaryIndex = 0;
- let state = 0;
- let fileStart = 0;
-
- for (let i = 0; i < this.body.length; i++) {
- const byte = this.body[i];
- const prevByte = this.body[i - 1];
- const isNewLine = byte === LF && prevByte === CR;
-
- if (state === 1 || state === 2 || state == 3) {
- headerText += String.fromCharCode(byte);
- }
- if (state === 0 && isNewLine) {
- state = 1;
- } else if (state === 1 && isNewLine) {
- state = 2;
- const headersDone = this.body[i + 1] === CR &&
- this.body[i + 2] === LF;
-
- if (headersDone) {
- state = 3;
- }
- } else if (state === 2 && isNewLine) {
- state = 3;
- } else if (state === 3 && isNewLine) {
- state = 4;
- fileStart = i + 1;
- } else if (state === 4) {
- if (this.boundaryChars[boundaryIndex] !== byte) {
- boundaryIndex = 0;
- } else {
- boundaryIndex++;
- }
-
- if (boundaryIndex >= this.boundary.length) {
- const { headers, disposition } = this.#parseHeaders(headerText);
- const content = this.body.subarray(
- fileStart,
- i - boundaryIndex - 1,
- );
- // https://fetch.spec.whatwg.org/#ref-for-dom-body-formdata
- const filename = disposition.get("filename");
- const name = disposition.get("name");
-
- state = 5;
- // Reset
- boundaryIndex = 0;
- headerText = "";
-
- if (!name) {
- continue; // Skip, unknown name
- }
-
- if (filename) {
- const blob = new Blob([content], {
- type: headers.get("Content-Type") || "application/octet-stream",
- });
- formData.append(name, blob, filename);
- } else {
- formData.append(name, decoder.decode(content));
- }
- }
- } else if (state === 5 && isNewLine) {
- state = 1;
- }
- }
-
- return formData;
- }
- }
-
- /**
- * @param {Uint8Array} body
- * @param {string | undefined} boundary
- * @returns {FormData}
- */
- function parseFormData(body, boundary) {
- const parser = new MultipartParser(body, boundary);
- return parser.parse();
- }
-
- /**
- * @param {FormDataEntry[]} entries
- * @returns {FormData}
- */
- function formDataFromEntries(entries) {
- const fd = new FormData();
- fd[entryList] = entries;
- return fd;
- }
-
- webidl.converters["FormData"] = webidl
- .createInterfaceConverter("FormData", FormData);
-
- globalThis.__bootstrap.formData = {
- FormData,
- encodeFormData,
- parseFormData,
- formDataFromEntries,
- };
-})(globalThis);
diff --git a/op_crates/fetch/22_body.js b/op_crates/fetch/22_body.js
deleted file mode 100644
index 938e3023e..000000000
--- a/op_crates/fetch/22_body.js
+++ /dev/null
@@ -1,338 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// @ts-check
-/// <reference path="../webidl/internal.d.ts" />
-/// <reference path="../url/internal.d.ts" />
-/// <reference path="../url/lib.deno_url.d.ts" />
-/// <reference path="../web/internal.d.ts" />
-/// <reference path="../file/internal.d.ts" />
-/// <reference path="../file/lib.deno_file.d.ts" />
-/// <reference path="./internal.d.ts" />
-/// <reference path="./11_streams_types.d.ts" />
-/// <reference path="./lib.deno_fetch.d.ts" />
-/// <reference lib="esnext" />
-"use strict";
-
-((window) => {
- const core = window.Deno.core;
- const webidl = globalThis.__bootstrap.webidl;
- const { parseUrlEncoded } = globalThis.__bootstrap.url;
- const { parseFormData, formDataFromEntries, encodeFormData } =
- globalThis.__bootstrap.formData;
- const mimesniff = globalThis.__bootstrap.mimesniff;
- const { isReadableStreamDisturbed } = globalThis.__bootstrap.streams;
-
- class InnerBody {
- /** @type {ReadableStream<Uint8Array> | { body: Uint8Array, consumed: boolean }} */
- streamOrStatic;
- /** @type {null | Uint8Array | Blob | FormData} */
- source = null;
- /** @type {null | number} */
- length = null;
-
- /**
- * @param {ReadableStream<Uint8Array> | { body: Uint8Array, consumed: boolean }} stream
- */
- constructor(stream) {
- this.streamOrStatic = stream ??
- { body: new Uint8Array(), consumed: false };
- }
-
- get stream() {
- if (!(this.streamOrStatic instanceof ReadableStream)) {
- const { body, consumed } = this.streamOrStatic;
- this.streamOrStatic = new ReadableStream({
- start(controller) {
- controller.enqueue(body);
- controller.close();
- },
- });
- if (consumed) {
- this.streamOrStatic.cancel();
- }
- }
- return this.streamOrStatic;
- }
-
- /**
- * https://fetch.spec.whatwg.org/#body-unusable
- * @returns {boolean}
- */
- unusable() {
- if (this.streamOrStatic instanceof ReadableStream) {
- return this.streamOrStatic.locked ||
- isReadableStreamDisturbed(this.streamOrStatic);
- }
- return this.streamOrStatic.consumed;
- }
-
- /**
- * @returns {boolean}
- */
- consumed() {
- if (this.streamOrStatic instanceof ReadableStream) {
- return isReadableStreamDisturbed(this.streamOrStatic);
- }
- return this.streamOrStatic.consumed;
- }
-
- /**
- * https://fetch.spec.whatwg.org/#concept-body-consume-body
- * @returns {Promise<Uint8Array>}
- */
- async consume() {
- if (this.unusable()) throw new TypeError("Body already consumed.");
- if (this.streamOrStatic instanceof ReadableStream) {
- const reader = this.stream.getReader();
- /** @type {Uint8Array[]} */
- const chunks = [];
- let totalLength = 0;
- while (true) {
- const { value: chunk, done } = await reader.read();
- if (done) break;
- chunks.push(chunk);
- totalLength += chunk.byteLength;
- }
- const finalBuffer = new Uint8Array(totalLength);
- let i = 0;
- for (const chunk of chunks) {
- finalBuffer.set(chunk, i);
- i += chunk.byteLength;
- }
- return finalBuffer;
- } else {
- this.streamOrStatic.consumed = true;
- return this.streamOrStatic.body;
- }
- }
-
- /**
- * @returns {InnerBody}
- */
- clone() {
- const [out1, out2] = this.stream.tee();
- this.streamOrStatic = out1;
- const second = new InnerBody(out2);
- second.source = core.deserialize(core.serialize(this.source));
- second.length = this.length;
- return second;
- }
- }
-
- /**
- * @param {any} prototype
- * @param {symbol} bodySymbol
- * @param {symbol} mimeTypeSymbol
- * @returns {void}
- */
- function mixinBody(prototype, bodySymbol, mimeTypeSymbol) {
- function consumeBody(object) {
- if (object[bodySymbol] !== null) {
- return object[bodySymbol].consume();
- }
- return Promise.resolve(new Uint8Array());
- }
-
- /** @type {PropertyDescriptorMap} */
- const mixin = {
- body: {
- /**
- * @returns {ReadableStream<Uint8Array> | null}
- */
- get() {
- webidl.assertBranded(this, prototype);
- if (this[bodySymbol] === null) {
- return null;
- } else {
- return this[bodySymbol].stream;
- }
- },
- },
- bodyUsed: {
- /**
- * @returns {boolean}
- */
- get() {
- webidl.assertBranded(this, prototype);
- if (this[bodySymbol] !== null) {
- return this[bodySymbol].consumed();
- }
- return false;
- },
- },
- arrayBuffer: {
- /** @returns {Promise<ArrayBuffer>} */
- value: async function arrayBuffer() {
- webidl.assertBranded(this, prototype);
- const body = await consumeBody(this);
- return packageData(body, "ArrayBuffer");
- },
- },
- blob: {
- /** @returns {Promise<Blob>} */
- value: async function blob() {
- webidl.assertBranded(this, prototype);
- const body = await consumeBody(this);
- return packageData(body, "Blob", this[mimeTypeSymbol]);
- },
- },
- formData: {
- /** @returns {Promise<FormData>} */
- value: async function formData() {
- webidl.assertBranded(this, prototype);
- const body = await consumeBody(this);
- return packageData(body, "FormData", this[mimeTypeSymbol]);
- },
- },
- json: {
- /** @returns {Promise<any>} */
- value: async function json() {
- webidl.assertBranded(this, prototype);
- const body = await consumeBody(this);
- return packageData(body, "JSON");
- },
- },
- text: {
- /** @returns {Promise<string>} */
- value: async function text() {
- webidl.assertBranded(this, prototype);
- const body = await consumeBody(this);
- return packageData(body, "text");
- },
- },
- };
- return Object.defineProperties(prototype.prototype, mixin);
- }
-
- const decoder = new TextDecoder();
-
- /**
- * https://fetch.spec.whatwg.org/#concept-body-package-data
- * @param {Uint8Array} bytes
- * @param {"ArrayBuffer" | "Blob" | "FormData" | "JSON" | "text"} type
- * @param {MimeType | null} [mimeType]
- */
- function packageData(bytes, type, mimeType) {
- switch (type) {
- case "ArrayBuffer":
- return bytes.buffer;
- case "Blob":
- return new Blob([bytes], {
- type: mimeType !== null ? mimesniff.serializeMimeType(mimeType) : "",
- });
- case "FormData": {
- if (mimeType !== null) {
- if (mimeType !== null) {
- const essence = mimesniff.essence(mimeType);
- if (essence === "multipart/form-data") {
- const boundary = mimeType.parameters.get("boundary");
- if (boundary === null) {
- throw new TypeError(
- "Missing boundary parameter in mime type of multipart formdata.",
- );
- }
- return parseFormData(bytes, boundary);
- } else if (essence === "application/x-www-form-urlencoded") {
- const entries = parseUrlEncoded(bytes);
- return formDataFromEntries(
- entries.map((x) => ({ name: x[0], value: x[1] })),
- );
- }
- }
- throw new TypeError("Invalid form data");
- }
- throw new TypeError("Missing content type");
- }
- case "JSON":
- return JSON.parse(decoder.decode(bytes));
- case "text":
- return decoder.decode(bytes);
- }
- }
-
- const encoder = new TextEncoder();
-
- /**
- * @param {BodyInit} object
- * @returns {{body: InnerBody, contentType: string | null}}
- */
- function extractBody(object) {
- /** @type {ReadableStream<Uint8Array> | { body: Uint8Array, consumed: boolean }} */
- let stream;
- let source = null;
- let length = null;
- let contentType = null;
- if (object instanceof Blob) {
- stream = object.stream();
- source = object;
- length = object.size;
- if (object.type.length !== 0) {
- contentType = object.type;
- }
- } else if (ArrayBuffer.isView(object) || object instanceof ArrayBuffer) {
- const u8 = ArrayBuffer.isView(object)
- ? new Uint8Array(
- object.buffer,
- object.byteOffset,
- object.byteLength,
- )
- : new Uint8Array(object);
- const copy = u8.slice(0, u8.byteLength);
- source = copy;
- } else if (object instanceof FormData) {
- const res = encodeFormData(object);
- stream = { body: res.body, consumed: false };
- source = object;
- length = res.body.byteLength;
- contentType = res.contentType;
- } else if (object instanceof URLSearchParams) {
- source = encoder.encode(object.toString());
- contentType = "application/x-www-form-urlencoded;charset=UTF-8";
- } else if (typeof object === "string") {
- source = encoder.encode(object);
- contentType = "text/plain;charset=UTF-8";
- } else if (object instanceof ReadableStream) {
- stream = object;
- if (object.locked || isReadableStreamDisturbed(object)) {
- throw new TypeError("ReadableStream is locked or disturbed");
- }
- }
- if (source instanceof Uint8Array) {
- stream = { body: source, consumed: false };
- length = source.byteLength;
- }
- const body = new InnerBody(stream);
- body.source = source;
- body.length = length;
- return { body, contentType };
- }
-
- webidl.converters["BodyInit"] = (V, opts) => {
- // Union for (ReadableStream or Blob or ArrayBufferView or ArrayBuffer or FormData or URLSearchParams or USVString)
- if (V instanceof ReadableStream) {
- // TODO(lucacasonato): ReadableStream is not branded
- return V;
- } else if (V instanceof Blob) {
- return webidl.converters["Blob"](V, opts);
- } else if (V instanceof FormData) {
- return webidl.converters["FormData"](V, opts);
- } else if (V instanceof URLSearchParams) {
- // TODO(lucacasonato): URLSearchParams is not branded
- return V;
- }
- if (typeof V === "object") {
- if (V instanceof ArrayBuffer || V instanceof SharedArrayBuffer) {
- return webidl.converters["ArrayBuffer"](V, opts);
- }
- if (ArrayBuffer.isView(V)) {
- return webidl.converters["ArrayBufferView"](V, opts);
- }
- }
- return webidl.converters["USVString"](V, opts);
- };
- webidl.converters["BodyInit?"] = webidl.createNullableConverter(
- webidl.converters["BodyInit"],
- );
-
- window.__bootstrap.fetchBody = { mixinBody, InnerBody, extractBody };
-})(globalThis);
diff --git a/op_crates/fetch/22_http_client.js b/op_crates/fetch/22_http_client.js
deleted file mode 100644
index 770080cc9..000000000
--- a/op_crates/fetch/22_http_client.js
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// @ts-check
-/// <reference path="../webidl/internal.d.ts" />
-/// <reference path="../web/internal.d.ts" />
-/// <reference path="../url/internal.d.ts" />
-/// <reference path="../file/internal.d.ts" />
-/// <reference path="../file/lib.deno_file.d.ts" />
-/// <reference path="./internal.d.ts" />
-/// <reference path="./11_streams_types.d.ts" />
-/// <reference path="./lib.deno_fetch.d.ts" />
-/// <reference lib="esnext" />
-"use strict";
-
-((window) => {
- const core = window.Deno.core;
-
- /**
- * @param {Deno.CreateHttpClientOptions} options
- * @returns {HttpClient}
- */
- function createHttpClient(options) {
- return new HttpClient(core.opSync("op_create_http_client", options));
- }
-
- class HttpClient {
- /**
- * @param {number} rid
- */
- constructor(rid) {
- this.rid = rid;
- }
- close() {
- core.close(this.rid);
- }
- }
-
- window.__bootstrap.fetch ??= {};
- window.__bootstrap.fetch.createHttpClient = createHttpClient;
- window.__bootstrap.fetch.HttpClient = HttpClient;
-})(globalThis);
diff --git a/op_crates/fetch/23_request.js b/op_crates/fetch/23_request.js
deleted file mode 100644
index 603a37a5f..000000000
--- a/op_crates/fetch/23_request.js
+++ /dev/null
@@ -1,524 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// @ts-check
-/// <reference path="../webidl/internal.d.ts" />
-/// <reference path="../web/internal.d.ts" />
-/// <reference path="../file/internal.d.ts" />
-/// <reference path="../file/lib.deno_file.d.ts" />
-/// <reference path="./internal.d.ts" />
-/// <reference path="./11_streams_types.d.ts" />
-/// <reference path="./lib.deno_fetch.d.ts" />
-/// <reference lib="esnext" />
-"use strict";
-
-((window) => {
- const webidl = window.__bootstrap.webidl;
- const { HTTP_TOKEN_CODE_POINT_RE, byteUpperCase } = window.__bootstrap.infra;
- const { URL } = window.__bootstrap.url;
- const { guardFromHeaders } = window.__bootstrap.headers;
- const { InnerBody, mixinBody, extractBody } = window.__bootstrap.fetchBody;
- const { getLocationHref } = window.__bootstrap.location;
- const mimesniff = window.__bootstrap.mimesniff;
- const {
- headersFromHeaderList,
- headerListFromHeaders,
- fillHeaders,
- getDecodeSplitHeader,
- } = window.__bootstrap.headers;
- const { HttpClient } = window.__bootstrap.fetch;
-
- const _request = Symbol("request");
- const _headers = Symbol("headers");
- const _mimeType = Symbol("mime type");
- const _body = Symbol("body");
-
- /**
- * @typedef InnerRequest
- * @property {string} method
- * @property {() => string} url
- * @property {() => string} currentUrl
- * @property {[string, string][]} headerList
- * @property {null | InnerBody} body
- * @property {"follow" | "error" | "manual"} redirectMode
- * @property {number} redirectCount
- * @property {string[]} urlList
- * @property {number | null} clientRid NOTE: non standard extension for `Deno.HttpClient`.
- */
-
- const defaultInnerRequest = {
- url() {
- return this.urlList[0];
- },
- currentUrl() {
- return this.urlList[this.urlList.length - 1];
- },
- redirectMode: "follow",
- redirectCount: 0,
- clientRid: null,
- };
-
- /**
- * @param {string} method
- * @param {string} url
- * @param {[string, string][]} headerList
- * @param {InnerBody} body
- * @returns
- */
- function newInnerRequest(method, url, headerList = [], body = null) {
- return {
- method: method,
- headerList,
- body,
- urlList: [url],
- ...defaultInnerRequest,
- };
- }
-
- /**
- * https://fetch.spec.whatwg.org/#concept-request-clone
- * @param {InnerRequest} request
- * @returns {InnerRequest}
- */
- function cloneInnerRequest(request) {
- const headerList = [...request.headerList.map((x) => [x[0], x[1]])];
- let body = null;
- if (request.body !== null) {
- body = request.body.clone();
- }
-
- return {
- method: request.method,
- url() {
- return this.urlList[0];
- },
- currentUrl() {
- return this.urlList[this.urlList.length - 1];
- },
- headerList,
- body,
- redirectMode: request.redirectMode,
- redirectCount: request.redirectCount,
- urlList: request.urlList,
- clientRid: request.clientRid,
- };
- }
-
- /**
- * @param {string} m
- * @returns {boolean}
- */
- function isKnownMethod(m) {
- return (
- m === "DELETE" ||
- m === "GET" ||
- m === "HEAD" ||
- m === "OPTIONS" ||
- m === "POST" ||
- m === "PUT"
- );
- }
- /**
- * @param {string} m
- * @returns {string}
- */
- function validateAndNormalizeMethod(m) {
- // Fast path for well-known methods
- if (isKnownMethod(m)) {
- return m;
- }
-
- // Regular path
- if (!HTTP_TOKEN_CODE_POINT_RE.test(m)) {
- throw new TypeError("Method is not valid.");
- }
- const upperCase = byteUpperCase(m);
- if (
- upperCase === "CONNECT" || upperCase === "TRACE" || upperCase === "TRACK"
- ) {
- throw new TypeError("Method is forbidden.");
- }
- return upperCase;
- }
-
- class Request {
- /** @type {InnerRequest} */
- [_request];
- /** @type {Headers} */
- [_headers];
- get [_mimeType]() {
- let charset = null;
- let essence = null;
- let mimeType = null;
- const values = getDecodeSplitHeader(
- headerListFromHeaders(this[_headers]),
- "Content-Type",
- );
- if (values === null) return null;
- for (const value of values) {
- const temporaryMimeType = mimesniff.parseMimeType(value);
- if (
- temporaryMimeType === null ||
- mimesniff.essence(temporaryMimeType) == "*/*"
- ) {
- continue;
- }
- mimeType = temporaryMimeType;
- if (mimesniff.essence(mimeType) !== essence) {
- charset = null;
- const newCharset = mimeType.parameters.get("charset");
- if (newCharset !== undefined) {
- charset = newCharset;
- }
- essence = mimesniff.essence(mimeType);
- } else {
- if (mimeType.parameters.has("charset") === null && charset !== null) {
- mimeType.parameters.set("charset", charset);
- }
- }
- }
- if (mimeType === null) return null;
- return mimeType;
- }
- get [_body]() {
- return this[_request].body;
- }
-
- /**
- * https://fetch.spec.whatwg.org/#dom-request
- * @param {RequestInfo} input
- * @param {RequestInit} init
- */
- constructor(input, init = {}) {
- const prefix = "Failed to construct 'Request'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- input = webidl.converters["RequestInfo"](input, {
- prefix,
- context: "Argument 1",
- });
- init = webidl.converters["RequestInit"](init, {
- prefix,
- context: "Argument 2",
- });
-
- this[webidl.brand] = webidl.brand;
-
- /** @type {InnerRequest} */
- let request;
- const baseURL = getLocationHref();
-
- // 5.
- if (typeof input === "string") {
- const parsedURL = new URL(input, baseURL);
- request = newInnerRequest("GET", parsedURL.href, [], null);
- } else { // 6.
- if (!(input instanceof Request)) throw new TypeError("Unreachable");
- request = input[_request];
- }
-
- // 22.
- if (init.redirect !== undefined) {
- request.redirectMode = init.redirect;
- }
-
- // 25.
- if (init.method !== undefined) {
- let method = init.method;
- method = validateAndNormalizeMethod(method);
- request.method = method;
- }
-
- // NOTE: non standard extension. This handles Deno.HttpClient parameter
- if (init.client !== undefined) {
- if (init.client !== null && !(init.client instanceof HttpClient)) {
- throw webidl.makeException(
- TypeError,
- "`client` must be a Deno.HttpClient",
- { prefix, context: "Argument 2" },
- );
- }
- request.clientRid = init.client?.rid ?? null;
- }
-
- // 27.
- this[_request] = request;
-
- // 29.
- this[_headers] = headersFromHeaderList(request.headerList, "request");
-
- // 31.
- if (Object.keys(init).length > 0) {
- let headers = headerListFromHeaders(this[_headers]).slice(
- 0,
- headerListFromHeaders(this[_headers]).length,
- );
- if (init.headers !== undefined) {
- headers = init.headers;
- }
- headerListFromHeaders(this[_headers]).splice(
- 0,
- headerListFromHeaders(this[_headers]).length,
- );
- fillHeaders(this[_headers], headers);
- }
-
- // 32.
- let inputBody = null;
- if (input instanceof Request) {
- inputBody = input[_body];
- }
-
- // 33.
- if (
- (request.method === "GET" || request.method === "HEAD") &&
- ((init.body !== undefined && init.body !== null) ||
- inputBody !== null)
- ) {
- throw new TypeError("HEAD and GET requests may not have a body.");
- }
-
- // 34.
- let initBody = null;
-
- // 35.
- if (init.body !== undefined && init.body !== null) {
- const res = extractBody(init.body);
- initBody = res.body;
- if (res.contentType !== null && !this[_headers].has("content-type")) {
- this[_headers].append("Content-Type", res.contentType);
- }
- }
-
- // 36.
- const inputOrInitBody = initBody ?? inputBody;
-
- // 38.
- const finalBody = inputOrInitBody;
-
- // 39.
- // TODO(lucacasonato): implement this step. Is it needed?
-
- // 40.
- request.body = finalBody;
- }
-
- get method() {
- webidl.assertBranded(this, Request);
- return this[_request].method;
- }
-
- get url() {
- webidl.assertBranded(this, Request);
- return this[_request].url();
- }
-
- get headers() {
- webidl.assertBranded(this, Request);
- return this[_headers];
- }
-
- get destination() {
- webidl.assertBranded(this, Request);
- throw new TypeError("This property is not implemented.");
- }
-
- get referrer() {
- webidl.assertBranded(this, Request);
- throw new TypeError("This property is not implemented.");
- }
-
- get referrerPolicy() {
- webidl.assertBranded(this, Request);
- throw new TypeError("This property is not implemented.");
- }
-
- get mode() {
- webidl.assertBranded(this, Request);
- throw new TypeError("This property is not implemented.");
- }
-
- get credentials() {
- webidl.assertBranded(this, Request);
- throw new TypeError("This property is not implemented.");
- }
-
- get cache() {
- webidl.assertBranded(this, Request);
- throw new TypeError("This property is not implemented.");
- }
-
- get redirect() {
- webidl.assertBranded(this, Request);
- return this[_request].redirectMode;
- }
-
- get integrity() {
- webidl.assertBranded(this, Request);
- throw new TypeError("This property is not implemented.");
- }
-
- get keepalive() {
- webidl.assertBranded(this, Request);
- throw new TypeError("This property is not implemented.");
- }
-
- get isReloadNavigation() {
- webidl.assertBranded(this, Request);
- throw new TypeError("This property is not implemented.");
- }
-
- get isHistoryNavigation() {
- webidl.assertBranded(this, Request);
- throw new TypeError("This property is not implemented.");
- }
-
- get signal() {
- webidl.assertBranded(this, Request);
- throw new TypeError("This property is not implemented.");
- }
-
- clone() {
- webidl.assertBranded(this, Request);
- if (this[_body] && this[_body].unusable()) {
- throw new TypeError("Body is unusable.");
- }
- const newReq = cloneInnerRequest(this[_request]);
- return fromInnerRequest(newReq, guardFromHeaders(this[_headers]));
- }
-
- get [Symbol.toStringTag]() {
- return "Request";
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- const inner = {
- bodyUsed: this.bodyUsed,
- headers: this.headers,
- method: this.method,
- redirect: this.redirect,
- url: this.url,
- };
- return `Request ${inspect(inner)}`;
- }
- }
-
- mixinBody(Request, _body, _mimeType);
-
- webidl.converters["Request"] = webidl.createInterfaceConverter(
- "Request",
- Request,
- );
- webidl.converters["RequestInfo"] = (V, opts) => {
- // Union for (Request or USVString)
- if (typeof V == "object") {
- if (V instanceof Request) {
- return webidl.converters["Request"](V, opts);
- }
- }
- return webidl.converters["USVString"](V, opts);
- };
-
- webidl.converters["ReferrerPolicy"] = webidl.createEnumConverter(
- "ReferrerPolicy",
- [
- "",
- "no-referrer",
- "no-referrer-when-downgrade",
- "same-origin",
- "origin",
- "strict-origin",
- "origin-when-cross-origin",
- "strict-origin-when-cross-origin",
- "unsafe-url",
- ],
- );
- webidl.converters["RequestMode"] = webidl.createEnumConverter("RequestMode", [
- "navigate",
- "same-origin",
- "no-cors",
- "cors",
- ]);
- webidl.converters["RequestCredentials"] = webidl.createEnumConverter(
- "RequestCredentials",
- [
- "omit",
- "same-origin",
- "include",
- ],
- );
- webidl.converters["RequestCache"] = webidl.createEnumConverter(
- "RequestCache",
- [
- "default",
- "no-store",
- "reload",
- "no-cache",
- "force-cache",
- "only-if-cached",
- ],
- );
- webidl.converters["RequestRedirect"] = webidl.createEnumConverter(
- "RequestRedirect",
- [
- "follow",
- "error",
- "manual",
- ],
- );
- webidl.converters["RequestInit"] = webidl.createDictionaryConverter(
- "RequestInit",
- [
- { key: "method", converter: webidl.converters["ByteString"] },
- { key: "headers", converter: webidl.converters["HeadersInit"] },
- {
- key: "body",
- converter: webidl.createNullableConverter(
- webidl.converters["BodyInit"],
- ),
- },
- { key: "referrer", converter: webidl.converters["USVString"] },
- { key: "referrerPolicy", converter: webidl.converters["ReferrerPolicy"] },
- { key: "mode", converter: webidl.converters["RequestMode"] },
- {
- key: "credentials",
- converter: webidl.converters["RequestCredentials"],
- },
- { key: "cache", converter: webidl.converters["RequestCache"] },
- { key: "redirect", converter: webidl.converters["RequestRedirect"] },
- { key: "integrity", converter: webidl.converters["DOMString"] },
- { key: "keepalive", converter: webidl.converters["boolean"] },
- {
- key: "signal",
- converter: webidl.createNullableConverter(
- webidl.converters["AbortSignal"],
- ),
- },
- { key: "client", converter: webidl.converters.any },
- ],
- );
-
- /**
- * @param {Request} request
- * @returns {InnerRequest}
- */
- function toInnerRequest(request) {
- return request[_request];
- }
-
- /**
- * @param {InnerRequest} inner
- * @param {"request" | "immutable" | "request-no-cors" | "response" | "none"} guard
- * @returns {Request}
- */
- function fromInnerRequest(inner, guard) {
- const request = webidl.createBranded(Request);
- request[_request] = inner;
- request[_headers] = headersFromHeaderList(inner.headerList, guard);
- return request;
- }
-
- window.__bootstrap.fetch ??= {};
- window.__bootstrap.fetch.Request = Request;
- window.__bootstrap.fetch.toInnerRequest = toInnerRequest;
- window.__bootstrap.fetch.fromInnerRequest = fromInnerRequest;
- window.__bootstrap.fetch.newInnerRequest = newInnerRequest;
-})(globalThis);
diff --git a/op_crates/fetch/23_response.js b/op_crates/fetch/23_response.js
deleted file mode 100644
index 6bd7a6487..000000000
--- a/op_crates/fetch/23_response.js
+++ /dev/null
@@ -1,415 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// @ts-check
-/// <reference path="../webidl/internal.d.ts" />
-/// <reference path="../web/internal.d.ts" />
-/// <reference path="../url/internal.d.ts" />
-/// <reference path="../file/internal.d.ts" />
-/// <reference path="../file/lib.deno_file.d.ts" />
-/// <reference path="./internal.d.ts" />
-/// <reference path="./11_streams_types.d.ts" />
-/// <reference path="./lib.deno_fetch.d.ts" />
-/// <reference lib="esnext" />
-"use strict";
-
-((window) => {
- const webidl = window.__bootstrap.webidl;
- const { HTTP_TAB_OR_SPACE, regexMatcher } = window.__bootstrap.infra;
- const { InnerBody, extractBody, mixinBody } = window.__bootstrap.fetchBody;
- const { getLocationHref } = window.__bootstrap.location;
- const mimesniff = window.__bootstrap.mimesniff;
- const { URL } = window.__bootstrap.url;
- const {
- getDecodeSplitHeader,
- headerListFromHeaders,
- headersFromHeaderList,
- guardFromHeaders,
- fillHeaders,
- } = window.__bootstrap.headers;
-
- const VCHAR = ["\x21-\x7E"];
- const OBS_TEXT = ["\x80-\xFF"];
-
- const REASON_PHRASE = [...HTTP_TAB_OR_SPACE, ...VCHAR, ...OBS_TEXT];
- const REASON_PHRASE_MATCHER = regexMatcher(REASON_PHRASE);
- const REASON_PHRASE_RE = new RegExp(`^[${REASON_PHRASE_MATCHER}]*$`);
-
- const _response = Symbol("response");
- const _headers = Symbol("headers");
- const _mimeType = Symbol("mime type");
- const _body = Symbol("body");
-
- /**
- * @typedef InnerResponse
- * @property {"basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect"} type
- * @property {() => string | null} url
- * @property {string[]} urlList
- * @property {number} status
- * @property {string} statusMessage
- * @property {[string, string][]} headerList
- * @property {null | InnerBody} body
- * @property {string} [error]
- */
-
- /**
- * @param {number} status
- * @returns {boolean}
- */
- function nullBodyStatus(status) {
- return status === 101 || status === 204 || status === 205 || status === 304;
- }
-
- /**
- * @param {number} status
- * @returns {boolean}
- */
- function redirectStatus(status) {
- return status === 301 || status === 302 || status === 303 ||
- status === 307 || status === 308;
- }
-
- /**
- * https://fetch.spec.whatwg.org/#concept-response-clone
- * @param {InnerResponse} response
- * @returns {InnerResponse}
- */
- function cloneInnerResponse(response) {
- const urlList = [...response.urlList];
- const headerList = [...response.headerList.map((x) => [x[0], x[1]])];
- let body = null;
- if (response.body !== null) {
- body = response.body.clone();
- }
-
- return {
- type: response.type,
- body,
- headerList,
- url() {
- if (this.urlList.length == 0) return null;
- return this.urlList[this.urlList.length - 1];
- },
- urlList,
- status: response.status,
- statusMessage: response.statusMessage,
- };
- }
-
- const defaultInnerResponse = {
- type: "default",
- body: null,
- url() {
- if (this.urlList.length == 0) return null;
- return this.urlList[this.urlList.length - 1];
- },
- };
-
- /**
- * @returns {InnerResponse}
- */
- function newInnerResponse(status = 200, statusMessage = "") {
- return {
- headerList: [],
- urlList: [],
- status,
- statusMessage,
- ...defaultInnerResponse,
- };
- }
-
- /**
- * @param {string} error
- * @returns {InnerResponse}
- */
- function networkError(error) {
- const resp = newInnerResponse(0);
- resp.type = "error";
- resp.error = error;
- return resp;
- }
-
- class Response {
- /** @type {InnerResponse} */
- [_response];
- /** @type {Headers} */
- [_headers];
- get [_mimeType]() {
- let charset = null;
- let essence = null;
- let mimeType = null;
- const values = getDecodeSplitHeader(
- headerListFromHeaders(this[_headers]),
- "Content-Type",
- );
- if (values === null) return null;
- for (const value of values) {
- const temporaryMimeType = mimesniff.parseMimeType(value);
- if (
- temporaryMimeType === null ||
- mimesniff.essence(temporaryMimeType) == "*/*"
- ) {
- continue;
- }
- mimeType = temporaryMimeType;
- if (mimesniff.essence(mimeType) !== essence) {
- charset = null;
- const newCharset = mimeType.parameters.get("charset");
- if (newCharset !== undefined) {
- charset = newCharset;
- }
- essence = mimesniff.essence(mimeType);
- } else {
- if (mimeType.parameters.has("charset") === null && charset !== null) {
- mimeType.parameters.set("charset", charset);
- }
- }
- }
- if (mimeType === null) return null;
- return mimeType;
- }
- get [_body]() {
- return this[_response].body;
- }
-
- /**
- * @returns {Response}
- */
- static error() {
- const inner = newInnerResponse(0);
- inner.type = "error";
- const response = webidl.createBranded(Response);
- response[_response] = inner;
- response[_headers] = headersFromHeaderList(
- response[_response].headerList,
- "immutable",
- );
- return response;
- }
-
- /**
- * @param {string} url
- * @param {number} status
- * @returns {Response}
- */
- static redirect(url, status = 302) {
- const prefix = "Failed to call 'Response.redirect'";
- url = webidl.converters["USVString"](url, {
- prefix,
- context: "Argument 1",
- });
- status = webidl.converters["unsigned short"](status, {
- prefix,
- context: "Argument 2",
- });
-
- const baseURL = getLocationHref();
- const parsedURL = new URL(url, baseURL);
- if (!redirectStatus(status)) {
- throw new RangeError("Invalid redirect status code.");
- }
- const inner = newInnerResponse(status);
- inner.type = "default";
- inner.headerList.push(["Location", parsedURL.href]);
- const response = webidl.createBranded(Response);
- response[_response] = inner;
- response[_headers] = headersFromHeaderList(
- response[_response].headerList,
- "immutable",
- );
- return response;
- }
-
- /**
- * @param {BodyInit | null} body
- * @param {ResponseInit} init
- */
- constructor(body = null, init = {}) {
- const prefix = "Failed to construct 'Response'";
- body = webidl.converters["BodyInit?"](body, {
- prefix,
- context: "Argument 1",
- });
- init = webidl.converters["ResponseInit"](init, {
- prefix,
- context: "Argument 2",
- });
-
- if (init.status < 200 || init.status > 599) {
- throw new RangeError(
- `The status provided (${init.status}) is outside the range [200, 599].`,
- );
- }
-
- if (!REASON_PHRASE_RE.test(init.statusText)) {
- throw new TypeError("Status text is not valid.");
- }
-
- this[webidl.brand] = webidl.brand;
- const response = newInnerResponse(init.status, init.statusText);
- this[_response] = response;
- this[_headers] = headersFromHeaderList(response.headerList, "response");
- if (init.headers !== undefined) {
- fillHeaders(this[_headers], init.headers);
- }
- if (body !== null) {
- if (nullBodyStatus(response.status)) {
- throw new TypeError(
- "Response with null body status cannot have body",
- );
- }
- const res = extractBody(body);
- response.body = res.body;
- if (res.contentType !== null && !this[_headers].has("content-type")) {
- this[_headers].append("Content-Type", res.contentType);
- }
- }
- }
-
- /**
- * @returns {"basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect"}
- */
- get type() {
- webidl.assertBranded(this, Response);
- return this[_response].type;
- }
-
- /**
- * @returns {string}
- */
- get url() {
- webidl.assertBranded(this, Response);
- const url = this[_response].url();
- if (url === null) return "";
- const newUrl = new URL(url);
- newUrl.hash = "";
- return newUrl.href;
- }
-
- /**
- * @returns {boolean}
- */
- get redirected() {
- webidl.assertBranded(this, Response);
- return this[_response].urlList.length > 1;
- }
-
- /**
- * @returns {number}
- */
- get status() {
- webidl.assertBranded(this, Response);
- return this[_response].status;
- }
-
- /**
- * @returns {boolean}
- */
- get ok() {
- webidl.assertBranded(this, Response);
- const status = this[_response].status;
- return status >= 200 && status <= 299;
- }
-
- /**
- * @returns {string}
- */
- get statusText() {
- webidl.assertBranded(this, Response);
- return this[_response].statusMessage;
- }
-
- /**
- * @returns {Headers}
- */
- get headers() {
- webidl.assertBranded(this, Response);
- return this[_headers];
- }
-
- /**
- * @returns {Response}
- */
- clone() {
- webidl.assertBranded(this, Response);
- if (this[_body] && this[_body].unusable()) {
- throw new TypeError("Body is unusable.");
- }
- const second = webidl.createBranded(Response);
- const newRes = cloneInnerResponse(this[_response]);
- second[_response] = newRes;
- second[_headers] = headersFromHeaderList(
- newRes.headerList,
- guardFromHeaders(this[_headers]),
- );
- return second;
- }
-
- get [Symbol.toStringTag]() {
- return "Response";
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- const inner = {
- body: this.body,
- bodyUsed: this.bodyUsed,
- headers: this.headers,
- ok: this.ok,
- redirected: this.redirected,
- status: this.status,
- statusText: this.statusText,
- url: this.url,
- };
- return `Response ${inspect(inner)}`;
- }
- }
-
- mixinBody(Response, _body, _mimeType);
-
- webidl.converters["Response"] = webidl.createInterfaceConverter(
- "Response",
- Response,
- );
- webidl.converters["ResponseInit"] = webidl.createDictionaryConverter(
- "ResponseInit",
- [{
- key: "status",
- defaultValue: 200,
- converter: webidl.converters["unsigned short"],
- }, {
- key: "statusText",
- defaultValue: "",
- converter: webidl.converters["ByteString"],
- }, {
- key: "headers",
- converter: webidl.converters["HeadersInit"],
- }],
- );
-
- /**
- * @param {Response} response
- * @returns {InnerResponse}
- */
- function toInnerResponse(response) {
- return response[_response];
- }
-
- /**
- * @param {InnerResponse} inner
- * @param {"request" | "immutable" | "request-no-cors" | "response" | "none"} guard
- * @returns {Response}
- */
- function fromInnerResponse(inner, guard) {
- const response = webidl.createBranded(Response);
- response[_response] = inner;
- response[_headers] = headersFromHeaderList(inner.headerList, guard);
- return response;
- }
-
- window.__bootstrap.fetch ??= {};
- window.__bootstrap.fetch.Response = Response;
- window.__bootstrap.fetch.toInnerResponse = toInnerResponse;
- window.__bootstrap.fetch.fromInnerResponse = fromInnerResponse;
- window.__bootstrap.fetch.redirectStatus = redirectStatus;
- window.__bootstrap.fetch.nullBodyStatus = nullBodyStatus;
- window.__bootstrap.fetch.networkError = networkError;
-})(globalThis);
diff --git a/op_crates/fetch/26_fetch.js b/op_crates/fetch/26_fetch.js
deleted file mode 100644
index cd86d6023..000000000
--- a/op_crates/fetch/26_fetch.js
+++ /dev/null
@@ -1,307 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// @ts-check
-/// <reference path="../../core/lib.deno_core.d.ts" />
-/// <reference path="../web/internal.d.ts" />
-/// <reference path="../url/internal.d.ts" />
-/// <reference path="../web/lib.deno_web.d.ts" />
-/// <reference path="./11_streams_types.d.ts" />
-/// <reference path="./internal.d.ts" />
-/// <reference path="./lib.deno_fetch.d.ts" />
-/// <reference lib="esnext" />
-"use strict";
-
-((window) => {
- const core = window.Deno.core;
- const webidl = window.__bootstrap.webidl;
- const { byteLowerCase } = window.__bootstrap.infra;
- const { InnerBody, extractBody } = window.__bootstrap.fetchBody;
- const {
- toInnerRequest,
- fromInnerResponse,
- redirectStatus,
- nullBodyStatus,
- networkError,
- } = window.__bootstrap.fetch;
-
- const REQUEST_BODY_HEADER_NAMES = [
- "content-encoding",
- "content-language",
- "content-location",
- "content-type",
- ];
-
- /**
- * @param {{ method: string, url: string, headers: [string, string][], clientRid: number | null, hasBody: boolean }} args
- * @param {Uint8Array | null} body
- * @returns {{ requestRid: number, requestBodyRid: number | null }}
- */
- function opFetch(args, body) {
- return core.opSync("op_fetch", args, body);
- }
-
- /**
- * @param {number} rid
- * @returns {Promise<{ status: number, statusText: string, headers: [string, string][], url: string, responseRid: number }>}
- */
- function opFetchSend(rid) {
- return core.opAsync("op_fetch_send", rid);
- }
-
- /**
- * @param {number} rid
- * @param {Uint8Array} body
- * @returns {Promise<void>}
- */
- function opFetchRequestWrite(rid, body) {
- return core.opAsync("op_fetch_request_write", rid, body);
- }
-
- /**
- * @param {number} rid
- * @param {Uint8Array} body
- * @returns {Promise<number>}
- */
- function opFetchResponseRead(rid, body) {
- return core.opAsync("op_fetch_response_read", rid, body);
- }
-
- /**
- * @param {number} responseBodyRid
- * @returns {ReadableStream<Uint8Array>}
- */
- function createResponseBodyStream(responseBodyRid) {
- return new ReadableStream({
- type: "bytes",
- async pull(controller) {
- try {
- // This is the largest possible size for a single packet on a TLS
- // stream.
- const chunk = new Uint8Array(16 * 1024 + 256);
- const read = await opFetchResponseRead(
- responseBodyRid,
- chunk,
- );
- if (read > 0) {
- // We read some data. Enqueue it onto the stream.
- controller.enqueue(chunk.subarray(0, read));
- } else {
- // We have reached the end of the body, so we close the stream.
- controller.close();
- core.close(responseBodyRid);
- }
- } catch (err) {
- // There was an error while reading a chunk of the body, so we
- // error.
- controller.error(err);
- controller.close();
- core.close(responseBodyRid);
- }
- },
- cancel() {
- core.close(responseBodyRid);
- },
- });
- }
-
- /**
- * @param {InnerRequest} req
- * @param {boolean} recursive
- * @returns {Promise<InnerResponse>}
- */
- async function mainFetch(req, recursive) {
- /** @type {ReadableStream<Uint8Array> | Uint8Array | null} */
- let reqBody = null;
- if (req.body !== null) {
- if (req.body.streamOrStatic instanceof ReadableStream) {
- if (req.body.length === null) {
- reqBody = req.body.stream;
- } else {
- const reader = req.body.stream.getReader();
- const r1 = await reader.read();
- if (r1.done) throw new TypeError("Unreachable");
- reqBody = r1.value;
- const r2 = await reader.read();
- if (!r2.done) throw new TypeError("Unreachable");
- }
- } else {
- req.body.streamOrStatic.consumed = true;
- reqBody = req.body.streamOrStatic.body;
- }
- }
-
- const { requestRid, requestBodyRid } = opFetch({
- method: req.method,
- url: req.currentUrl(),
- headers: req.headerList,
- clientRid: req.clientRid,
- hasBody: reqBody !== null,
- }, reqBody instanceof Uint8Array ? reqBody : null);
-
- if (requestBodyRid !== null) {
- if (reqBody === null || !(reqBody instanceof ReadableStream)) {
- throw new TypeError("Unreachable");
- }
- const reader = reqBody.getReader();
- (async () => {
- while (true) {
- const { value, done } = await reader.read();
- if (done) break;
- if (!(value instanceof Uint8Array)) {
- await reader.cancel("value not a Uint8Array");
- break;
- }
- try {
- await opFetchRequestWrite(requestBodyRid, value);
- } catch (err) {
- await reader.cancel(err);
- break;
- }
- }
- core.close(requestBodyRid);
- })();
- }
-
- const resp = await opFetchSend(requestRid);
- /** @type {InnerResponse} */
- const response = {
- headerList: resp.headers,
- status: resp.status,
- body: null,
- statusMessage: resp.statusText,
- type: "basic",
- url() {
- if (this.urlList.length == 0) return null;
- return this.urlList[this.urlList.length - 1];
- },
- urlList: req.urlList,
- };
- if (redirectStatus(resp.status)) {
- switch (req.redirectMode) {
- case "error":
- core.close(resp.responseRid);
- return networkError(
- "Encountered redirect while redirect mode is set to 'error'",
- );
- case "follow":
- core.close(resp.responseRid);
- return httpRedirectFetch(req, response);
- case "manual":
- break;
- }
- }
-
- if (nullBodyStatus(response.status)) {
- core.close(resp.responseRid);
- } else {
- response.body = new InnerBody(createResponseBodyStream(resp.responseRid));
- }
-
- if (recursive) return response;
-
- if (response.urlList.length === 0) {
- response.urlList = [...req.urlList];
- }
-
- return response;
- }
-
- /**
- * @param {InnerRequest} request
- * @param {InnerResponse} response
- * @returns {Promise<InnerResponse>}
- */
- function httpRedirectFetch(request, response) {
- const locationHeaders = response.headerList.filter((entry) =>
- byteLowerCase(entry[0]) === "location"
- );
- if (locationHeaders.length === 0) {
- return response;
- }
- const locationURL = new URL(
- locationHeaders[0][1],
- response.url() ?? undefined,
- );
- if (locationURL.hash === "") {
- locationURL.hash = request.currentUrl().hash;
- }
- if (locationURL.protocol !== "https:" && locationURL.protocol !== "http:") {
- return networkError("Can not redirect to a non HTTP(s) url");
- }
- if (request.redirectCount === 20) {
- return networkError("Maximum number of redirects (20) reached");
- }
- request.redirectCount++;
- if (
- response.status !== 303 && request.body !== null &&
- request.body.source === null
- ) {
- return networkError(
- "Can not redeliver a streaming request body after a redirect",
- );
- }
- if (
- ((response.status === 301 || response.status === 302) &&
- request.method === "POST") ||
- (response.status === 303 &&
- (request.method !== "GET" && request.method !== "HEAD"))
- ) {
- request.method = "GET";
- request.body = null;
- for (let i = 0; i < request.headerList.length; i++) {
- if (
- REQUEST_BODY_HEADER_NAMES.includes(
- byteLowerCase(request.headerList[i][0]),
- )
- ) {
- request.headerList.splice(i, 1);
- i--;
- }
- }
- }
- if (request.body !== null) {
- const res = extractBody(request.body.source);
- request.body = res.body;
- }
- request.urlList.push(locationURL.href);
- return mainFetch(request, true);
- }
-
- /**
- * @param {RequestInfo} input
- * @param {RequestInit} init
- */
- async function fetch(input, init = {}) {
- const prefix = "Failed to call 'fetch'";
- input = webidl.converters["RequestInfo"](input, {
- prefix,
- context: "Argument 1",
- });
- init = webidl.converters["RequestInit"](init, {
- prefix,
- context: "Argument 2",
- });
-
- // 1.
- const requestObject = new Request(input, init);
- // 2.
- const request = toInnerRequest(requestObject);
- // 10.
- if (!requestObject.headers.has("Accept")) {
- request.headerList.push(["Accept", "*/*"]);
- }
-
- // 12.
- const response = await mainFetch(request, false);
- if (response.type === "error") {
- throw new TypeError(
- "Fetch failed: " + (response.error ?? "unknown error"),
- );
- }
-
- return fromInnerResponse(response, "immutable");
- }
-
- window.__bootstrap.fetch ??= {};
- window.__bootstrap.fetch.fetch = fetch;
-})(this);
diff --git a/op_crates/fetch/Cargo.toml b/op_crates/fetch/Cargo.toml
deleted file mode 100644
index d2ed10714..000000000
--- a/op_crates/fetch/Cargo.toml
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-[package]
-name = "deno_fetch"
-version = "0.27.0"
-edition = "2018"
-description = "Fetch API implementation for Deno"
-authors = ["the Deno authors"]
-license = "MIT"
-readme = "README.md"
-repository = "https://github.com/denoland/deno"
-
-[lib]
-path = "lib.rs"
-
-[dependencies]
-bytes = "1.0.1"
-data-url = "0.1.0"
-deno_core = { version = "0.86.0", path = "../../core" }
-deno_file = { version = "0.4.0", path = "../file" }
-http = "0.2.3"
-reqwest = { version = "0.11.2", default-features = false, features = ["rustls-tls", "stream", "gzip", "brotli"] }
-serde = { version = "1.0.125", features = ["derive"] }
-tokio = { version = "1.4.0", features = ["full"] }
-tokio-stream = "0.1.5"
-tokio-util = "0.6.5"
diff --git a/op_crates/fetch/README.md b/op_crates/fetch/README.md
deleted file mode 100644
index 2c946197e..000000000
--- a/op_crates/fetch/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# deno_fetch
-
-This crate implements the Fetch API.
-
-Spec: https://fetch.spec.whatwg.org/
diff --git a/op_crates/fetch/internal.d.ts b/op_crates/fetch/internal.d.ts
deleted file mode 100644
index 86de52761..000000000
--- a/op_crates/fetch/internal.d.ts
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// deno-lint-ignore-file no-explicit-any
-
-/// <reference no-default-lib="true" />
-/// <reference lib="esnext" />
-
-declare namespace globalThis {
- declare namespace __bootstrap {
- declare var fetchUtil: {
- requiredArguments(name: string, length: number, required: number): void;
- };
-
- declare var domIterable: {
- DomIterableMixin(base: any, dataSymbol: symbol): any;
- };
-
- declare namespace headers {
- class Headers {
- }
- type HeaderList = [string, string][];
- function headersFromHeaderList(
- list: HeaderList,
- guard:
- | "immutable"
- | "request"
- | "request-no-cors"
- | "response"
- | "none",
- ): Headers;
- function headerListFromHeaders(headers: Headers): HeaderList;
- function fillHeaders(headers: Headers, object: HeadersInit): void;
- function getDecodeSplitHeader(
- list: HeaderList,
- name: string,
- ): string[] | null;
- function guardFromHeaders(
- headers: Headers,
- ): "immutable" | "request" | "request-no-cors" | "response" | "none";
- }
-
- declare namespace formData {
- declare type FormData = typeof FormData;
- declare function encodeFormData(formdata: FormData): {
- body: Uint8Array;
- contentType: string;
- };
- declare function parseFormData(
- body: Uint8Array,
- boundary: string | undefined,
- ): FormData;
- declare function formDataFromEntries(entries: FormDataEntry[]): FormData;
- }
-
- declare var streams: {
- ReadableStream: typeof ReadableStream;
- isReadableStreamDisturbed(stream: ReadableStream): boolean;
- };
-
- declare namespace fetchBody {
- function mixinBody(
- prototype: any,
- bodySymbol: symbol,
- mimeTypeSymbol: symbol,
- ): void;
- class InnerBody {
- constructor(stream?: ReadableStream<Uint8Array>);
- stream: ReadableStream<Uint8Array>;
- source: null | Uint8Array | Blob | FormData;
- length: null | number;
- unusable(): boolean;
- consume(): Promise<Uint8Array>;
- clone(): InnerBody;
- }
- function extractBody(object: BodyInit): {
- body: InnerBody;
- contentType: string | null;
- };
- }
-
- declare namespace fetch {
- function toInnerRequest(request: Request): InnerRequest;
- function fromInnerRequest(
- inner: InnerRequest,
- guard:
- | "request"
- | "immutable"
- | "request-no-cors"
- | "response"
- | "none",
- ): Request;
- function redirectStatus(status: number): boolean;
- function nullBodyStatus(status: number): boolean;
- function newInnerRequest(
- method: string,
- url: any,
- headerList?: [string, string][],
- body?: globalThis.__bootstrap.fetchBody.InnerBody,
- ): InnerResponse;
- function toInnerResponse(response: Response): InnerResponse;
- function fromInnerResponse(
- inner: InnerResponse,
- guard:
- | "request"
- | "immutable"
- | "request-no-cors"
- | "response"
- | "none",
- ): Response;
- function networkError(error: string): InnerResponse;
- }
- }
-}
diff --git a/op_crates/fetch/lib.deno_fetch.d.ts b/op_crates/fetch/lib.deno_fetch.d.ts
deleted file mode 100644
index af21d8c44..000000000
--- a/op_crates/fetch/lib.deno_fetch.d.ts
+++ /dev/null
@@ -1,708 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// deno-lint-ignore-file no-explicit-any
-
-/// <reference no-default-lib="true" />
-/// <reference lib="esnext" />
-
-interface DomIterable<K, V> {
- keys(): IterableIterator<K>;
- values(): IterableIterator<V>;
- entries(): IterableIterator<[K, V]>;
- [Symbol.iterator](): IterableIterator<[K, V]>;
- forEach(
- callback: (value: V, key: K, parent: this) => void,
- thisArg?: any,
- ): void;
-}
-
-interface ReadableStreamReadDoneResult<T> {
- done: true;
- value?: T;
-}
-
-interface ReadableStreamReadValueResult<T> {
- done: false;
- value: T;
-}
-
-type ReadableStreamReadResult<T> =
- | ReadableStreamReadValueResult<T>
- | ReadableStreamReadDoneResult<T>;
-
-interface ReadableStreamDefaultReader<R = any> {
- readonly closed: Promise<void>;
- cancel(reason?: any): Promise<void>;
- read(): Promise<ReadableStreamReadResult<R>>;
- releaseLock(): void;
-}
-
-declare var ReadableStreamDefaultReader: {
- prototype: ReadableStreamDefaultReader;
- new <R>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>;
-};
-
-interface ReadableStreamReader<R = any> {
- cancel(): Promise<void>;
- read(): Promise<ReadableStreamReadResult<R>>;
- releaseLock(): void;
-}
-
-declare var ReadableStreamReader: {
- prototype: ReadableStreamReader;
- new (): ReadableStreamReader;
-};
-
-interface ReadableByteStreamControllerCallback {
- (controller: ReadableByteStreamController): void | PromiseLike<void>;
-}
-
-interface UnderlyingByteSource {
- autoAllocateChunkSize?: number;
- cancel?: ReadableStreamErrorCallback;
- pull?: ReadableByteStreamControllerCallback;
- start?: ReadableByteStreamControllerCallback;
- type: "bytes";
-}
-
-interface UnderlyingSink<W = any> {
- abort?: WritableStreamErrorCallback;
- close?: WritableStreamDefaultControllerCloseCallback;
- start?: WritableStreamDefaultControllerStartCallback;
- type?: undefined;
- write?: WritableStreamDefaultControllerWriteCallback<W>;
-}
-
-interface UnderlyingSource<R = any> {
- cancel?: ReadableStreamErrorCallback;
- pull?: ReadableStreamDefaultControllerCallback<R>;
- start?: ReadableStreamDefaultControllerCallback<R>;
- type?: undefined;
-}
-
-interface ReadableStreamErrorCallback {
- (reason: any): void | PromiseLike<void>;
-}
-
-interface ReadableStreamDefaultControllerCallback<R> {
- (controller: ReadableStreamDefaultController<R>): void | PromiseLike<void>;
-}
-
-interface ReadableStreamDefaultController<R = any> {
- readonly desiredSize: number | null;
- close(): void;
- enqueue(chunk: R): void;
- error(error?: any): void;
-}
-
-declare var ReadableStreamDefaultController: {
- prototype: ReadableStreamDefaultController;
- new (): ReadableStreamDefaultController;
-};
-
-interface ReadableByteStreamController {
- readonly byobRequest: undefined;
- readonly desiredSize: number | null;
- close(): void;
- enqueue(chunk: ArrayBufferView): void;
- error(error?: any): void;
-}
-
-declare var ReadableByteStreamController: {
- prototype: ReadableByteStreamController;
- new (): ReadableByteStreamController;
-};
-
-interface PipeOptions {
- preventAbort?: boolean;
- preventCancel?: boolean;
- preventClose?: boolean;
- signal?: AbortSignal;
-}
-
-interface QueuingStrategySizeCallback<T = any> {
- (chunk: T): number;
-}
-
-interface QueuingStrategy<T = any> {
- highWaterMark?: number;
- size?: QueuingStrategySizeCallback<T>;
-}
-
-/** This Streams API interface provides a built-in byte length queuing strategy
- * that can be used when constructing streams. */
-declare class CountQueuingStrategy implements QueuingStrategy {
- constructor(options: { highWaterMark: number });
- highWaterMark: number;
- size(chunk: any): 1;
-}
-
-declare class ByteLengthQueuingStrategy
- implements QueuingStrategy<ArrayBufferView> {
- constructor(options: { highWaterMark: number });
- highWaterMark: number;
- size(chunk: ArrayBufferView): number;
-}
-
-/** This Streams API interface represents a readable stream of byte data. The
- * Fetch API offers a concrete instance of a ReadableStream through the body
- * property of a Response object. */
-interface ReadableStream<R = any> {
- readonly locked: boolean;
- cancel(reason?: any): Promise<void>;
- /**
- * @deprecated This is no longer part of the Streams standard and the async
- * iterable should be obtained by just using the stream as an
- * async iterator.
- */
- getIterator(options?: { preventCancel?: boolean }): AsyncIterableIterator<R>;
- getReader(): ReadableStreamDefaultReader<R>;
- pipeThrough<T>(
- { writable, readable }: {
- writable: WritableStream<R>;
- readable: ReadableStream<T>;
- },
- options?: PipeOptions,
- ): ReadableStream<T>;
- pipeTo(dest: WritableStream<R>, options?: PipeOptions): Promise<void>;
- tee(): [ReadableStream<R>, ReadableStream<R>];
- [Symbol.asyncIterator](options?: {
- preventCancel?: boolean;
- }): AsyncIterableIterator<R>;
-}
-
-declare var ReadableStream: {
- prototype: ReadableStream;
- new (
- underlyingSource: UnderlyingByteSource,
- strategy?: { highWaterMark?: number; size?: undefined },
- ): ReadableStream<Uint8Array>;
- new <R = any>(
- underlyingSource?: UnderlyingSource<R>,
- strategy?: QueuingStrategy<R>,
- ): ReadableStream<R>;
-};
-
-interface WritableStreamDefaultControllerCloseCallback {
- (): void | PromiseLike<void>;
-}
-
-interface WritableStreamDefaultControllerStartCallback {
- (controller: WritableStreamDefaultController): void | PromiseLike<void>;
-}
-
-interface WritableStreamDefaultControllerWriteCallback<W> {
- (chunk: W, controller: WritableStreamDefaultController):
- | void
- | PromiseLike<
- void
- >;
-}
-
-interface WritableStreamErrorCallback {
- (reason: any): void | PromiseLike<void>;
-}
-
-/** This Streams API interface provides a standard abstraction for writing
- * streaming data to a destination, known as a sink. This object comes with
- * built-in backpressure and queuing. */
-interface WritableStream<W = any> {
- readonly locked: boolean;
- abort(reason?: any): Promise<void>;
- getWriter(): WritableStreamDefaultWriter<W>;
-}
-
-declare var WritableStream: {
- prototype: WritableStream;
- new <W = any>(
- underlyingSink?: UnderlyingSink<W>,
- strategy?: QueuingStrategy<W>,
- ): WritableStream<W>;
-};
-
-/** This Streams API interface represents a controller allowing control of a
- * WritableStream's state. When constructing a WritableStream, the underlying
- * sink is given a corresponding WritableStreamDefaultController instance to
- * manipulate. */
-interface WritableStreamDefaultController {
- error(error?: any): void;
-}
-
-/** This Streams API interface is the object returned by
- * WritableStream.getWriter() and once created locks the < writer to the
- * WritableStream ensuring that no other streams can write to the underlying
- * sink. */
-interface WritableStreamDefaultWriter<W = any> {
- readonly closed: Promise<void>;
- readonly desiredSize: number | null;
- readonly ready: Promise<void>;
- abort(reason?: any): Promise<void>;
- close(): Promise<void>;
- releaseLock(): void;
- write(chunk: W): Promise<void>;
-}
-
-declare var WritableStreamDefaultWriter: {
- prototype: WritableStreamDefaultWriter;
- new (): WritableStreamDefaultWriter;
-};
-
-interface TransformStream<I = any, O = any> {
- readonly readable: ReadableStream<O>;
- readonly writable: WritableStream<I>;
-}
-
-declare var TransformStream: {
- prototype: TransformStream;
- new <I = any, O = any>(
- transformer?: Transformer<I, O>,
- writableStrategy?: QueuingStrategy<I>,
- readableStrategy?: QueuingStrategy<O>,
- ): TransformStream<I, O>;
-};
-
-interface TransformStreamDefaultController<O = any> {
- readonly desiredSize: number | null;
- enqueue(chunk: O): void;
- error(reason?: any): void;
- terminate(): void;
-}
-
-interface Transformer<I = any, O = any> {
- flush?: TransformStreamDefaultControllerCallback<O>;
- readableType?: undefined;
- start?: TransformStreamDefaultControllerCallback<O>;
- transform?: TransformStreamDefaultControllerTransformCallback<I, O>;
- writableType?: undefined;
-}
-
-interface TransformStreamDefaultControllerCallback<O> {
- (controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
-}
-
-interface TransformStreamDefaultControllerTransformCallback<I, O> {
- (
- chunk: I,
- controller: TransformStreamDefaultController<O>,
- ): void | PromiseLike<void>;
-}
-
-type FormDataEntryValue = File | string;
-
-/** Provides a way to easily construct a set of key/value pairs representing
- * form fields and their values, which can then be easily sent using the
- * XMLHttpRequest.send() method. It uses the same format a form would use if the
- * encoding type were set to "multipart/form-data". */
-declare class FormData implements DomIterable<string, FormDataEntryValue> {
- // TODO(ry) FormData constructor is non-standard.
- // new(form?: HTMLFormElement): FormData;
- constructor();
-
- append(name: string, value: string | Blob, fileName?: string): void;
- delete(name: string): void;
- get(name: string): FormDataEntryValue | null;
- getAll(name: string): FormDataEntryValue[];
- has(name: string): boolean;
- set(name: string, value: string | Blob, fileName?: string): void;
- keys(): IterableIterator<string>;
- values(): IterableIterator<string>;
- entries(): IterableIterator<[string, FormDataEntryValue]>;
- [Symbol.iterator](): IterableIterator<[string, FormDataEntryValue]>;
- forEach(
- callback: (value: FormDataEntryValue, key: string, parent: this) => void,
- thisArg?: any,
- ): void;
-}
-
-interface Body {
- /** A simple getter used to expose a `ReadableStream` of the body contents. */
- readonly body: ReadableStream<Uint8Array> | null;
- /** Stores a `Boolean` that declares whether the body has been used in a
- * response yet.
- */
- readonly bodyUsed: boolean;
- /** Takes a `Response` stream and reads it to completion. It returns a promise
- * that resolves with an `ArrayBuffer`.
- */
- arrayBuffer(): Promise<ArrayBuffer>;
- /** Takes a `Response` stream and reads it to completion. It returns a promise
- * that resolves with a `Blob`.
- */
- blob(): Promise<Blob>;
- /** Takes a `Response` stream and reads it to completion. It returns a promise
- * that resolves with a `FormData` object.
- */
- formData(): Promise<FormData>;
- /** Takes a `Response` stream and reads it to completion. It returns a promise
- * that resolves with the result of parsing the body text as JSON.
- */
- json(): Promise<any>;
- /** Takes a `Response` stream and reads it to completion. It returns a promise
- * that resolves with a `USVString` (text).
- */
- text(): Promise<string>;
-}
-
-type HeadersInit = Headers | string[][] | Record<string, string>;
-
-/** This Fetch API interface allows you to perform various actions on HTTP
- * request and response headers. These actions include retrieving, setting,
- * adding to, and removing. A Headers object has an associated header list,
- * which is initially empty and consists of zero or more name and value pairs.
- * You can add to this using methods like append() (see Examples). In all
- * methods of this interface, header names are matched by case-insensitive byte
- * sequence. */
-interface Headers {
- append(name: string, value: string): void;
- delete(name: string): void;
- get(name: string): string | null;
- has(name: string): boolean;
- set(name: string, value: string): void;
- forEach(
- callbackfn: (value: string, key: string, parent: Headers) => void,
- thisArg?: any,
- ): void;
-}
-
-declare class Headers implements DomIterable<string, string> {
- constructor(init?: HeadersInit);
-
- /** Appends a new value onto an existing header inside a `Headers` object, or
- * adds the header if it does not already exist.
- */
- append(name: string, value: string): void;
- /** Deletes a header from a `Headers` object. */
- delete(name: string): void;
- /** Returns an iterator allowing to go through all key/value pairs
- * contained in this Headers object. The both the key and value of each pairs
- * are ByteString objects.
- */
- entries(): IterableIterator<[string, string]>;
- /** Returns a `ByteString` sequence of all the values of a header within a
- * `Headers` object with a given name.
- */
- get(name: string): string | null;
- /** Returns a boolean stating whether a `Headers` object contains a certain
- * header.
- */
- has(name: string): boolean;
- /** Returns an iterator allowing to go through all keys contained in
- * this Headers object. The keys are ByteString objects.
- */
- keys(): IterableIterator<string>;
- /** Sets a new value for an existing header inside a Headers object, or adds
- * the header if it does not already exist.
- */
- set(name: string, value: string): void;
- /** Returns an iterator allowing to go through all values contained in
- * this Headers object. The values are ByteString objects.
- */
- values(): IterableIterator<string>;
- forEach(
- callbackfn: (value: string, key: string, parent: this) => void,
- thisArg?: any,
- ): void;
- /** The Symbol.iterator well-known symbol specifies the default
- * iterator for this Headers object
- */
- [Symbol.iterator](): IterableIterator<[string, string]>;
-}
-
-type RequestInfo = Request | string;
-type RequestCache =
- | "default"
- | "force-cache"
- | "no-cache"
- | "no-store"
- | "only-if-cached"
- | "reload";
-type RequestCredentials = "include" | "omit" | "same-origin";
-type RequestMode = "cors" | "navigate" | "no-cors" | "same-origin";
-type RequestRedirect = "error" | "follow" | "manual";
-type ReferrerPolicy =
- | ""
- | "no-referrer"
- | "no-referrer-when-downgrade"
- | "origin"
- | "origin-when-cross-origin"
- | "same-origin"
- | "strict-origin"
- | "strict-origin-when-cross-origin"
- | "unsafe-url";
-type BodyInit =
- | Blob
- | BufferSource
- | FormData
- | URLSearchParams
- | ReadableStream<Uint8Array>
- | string;
-type RequestDestination =
- | ""
- | "audio"
- | "audioworklet"
- | "document"
- | "embed"
- | "font"
- | "image"
- | "manifest"
- | "object"
- | "paintworklet"
- | "report"
- | "script"
- | "sharedworker"
- | "style"
- | "track"
- | "video"
- | "worker"
- | "xslt";
-
-interface RequestInit {
- /**
- * A BodyInit object or null to set request's body.
- */
- body?: BodyInit | null;
- /**
- * A string indicating how the request will interact with the browser's cache
- * to set request's cache.
- */
- cache?: RequestCache;
- /**
- * A string indicating whether credentials will be sent with the request
- * always, never, or only when sent to a same-origin URL. Sets request's
- * credentials.
- */
- credentials?: RequestCredentials;
- /**
- * A Headers object, an object literal, or an array of two-item arrays to set
- * request's headers.
- */
- headers?: HeadersInit;
- /**
- * A cryptographic hash of the resource to be fetched by request. Sets
- * request's integrity.
- */
- integrity?: string;
- /**
- * A boolean to set request's keepalive.
- */
- keepalive?: boolean;
- /**
- * A string to set request's method.
- */
- method?: string;
- /**
- * A string to indicate whether the request will use CORS, or will be
- * restricted to same-origin URLs. Sets request's mode.
- */
- mode?: RequestMode;
- /**
- * A string indicating whether request follows redirects, results in an error
- * upon encountering a redirect, or returns the redirect (in an opaque
- * fashion). Sets request's redirect.
- */
- redirect?: RequestRedirect;
- /**
- * A string whose value is a same-origin URL, "about:client", or the empty
- * string, to set request's referrer.
- */
- referrer?: string;
- /**
- * A referrer policy to set request's referrerPolicy.
- */
- referrerPolicy?: ReferrerPolicy;
- /**
- * An AbortSignal to set request's signal.
- */
- signal?: AbortSignal | null;
- /**
- * Can only be null. Used to disassociate request from any Window.
- */
- window?: any;
-}
-
-/** This Fetch API interface represents a resource request. */
-declare class Request implements Body {
- constructor(input: RequestInfo, init?: RequestInit);
-
- /**
- * Returns the cache mode associated with request, which is a string
- * indicating how the request will interact with the browser's cache when
- * fetching.
- */
- readonly cache: RequestCache;
- /**
- * Returns the credentials mode associated with request, which is a string
- * indicating whether credentials will be sent with the request always, never,
- * or only when sent to a same-origin URL.
- */
- readonly credentials: RequestCredentials;
- /**
- * Returns the kind of resource requested by request, e.g., "document" or "script".
- */
- readonly destination: RequestDestination;
- /**
- * Returns a Headers object consisting of the headers associated with request.
- * Note that headers added in the network layer by the user agent will not be
- * accounted for in this object, e.g., the "Host" header.
- */
- readonly headers: Headers;
- /**
- * Returns request's subresource integrity metadata, which is a cryptographic
- * hash of the resource being fetched. Its value consists of multiple hashes
- * separated by whitespace. [SRI]
- */
- readonly integrity: string;
- /**
- * Returns a boolean indicating whether or not request is for a history
- * navigation (a.k.a. back-forward navigation).
- */
- readonly isHistoryNavigation: boolean;
- /**
- * Returns a boolean indicating whether or not request is for a reload
- * navigation.
- */
- readonly isReloadNavigation: boolean;
- /**
- * Returns a boolean indicating whether or not request can outlive the global
- * in which it was created.
- */
- readonly keepalive: boolean;
- /**
- * Returns request's HTTP method, which is "GET" by default.
- */
- readonly method: string;
- /**
- * Returns the mode associated with request, which is a string indicating
- * whether the request will use CORS, or will be restricted to same-origin
- * URLs.
- */
- readonly mode: RequestMode;
- /**
- * Returns the redirect mode associated with request, which is a string
- * indicating how redirects for the request will be handled during fetching. A
- * request will follow redirects by default.
- */
- readonly redirect: RequestRedirect;
- /**
- * Returns the referrer of request. Its value can be a same-origin URL if
- * explicitly set in init, the empty string to indicate no referrer, and
- * "about:client" when defaulting to the global's default. This is used during
- * fetching to determine the value of the `Referer` header of the request
- * being made.
- */
- readonly referrer: string;
- /**
- * Returns the referrer policy associated with request. This is used during
- * fetching to compute the value of the request's referrer.
- */
- readonly referrerPolicy: ReferrerPolicy;
- /**
- * Returns the signal associated with request, which is an AbortSignal object
- * indicating whether or not request has been aborted, and its abort event
- * handler.
- */
- readonly signal: AbortSignal;
- /**
- * Returns the URL of request as a string.
- */
- readonly url: string;
- clone(): Request;
-
- /** A simple getter used to expose a `ReadableStream` of the body contents. */
- readonly body: ReadableStream<Uint8Array> | null;
- /** Stores a `Boolean` that declares whether the body has been used in a
- * response yet.
- */
- readonly bodyUsed: boolean;
- /** Takes a `Response` stream and reads it to completion. It returns a promise
- * that resolves with an `ArrayBuffer`.
- */
- arrayBuffer(): Promise<ArrayBuffer>;
- /** Takes a `Response` stream and reads it to completion. It returns a promise
- * that resolves with a `Blob`.
- */
- blob(): Promise<Blob>;
- /** Takes a `Response` stream and reads it to completion. It returns a promise
- * that resolves with a `FormData` object.
- */
- formData(): Promise<FormData>;
- /** Takes a `Response` stream and reads it to completion. It returns a promise
- * that resolves with the result of parsing the body text as JSON.
- */
- json(): Promise<any>;
- /** Takes a `Response` stream and reads it to completion. It returns a promise
- * that resolves with a `USVString` (text).
- */
- text(): Promise<string>;
-}
-
-interface ResponseInit {
- headers?: HeadersInit;
- status?: number;
- statusText?: string;
-}
-
-type ResponseType =
- | "basic"
- | "cors"
- | "default"
- | "error"
- | "opaque"
- | "opaqueredirect";
-
-/** This Fetch API interface represents the response to a request. */
-declare class Response implements Body {
- constructor(body?: BodyInit | null, init?: ResponseInit);
- static error(): Response;
- static redirect(url: string, status?: number): Response;
-
- readonly headers: Headers;
- readonly ok: boolean;
- readonly redirected: boolean;
- readonly status: number;
- readonly statusText: string;
- readonly trailer: Promise<Headers>;
- readonly type: ResponseType;
- readonly url: string;
- clone(): Response;
-
- /** A simple getter used to expose a `ReadableStream` of the body contents. */
- readonly body: ReadableStream<Uint8Array> | null;
- /** Stores a `Boolean` that declares whether the body has been used in a
- * response yet.
- */
- readonly bodyUsed: boolean;
- /** Takes a `Response` stream and reads it to completion. It returns a promise
- * that resolves with an `ArrayBuffer`.
- */
- arrayBuffer(): Promise<ArrayBuffer>;
- /** Takes a `Response` stream and reads it to completion. It returns a promise
- * that resolves with a `Blob`.
- */
- blob(): Promise<Blob>;
- /** Takes a `Response` stream and reads it to completion. It returns a promise
- * that resolves with a `FormData` object.
- */
- formData(): Promise<FormData>;
- /** Takes a `Response` stream and reads it to completion. It returns a promise
- * that resolves with the result of parsing the body text as JSON.
- */
- json(): Promise<any>;
- /** Takes a `Response` stream and reads it to completion. It returns a promise
- * that resolves with a `USVString` (text).
- */
- text(): Promise<string>;
-}
-
-/** Fetch a resource from the network. It returns a Promise that resolves to the
- * Response to that request, whether it is successful or not.
- *
- * const response = await fetch("http://my.json.host/data.json");
- * console.log(response.status); // e.g. 200
- * console.log(response.statusText); // e.g. "OK"
- * const jsonData = await response.json();
- */
-declare function fetch(
- input: Request | URL | string,
- init?: RequestInit,
-): Promise<Response>;
diff --git a/op_crates/fetch/lib.rs b/op_crates/fetch/lib.rs
deleted file mode 100644
index 861fc6e54..000000000
--- a/op_crates/fetch/lib.rs
+++ /dev/null
@@ -1,497 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::error::bad_resource_id;
-use deno_core::error::generic_error;
-use deno_core::error::null_opbuf;
-use deno_core::error::type_error;
-use deno_core::error::AnyError;
-use deno_core::futures::Future;
-use deno_core::futures::Stream;
-use deno_core::futures::StreamExt;
-use deno_core::include_js_files;
-use deno_core::op_async;
-use deno_core::op_sync;
-use deno_core::url::Url;
-use deno_core::AsyncRefCell;
-use deno_core::CancelFuture;
-use deno_core::CancelHandle;
-use deno_core::CancelTryFuture;
-use deno_core::Extension;
-use deno_core::OpState;
-use deno_core::RcRef;
-use deno_core::Resource;
-use deno_core::ResourceId;
-use deno_core::ZeroCopyBuf;
-
-use data_url::DataUrl;
-use deno_file::BlobUrlStore;
-use reqwest::header::HeaderMap;
-use reqwest::header::HeaderName;
-use reqwest::header::HeaderValue;
-use reqwest::header::USER_AGENT;
-use reqwest::redirect::Policy;
-use reqwest::Body;
-use reqwest::Client;
-use reqwest::Method;
-use reqwest::Response;
-use serde::Deserialize;
-use serde::Serialize;
-use std::borrow::Cow;
-use std::cell::RefCell;
-use std::convert::From;
-use std::fs::File;
-use std::io::Read;
-use std::path::Path;
-use std::path::PathBuf;
-use std::pin::Pin;
-use std::rc::Rc;
-use tokio::io::AsyncReadExt;
-use tokio::sync::mpsc;
-use tokio_stream::wrappers::ReceiverStream;
-use tokio_util::io::StreamReader;
-
-pub use reqwest; // Re-export reqwest
-
-pub fn init<P: FetchPermissions + 'static>(
- user_agent: String,
- ca_data: Option<Vec<u8>>,
-) -> Extension {
- Extension::builder()
- .js(include_js_files!(
- prefix "deno:op_crates/fetch",
- "01_fetch_util.js",
- "11_streams.js",
- "20_headers.js",
- "21_formdata.js",
- "22_body.js",
- "22_http_client.js",
- "23_request.js",
- "23_response.js",
- "26_fetch.js",
- ))
- .ops(vec![
- ("op_fetch", op_sync(op_fetch::<P>)),
- ("op_fetch_send", op_async(op_fetch_send)),
- ("op_fetch_request_write", op_async(op_fetch_request_write)),
- ("op_fetch_response_read", op_async(op_fetch_response_read)),
- ("op_create_http_client", op_sync(op_create_http_client::<P>)),
- ])
- .state(move |state| {
- state.put::<reqwest::Client>({
- create_http_client(user_agent.clone(), ca_data.clone()).unwrap()
- });
- state.put::<HttpClientDefaults>(HttpClientDefaults {
- ca_data: ca_data.clone(),
- user_agent: user_agent.clone(),
- });
- Ok(())
- })
- .build()
-}
-
-pub struct HttpClientDefaults {
- pub user_agent: String,
- pub ca_data: Option<Vec<u8>>,
-}
-
-pub trait FetchPermissions {
- fn check_net_url(&mut self, _url: &Url) -> Result<(), AnyError>;
- fn check_read(&mut self, _p: &Path) -> Result<(), AnyError>;
-}
-
-/// For use with `op_fetch` when the user does not want permissions.
-pub struct NoFetchPermissions;
-
-impl FetchPermissions for NoFetchPermissions {
- fn check_net_url(&mut self, _url: &Url) -> Result<(), AnyError> {
- Ok(())
- }
-
- fn check_read(&mut self, _p: &Path) -> Result<(), AnyError> {
- Ok(())
- }
-}
-
-pub fn get_declaration() -> PathBuf {
- PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("lib.deno_fetch.d.ts")
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct FetchArgs {
- method: String,
- url: String,
- headers: Vec<(String, String)>,
- client_rid: Option<u32>,
- has_body: bool,
-}
-
-#[derive(Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct FetchReturn {
- request_rid: ResourceId,
- request_body_rid: Option<ResourceId>,
-}
-
-pub fn op_fetch<FP>(
- state: &mut OpState,
- args: FetchArgs,
- data: Option<ZeroCopyBuf>,
-) -> Result<FetchReturn, AnyError>
-where
- FP: FetchPermissions + 'static,
-{
- let client = if let Some(rid) = args.client_rid {
- let r = state
- .resource_table
- .get::<HttpClientResource>(rid)
- .ok_or_else(bad_resource_id)?;
- r.client.clone()
- } else {
- let client = state.borrow::<reqwest::Client>();
- client.clone()
- };
-
- let method = Method::from_bytes(args.method.as_bytes())?;
- let url = Url::parse(&args.url)?;
-
- // Check scheme before asking for net permission
- let scheme = url.scheme();
- let (request_rid, request_body_rid) = match scheme {
- "http" | "https" => {
- let permissions = state.borrow_mut::<FP>();
- permissions.check_net_url(&url)?;
-
- let mut request = client.request(method, url);
-
- let request_body_rid = if args.has_body {
- match data {
- None => {
- // If no body is passed, we return a writer for streaming the body.
- let (tx, rx) = mpsc::channel::<std::io::Result<Vec<u8>>>(1);
- request = request.body(Body::wrap_stream(ReceiverStream::new(rx)));
-
- let request_body_rid =
- state.resource_table.add(FetchRequestBodyResource {
- body: AsyncRefCell::new(tx),
- cancel: CancelHandle::default(),
- });
-
- Some(request_body_rid)
- }
- Some(data) => {
- // If a body is passed, we use it, and don't return a body for streaming.
- request = request.body(Vec::from(&*data));
- None
- }
- }
- } else {
- None
- };
-
- for (key, value) in args.headers {
- let name = HeaderName::from_bytes(key.as_bytes()).unwrap();
- let v = HeaderValue::from_str(&value).unwrap();
- request = request.header(name, v);
- }
-
- let fut = request.send();
-
- let request_rid = state
- .resource_table
- .add(FetchRequestResource(Box::pin(fut)));
-
- (request_rid, request_body_rid)
- }
- "data" => {
- let data_url = DataUrl::process(url.as_str())
- .map_err(|e| type_error(format!("{:?}", e)))?;
-
- let (body, _) = data_url
- .decode_to_vec()
- .map_err(|e| type_error(format!("{:?}", e)))?;
-
- let response = http::Response::builder()
- .status(http::StatusCode::OK)
- .header(http::header::CONTENT_TYPE, data_url.mime_type().to_string())
- .body(reqwest::Body::from(body))?;
-
- let fut = async move { Ok(Response::from(response)) };
-
- let request_rid = state
- .resource_table
- .add(FetchRequestResource(Box::pin(fut)));
-
- (request_rid, None)
- }
- "blob" => {
- let blob_url_storage =
- state.try_borrow::<BlobUrlStore>().ok_or_else(|| {
- type_error("Blob URLs are not supported in this context.")
- })?;
-
- let blob = blob_url_storage
- .get(url)?
- .ok_or_else(|| type_error("Blob for the given URL not found."))?;
-
- if method != "GET" {
- return Err(type_error("Blob URL fetch only supports GET method."));
- }
-
- let response = http::Response::builder()
- .status(http::StatusCode::OK)
- .header(http::header::CONTENT_LENGTH, blob.data.len())
- .header(http::header::CONTENT_TYPE, blob.media_type)
- .body(reqwest::Body::from(blob.data))?;
-
- let fut = async move { Ok(Response::from(response)) };
-
- let request_rid = state
- .resource_table
- .add(FetchRequestResource(Box::pin(fut)));
-
- (request_rid, None)
- }
- _ => return Err(type_error(format!("scheme '{}' not supported", scheme))),
- };
-
- Ok(FetchReturn {
- request_rid,
- request_body_rid,
- })
-}
-
-#[derive(Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct FetchResponse {
- status: u16,
- status_text: String,
- headers: Vec<(String, String)>,
- url: String,
- response_rid: ResourceId,
-}
-
-pub async fn op_fetch_send(
- state: Rc<RefCell<OpState>>,
- rid: ResourceId,
- _data: Option<ZeroCopyBuf>,
-) -> Result<FetchResponse, AnyError> {
- let request = state
- .borrow_mut()
- .resource_table
- .take::<FetchRequestResource>(rid)
- .ok_or_else(bad_resource_id)?;
-
- let request = Rc::try_unwrap(request)
- .ok()
- .expect("multiple op_fetch_send ongoing");
-
- let res = match request.0.await {
- Ok(res) => res,
- Err(e) => return Err(type_error(e.to_string())),
- };
-
- //debug!("Fetch response {}", url);
- let status = res.status();
- let url = res.url().to_string();
- let mut res_headers = Vec::new();
- for (key, val) in res.headers().iter() {
- let key_string = key.to_string();
-
- if val.as_bytes().is_ascii() {
- res_headers.push((key_string, val.to_str().unwrap().to_owned()))
- } else {
- res_headers.push((
- key_string,
- val
- .as_bytes()
- .iter()
- .map(|&c| c as char)
- .collect::<String>(),
- ));
- }
- }
-
- let stream: BytesStream = Box::pin(res.bytes_stream().map(|r| {
- r.map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))
- }));
- let stream_reader = StreamReader::new(stream);
- let rid = state
- .borrow_mut()
- .resource_table
- .add(FetchResponseBodyResource {
- reader: AsyncRefCell::new(stream_reader),
- cancel: CancelHandle::default(),
- });
-
- Ok(FetchResponse {
- status: status.as_u16(),
- status_text: status.canonical_reason().unwrap_or("").to_string(),
- headers: res_headers,
- url,
- response_rid: rid,
- })
-}
-
-pub async fn op_fetch_request_write(
- state: Rc<RefCell<OpState>>,
- rid: ResourceId,
- data: Option<ZeroCopyBuf>,
-) -> Result<(), AnyError> {
- let data = data.ok_or_else(null_opbuf)?;
- let buf = Vec::from(&*data);
-
- let resource = state
- .borrow()
- .resource_table
- .get::<FetchRequestBodyResource>(rid)
- .ok_or_else(bad_resource_id)?;
- let body = RcRef::map(&resource, |r| &r.body).borrow_mut().await;
- let cancel = RcRef::map(resource, |r| &r.cancel);
- body.send(Ok(buf)).or_cancel(cancel).await??;
-
- Ok(())
-}
-
-pub async fn op_fetch_response_read(
- state: Rc<RefCell<OpState>>,
- rid: ResourceId,
- data: Option<ZeroCopyBuf>,
-) -> Result<usize, AnyError> {
- let data = data.ok_or_else(null_opbuf)?;
-
- let resource = state
- .borrow()
- .resource_table
- .get::<FetchResponseBodyResource>(rid)
- .ok_or_else(bad_resource_id)?;
- let mut reader = RcRef::map(&resource, |r| &r.reader).borrow_mut().await;
- let cancel = RcRef::map(resource, |r| &r.cancel);
- let mut buf = data.clone();
- let read = reader.read(&mut buf).try_or_cancel(cancel).await?;
- Ok(read)
-}
-
-struct FetchRequestResource(
- Pin<Box<dyn Future<Output = Result<Response, reqwest::Error>>>>,
-);
-
-impl Resource for FetchRequestResource {
- fn name(&self) -> Cow<str> {
- "fetchRequest".into()
- }
-}
-
-struct FetchRequestBodyResource {
- body: AsyncRefCell<mpsc::Sender<std::io::Result<Vec<u8>>>>,
- cancel: CancelHandle,
-}
-
-impl Resource for FetchRequestBodyResource {
- fn name(&self) -> Cow<str> {
- "fetchRequestBody".into()
- }
-}
-
-type BytesStream =
- Pin<Box<dyn Stream<Item = Result<bytes::Bytes, std::io::Error>> + Unpin>>;
-
-struct FetchResponseBodyResource {
- reader: AsyncRefCell<StreamReader<BytesStream, bytes::Bytes>>,
- cancel: CancelHandle,
-}
-
-impl Resource for FetchResponseBodyResource {
- fn name(&self) -> Cow<str> {
- "fetchResponseBody".into()
- }
-}
-
-struct HttpClientResource {
- client: Client,
-}
-
-impl Resource for HttpClientResource {
- fn name(&self) -> Cow<str> {
- "httpClient".into()
- }
-}
-
-impl HttpClientResource {
- fn new(client: Client) -> Self {
- Self { client }
- }
-}
-
-#[derive(Deserialize, Default, Debug)]
-#[serde(rename_all = "camelCase")]
-#[serde(default)]
-pub struct CreateHttpClientOptions {
- ca_file: Option<String>,
- ca_data: Option<String>,
-}
-
-pub fn op_create_http_client<FP>(
- state: &mut OpState,
- args: CreateHttpClientOptions,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<ResourceId, AnyError>
-where
- FP: FetchPermissions + 'static,
-{
- if let Some(ca_file) = args.ca_file.clone() {
- let permissions = state.borrow_mut::<FP>();
- permissions.check_read(&PathBuf::from(ca_file))?;
- }
-
- let defaults = state.borrow::<HttpClientDefaults>();
-
- let cert_data =
- get_cert_data(args.ca_file.as_deref(), args.ca_data.as_deref())?;
- let client = create_http_client(
- defaults.user_agent.clone(),
- cert_data.or_else(|| defaults.ca_data.clone()),
- )
- .unwrap();
-
- let rid = state.resource_table.add(HttpClientResource::new(client));
- Ok(rid)
-}
-
-fn get_cert_data(
- ca_file: Option<&str>,
- ca_data: Option<&str>,
-) -> Result<Option<Vec<u8>>, AnyError> {
- if let Some(ca_data) = ca_data {
- Ok(Some(ca_data.as_bytes().to_vec()))
- } else if let Some(ca_file) = ca_file {
- let mut buf = Vec::new();
- File::open(ca_file)?.read_to_end(&mut buf)?;
- Ok(Some(buf))
- } else {
- Ok(None)
- }
-}
-
-/// Create new instance of async reqwest::Client. This client supports
-/// proxies and doesn't follow redirects.
-pub fn create_http_client(
- user_agent: String,
- ca_data: Option<Vec<u8>>,
-) -> Result<Client, AnyError> {
- let mut headers = HeaderMap::new();
- headers.insert(USER_AGENT, user_agent.parse().unwrap());
- let mut builder = Client::builder()
- .redirect(Policy::none())
- .default_headers(headers)
- .use_rustls_tls();
-
- if let Some(ca_data) = ca_data {
- let cert = reqwest::Certificate::from_pem(&ca_data)?;
- builder = builder.add_root_certificate(cert);
- }
-
- builder
- .build()
- .map_err(|e| generic_error(format!("Unable to build http client: {}", e)))
-}
diff --git a/op_crates/file/01_file.js b/op_crates/file/01_file.js
deleted file mode 100644
index 05c410572..000000000
--- a/op_crates/file/01_file.js
+++ /dev/null
@@ -1,412 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// @ts-check
-/// <reference no-default-lib="true" />
-/// <reference path="../../core/lib.deno_core.d.ts" />
-/// <reference path="../webidl/internal.d.ts" />
-/// <reference path="../web/internal.d.ts" />
-/// <reference path="../web/lib.deno_web.d.ts" />
-/// <reference path="./internal.d.ts" />
-/// <reference path="./lib.deno_file.d.ts" />
-/// <reference lib="esnext" />
-"use strict";
-
-((window) => {
- const webidl = window.__bootstrap.webidl;
-
- // TODO(lucacasonato): this needs to not be hardcoded and instead depend on
- // host os.
- const isWindows = false;
-
- /**
- * @param {string} input
- * @param {number} position
- * @returns {{result: string, position: number}}
- */
- function collectCodepointsNotCRLF(input, position) {
- // See https://w3c.github.io/FileAPI/#convert-line-endings-to-native and
- // https://infra.spec.whatwg.org/#collect-a-sequence-of-code-points
- const start = position;
- for (
- let c = input.charAt(position);
- position < input.length && !(c === "\r" || c === "\n");
- c = input.charAt(++position)
- );
- return { result: input.slice(start, position), position };
- }
-
- /**
- * @param {string} s
- * @returns {string}
- */
- function convertLineEndingsToNative(s) {
- const nativeLineEnding = isWindows ? "\r\n" : "\n";
-
- let { result, position } = collectCodepointsNotCRLF(s, 0);
-
- while (position < s.length) {
- const codePoint = s.charAt(position);
- if (codePoint === "\r") {
- result += nativeLineEnding;
- position++;
- if (position < s.length && s.charAt(position) === "\n") {
- position++;
- }
- } else if (codePoint === "\n") {
- position++;
- result += nativeLineEnding;
- }
- const { result: token, position: newPosition } = collectCodepointsNotCRLF(
- s,
- position,
- );
- position = newPosition;
- result += token;
- }
-
- return result;
- }
-
- /**
- * @param {...Uint8Array} bytesArrays
- * @returns {Uint8Array}
- */
- function concatUint8Arrays(...bytesArrays) {
- let byteLength = 0;
- for (const bytes of bytesArrays) {
- byteLength += bytes.byteLength;
- }
- const finalBytes = new Uint8Array(byteLength);
- let current = 0;
- for (const bytes of bytesArrays) {
- finalBytes.set(bytes, current);
- current += bytes.byteLength;
- }
- return finalBytes;
- }
-
- const utf8Encoder = new TextEncoder();
- const utf8Decoder = new TextDecoder();
-
- /** @typedef {BufferSource | Blob | string} BlobPart */
-
- /**
- * @param {BlobPart[]} parts
- * @param {string} endings
- * @returns {Uint8Array}
- */
- function processBlobParts(parts, endings) {
- /** @type {Uint8Array[]} */
- const bytesArrays = [];
- for (const element of parts) {
- if (element instanceof ArrayBuffer) {
- bytesArrays.push(new Uint8Array(element.slice(0)));
- } else if (ArrayBuffer.isView(element)) {
- const buffer = element.buffer.slice(
- element.byteOffset,
- element.byteOffset + element.byteLength,
- );
- bytesArrays.push(new Uint8Array(buffer));
- } else if (element instanceof Blob) {
- bytesArrays.push(
- new Uint8Array(element[_byteSequence].buffer.slice(0)),
- );
- } else if (typeof element === "string") {
- let s = element;
- if (endings == "native") {
- s = convertLineEndingsToNative(s);
- }
- bytesArrays.push(utf8Encoder.encode(s));
- } else {
- throw new TypeError("Unreachable code (invalild element type)");
- }
- }
- return concatUint8Arrays(...bytesArrays);
- }
-
- /**
- * @param {string} str
- * @returns {string}
- */
- function normalizeType(str) {
- let normalizedType = str;
- if (!/^[\x20-\x7E]*$/.test(str)) {
- normalizedType = "";
- }
- return normalizedType.toLowerCase();
- }
-
- const _byteSequence = Symbol("[[ByteSequence]]");
-
- class Blob {
- get [Symbol.toStringTag]() {
- return "Blob";
- }
-
- /** @type {string} */
- #type;
-
- /** @type {Uint8Array} */
- [_byteSequence];
-
- /**
- * @param {BlobPart[]} blobParts
- * @param {BlobPropertyBag} options
- */
- constructor(blobParts = [], options = {}) {
- const prefix = "Failed to construct 'Blob'";
- blobParts = webidl.converters["sequence<BlobPart>"](blobParts, {
- context: "Argument 1",
- prefix,
- });
- options = webidl.converters["BlobPropertyBag"](options, {
- context: "Argument 2",
- prefix,
- });
-
- this[webidl.brand] = webidl.brand;
-
- /** @type {Uint8Array} */
- this[_byteSequence] = processBlobParts(
- blobParts,
- options.endings,
- );
- this.#type = normalizeType(options.type);
- }
-
- /** @returns {number} */
- get size() {
- webidl.assertBranded(this, Blob);
- return this[_byteSequence].byteLength;
- }
-
- /** @returns {string} */
- get type() {
- webidl.assertBranded(this, Blob);
- return this.#type;
- }
-
- /**
- * @param {number} [start]
- * @param {number} [end]
- * @param {string} [contentType]
- * @returns {Blob}
- */
- slice(start, end, contentType) {
- webidl.assertBranded(this, Blob);
- const prefix = "Failed to execute 'slice' on 'Blob'";
- if (start !== undefined) {
- start = webidl.converters["long long"](start, {
- clamp: true,
- context: "Argument 1",
- prefix,
- });
- }
- if (end !== undefined) {
- end = webidl.converters["long long"](end, {
- clamp: true,
- context: "Argument 2",
- prefix,
- });
- }
- if (contentType !== undefined) {
- contentType = webidl.converters["DOMString"](contentType, {
- context: "Argument 3",
- prefix,
- });
- }
-
- const O = this;
- /** @type {number} */
- let relativeStart;
- if (start === undefined) {
- relativeStart = 0;
- } else {
- if (start < 0) {
- relativeStart = Math.max(O.size + start, 0);
- } else {
- relativeStart = Math.min(start, O.size);
- }
- }
- /** @type {number} */
- let relativeEnd;
- if (end === undefined) {
- relativeEnd = O.size;
- } else {
- if (end < 0) {
- relativeEnd = Math.max(O.size + end, 0);
- } else {
- relativeEnd = Math.min(end, O.size);
- }
- }
- /** @type {string} */
- let relativeContentType;
- if (contentType === undefined) {
- relativeContentType = "";
- } else {
- relativeContentType = normalizeType(contentType);
- }
- return new Blob([
- O[_byteSequence].buffer.slice(relativeStart, relativeEnd),
- ], { type: relativeContentType });
- }
-
- /**
- * @returns {ReadableStream<Uint8Array>}
- */
- stream() {
- webidl.assertBranded(this, Blob);
- const bytes = this[_byteSequence];
- const stream = new ReadableStream({
- type: "bytes",
- /** @param {ReadableByteStreamController} controller */
- start(controller) {
- const chunk = new Uint8Array(bytes.buffer.slice(0));
- if (chunk.byteLength > 0) controller.enqueue(chunk);
- controller.close();
- },
- });
- return stream;
- }
-
- /**
- * @returns {Promise<string>}
- */
- async text() {
- webidl.assertBranded(this, Blob);
- const buffer = await this.arrayBuffer();
- return utf8Decoder.decode(buffer);
- }
-
- /**
- * @returns {Promise<ArrayBuffer>}
- */
- async arrayBuffer() {
- webidl.assertBranded(this, Blob);
- const stream = this.stream();
- let bytes = new Uint8Array();
- for await (const chunk of stream) {
- bytes = concatUint8Arrays(bytes, chunk);
- }
- return bytes.buffer;
- }
- }
-
- webidl.converters["Blob"] = webidl.createInterfaceConverter("Blob", Blob);
- webidl.converters["BlobPart"] = (V, opts) => {
- // Union for ((ArrayBuffer or ArrayBufferView) or Blob or USVString)
- if (typeof V == "object") {
- if (V instanceof Blob) {
- return webidl.converters["Blob"](V, opts);
- }
- if (V instanceof ArrayBuffer || V instanceof SharedArrayBuffer) {
- return webidl.converters["ArrayBuffer"](V, opts);
- }
- if (ArrayBuffer.isView(V)) {
- return webidl.converters["ArrayBufferView"](V, opts);
- }
- }
- return webidl.converters["USVString"](V, opts);
- };
- webidl.converters["sequence<BlobPart>"] = webidl.createSequenceConverter(
- webidl.converters["BlobPart"],
- );
- webidl.converters["EndingType"] = webidl.createEnumConverter("EndingType", [
- "transparent",
- "native",
- ]);
- const blobPropertyBagDictionary = [
- {
- key: "type",
- converter: webidl.converters["DOMString"],
- defaultValue: "",
- },
- {
- key: "endings",
- converter: webidl.converters["EndingType"],
- defaultValue: "transparent",
- },
- ];
- webidl.converters["BlobPropertyBag"] = webidl.createDictionaryConverter(
- "BlobPropertyBag",
- blobPropertyBagDictionary,
- );
-
- const _Name = Symbol("[[Name]]");
- const _LastModfied = Symbol("[[LastModified]]");
-
- class File extends Blob {
- get [Symbol.toStringTag]() {
- return "File";
- }
-
- /** @type {string} */
- [_Name];
- /** @type {number} */
- [_LastModfied];
-
- /**
- * @param {BlobPart[]} fileBits
- * @param {string} fileName
- * @param {FilePropertyBag} options
- */
- constructor(fileBits, fileName, options = {}) {
- const prefix = "Failed to construct 'File'";
- webidl.requiredArguments(arguments.length, 2, { prefix });
-
- fileBits = webidl.converters["sequence<BlobPart>"](fileBits, {
- context: "Argument 1",
- prefix,
- });
- fileName = webidl.converters["USVString"](fileName, {
- context: "Argument 2",
- prefix,
- });
- options = webidl.converters["FilePropertyBag"](options, {
- context: "Argument 3",
- prefix,
- });
-
- super(fileBits, options);
-
- /** @type {string} */
- this[_Name] = fileName.replaceAll("/", ":");
- if (options.lastModified === undefined) {
- /** @type {number} */
- this[_LastModfied] = new Date().getTime();
- } else {
- /** @type {number} */
- this[_LastModfied] = options.lastModified;
- }
- }
-
- /** @returns {string} */
- get name() {
- webidl.assertBranded(this, File);
- return this[_Name];
- }
-
- /** @returns {number} */
- get lastModified() {
- webidl.assertBranded(this, File);
- return this[_LastModfied];
- }
- }
-
- webidl.converters["FilePropertyBag"] = webidl.createDictionaryConverter(
- "FilePropertyBag",
- blobPropertyBagDictionary,
- [
- {
- key: "lastModified",
- converter: webidl.converters["long long"],
- },
- ],
- );
-
- window.__bootstrap.file = {
- Blob,
- _byteSequence,
- File,
- };
-})(this);
diff --git a/op_crates/file/02_filereader.js b/op_crates/file/02_filereader.js
deleted file mode 100644
index 9575ab85a..000000000
--- a/op_crates/file/02_filereader.js
+++ /dev/null
@@ -1,414 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// @ts-check
-/// <reference no-default-lib="true" />
-/// <reference path="../../core/lib.deno_core.d.ts" />
-/// <reference path="../webidl/internal.d.ts" />
-/// <reference path="../web/internal.d.ts" />
-/// <reference path="../web/lib.deno_web.d.ts" />
-/// <reference path="./internal.d.ts" />
-/// <reference path="./lib.deno_file.d.ts" />
-/// <reference lib="esnext" />
-
-"use strict";
-
-((window) => {
- const webidl = window.__bootstrap.webidl;
- const { decode } = window.__bootstrap.encoding;
- const { parseMimeType } = window.__bootstrap.mimesniff;
- const base64 = window.__bootstrap.base64;
-
- const state = Symbol("[[state]]");
- const result = Symbol("[[result]]");
- const error = Symbol("[[error]]");
- const aborted = Symbol("[[aborted]]");
-
- class FileReader extends EventTarget {
- get [Symbol.toStringTag]() {
- return "FileReader";
- }
-
- /** @type {"empty" | "loading" | "done"} */
- [state] = "empty";
- /** @type {null | string | ArrayBuffer} */
- [result] = null;
- /** @type {null | DOMException} */
- [error] = null;
-
- [aborted] = false;
-
- /**
- * @param {Blob} blob
- * @param {{kind: "ArrayBuffer" | "Text" | "DataUrl" | "BinaryString", encoding?: string}} readtype
- */
- #readOperation = (blob, readtype) => {
- // 1. If fr’s state is "loading", throw an InvalidStateError DOMException.
- if (this[state] === "loading") {
- throw new DOMException(
- "Invalid FileReader state.",
- "InvalidStateError",
- );
- }
- // 2. Set fr’s state to "loading".
- this[state] = "loading";
- // 3. Set fr’s result to null.
- this[result] = null;
- // 4. Set fr’s error to null.
- this[error] = null;
-
- // 5. Let stream be the result of calling get stream on blob.
- const stream /*: ReadableStream<ArrayBufferView>*/ = blob.stream();
-
- // 6. Let reader be the result of getting a reader from stream.
- const reader = stream.getReader();
-
- // 7. Let bytes be an empty byte sequence.
- /** @type {Uint8Array[]} */
- const chunks = [];
-
- // 8. Let chunkPromise be the result of reading a chunk from stream with reader.
- let chunkPromise = reader.read();
-
- // 9. Let isFirstChunk be true.
- let isFirstChunk = true;
-
- // 10 in parallel while true
- (async () => {
- while (!this[aborted]) {
- // 1. Wait for chunkPromise to be fulfilled or rejected.
- try {
- const chunk = await chunkPromise;
- if (this[aborted]) return;
-
- // 2. If chunkPromise is fulfilled, and isFirstChunk is true, queue a task to fire a progress event called loadstart at fr.
- if (isFirstChunk) {
- // TODO(lucacasonato): this is wrong, should be HTML "queue a task"
- queueMicrotask(() => {
- if (this[aborted]) return;
- // fire a progress event for loadstart
- const ev = new ProgressEvent("loadstart", {});
- this.dispatchEvent(ev);
- });
- }
- // 3. Set isFirstChunk to false.
- isFirstChunk = false;
-
- // 4. If chunkPromise is fulfilled with an object whose done property is false
- // and whose value property is a Uint8Array object, run these steps:
- if (!chunk.done && chunk.value instanceof Uint8Array) {
- chunks.push(chunk.value);
-
- // TODO(bartlomieju): (only) If roughly 50ms have passed since last progress
- {
- const size = chunks.reduce((p, i) => p + i.byteLength, 0);
- const ev = new ProgressEvent("progress", {
- loaded: size,
- });
- // TODO(lucacasonato): this is wrong, should be HTML "queue a task"
- queueMicrotask(() => {
- if (this[aborted]) return;
- this.dispatchEvent(ev);
- });
- }
-
- chunkPromise = reader.read();
- } // 5 Otherwise, if chunkPromise is fulfilled with an object whose done property is true, queue a task to run the following steps and abort this algorithm:
- else if (chunk.done === true) {
- // TODO(lucacasonato): this is wrong, should be HTML "queue a task"
- queueMicrotask(() => {
- if (this[aborted]) return;
- // 1. Set fr’s state to "done".
- this[state] = "done";
- // 2. Let result be the result of package data given bytes, type, blob’s type, and encodingName.
- const size = chunks.reduce((p, i) => p + i.byteLength, 0);
- const bytes = new Uint8Array(size);
- let offs = 0;
- for (const chunk of chunks) {
- bytes.set(chunk, offs);
- offs += chunk.byteLength;
- }
- switch (readtype.kind) {
- case "ArrayBuffer": {
- this[result] = bytes.buffer;
- break;
- }
- case "BinaryString":
- this[result] = [...new Uint8Array(bytes.buffer)].map((v) =>
- String.fromCodePoint(v)
- ).join("");
- break;
- case "Text": {
- let decoder = undefined;
- if (readtype.encoding) {
- try {
- decoder = new TextDecoder(readtype.encoding);
- } catch {
- // don't care about the error
- }
- }
- if (decoder === undefined) {
- const mimeType = parseMimeType(blob.type);
- if (mimeType) {
- const charset = mimeType.parameters.get("charset");
- if (charset) {
- try {
- decoder = new TextDecoder(charset);
- } catch {
- // don't care about the error
- }
- }
- }
- }
- if (decoder === undefined) {
- decoder = new TextDecoder();
- }
- this[result] = decode(bytes, decoder.encoding);
- break;
- }
- case "DataUrl": {
- const mediaType = blob.type || "application/octet-stream";
- this[result] = `data:${mediaType};base64,${
- base64.fromByteArray(bytes)
- }`;
- break;
- }
- }
- // 4.2 Fire a progress event called load at the fr.
- {
- const ev = new ProgressEvent("load", {
- lengthComputable: true,
- loaded: size,
- total: size,
- });
- this.dispatchEvent(ev);
- }
-
- // 5. If fr’s state is not "loading", fire a progress event called loadend at the fr.
- //Note: Event handler for the load or error events could have started another load, if that happens the loadend event for this load is not fired.
- if (this[state] !== "loading") {
- const ev = new ProgressEvent("loadend", {
- lengthComputable: true,
- loaded: size,
- total: size,
- });
- this.dispatchEvent(ev);
- }
- });
- break;
- }
- } catch (err) {
- // TODO(lucacasonato): this is wrong, should be HTML "queue a task"
- queueMicrotask(() => {
- if (this[aborted]) return;
-
- // chunkPromise rejected
- this[state] = "done";
- this[error] = err;
-
- {
- const ev = new ProgressEvent("error", {});
- this.dispatchEvent(ev);
- }
-
- //If fr’s state is not "loading", fire a progress event called loadend at fr.
- //Note: Event handler for the error event could have started another load, if that happens the loadend event for this load is not fired.
- if (this[state] !== "loading") {
- const ev = new ProgressEvent("loadend", {});
- this.dispatchEvent(ev);
- }
- });
- break;
- }
- }
- })();
- };
-
- constructor() {
- super();
- this[webidl.brand] = webidl.brand;
- }
-
- /** @returns {number} */
- get readyState() {
- webidl.assertBranded(this, FileReader);
- switch (this[state]) {
- case "empty":
- return FileReader.EMPTY;
- case "loading":
- return FileReader.LOADING;
- case "done":
- return FileReader.DONE;
- default:
- throw new TypeError("Invalid state");
- }
- }
-
- get result() {
- webidl.assertBranded(this, FileReader);
- return this[result];
- }
-
- get error() {
- webidl.assertBranded(this, FileReader);
- return this[error];
- }
-
- abort() {
- webidl.assertBranded(this, FileReader);
- // If context object's state is "empty" or if context object's state is "done" set context object's result to null and terminate this algorithm.
- if (
- this[state] === "empty" ||
- this[state] === "done"
- ) {
- this[result] = null;
- return;
- }
- // If context object's state is "loading" set context object's state to "done" and set context object's result to null.
- if (this[state] === "loading") {
- this[state] = "done";
- this[result] = null;
- }
- // If there are any tasks from the context object on the file reading task source in an affiliated task queue, then remove those tasks from that task queue.
- // Terminate the algorithm for the read method being processed.
- this[aborted] = true;
-
- // Fire a progress event called abort at the context object.
- const ev = new ProgressEvent("abort", {});
- this.dispatchEvent(ev);
-
- // If context object's state is not "loading", fire a progress event called loadend at the context object.
- if (this[state] !== "loading") {
- const ev = new ProgressEvent("loadend", {});
- this.dispatchEvent(ev);
- }
- }
-
- /** @param {Blob} blob */
- readAsArrayBuffer(blob) {
- webidl.assertBranded(this, FileReader);
- const prefix = "Failed to execute 'readAsArrayBuffer' on 'FileReader'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- this.#readOperation(blob, { kind: "ArrayBuffer" });
- }
-
- /** @param {Blob} blob */
- readAsBinaryString(blob) {
- webidl.assertBranded(this, FileReader);
- const prefix = "Failed to execute 'readAsBinaryString' on 'FileReader'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- // alias for readAsArrayBuffer
- this.#readOperation(blob, { kind: "BinaryString" });
- }
-
- /** @param {Blob} blob */
- readAsDataURL(blob) {
- webidl.assertBranded(this, FileReader);
- const prefix = "Failed to execute 'readAsBinaryString' on 'FileReader'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- // alias for readAsArrayBuffer
- this.#readOperation(blob, { kind: "DataUrl" });
- }
-
- /**
- * @param {Blob} blob
- * @param {string} [encoding]
- */
- readAsText(blob, encoding) {
- webidl.assertBranded(this, FileReader);
- const prefix = "Failed to execute 'readAsBinaryString' on 'FileReader'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- if (encoding !== undefined) {
- encoding = webidl.converters["DOMString"](encoding, {
- prefix,
- context: "Argument 2",
- });
- }
- // alias for readAsArrayBuffer
- this.#readOperation(blob, { kind: "Text", encoding });
- }
- }
-
- Object.defineProperty(FileReader, "EMPTY", {
- writable: false,
- enumerable: true,
- configurable: false,
- value: 0,
- });
- Object.defineProperty(FileReader, "LOADING", {
- writable: false,
- enumerable: true,
- configurable: false,
- value: 1,
- });
- Object.defineProperty(FileReader, "DONE", {
- writable: false,
- enumerable: true,
- configurable: false,
- value: 2,
- });
- Object.defineProperty(FileReader.prototype, "EMPTY", {
- writable: false,
- enumerable: true,
- configurable: false,
- value: 0,
- });
- Object.defineProperty(FileReader.prototype, "LOADING", {
- writable: false,
- enumerable: true,
- configurable: false,
- value: 1,
- });
- Object.defineProperty(FileReader.prototype, "DONE", {
- writable: false,
- enumerable: true,
- configurable: false,
- value: 2,
- });
-
- const handlerSymbol = Symbol("eventHandlers");
-
- function makeWrappedHandler(handler) {
- function wrappedHandler(...args) {
- if (typeof wrappedHandler.handler !== "function") {
- return;
- }
- return wrappedHandler.handler.call(this, ...args);
- }
- wrappedHandler.handler = handler;
- return wrappedHandler;
- }
- // TODO(benjamingr) reuse when we can reuse code between web crates
- function defineEventHandler(emitter, name) {
- // HTML specification section 8.1.5.1
- Object.defineProperty(emitter, `on${name}`, {
- get() {
- return this[handlerSymbol]?.get(name)?.handler ?? null;
- },
- set(value) {
- if (!this[handlerSymbol]) {
- this[handlerSymbol] = new Map();
- }
- let handlerWrapper = this[handlerSymbol]?.get(name);
- if (handlerWrapper) {
- handlerWrapper.handler = value;
- } else {
- handlerWrapper = makeWrappedHandler(value);
- this.addEventListener(name, handlerWrapper);
- }
- this[handlerSymbol].set(name, handlerWrapper);
- },
- configurable: true,
- enumerable: true,
- });
- }
- defineEventHandler(FileReader.prototype, "error");
- defineEventHandler(FileReader.prototype, "loadstart");
- defineEventHandler(FileReader.prototype, "load");
- defineEventHandler(FileReader.prototype, "loadend");
- defineEventHandler(FileReader.prototype, "progress");
- defineEventHandler(FileReader.prototype, "abort");
-
- window.__bootstrap.fileReader = {
- FileReader,
- };
-})(this);
diff --git a/op_crates/file/03_blob_url.js b/op_crates/file/03_blob_url.js
deleted file mode 100644
index 2b5e16b55..000000000
--- a/op_crates/file/03_blob_url.js
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// @ts-check
-/// <reference no-default-lib="true" />
-/// <reference path="../../core/lib.deno_core.d.ts" />
-/// <reference path="../webidl/internal.d.ts" />
-/// <reference path="../web/internal.d.ts" />
-/// <reference path="../web/lib.deno_web.d.ts" />
-/// <reference path="../url/internal.d.ts" />
-/// <reference path="../url/lib.deno_url.d.ts" />
-/// <reference path="./internal.d.ts" />
-/// <reference path="./lib.deno_file.d.ts" />
-/// <reference lib="esnext" />
-"use strict";
-
-((window) => {
- const core = Deno.core;
- const webidl = window.__bootstrap.webidl;
- const { _byteSequence } = window.__bootstrap.file;
- const { URL } = window.__bootstrap.url;
-
- /**
- * @param {Blob} blob
- * @returns {string}
- */
- function createObjectURL(blob) {
- const prefix = "Failed to execute 'createObjectURL' on 'URL'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- blob = webidl.converters["Blob"](blob, {
- context: "Argument 1",
- prefix,
- });
-
- const url = core.opSync(
- "op_file_create_object_url",
- blob.type,
- blob[_byteSequence],
- );
-
- return url;
- }
-
- /**
- * @param {string} url
- * @returns {void}
- */
- function revokeObjectURL(url) {
- const prefix = "Failed to execute 'revokeObjectURL' on 'URL'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- url = webidl.converters["DOMString"](url, {
- context: "Argument 1",
- prefix,
- });
-
- core.opSync(
- "op_file_revoke_object_url",
- url,
- );
- }
-
- URL.createObjectURL = createObjectURL;
- URL.revokeObjectURL = revokeObjectURL;
-})(globalThis);
diff --git a/op_crates/file/Cargo.toml b/op_crates/file/Cargo.toml
deleted file mode 100644
index 2338fab7c..000000000
--- a/op_crates/file/Cargo.toml
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-[package]
-name = "deno_file"
-version = "0.4.0"
-edition = "2018"
-description = "File API implementation for Deno"
-authors = ["the Deno authors"]
-license = "MIT"
-readme = "README.md"
-repository = "https://github.com/denoland/deno"
-
-[lib]
-path = "lib.rs"
-
-[dependencies]
-deno_core = { version = "0.86.0", path = "../../core" }
-uuid = { version = "0.8.2", features = ["v4"] }
diff --git a/op_crates/file/README.md b/op_crates/file/README.md
deleted file mode 100644
index c421bf004..000000000
--- a/op_crates/file/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# deno_file
-
-This crate implements the File API.
-
-Spec: https://w3c.github.io/FileAPI
diff --git a/op_crates/file/internal.d.ts b/op_crates/file/internal.d.ts
deleted file mode 100644
index dd892e736..000000000
--- a/op_crates/file/internal.d.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-/// <reference no-default-lib="true" />
-/// <reference lib="esnext" />
-
-declare namespace globalThis {
- declare namespace __bootstrap {
- declare var file: {
- Blob: typeof Blob & {
- [globalThis.__bootstrap.file._byteSequence]: Uint8Array;
- };
- readonly _byteSequence: unique symbol;
- File: typeof File & {
- [globalThis.__bootstrap.file._byteSequence]: Uint8Array;
- };
- };
- }
-}
diff --git a/op_crates/file/lib.deno_file.d.ts b/op_crates/file/lib.deno_file.d.ts
deleted file mode 100644
index a907c3f50..000000000
--- a/op_crates/file/lib.deno_file.d.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-/// <reference no-default-lib="true" />
-/// <reference lib="esnext" />
-
-type BlobPart = BufferSource | Blob | string;
-
-interface BlobPropertyBag {
- type?: string;
- endings?: "transparent" | "native";
-}
-
-/** A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system. */
-declare class Blob {
- constructor(blobParts?: BlobPart[], options?: BlobPropertyBag);
-
- readonly size: number;
- readonly type: string;
- arrayBuffer(): Promise<ArrayBuffer>;
- slice(start?: number, end?: number, contentType?: string): Blob;
- stream(): ReadableStream<Uint8Array>;
- text(): Promise<string>;
-}
-
-interface FilePropertyBag extends BlobPropertyBag {
- lastModified?: number;
-}
-
-/** Provides information about files and allows JavaScript in a web page to
- * access their content. */
-declare class File extends Blob {
- constructor(
- fileBits: BlobPart[],
- fileName: string,
- options?: FilePropertyBag,
- );
-
- readonly lastModified: number;
- readonly name: string;
-}
diff --git a/op_crates/file/lib.rs b/op_crates/file/lib.rs
deleted file mode 100644
index ccde34ada..000000000
--- a/op_crates/file/lib.rs
+++ /dev/null
@@ -1,120 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::error::null_opbuf;
-use deno_core::error::AnyError;
-use deno_core::include_js_files;
-use deno_core::op_sync;
-use deno_core::url::Url;
-use deno_core::Extension;
-use deno_core::ModuleSpecifier;
-use deno_core::ZeroCopyBuf;
-use std::collections::HashMap;
-use std::path::PathBuf;
-use std::sync::Arc;
-use std::sync::Mutex;
-use uuid::Uuid;
-
-#[derive(Debug, Clone)]
-pub struct Blob {
- pub data: Vec<u8>,
- pub media_type: String,
-}
-
-pub struct Location(pub Url);
-
-#[derive(Debug, Default, Clone)]
-pub struct BlobUrlStore(Arc<Mutex<HashMap<Url, Blob>>>);
-
-impl BlobUrlStore {
- pub fn get(&self, mut url: Url) -> Result<Option<Blob>, AnyError> {
- let blob_store = self.0.lock().unwrap();
- url.set_fragment(None);
- Ok(blob_store.get(&url).cloned())
- }
-
- pub fn insert(&self, blob: Blob, maybe_location: Option<Url>) -> Url {
- let origin = if let Some(location) = maybe_location {
- location.origin().ascii_serialization()
- } else {
- "null".to_string()
- };
- let id = Uuid::new_v4();
- let url = Url::parse(&format!("blob:{}/{}", origin, id)).unwrap();
-
- let mut blob_store = self.0.lock().unwrap();
- blob_store.insert(url.clone(), blob);
-
- url
- }
-
- pub fn remove(&self, url: &ModuleSpecifier) {
- let mut blob_store = self.0.lock().unwrap();
- blob_store.remove(&url);
- }
-}
-
-pub fn op_file_create_object_url(
- state: &mut deno_core::OpState,
- media_type: String,
- zero_copy: Option<ZeroCopyBuf>,
-) -> Result<String, AnyError> {
- let data = zero_copy.ok_or_else(null_opbuf)?;
- let blob = Blob {
- data: data.to_vec(),
- media_type,
- };
-
- let maybe_location = state.try_borrow::<Location>();
- let blob_store = state.borrow::<BlobUrlStore>();
-
- let url =
- blob_store.insert(blob, maybe_location.map(|location| location.0.clone()));
-
- Ok(url.to_string())
-}
-
-pub fn op_file_revoke_object_url(
- state: &mut deno_core::OpState,
- url: String,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<(), AnyError> {
- let url = Url::parse(&url)?;
- let blob_store = state.borrow::<BlobUrlStore>();
- blob_store.remove(&url);
- Ok(())
-}
-
-pub fn init(
- blob_url_store: BlobUrlStore,
- maybe_location: Option<Url>,
-) -> Extension {
- Extension::builder()
- .js(include_js_files!(
- prefix "deno:op_crates/file",
- "01_file.js",
- "02_filereader.js",
- "03_blob_url.js",
- ))
- .ops(vec![
- (
- "op_file_create_object_url",
- op_sync(op_file_create_object_url),
- ),
- (
- "op_file_revoke_object_url",
- op_sync(op_file_revoke_object_url),
- ),
- ])
- .state(move |state| {
- state.put(blob_url_store.clone());
- if let Some(location) = maybe_location.clone() {
- state.put(Location(location));
- }
- Ok(())
- })
- .build()
-}
-
-pub fn get_declaration() -> PathBuf {
- PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("lib.deno_file.d.ts")
-}
diff --git a/op_crates/timers/01_timers.js b/op_crates/timers/01_timers.js
deleted file mode 100644
index d6d6436fe..000000000
--- a/op_crates/timers/01_timers.js
+++ /dev/null
@@ -1,579 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-"use strict";
-
-((window) => {
- const core = window.Deno.core;
-
- // Shamelessly cribbed from op_crates/fetch/11_streams.js
- class AssertionError extends Error {
- constructor(msg) {
- super(msg);
- this.name = "AssertionError";
- }
- }
-
- /**
- * @param {unknown} cond
- * @param {string=} msg
- * @returns {asserts cond}
- */
- function assert(cond, msg = "Assertion failed.") {
- if (!cond) {
- throw new AssertionError(msg);
- }
- }
-
- function opStopGlobalTimer() {
- core.opSync("op_global_timer_stop");
- }
-
- function opStartGlobalTimer(timeout) {
- return core.opSync("op_global_timer_start", timeout);
- }
-
- async function opWaitGlobalTimer() {
- await core.opAsync("op_global_timer");
- }
-
- function opNow() {
- return core.opSync("op_now");
- }
-
- function sleepSync(millis = 0) {
- return core.opSync("op_sleep_sync", millis);
- }
-
- // Derived from https://github.com/vadimg/js_bintrees. MIT Licensed.
-
- class RBNode {
- constructor(data) {
- this.data = data;
- this.left = null;
- this.right = null;
- this.red = true;
- }
-
- getChild(dir) {
- return dir ? this.right : this.left;
- }
-
- setChild(dir, val) {
- if (dir) {
- this.right = val;
- } else {
- this.left = val;
- }
- }
- }
-
- class RBTree {
- #comparator = null;
- #root = null;
-
- constructor(comparator) {
- this.#comparator = comparator;
- this.#root = null;
- }
-
- /** Returns `null` if tree is empty. */
- min() {
- let res = this.#root;
- if (res === null) {
- return null;
- }
- while (res.left !== null) {
- res = res.left;
- }
- return res.data;
- }
-
- /** Returns node `data` if found, `null` otherwise. */
- find(data) {
- let res = this.#root;
- while (res !== null) {
- const c = this.#comparator(data, res.data);
- if (c === 0) {
- return res.data;
- } else {
- res = res.getChild(c > 0);
- }
- }
- return null;
- }
-
- /** returns `true` if inserted, `false` if duplicate. */
- insert(data) {
- let ret = false;
-
- if (this.#root === null) {
- // empty tree
- this.#root = new RBNode(data);
- ret = true;
- } else {
- const head = new RBNode(null); // fake tree root
-
- let dir = 0;
- let last = 0;
-
- // setup
- let gp = null; // grandparent
- let ggp = head; // grand-grand-parent
- let p = null; // parent
- let node = this.#root;
- ggp.right = this.#root;
-
- // search down
- while (true) {
- if (node === null) {
- // insert new node at the bottom
- node = new RBNode(data);
- p.setChild(dir, node);
- ret = true;
- } else if (isRed(node.left) && isRed(node.right)) {
- // color flip
- node.red = true;
- node.left.red = false;
- node.right.red = false;
- }
-
- // fix red violation
- if (isRed(node) && isRed(p)) {
- const dir2 = ggp.right === gp;
-
- assert(gp);
- if (node === p.getChild(last)) {
- ggp.setChild(dir2, singleRotate(gp, !last));
- } else {
- ggp.setChild(dir2, doubleRotate(gp, !last));
- }
- }
-
- const cmp = this.#comparator(node.data, data);
-
- // stop if found
- if (cmp === 0) {
- break;
- }
-
- last = dir;
- dir = Number(cmp < 0); // Fix type
-
- // update helpers
- if (gp !== null) {
- ggp = gp;
- }
- gp = p;
- p = node;
- node = node.getChild(dir);
- }
-
- // update root
- this.#root = head.right;
- }
-
- // make root black
- this.#root.red = false;
-
- return ret;
- }
-
- /** Returns `true` if removed, `false` if not found. */
- remove(data) {
- if (this.#root === null) {
- return false;
- }
-
- const head = new RBNode(null); // fake tree root
- let node = head;
- node.right = this.#root;
- let p = null; // parent
- let gp = null; // grand parent
- let found = null; // found item
- let dir = 1;
-
- while (node.getChild(dir) !== null) {
- const last = dir;
-
- // update helpers
- gp = p;
- p = node;
- node = node.getChild(dir);
-
- const cmp = this.#comparator(data, node.data);
-
- dir = cmp > 0;
-
- // save found node
- if (cmp === 0) {
- found = node;
- }
-
- // push the red node down
- if (!isRed(node) && !isRed(node.getChild(dir))) {
- if (isRed(node.getChild(!dir))) {
- const sr = singleRotate(node, dir);
- p.setChild(last, sr);
- p = sr;
- } else if (!isRed(node.getChild(!dir))) {
- const sibling = p.getChild(!last);
- if (sibling !== null) {
- if (
- !isRed(sibling.getChild(!last)) &&
- !isRed(sibling.getChild(last))
- ) {
- // color flip
- p.red = false;
- sibling.red = true;
- node.red = true;
- } else {
- assert(gp);
- const dir2 = gp.right === p;
-
- if (isRed(sibling.getChild(last))) {
- gp.setChild(dir2, doubleRotate(p, last));
- } else if (isRed(sibling.getChild(!last))) {
- gp.setChild(dir2, singleRotate(p, last));
- }
-
- // ensure correct coloring
- const gpc = gp.getChild(dir2);
- assert(gpc);
- gpc.red = true;
- node.red = true;
- assert(gpc.left);
- gpc.left.red = false;
- assert(gpc.right);
- gpc.right.red = false;
- }
- }
- }
- }
- }
-
- // replace and remove if found
- if (found !== null) {
- found.data = node.data;
- assert(p);
- p.setChild(p.right === node, node.getChild(node.left === null));
- }
-
- // update root and make it black
- this.#root = head.right;
- if (this.#root !== null) {
- this.#root.red = false;
- }
-
- return found !== null;
- }
- }
-
- function isRed(node) {
- return node !== null && node.red;
- }
-
- function singleRotate(root, dir) {
- const save = root.getChild(!dir);
- assert(save);
-
- root.setChild(!dir, save.getChild(dir));
- save.setChild(dir, root);
-
- root.red = true;
- save.red = false;
-
- return save;
- }
-
- function doubleRotate(root, dir) {
- root.setChild(!dir, singleRotate(root.getChild(!dir), !dir));
- return singleRotate(root, dir);
- }
-
- const { console } = globalThis;
- const OriginalDateNow = Date.now;
-
- // Timeout values > TIMEOUT_MAX are set to 1.
- const TIMEOUT_MAX = 2 ** 31 - 1;
-
- let globalTimeoutDue = null;
-
- let nextTimerId = 1;
- const idMap = new Map();
- const dueTree = new RBTree((a, b) => a.due - b.due);
-
- function clearGlobalTimeout() {
- globalTimeoutDue = null;
- opStopGlobalTimer();
- }
-
- let pendingEvents = 0;
- const pendingFireTimers = [];
-
- /** Process and run a single ready timer macrotask.
- * This function should be registered through Deno.core.setMacrotaskCallback.
- * Returns true when all ready macrotasks have been processed, false if more
- * ready ones are available. The Isolate future would rely on the return value
- * to repeatedly invoke this function until depletion. Multiple invocations
- * of this function one at a time ensures newly ready microtasks are processed
- * before next macrotask timer callback is invoked. */
- function handleTimerMacrotask() {
- if (pendingFireTimers.length > 0) {
- fire(pendingFireTimers.shift());
- return pendingFireTimers.length === 0;
- }
- return true;
- }
-
- async function setGlobalTimeout(due, now) {
- // Since JS and Rust don't use the same clock, pass the time to rust as a
- // relative time value. On the Rust side we'll turn that into an absolute
- // value again.
- const timeout = due - now;
- assert(timeout >= 0);
- // Send message to the backend.
- globalTimeoutDue = due;
- pendingEvents++;
- // FIXME(bartlomieju): this is problematic, because `clearGlobalTimeout`
- // is synchronous. That means that timer is cancelled, but this promise is still pending
- // until next turn of event loop. This leads to "leaking of async ops" in tests;
- // because `clearTimeout/clearInterval` might be the last statement in test function
- // `opSanitizer` will immediately complain that there is pending op going on, unless
- // some timeout/defer is put in place to allow promise resolution.
- // Ideally `clearGlobalTimeout` doesn't return until this op is resolved, but
- // I'm not if that's possible.
- opStartGlobalTimer(timeout);
- await opWaitGlobalTimer();
- pendingEvents--;
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
- prepareReadyTimers();
- }
-
- function prepareReadyTimers() {
- const now = OriginalDateNow();
- // Bail out if we're not expecting the global timer to fire.
- if (globalTimeoutDue === null || pendingEvents > 0) {
- return;
- }
- // After firing the timers that are due now, this will hold the first timer
- // list that hasn't fired yet.
- let nextDueNode;
- while ((nextDueNode = dueTree.min()) !== null && nextDueNode.due <= now) {
- dueTree.remove(nextDueNode);
- // Fire all the timers in the list.
- for (const timer of nextDueNode.timers) {
- // With the list dropped, the timer is no longer scheduled.
- timer.scheduled = false;
- // Place the callback to pending timers to fire.
- pendingFireTimers.push(timer);
- }
- }
- setOrClearGlobalTimeout(nextDueNode && nextDueNode.due, now);
- }
-
- function setOrClearGlobalTimeout(due, now) {
- if (due == null) {
- clearGlobalTimeout();
- } else {
- setGlobalTimeout(due, now);
- }
- }
-
- function schedule(timer, now) {
- assert(!timer.scheduled);
- assert(now <= timer.due);
- // Find or create the list of timers that will fire at point-in-time `due`.
- const maybeNewDueNode = { due: timer.due, timers: [] };
- let dueNode = dueTree.find(maybeNewDueNode);
- if (dueNode === null) {
- dueTree.insert(maybeNewDueNode);
- dueNode = maybeNewDueNode;
- }
- // Append the newly scheduled timer to the list and mark it as scheduled.
- dueNode.timers.push(timer);
- timer.scheduled = true;
- // If the new timer is scheduled to fire before any timer that existed before,
- // update the global timeout to reflect this.
- if (globalTimeoutDue === null || globalTimeoutDue > timer.due) {
- setOrClearGlobalTimeout(timer.due, now);
- }
- }
-
- function unschedule(timer) {
- // Check if our timer is pending scheduling or pending firing.
- // If either is true, they are not in tree, and their idMap entry
- // will be deleted soon. Remove it from queue.
- let index = -1;
- if ((index = pendingFireTimers.indexOf(timer)) >= 0) {
- pendingFireTimers.splice(index);
- return;
- }
- // If timer is not in the 2 pending queues and is unscheduled,
- // it is not in the tree.
- if (!timer.scheduled) {
- return;
- }
- const searchKey = { due: timer.due, timers: [] };
- // Find the list of timers that will fire at point-in-time `due`.
- const list = dueTree.find(searchKey).timers;
- if (list.length === 1) {
- // Time timer is the only one in the list. Remove the entire list.
- assert(list[0] === timer);
- dueTree.remove(searchKey);
- // If the unscheduled timer was 'next up', find when the next timer that
- // still exists is due, and update the global alarm accordingly.
- if (timer.due === globalTimeoutDue) {
- const nextDueNode = dueTree.min();
- setOrClearGlobalTimeout(
- nextDueNode && nextDueNode.due,
- OriginalDateNow(),
- );
- }
- } else {
- // Multiple timers that are due at the same point in time.
- // Remove this timer from the list.
- const index = list.indexOf(timer);
- assert(index > -1);
- list.splice(index, 1);
- }
- }
-
- function fire(timer) {
- // If the timer isn't found in the ID map, that means it has been cancelled
- // between the timer firing and the promise callback (this function).
- if (!idMap.has(timer.id)) {
- return;
- }
- // Reschedule the timer if it is a repeating one, otherwise drop it.
- if (!timer.repeat) {
- // One-shot timer: remove the timer from this id-to-timer map.
- idMap.delete(timer.id);
- } else {
- // Interval timer: compute when timer was supposed to fire next.
- // However make sure to never schedule the next interval in the past.
- const now = OriginalDateNow();
- timer.due = Math.max(now, timer.due + timer.delay);
- schedule(timer, now);
- }
- // Call the user callback. Intermediate assignment is to avoid leaking `this`
- // to it, while also keeping the stack trace neat when it shows up in there.
- const callback = timer.callback;
- if ("function" === typeof callback) {
- callback();
- } else {
- (0, eval)(callback);
- }
- }
-
- function checkThis(thisArg) {
- if (thisArg !== null && thisArg !== undefined && thisArg !== globalThis) {
- throw new TypeError("Illegal invocation");
- }
- }
-
- function setTimer(
- cb,
- delay,
- args,
- repeat,
- ) {
- // If the callack is a function, bind `args` to the callback and bind `this` to globalThis(global).
- // otherwise call `String` on it, and `eval` it on calls; do not pass variardic args to the string
- let callback;
-
- if ("function" === typeof cb) {
- callback = Function.prototype.bind.call(cb, globalThis, ...args);
- } else {
- callback = String(cb);
- args = []; // args are ignored
- }
- // In the browser, the delay value must be coercible to an integer between 0
- // and INT32_MAX. Any other value will cause the timer to fire immediately.
- // We emulate this behavior.
- const now = OriginalDateNow();
- if (delay > TIMEOUT_MAX) {
- console.warn(
- `${delay} does not fit into` +
- " a 32-bit signed integer." +
- "\nTimeout duration was set to 1.",
- );
- delay = 1;
- }
- delay = Math.max(0, delay | 0);
-
- // Create a new, unscheduled timer object.
- const timer = {
- id: nextTimerId++,
- callback,
- args,
- delay,
- due: now + delay,
- repeat,
- scheduled: false,
- };
- // Register the timer's existence in the id-to-timer map.
- idMap.set(timer.id, timer);
- // Schedule the timer in the due table.
- schedule(timer, now);
- return timer.id;
- }
-
- function setTimeout(
- cb,
- delay = 0,
- ...args
- ) {
- delay >>>= 0;
- checkThis(this);
- return setTimer(cb, delay, args, false);
- }
-
- function setInterval(
- cb,
- delay = 0,
- ...args
- ) {
- delay >>>= 0;
- checkThis(this);
- return setTimer(cb, delay, args, true);
- }
-
- function clearTimer(id) {
- id >>>= 0;
- const timer = idMap.get(id);
- if (timer === undefined) {
- // Timer doesn't exist any more or never existed. This is not an error.
- return;
- }
- // Unschedule the timer if it is currently scheduled, and forget about it.
- unschedule(timer);
- idMap.delete(timer.id);
- }
-
- function clearTimeout(id = 0) {
- id >>>= 0;
- if (id === 0) {
- return;
- }
- clearTimer(id);
- }
-
- function clearInterval(id = 0) {
- id >>>= 0;
- if (id === 0) {
- return;
- }
- clearTimer(id);
- }
-
- window.__bootstrap.timers = {
- clearInterval,
- setInterval,
- clearTimeout,
- setTimeout,
- handleTimerMacrotask,
- opStopGlobalTimer,
- opStartGlobalTimer,
- opNow,
- sleepSync,
- };
-})(this);
diff --git a/op_crates/timers/Cargo.toml b/op_crates/timers/Cargo.toml
deleted file mode 100644
index ead1ae00c..000000000
--- a/op_crates/timers/Cargo.toml
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-[package]
-name = "deno_timers"
-version = "0.3.0"
-edition = "2018"
-description = "Timers API implementation for Deno"
-authors = ["the Deno authors"]
-license = "MIT"
-readme = "README.md"
-repository = "https://github.com/denoland/deno"
-
-[lib]
-path = "lib.rs"
-
-[dependencies]
-deno_core = { version = "0.86.0", path = "../../core" }
-tokio = { version = "1.4.0", features = ["full"] }
diff --git a/op_crates/timers/README.md b/op_crates/timers/README.md
deleted file mode 100644
index 5a2a8e516..000000000
--- a/op_crates/timers/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# deno_timers
-
-This crate implements the timers API.
-
-Spec: https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers
diff --git a/op_crates/timers/lib.rs b/op_crates/timers/lib.rs
deleted file mode 100644
index 62f5953fa..000000000
--- a/op_crates/timers/lib.rs
+++ /dev/null
@@ -1,191 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-//! This module helps deno implement timers.
-//!
-//! As an optimization, we want to avoid an expensive calls into rust for every
-//! setTimeout in JavaScript. Thus in //js/timers.ts a data structure is
-//! implemented that calls into Rust for only the smallest timeout. Thus we
-//! only need to be able to start, cancel and await a single timer (or Delay, as Tokio
-//! calls it) for an entire Isolate. This is what is implemented here.
-
-use deno_core::error::AnyError;
-use deno_core::futures;
-use deno_core::futures::channel::oneshot;
-use deno_core::futures::FutureExt;
-use deno_core::futures::TryFutureExt;
-use deno_core::include_js_files;
-use deno_core::op_async;
-use deno_core::op_sync;
-use deno_core::Extension;
-use deno_core::OpState;
-use deno_core::ZeroCopyBuf;
-use std::cell::RefCell;
-use std::future::Future;
-use std::pin::Pin;
-use std::rc::Rc;
-use std::thread::sleep;
-use std::time::Duration;
-use std::time::Instant;
-
-pub trait TimersPermission {
- fn allow_hrtime(&mut self) -> bool;
- fn check_unstable(&self, state: &OpState, api_name: &'static str);
-}
-
-pub struct NoTimersPermission;
-
-impl TimersPermission for NoTimersPermission {
- fn allow_hrtime(&mut self) -> bool {
- false
- }
- fn check_unstable(&self, _: &OpState, _: &'static str) {}
-}
-
-pub fn init<P: TimersPermission + 'static>() -> Extension {
- Extension::builder()
- .js(include_js_files!(
- prefix "deno:op_crates/timers",
- "01_timers.js",
- ))
- .ops(vec![
- ("op_global_timer_stop", op_sync(op_global_timer_stop)),
- ("op_global_timer_start", op_sync(op_global_timer_start)),
- ("op_global_timer", op_async(op_global_timer)),
- ("op_now", op_sync(op_now::<P>)),
- ("op_sleep_sync", op_sync(op_sleep_sync::<P>)),
- ])
- .state(|state| {
- state.put(GlobalTimer::default());
- state.put(StartTime::now());
- Ok(())
- })
- .build()
-}
-
-pub type StartTime = Instant;
-
-type TimerFuture = Pin<Box<dyn Future<Output = Result<(), ()>>>>;
-
-#[derive(Default)]
-pub struct GlobalTimer {
- tx: Option<oneshot::Sender<()>>,
- pub future: Option<TimerFuture>,
-}
-
-impl GlobalTimer {
- pub fn cancel(&mut self) {
- if let Some(tx) = self.tx.take() {
- tx.send(()).ok();
- }
- }
-
- pub fn new_timeout(&mut self, deadline: Instant) {
- if self.tx.is_some() {
- self.cancel();
- }
- assert!(self.tx.is_none());
- self.future.take();
-
- let (tx, rx) = oneshot::channel();
- self.tx = Some(tx);
-
- let delay = tokio::time::sleep_until(deadline.into()).boxed_local();
- let rx = rx
- .map_err(|err| panic!("Unexpected error in receiving channel {:?}", err));
-
- let fut = futures::future::select(delay, rx)
- .then(|_| futures::future::ok(()))
- .boxed_local();
- self.future = Some(fut);
- }
-}
-
-#[allow(clippy::unnecessary_wraps)]
-pub fn op_global_timer_stop(
- state: &mut OpState,
- _args: (),
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<(), AnyError> {
- let global_timer = state.borrow_mut::<GlobalTimer>();
- global_timer.cancel();
- Ok(())
-}
-
-// Set up a timer that will be later awaited by JS promise.
-// It's a separate op, because canceling a timeout immediately
-// after setting it caused a race condition (because Tokio timeout)
-// might have been registered after next event loop tick.
-//
-// See https://github.com/denoland/deno/issues/7599 for more
-// details.
-#[allow(clippy::unnecessary_wraps)]
-pub fn op_global_timer_start(
- state: &mut OpState,
- timeout: u64,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<(), AnyError> {
- let deadline = Instant::now() + Duration::from_millis(timeout);
- let global_timer = state.borrow_mut::<GlobalTimer>();
- global_timer.new_timeout(deadline);
- Ok(())
-}
-
-pub async fn op_global_timer(
- state: Rc<RefCell<OpState>>,
- _args: (),
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<(), AnyError> {
- let maybe_timer_fut = {
- let mut s = state.borrow_mut();
- let global_timer = s.borrow_mut::<GlobalTimer>();
- global_timer.future.take()
- };
- if let Some(timer_fut) = maybe_timer_fut {
- let _ = timer_fut.await;
- }
- Ok(())
-}
-
-// Returns a milliseconds and nanoseconds subsec
-// since the start time of the deno runtime.
-// If the High precision flag is not set, the
-// nanoseconds are rounded on 2ms.
-#[allow(clippy::unnecessary_wraps)]
-pub fn op_now<TP>(
- state: &mut OpState,
- _argument: (),
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<f64, AnyError>
-where
- TP: TimersPermission + 'static,
-{
- let start_time = state.borrow::<StartTime>();
- let seconds = start_time.elapsed().as_secs();
- let mut subsec_nanos = start_time.elapsed().subsec_nanos() as f64;
- let reduced_time_precision = 2_000_000.0; // 2ms in nanoseconds
-
- // If the permission is not enabled
- // Round the nano result on 2 milliseconds
- // see: https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp#Reduced_time_precision
- if !state.borrow_mut::<TP>().allow_hrtime() {
- subsec_nanos -= subsec_nanos % reduced_time_precision;
- }
-
- let result = (seconds * 1_000) as f64 + (subsec_nanos / 1_000_000.0);
-
- Ok(result)
-}
-
-#[allow(clippy::unnecessary_wraps)]
-pub fn op_sleep_sync<TP>(
- state: &mut OpState,
- millis: u64,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<(), AnyError>
-where
- TP: TimersPermission + 'static,
-{
- state.borrow::<TP>().check_unstable(state, "Deno.sleepSync");
- sleep(Duration::from_millis(millis));
- Ok(())
-}
diff --git a/op_crates/url/00_url.js b/op_crates/url/00_url.js
deleted file mode 100644
index 340937748..000000000
--- a/op_crates/url/00_url.js
+++ /dev/null
@@ -1,409 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-"use strict";
-
-((window) => {
- const core = window.Deno.core;
-
- function requiredArguments(name, length, required) {
- if (length < required) {
- const errMsg = `${name} requires at least ${required} argument${
- required === 1 ? "" : "s"
- }, but only ${length} present`;
- throw new TypeError(errMsg);
- }
- }
-
- const paramLists = new WeakMap();
- const urls = new WeakMap();
-
- class URLSearchParams {
- #params = [];
-
- constructor(init = "") {
- if (typeof init === "string") {
- // Overload: USVString
- // If init is a string and starts with U+003F (?),
- // remove the first code point from init.
- if (init[0] == "?") {
- init = init.slice(1);
- }
-
- this.#params = core.opSync("op_url_parse_search_params", init);
- } else if (
- Array.isArray(init) ||
- typeof init?.[Symbol.iterator] == "function"
- ) {
- // Overload: sequence<sequence<USVString>>
- for (const pair of init) {
- // If pair does not contain exactly two items, then throw a TypeError.
- if (pair.length !== 2) {
- throw new TypeError(
- "URLSearchParams.constructor sequence argument must only contain pair elements",
- );
- }
- this.#params.push([String(pair[0]), String(pair[1])]);
- }
- } else if (Object(init) !== init) {
- // pass
- } else if (init instanceof URLSearchParams) {
- this.#params = [...init.#params];
- } else {
- // Overload: record<USVString, USVString>
- for (const key of Object.keys(init)) {
- this.#params.push([key, String(init[key])]);
- }
- }
-
- paramLists.set(this, this.#params);
- urls.set(this, null);
- }
-
- #updateUrlSearch = () => {
- const url = urls.get(this);
- if (url == null) {
- return;
- }
- const parseArgs = { href: url.href, setSearch: this.toString() };
- parts.set(url, core.opSync("op_url_parse", parseArgs));
- };
-
- append(name, value) {
- requiredArguments("URLSearchParams.append", arguments.length, 2);
- this.#params.push([String(name), String(value)]);
- this.#updateUrlSearch();
- }
-
- delete(name) {
- requiredArguments("URLSearchParams.delete", arguments.length, 1);
- name = String(name);
- let i = 0;
- while (i < this.#params.length) {
- if (this.#params[i][0] === name) {
- this.#params.splice(i, 1);
- } else {
- i++;
- }
- }
- this.#updateUrlSearch();
- }
-
- getAll(name) {
- requiredArguments("URLSearchParams.getAll", arguments.length, 1);
- name = String(name);
- const values = [];
- for (const entry of this.#params) {
- if (entry[0] === name) {
- values.push(entry[1]);
- }
- }
-
- return values;
- }
-
- get(name) {
- requiredArguments("URLSearchParams.get", arguments.length, 1);
- name = String(name);
- for (const entry of this.#params) {
- if (entry[0] === name) {
- return entry[1];
- }
- }
-
- return null;
- }
-
- has(name) {
- requiredArguments("URLSearchParams.has", arguments.length, 1);
- name = String(name);
- return this.#params.some((entry) => entry[0] === name);
- }
-
- set(name, value) {
- requiredArguments("URLSearchParams.set", arguments.length, 2);
-
- // If there are any name-value pairs whose name is name, in list,
- // set the value of the first such name-value pair to value
- // and remove the others.
- name = String(name);
- value = String(value);
- let found = false;
- let i = 0;
- while (i < this.#params.length) {
- if (this.#params[i][0] === name) {
- if (!found) {
- this.#params[i][1] = value;
- found = true;
- i++;
- } else {
- this.#params.splice(i, 1);
- }
- } else {
- i++;
- }
- }
-
- // Otherwise, append a new name-value pair whose name is name
- // and value is value, to list.
- if (!found) {
- this.#params.push([String(name), String(value)]);
- }
-
- this.#updateUrlSearch();
- }
-
- sort() {
- this.#params.sort((a, b) => (a[0] === b[0] ? 0 : a[0] > b[0] ? 1 : -1));
- this.#updateUrlSearch();
- }
-
- forEach(callbackfn, thisArg) {
- requiredArguments("URLSearchParams.forEach", arguments.length, 1);
-
- if (typeof thisArg !== "undefined") {
- callbackfn = callbackfn.bind(thisArg);
- }
-
- for (const [key, value] of this.#params) {
- callbackfn(value, key, this);
- }
- }
-
- *keys() {
- for (const [key] of this.#params) {
- yield key;
- }
- }
-
- *values() {
- for (const [, value] of this.#params) {
- yield value;
- }
- }
-
- *entries() {
- yield* this.#params;
- }
-
- *[Symbol.iterator]() {
- yield* this.#params;
- }
-
- toString() {
- return core.opSync("op_url_stringify_search_params", this.#params);
- }
- }
-
- const parts = new WeakMap();
-
- class URL {
- #searchParams = null;
-
- constructor(url, base) {
- new.target;
-
- if (url instanceof URL && base === undefined) {
- parts.set(this, parts.get(url));
- } else {
- base = base !== undefined ? String(base) : base;
- const parseArgs = { href: String(url), baseHref: base };
- parts.set(this, core.opSync("op_url_parse", parseArgs));
- }
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- const object = {
- href: this.href,
- origin: this.origin,
- protocol: this.protocol,
- username: this.username,
- password: this.password,
- host: this.host,
- hostname: this.hostname,
- port: this.port,
- pathname: this.pathname,
- hash: this.hash,
- search: this.search,
- };
- return `${this.constructor.name} ${inspect(object)}`;
- }
-
- #updateSearchParams = () => {
- if (this.#searchParams != null) {
- const params = paramLists.get(this.#searchParams);
- const newParams = core.opSync(
- "op_url_parse_search_params",
- this.search.slice(1),
- );
- params.splice(0, params.length, ...newParams);
- }
- };
-
- get hash() {
- return parts.get(this).hash;
- }
-
- set hash(value) {
- try {
- const parseArgs = { href: this.href, setHash: String(value) };
- parts.set(this, core.opSync("op_url_parse", parseArgs));
- } catch {
- /* pass */
- }
- }
-
- get host() {
- return parts.get(this).host;
- }
-
- set host(value) {
- try {
- const parseArgs = { href: this.href, setHost: String(value) };
- parts.set(this, core.opSync("op_url_parse", parseArgs));
- } catch {
- /* pass */
- }
- }
-
- get hostname() {
- return parts.get(this).hostname;
- }
-
- set hostname(value) {
- try {
- const parseArgs = { href: this.href, setHostname: String(value) };
- parts.set(this, core.opSync("op_url_parse", parseArgs));
- } catch {
- /* pass */
- }
- }
-
- get href() {
- return parts.get(this).href;
- }
-
- set href(value) {
- try {
- const parseArgs = { href: String(value) };
- parts.set(this, core.opSync("op_url_parse", parseArgs));
- } catch {
- throw new TypeError("Invalid URL");
- }
- this.#updateSearchParams();
- }
-
- get origin() {
- return parts.get(this).origin;
- }
-
- get password() {
- return parts.get(this).password;
- }
-
- set password(value) {
- try {
- const parseArgs = { href: this.href, setPassword: String(value) };
- parts.set(this, core.opSync("op_url_parse", parseArgs));
- } catch {
- /* pass */
- }
- }
-
- get pathname() {
- return parts.get(this).pathname;
- }
-
- set pathname(value) {
- try {
- const parseArgs = { href: this.href, setPathname: String(value) };
- parts.set(this, core.opSync("op_url_parse", parseArgs));
- } catch {
- /* pass */
- }
- }
-
- get port() {
- return parts.get(this).port;
- }
-
- set port(value) {
- try {
- const parseArgs = { href: this.href, setPort: String(value) };
- parts.set(this, core.opSync("op_url_parse", parseArgs));
- } catch {
- /* pass */
- }
- }
-
- get protocol() {
- return parts.get(this).protocol;
- }
-
- set protocol(value) {
- try {
- const parseArgs = { href: this.href, setProtocol: String(value) };
- parts.set(this, core.opSync("op_url_parse", parseArgs));
- } catch {
- /* pass */
- }
- }
-
- get search() {
- return parts.get(this).search;
- }
-
- set search(value) {
- try {
- const parseArgs = { href: this.href, setSearch: String(value) };
- parts.set(this, core.opSync("op_url_parse", parseArgs));
- this.#updateSearchParams();
- } catch {
- /* pass */
- }
- }
-
- get username() {
- return parts.get(this).username;
- }
-
- set username(value) {
- try {
- const parseArgs = { href: this.href, setUsername: String(value) };
- parts.set(this, core.opSync("op_url_parse", parseArgs));
- } catch {
- /* pass */
- }
- }
-
- get searchParams() {
- if (this.#searchParams == null) {
- this.#searchParams = new URLSearchParams(this.search);
- urls.set(this.#searchParams, this);
- }
- return this.#searchParams;
- }
-
- toString() {
- return this.href;
- }
-
- toJSON() {
- return this.href;
- }
- }
-
- /**
- * This function implements application/x-www-form-urlencoded parsing.
- * https://url.spec.whatwg.org/#concept-urlencoded-parser
- * @param {Uint8Array} bytes
- * @returns {[string, string][]}
- */
- function parseUrlEncoded(bytes) {
- return core.opSync("op_url_parse_search_params", null, bytes);
- }
-
- window.__bootstrap.url = {
- URL,
- URLSearchParams,
- parseUrlEncoded,
- };
-})(this);
diff --git a/op_crates/url/Cargo.toml b/op_crates/url/Cargo.toml
deleted file mode 100644
index de7a3cb0a..000000000
--- a/op_crates/url/Cargo.toml
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-[package]
-name = "deno_url"
-version = "0.5.0"
-edition = "2018"
-description = "URL API implementation for Deno"
-authors = ["the Deno authors"]
-license = "MIT"
-readme = "README.md"
-repository = "https://github.com/denoland/deno"
-
-[lib]
-path = "lib.rs"
-
-[dependencies]
-deno_core = { version = "0.86.0", path = "../../core" }
-idna = "0.2.2"
-percent-encoding = "2.1.0"
-serde = { version = "1.0.125", features = ["derive"] }
-
-[dev-dependencies]
-bencher = "0.1"
-
-[[bench]]
-name = "url_ops"
-harness = false
diff --git a/op_crates/url/README.md b/op_crates/url/README.md
deleted file mode 100644
index 991dd8b20..000000000
--- a/op_crates/url/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# deno_url
-
-This crate implements the URL API for Deno.
-
-Spec: https://url.spec.whatwg.org/
diff --git a/op_crates/url/benches/url_ops.rs b/op_crates/url/benches/url_ops.rs
deleted file mode 100644
index 8b3cf2705..000000000
--- a/op_crates/url/benches/url_ops.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-use bencher::{benchmark_group, benchmark_main, Bencher};
-
-use deno_core::v8;
-use deno_core::JsRuntime;
-use deno_core::RuntimeOptions;
-
-fn create_js_runtime() -> JsRuntime {
- let mut runtime = JsRuntime::new(RuntimeOptions {
- extensions: vec![deno_url::init()],
- ..Default::default()
- });
-
- runtime
- .execute("setup", "const { URL } = globalThis.__bootstrap.url;")
- .unwrap();
-
- runtime
-}
-
-pub fn bench_runtime_js(b: &mut Bencher, src: &str) {
- let mut runtime = create_js_runtime();
- let scope = &mut runtime.handle_scope();
- let code = v8::String::new(scope, src).unwrap();
- let script = v8::Script::compile(scope, code, None).unwrap();
- b.iter(|| {
- script.run(scope).unwrap();
- });
-}
-
-fn bench_url_parse(b: &mut Bencher) {
- bench_runtime_js(b, r#"new URL(`http://www.google.com/`);"#);
-}
-
-benchmark_group!(benches, bench_url_parse,);
-benchmark_main!(benches);
diff --git a/op_crates/url/internal.d.ts b/op_crates/url/internal.d.ts
deleted file mode 100644
index ec2c2688c..000000000
--- a/op_crates/url/internal.d.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-/// <reference no-default-lib="true" />
-/// <reference lib="esnext" />
-
-declare namespace globalThis {
- declare namespace __bootstrap {
- declare var url: {
- URL: typeof URL;
- URLSearchParams: typeof URLSearchParams;
- parseUrlEncoded(bytes: Uint8Array): [string, string][];
- };
- }
-}
diff --git a/op_crates/url/lib.deno_url.d.ts b/op_crates/url/lib.deno_url.d.ts
deleted file mode 100644
index 3f9745352..000000000
--- a/op_crates/url/lib.deno_url.d.ts
+++ /dev/null
@@ -1,175 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// deno-lint-ignore-file no-explicit-any
-
-/// <reference no-default-lib="true" />
-/// <reference lib="esnext" />
-
-declare class URLSearchParams {
- constructor(
- init?: string[][] | Record<string, string> | string | URLSearchParams,
- );
- static toString(): string;
-
- /** Appends a specified key/value pair as a new search parameter.
- *
- * ```ts
- * let searchParams = new URLSearchParams();
- * searchParams.append('name', 'first');
- * searchParams.append('name', 'second');
- * ```
- */
- append(name: string, value: string): void;
-
- /** Deletes the given search parameter and its associated value,
- * from the list of all search parameters.
- *
- * ```ts
- * let searchParams = new URLSearchParams([['name', 'value']]);
- * searchParams.delete('name');
- * ```
- */
- delete(name: string): void;
-
- /** Returns all the values associated with a given search parameter
- * as an array.
- *
- * ```ts
- * searchParams.getAll('name');
- * ```
- */
- getAll(name: string): string[];
-
- /** Returns the first value associated to the given search parameter.
- *
- * ```ts
- * searchParams.get('name');
- * ```
- */
- get(name: string): string | null;
-
- /** Returns a Boolean that indicates whether a parameter with the
- * specified name exists.
- *
- * ```ts
- * searchParams.has('name');
- * ```
- */
- has(name: string): boolean;
-
- /** Sets the value associated with a given search parameter to the
- * given value. If there were several matching values, this method
- * deletes the others. If the search parameter doesn't exist, this
- * method creates it.
- *
- * ```ts
- * searchParams.set('name', 'value');
- * ```
- */
- set(name: string, value: string): void;
-
- /** Sort all key/value pairs contained in this object in place and
- * return undefined. The sort order is according to Unicode code
- * points of the keys.
- *
- * ```ts
- * searchParams.sort();
- * ```
- */
- sort(): void;
-
- /** Calls a function for each element contained in this object in
- * place and return undefined. Optionally accepts an object to use
- * as this when executing callback as second argument.
- *
- * ```ts
- * const params = new URLSearchParams([["a", "b"], ["c", "d"]]);
- * params.forEach((value, key, parent) => {
- * console.log(value, key, parent);
- * });
- * ```
- *
- */
- forEach(
- callbackfn: (value: string, key: string, parent: this) => void,
- thisArg?: any,
- ): void;
-
- /** Returns an iterator allowing to go through all keys contained
- * in this object.
- *
- * ```ts
- * const params = new URLSearchParams([["a", "b"], ["c", "d"]]);
- * for (const key of params.keys()) {
- * console.log(key);
- * }
- * ```
- */
- keys(): IterableIterator<string>;
-
- /** Returns an iterator allowing to go through all values contained
- * in this object.
- *
- * ```ts
- * const params = new URLSearchParams([["a", "b"], ["c", "d"]]);
- * for (const value of params.values()) {
- * console.log(value);
- * }
- * ```
- */
- values(): IterableIterator<string>;
-
- /** Returns an iterator allowing to go through all key/value
- * pairs contained in this object.
- *
- * ```ts
- * const params = new URLSearchParams([["a", "b"], ["c", "d"]]);
- * for (const [key, value] of params.entries()) {
- * console.log(key, value);
- * }
- * ```
- */
- entries(): IterableIterator<[string, string]>;
-
- /** Returns an iterator allowing to go through all key/value
- * pairs contained in this object.
- *
- * ```ts
- * const params = new URLSearchParams([["a", "b"], ["c", "d"]]);
- * for (const [key, value] of params) {
- * console.log(key, value);
- * }
- * ```
- */
- [Symbol.iterator](): IterableIterator<[string, string]>;
-
- /** Returns a query string suitable for use in a URL.
- *
- * ```ts
- * searchParams.toString();
- * ```
- */
- toString(): string;
-}
-
-/** The URL interface represents an object providing static methods used for creating object URLs. */
-declare class URL {
- constructor(url: string, base?: string | URL);
- static createObjectURL(blob: Blob): string;
- static revokeObjectURL(url: string): void;
-
- hash: string;
- host: string;
- hostname: string;
- href: string;
- toString(): string;
- readonly origin: string;
- password: string;
- pathname: string;
- port: string;
- protocol: string;
- search: string;
- readonly searchParams: URLSearchParams;
- username: string;
- toJSON(): string;
-}
diff --git a/op_crates/url/lib.rs b/op_crates/url/lib.rs
deleted file mode 100644
index 1d7a9b08b..000000000
--- a/op_crates/url/lib.rs
+++ /dev/null
@@ -1,173 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::error::generic_error;
-use deno_core::error::type_error;
-use deno_core::error::uri_error;
-use deno_core::error::AnyError;
-use deno_core::include_js_files;
-use deno_core::op_sync;
-use deno_core::url::form_urlencoded;
-use deno_core::url::quirks;
-use deno_core::url::Url;
-use deno_core::Extension;
-use deno_core::ZeroCopyBuf;
-use serde::Deserialize;
-use serde::Serialize;
-use std::panic::catch_unwind;
-use std::path::PathBuf;
-
-pub fn init() -> Extension {
- Extension::builder()
- .js(include_js_files!(
- prefix "deno:op_crates/url",
- "00_url.js",
- ))
- .ops(vec![
- ("op_url_parse", op_sync(op_url_parse)),
- (
- "op_url_parse_search_params",
- op_sync(op_url_parse_search_params),
- ),
- (
- "op_url_stringify_search_params",
- op_sync(op_url_stringify_search_params),
- ),
- ])
- .build()
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct UrlParseArgs {
- href: String,
- base_href: Option<String>,
- // If one of the following are present, this is a setter call. Apply the
- // proper `Url::set_*()` method after (re)parsing `href`.
- set_hash: Option<String>,
- set_host: Option<String>,
- set_hostname: Option<String>,
- set_password: Option<String>,
- set_pathname: Option<String>,
- set_port: Option<String>,
- set_protocol: Option<String>,
- set_search: Option<String>,
- set_username: Option<String>,
-}
-
-#[derive(Serialize)]
-pub struct UrlParts {
- href: String,
- hash: String,
- host: String,
- hostname: String,
- origin: String,
- password: String,
- pathname: String,
- port: String,
- protocol: String,
- search: String,
- username: String,
-}
-
-/// Parse `UrlParseArgs::href` with an optional `UrlParseArgs::base_href`, or an
-/// optional part to "set" after parsing. Return `UrlParts`.
-pub fn op_url_parse(
- _state: &mut deno_core::OpState,
- args: UrlParseArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<UrlParts, AnyError> {
- let base_url = args
- .base_href
- .as_ref()
- .map(|b| Url::parse(b).map_err(|_| type_error("Invalid base URL")))
- .transpose()?;
- let mut url = Url::options()
- .base_url(base_url.as_ref())
- .parse(&args.href)
- .map_err(|_| type_error("Invalid URL"))?;
-
- if let Some(hash) = args.set_hash.as_ref() {
- quirks::set_hash(&mut url, hash);
- } else if let Some(host) = args.set_host.as_ref() {
- quirks::set_host(&mut url, host).map_err(|_| uri_error("Invalid host"))?;
- } else if let Some(hostname) = args.set_hostname.as_ref() {
- quirks::set_hostname(&mut url, hostname)
- .map_err(|_| uri_error("Invalid hostname"))?;
- } else if let Some(password) = args.set_password.as_ref() {
- quirks::set_password(&mut url, password)
- .map_err(|_| uri_error("Invalid password"))?;
- } else if let Some(pathname) = args.set_pathname.as_ref() {
- quirks::set_pathname(&mut url, pathname);
- } else if let Some(port) = args.set_port.as_ref() {
- quirks::set_port(&mut url, port).map_err(|_| uri_error("Invalid port"))?;
- } else if let Some(protocol) = args.set_protocol.as_ref() {
- quirks::set_protocol(&mut url, protocol)
- .map_err(|_| uri_error("Invalid protocol"))?;
- } else if let Some(search) = args.set_search.as_ref() {
- quirks::set_search(&mut url, search);
- } else if let Some(username) = args.set_username.as_ref() {
- quirks::set_username(&mut url, username)
- .map_err(|_| uri_error("Invalid username"))?;
- }
-
- // TODO(nayeemrmn): Panic that occurs in rust-url for the `non-spec:`
- // url-constructor wpt tests: https://github.com/servo/rust-url/issues/670.
- let username = catch_unwind(|| quirks::username(&url)).map_err(|_| {
- generic_error(format!(
- "Internal error while parsing \"{}\"{}, \
- see https://github.com/servo/rust-url/issues/670",
- args.href,
- args
- .base_href
- .map(|b| format!(" against \"{}\"", b))
- .unwrap_or_default()
- ))
- })?;
- Ok(UrlParts {
- href: quirks::href(&url).to_string(),
- hash: quirks::hash(&url).to_string(),
- host: quirks::host(&url).to_string(),
- hostname: quirks::hostname(&url).to_string(),
- origin: quirks::origin(&url),
- password: quirks::password(&url).to_string(),
- pathname: quirks::pathname(&url).to_string(),
- port: quirks::port(&url).to_string(),
- protocol: quirks::protocol(&url).to_string(),
- search: quirks::search(&url).to_string(),
- username: username.to_string(),
- })
-}
-
-pub fn op_url_parse_search_params(
- _state: &mut deno_core::OpState,
- args: Option<String>,
- zero_copy: Option<ZeroCopyBuf>,
-) -> Result<Vec<(String, String)>, AnyError> {
- let params = match (args, zero_copy) {
- (None, Some(zero_copy)) => form_urlencoded::parse(&zero_copy)
- .into_iter()
- .map(|(k, v)| (k.as_ref().to_owned(), v.as_ref().to_owned()))
- .collect(),
- (Some(args), None) => form_urlencoded::parse(args.as_bytes())
- .into_iter()
- .map(|(k, v)| (k.as_ref().to_owned(), v.as_ref().to_owned()))
- .collect(),
- _ => return Err(type_error("invalid parameters")),
- };
- Ok(params)
-}
-
-pub fn op_url_stringify_search_params(
- _state: &mut deno_core::OpState,
- args: Vec<(String, String)>,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<String, AnyError> {
- let search = form_urlencoded::Serializer::new(String::new())
- .extend_pairs(args)
- .finish();
- Ok(search)
-}
-
-pub fn get_declaration() -> PathBuf {
- PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("lib.deno_url.d.ts")
-}
diff --git a/op_crates/web/00_infra.js b/op_crates/web/00_infra.js
deleted file mode 100644
index 05f68268f..000000000
--- a/op_crates/web/00_infra.js
+++ /dev/null
@@ -1,203 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// @ts-check
-/// <reference path="../../core/lib.deno_core.d.ts" />
-/// <reference path="../web/internal.d.ts" />
-/// <reference path="../web/lib.deno_web.d.ts" />
-
-"use strict";
-
-((window) => {
- const ASCII_DIGIT = ["\u0030-\u0039"];
- const ASCII_UPPER_ALPHA = ["\u0041-\u005A"];
- const ASCII_LOWER_ALPHA = ["\u0061-\u007A"];
- const ASCII_ALPHA = [...ASCII_UPPER_ALPHA, ...ASCII_LOWER_ALPHA];
- const ASCII_ALPHANUMERIC = [...ASCII_DIGIT, ...ASCII_ALPHA];
-
- const HTTP_TAB_OR_SPACE = ["\u0009", "\u0020"];
- const HTTP_WHITESPACE = ["\u000A", "\u000D", ...HTTP_TAB_OR_SPACE];
-
- const HTTP_TOKEN_CODE_POINT = [
- "\u0021",
- "\u0023",
- "\u0024",
- "\u0025",
- "\u0026",
- "\u0027",
- "\u002A",
- "\u002B",
- "\u002D",
- "\u002E",
- "\u005E",
- "\u005F",
- "\u0060",
- "\u007C",
- "\u007E",
- ...ASCII_ALPHANUMERIC,
- ];
- const HTTP_TOKEN_CODE_POINT_RE = new RegExp(
- `^[${regexMatcher(HTTP_TOKEN_CODE_POINT)}]+$`,
- );
- const HTTP_QUOTED_STRING_TOKEN_POINT = [
- "\u0009",
- "\u0020-\u007E",
- "\u0080-\u00FF",
- ];
- const HTTP_QUOTED_STRING_TOKEN_POINT_RE = new RegExp(
- `^[${regexMatcher(HTTP_QUOTED_STRING_TOKEN_POINT)}]+$`,
- );
- const HTTP_TAB_OR_SPACE_MATCHER = regexMatcher(HTTP_TAB_OR_SPACE);
- const HTTP_TAB_OR_SPACE_PREFIX_RE = new RegExp(
- `^[${HTTP_TAB_OR_SPACE_MATCHER}]+`,
- "g",
- );
- const HTTP_TAB_OR_SPACE_SUFFIX_RE = new RegExp(
- `[${HTTP_TAB_OR_SPACE_MATCHER}]+$`,
- "g",
- );
- const HTTP_WHITESPACE_MATCHER = regexMatcher(HTTP_WHITESPACE);
- const HTTP_WHITESPACE_PREFIX_RE = new RegExp(
- `^[${HTTP_WHITESPACE_MATCHER}]+`,
- "g",
- );
- const HTTP_WHITESPACE_SUFFIX_RE = new RegExp(
- `[${HTTP_WHITESPACE_MATCHER}]+$`,
- "g",
- );
-
- /**
- * Turn a string of chars into a regex safe matcher.
- * @param {string[]} chars
- * @returns {string}
- */
- function regexMatcher(chars) {
- const matchers = chars.map((char) => {
- if (char.length === 1) {
- return `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}`;
- } else if (char.length === 3 && char[1] === "-") {
- return `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}-\\u${
- char.charCodeAt(2).toString(16).padStart(4, "0")
- }`;
- } else {
- throw TypeError("unreachable");
- }
- });
- return matchers.join("");
- }
-
- /**
- * https://infra.spec.whatwg.org/#collect-a-sequence-of-code-points
- * @param {string} input
- * @param {number} position
- * @param {(char: string) => boolean} condition
- * @returns {{result: string, position: number}}
- */
- function collectSequenceOfCodepoints(input, position, condition) {
- const start = position;
- for (
- let c = input.charAt(position);
- position < input.length && condition(c);
- c = input.charAt(++position)
- );
- return { result: input.slice(start, position), position };
- }
-
- /**
- * @param {string} s
- * @returns {string}
- */
- function byteUpperCase(s) {
- return String(s).replace(/[a-z]/g, function byteUpperCaseReplace(c) {
- return c.toUpperCase();
- });
- }
-
- /**
- * @param {string} s
- * @returns {string}
- */
- function byteLowerCase(s) {
- return String(s).replace(/[A-Z]/g, function byteUpperCaseReplace(c) {
- return c.toLowerCase();
- });
- }
-
- /**
- * https://fetch.spec.whatwg.org/#collect-an-http-quoted-string
- * @param {string} input
- * @param {number} position
- * @param {boolean} extractValue
- * @returns {{result: string, position: number}}
- */
- function collectHttpQuotedString(input, position, extractValue) {
- // 1.
- const positionStart = position;
- // 2.
- let value = "";
- // 3.
- if (input[position] !== "\u0022") throw new Error('must be "');
- // 4.
- position++;
- // 5.
- while (true) {
- // 5.1.
- const res = collectSequenceOfCodepoints(
- input,
- position,
- (c) => c !== "\u0022" && c !== "\u005C",
- );
- value += res.result;
- position = res.position;
- // 5.2.
- if (position >= input.length) break;
- // 5.3.
- const quoteOrBackslash = input[position];
- // 5.4.
- position++;
- // 5.5.
- if (quoteOrBackslash === "\u005C") {
- // 5.5.1.
- if (position >= input.length) {
- value += "\u005C";
- break;
- }
- // 5.5.2.
- value += input[position];
- // 5.5.3.
- position++;
- } else { // 5.6.
- // 5.6.1
- if (quoteOrBackslash !== "\u0022") throw new Error('must be "');
- // 5.6.2
- break;
- }
- }
- // 6.
- if (extractValue) return { result: value, position };
- // 7.
- return { result: input.substring(positionStart, position + 1), position };
- }
-
- window.__bootstrap.infra = {
- collectSequenceOfCodepoints,
- ASCII_DIGIT,
- ASCII_UPPER_ALPHA,
- ASCII_LOWER_ALPHA,
- ASCII_ALPHA,
- ASCII_ALPHANUMERIC,
- HTTP_TAB_OR_SPACE,
- HTTP_WHITESPACE,
- HTTP_TOKEN_CODE_POINT,
- HTTP_TOKEN_CODE_POINT_RE,
- HTTP_QUOTED_STRING_TOKEN_POINT,
- HTTP_QUOTED_STRING_TOKEN_POINT_RE,
- HTTP_TAB_OR_SPACE_PREFIX_RE,
- HTTP_TAB_OR_SPACE_SUFFIX_RE,
- HTTP_WHITESPACE_PREFIX_RE,
- HTTP_WHITESPACE_SUFFIX_RE,
- regexMatcher,
- byteUpperCase,
- byteLowerCase,
- collectHttpQuotedString,
- };
-})(globalThis);
diff --git a/op_crates/web/01_dom_exception.js b/op_crates/web/01_dom_exception.js
deleted file mode 100644
index f5bd3289b..000000000
--- a/op_crates/web/01_dom_exception.js
+++ /dev/null
@@ -1,148 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// @ts-check
-/// <reference path="../../core/lib.deno_core.d.ts" />
-/// <reference path="../webidl/internal.d.ts" />
-/// <reference path="../web/internal.d.ts" />
-/// <reference path="../web/lib.deno_web.d.ts" />
-
-"use strict";
-
-((window) => {
- const webidl = window.__bootstrap.webidl;
-
- const { defineProperty } = Object;
- // Defined in WebIDL 4.3.
- // https://heycam.github.io/webidl/#idl-DOMException
- const INDEX_SIZE_ERR = 1;
- const DOMSTRING_SIZE_ERR = 2;
- const HIERARCHY_REQUEST_ERR = 3;
- const WRONG_DOCUMENT_ERR = 4;
- const INVALID_CHARACTER_ERR = 5;
- const NO_DATA_ALLOWED_ERR = 6;
- const NO_MODIFICATION_ALLOWED_ERR = 7;
- const NOT_FOUND_ERR = 8;
- const NOT_SUPPORTED_ERR = 9;
- const INUSE_ATTRIBUTE_ERR = 10;
- const INVALID_STATE_ERR = 11;
- const SYNTAX_ERR = 12;
- const INVALID_MODIFICATION_ERR = 13;
- const NAMESPACE_ERR = 14;
- const INVALID_ACCESS_ERR = 15;
- const VALIDATION_ERR = 16;
- const TYPE_MISMATCH_ERR = 17;
- const SECURITY_ERR = 18;
- const NETWORK_ERR = 19;
- const ABORT_ERR = 20;
- const URL_MISMATCH_ERR = 21;
- const QUOTA_EXCEEDED_ERR = 22;
- const TIMEOUT_ERR = 23;
- const INVALID_NODE_TYPE_ERR = 24;
- const DATA_CLONE_ERR = 25;
-
- // Defined in WebIDL 2.8.1.
- // https://heycam.github.io/webidl/#dfn-error-names-table
- /** @type {Record<string, number>} */
- const nameToCodeMapping = {
- IndexSizeError: INDEX_SIZE_ERR,
- HierarchyRequestError: HIERARCHY_REQUEST_ERR,
- WrongDocumentError: WRONG_DOCUMENT_ERR,
- InvalidCharacterError: INVALID_CHARACTER_ERR,
- NoModificationAllowedError: NO_MODIFICATION_ALLOWED_ERR,
- NotFoundError: NOT_FOUND_ERR,
- NotSupportedError: NOT_SUPPORTED_ERR,
- InUseAttributeError: INUSE_ATTRIBUTE_ERR,
- InvalidStateError: INVALID_STATE_ERR,
- SyntaxError: SYNTAX_ERR,
- InvalidModificationError: INVALID_MODIFICATION_ERR,
- NamespaceError: NAMESPACE_ERR,
- InvalidAccessError: INVALID_ACCESS_ERR,
- TypeMismatchError: TYPE_MISMATCH_ERR,
- SecurityError: SECURITY_ERR,
- NetworkError: NETWORK_ERR,
- AbortError: ABORT_ERR,
- URLMismatchError: URL_MISMATCH_ERR,
- QuotaExceededError: QUOTA_EXCEEDED_ERR,
- TimeoutError: TIMEOUT_ERR,
- InvalidNodeTypeError: INVALID_NODE_TYPE_ERR,
- DataCloneError: DATA_CLONE_ERR,
- };
-
- // Defined in WebIDL 4.3.
- // https://heycam.github.io/webidl/#idl-DOMException
- class DOMException extends Error {
- #message = "";
- #name = "";
- #code = 0;
-
- constructor(message = "", name = "Error") {
- super();
- this.#message = webidl.converters.DOMString(message, {
- prefix: "Failed to construct 'DOMException'",
- context: "Argument 1",
- });
- this.#name = webidl.converters.DOMString(name, {
- prefix: "Failed to construct 'DOMException'",
- context: "Argument 2",
- });
- this.#code = nameToCodeMapping[this.#name] ?? 0;
- }
-
- get message() {
- return this.#message;
- }
-
- get name() {
- return this.#name;
- }
-
- get code() {
- return this.#code;
- }
-
- get [Symbol.toStringTag]() {
- return "DOMException";
- }
- }
-
- defineProperty(DOMException.prototype, "message", { enumerable: true });
- defineProperty(DOMException.prototype, "name", { enumerable: true });
- defineProperty(DOMException.prototype, "code", { enumerable: true });
-
- for (
- const [key, value] of Object.entries({
- INDEX_SIZE_ERR,
- DOMSTRING_SIZE_ERR,
- HIERARCHY_REQUEST_ERR,
- WRONG_DOCUMENT_ERR,
- INVALID_CHARACTER_ERR,
- NO_DATA_ALLOWED_ERR,
- NO_MODIFICATION_ALLOWED_ERR,
- NOT_FOUND_ERR,
- NOT_SUPPORTED_ERR,
- INUSE_ATTRIBUTE_ERR,
- INVALID_STATE_ERR,
- SYNTAX_ERR,
- INVALID_MODIFICATION_ERR,
- NAMESPACE_ERR,
- INVALID_ACCESS_ERR,
- VALIDATION_ERR,
- TYPE_MISMATCH_ERR,
- SECURITY_ERR,
- NETWORK_ERR,
- ABORT_ERR,
- URL_MISMATCH_ERR,
- QUOTA_EXCEEDED_ERR,
- TIMEOUT_ERR,
- INVALID_NODE_TYPE_ERR,
- DATA_CLONE_ERR,
- })
- ) {
- const desc = { value, enumerable: true };
- defineProperty(DOMException, key, desc);
- defineProperty(DOMException.prototype, key, desc);
- }
-
- window.DOMException = DOMException;
- defineProperty(window, "DOMException", { enumerable: false });
-})(this);
diff --git a/op_crates/web/01_mimesniff.js b/op_crates/web/01_mimesniff.js
deleted file mode 100644
index b42dd1409..000000000
--- a/op_crates/web/01_mimesniff.js
+++ /dev/null
@@ -1,190 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// @ts-check
-/// <reference path="../../core/lib.deno_core.d.ts" />
-/// <reference path="../web/internal.d.ts" />
-/// <reference path="../web/lib.deno_web.d.ts" />
-
-"use strict";
-
-((window) => {
- const {
- collectSequenceOfCodepoints,
- HTTP_WHITESPACE,
- HTTP_WHITESPACE_PREFIX_RE,
- HTTP_WHITESPACE_SUFFIX_RE,
- HTTP_QUOTED_STRING_TOKEN_POINT_RE,
- HTTP_TOKEN_CODE_POINT_RE,
- collectHttpQuotedString,
- } = window.__bootstrap.infra;
-
- /**
- * @typedef MimeType
- * @property {string} type
- * @property {string} subtype
- * @property {Map<string,string>} parameters
- */
-
- /**
- * @param {string} input
- * @returns {MimeType | null}
- */
- function parseMimeType(input) {
- // 1.
- input = input.replaceAll(HTTP_WHITESPACE_PREFIX_RE, "");
- input = input.replaceAll(HTTP_WHITESPACE_SUFFIX_RE, "");
-
- // 2.
- let position = 0;
- const endOfInput = input.length;
-
- // 3.
- const res1 = collectSequenceOfCodepoints(
- input,
- position,
- (c) => c != "\u002F",
- );
- const type = res1.result;
- position = res1.position;
-
- // 4.
- if (type === "" || !HTTP_TOKEN_CODE_POINT_RE.test(type)) return null;
-
- // 5.
- if (position >= endOfInput) return null;
-
- // 6.
- position++;
-
- // 7.
- const res2 = collectSequenceOfCodepoints(
- input,
- position,
- (c) => c != "\u003B",
- );
- let subtype = res2.result;
- position = res2.position;
-
- // 8.
- subtype = subtype.replaceAll(HTTP_WHITESPACE_SUFFIX_RE, "");
-
- // 9.
- if (subtype === "" || !HTTP_TOKEN_CODE_POINT_RE.test(subtype)) return null;
-
- // 10.
- const mimeType = {
- type: type.toLowerCase(),
- subtype: subtype.toLowerCase(),
- /** @type {Map<string, string>} */
- parameters: new Map(),
- };
-
- // 11.
- while (position < endOfInput) {
- // 11.1.
- position++;
-
- // 11.2.
- const res1 = collectSequenceOfCodepoints(
- input,
- position,
- (c) => HTTP_WHITESPACE.includes(c),
- );
- position = res1.position;
-
- // 11.3.
- const res2 = collectSequenceOfCodepoints(
- input,
- position,
- (c) => c !== "\u003B" && c !== "\u003D",
- );
- let parameterName = res2.result;
- position = res2.position;
-
- // 11.4.
- parameterName = parameterName.toLowerCase();
-
- // 11.5.
- if (position < endOfInput) {
- if (input[position] == "\u003B") continue;
- position++;
- }
-
- // 11.6.
- if (position >= endOfInput) break;
-
- // 11.7.
- let parameterValue = null;
-
- // 11.8.
- if (input[position] === "\u0022") {
- // 11.8.1.
- const res = collectHttpQuotedString(input, position, true);
- parameterValue = res.result;
- position = res.position;
-
- // 11.8.2.
- position++;
- } else { // 11.9.
- // 11.9.1.
- const res = collectSequenceOfCodepoints(
- input,
- position,
- (c) => c !== "\u003B",
- );
- parameterValue = res.result;
- position = res.position;
-
- // 11.9.2.
- parameterValue = parameterValue.replaceAll(
- HTTP_WHITESPACE_SUFFIX_RE,
- "",
- );
-
- // 11.9.3.
- if (parameterValue === "") continue;
- }
-
- // 11.10.
- if (
- parameterName !== "" && HTTP_TOKEN_CODE_POINT_RE.test(parameterName) &&
- HTTP_QUOTED_STRING_TOKEN_POINT_RE.test(parameterValue) &&
- !mimeType.parameters.has(parameterName)
- ) {
- mimeType.parameters.set(parameterName, parameterValue);
- }
- }
-
- // 12.
- return mimeType;
- }
-
- /**
- * @param {MimeType} mimeType
- * @returns {string}
- */
- function essence(mimeType) {
- return `${mimeType.type}/${mimeType.subtype}`;
- }
-
- /**
- * @param {MimeType} mimeType
- * @returns {string}
- */
- function serializeMimeType(mimeType) {
- let serialization = essence(mimeType);
- for (const param of mimeType.parameters) {
- serialization += `;${param[0]}=`;
- let value = param[1];
- if (!HTTP_TOKEN_CODE_POINT_RE.test(value)) {
- value = value.replaceAll("\\", "\\\\");
- value = value.replaceAll('"', '\\"');
- value = `"${value}"`;
- }
- serialization += value;
- }
- return serialization;
- }
-
- window.__bootstrap.mimesniff = { parseMimeType, essence, serializeMimeType };
-})(this);
diff --git a/op_crates/web/02_event.js b/op_crates/web/02_event.js
deleted file mode 100644
index 35112132e..000000000
--- a/op_crates/web/02_event.js
+++ /dev/null
@@ -1,1212 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// This module follows most of the WHATWG Living Standard for the DOM logic.
-// Many parts of the DOM are not implemented in Deno, but the logic for those
-// parts still exists. This means you will observe a lot of strange structures
-// and impossible logic branches based on what Deno currently supports.
-"use strict";
-
-((window) => {
- const webidl = window.__bootstrap.webidl;
-
- // accessors for non runtime visible data
-
- function getDispatched(event) {
- return Boolean(event[_dispatched]);
- }
-
- function getPath(event) {
- return event[_path] ?? [];
- }
-
- function getStopImmediatePropagation(event) {
- return Boolean(event[_stopImmediatePropagationFlag]);
- }
-
- function setCurrentTarget(
- event,
- value,
- ) {
- event[_attributes].currentTarget = value;
- }
-
- function setIsTrusted(event, value) {
- event[_isTrusted] = value;
- }
-
- function setDispatched(event, value) {
- event[_dispatched] = value;
- }
-
- function setEventPhase(event, value) {
- event[_attributes].eventPhase = value;
- }
-
- function setInPassiveListener(event, value) {
- event[_inPassiveListener] = value;
- }
-
- function setPath(event, value) {
- event[_path] = value;
- }
-
- function setRelatedTarget(
- event,
- value,
- ) {
- event[_attributes].relatedTarget = value;
- }
-
- function setTarget(event, value) {
- event[_attributes].target = value;
- }
-
- function setStopImmediatePropagation(
- event,
- value,
- ) {
- event[_stopImmediatePropagationFlag] = value;
- }
-
- // Type guards that widen the event type
-
- function hasRelatedTarget(
- event,
- ) {
- return "relatedTarget" in event;
- }
-
- const isTrusted = Object.getOwnPropertyDescriptor({
- get isTrusted() {
- return this[_isTrusted];
- },
- }, "isTrusted").get;
-
- const eventInitConverter = webidl.createDictionaryConverter("EventInit", [{
- key: "bubbles",
- defaultValue: false,
- converter: webidl.converters.boolean,
- }, {
- key: "cancelable",
- defaultValue: false,
- converter: webidl.converters.boolean,
- }, {
- key: "composed",
- defaultValue: false,
- converter: webidl.converters.boolean,
- }]);
-
- const _attributes = Symbol("[[attributes]]");
- const _canceledFlag = Symbol("[[canceledFlag]]");
- const _stopPropagationFlag = Symbol("[[stopPropagationFlag]]");
- const _stopImmediatePropagationFlag = Symbol(
- "[[stopImmediatePropagationFlag]]",
- );
- const _inPassiveListener = Symbol("[[inPassiveListener]]");
- const _dispatched = Symbol("[[dispatched]]");
- const _isTrusted = Symbol("[[isTrusted]]");
- const _path = Symbol("[[path]]");
-
- class Event {
- [_attributes] = {};
- [_canceledFlag] = false;
- [_stopPropagationFlag] = false;
- [_stopImmediatePropagationFlag] = false;
- [_inPassiveListener] = false;
- [_dispatched] = false;
- [_isTrusted] = false;
- [_path] = [];
-
- constructor(type, eventInitDict = {}) {
- webidl.requiredArguments(arguments.length, 1, {
- prefix: "Failed to construct 'Event'",
- });
- type = webidl.converters.DOMString(type, {
- prefix: "Failed to construct 'Event'",
- context: "Argument 1",
- });
- const eventInit = eventInitConverter(eventInitDict, {
- prefix: "Failed to construct 'Event'",
- context: "Argument 2",
- });
- this[_attributes] = {
- type,
- ...eventInit,
- currentTarget: null,
- eventPhase: Event.NONE,
- target: null,
- timeStamp: Date.now(),
- };
- Reflect.defineProperty(this, "isTrusted", {
- enumerable: true,
- get: isTrusted,
- });
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return buildCustomInspectOutput(this, EVENT_PROPS, inspect);
- }
-
- get type() {
- return this[_attributes].type;
- }
- set type(_) {
- // this is a no-op because this member is readonly
- }
- get target() {
- return this[_attributes].target;
- }
- set target(_) {
- // this is a no-op because this member is readonly
- }
- get srcElement() {
- return null;
- }
- set srcElement(_) {
- // this is a no-op because this member is readonly
- }
- get currentTarget() {
- return this[_attributes].currentTarget;
- }
- set currentTarget(_) {
- // this is a no-op because this member is readonly
- }
- composedPath() {
- const path = this[_path];
- if (path.length === 0) {
- return [];
- }
-
- if (!this.currentTarget) {
- throw new Error("assertion error");
- }
- const composedPath = [
- {
- item: this.currentTarget,
- itemInShadowTree: false,
- relatedTarget: null,
- rootOfClosedTree: false,
- slotInClosedTree: false,
- target: null,
- touchTargetList: [],
- },
- ];
-
- let currentTargetIndex = 0;
- let currentTargetHiddenSubtreeLevel = 0;
-
- for (let index = path.length - 1; index >= 0; index--) {
- const { item, rootOfClosedTree, slotInClosedTree } = path[index];
-
- if (rootOfClosedTree) {
- currentTargetHiddenSubtreeLevel++;
- }
-
- if (item === this.currentTarget) {
- currentTargetIndex = index;
- break;
- }
-
- if (slotInClosedTree) {
- currentTargetHiddenSubtreeLevel--;
- }
- }
-
- let currentHiddenLevel = currentTargetHiddenSubtreeLevel;
- let maxHiddenLevel = currentTargetHiddenSubtreeLevel;
-
- for (let i = currentTargetIndex - 1; i >= 0; i--) {
- const { item, rootOfClosedTree, slotInClosedTree } = path[i];
-
- if (rootOfClosedTree) {
- currentHiddenLevel++;
- }
-
- if (currentHiddenLevel <= maxHiddenLevel) {
- composedPath.unshift({
- item,
- itemInShadowTree: false,
- relatedTarget: null,
- rootOfClosedTree: false,
- slotInClosedTree: false,
- target: null,
- touchTargetList: [],
- });
- }
-
- if (slotInClosedTree) {
- currentHiddenLevel--;
-
- if (currentHiddenLevel < maxHiddenLevel) {
- maxHiddenLevel = currentHiddenLevel;
- }
- }
- }
-
- currentHiddenLevel = currentTargetHiddenSubtreeLevel;
- maxHiddenLevel = currentTargetHiddenSubtreeLevel;
-
- for (let index = currentTargetIndex + 1; index < path.length; index++) {
- const { item, rootOfClosedTree, slotInClosedTree } = path[index];
-
- if (slotInClosedTree) {
- currentHiddenLevel++;
- }
-
- if (currentHiddenLevel <= maxHiddenLevel) {
- composedPath.push({
- item,
- itemInShadowTree: false,
- relatedTarget: null,
- rootOfClosedTree: false,
- slotInClosedTree: false,
- target: null,
- touchTargetList: [],
- });
- }
-
- if (rootOfClosedTree) {
- currentHiddenLevel--;
-
- if (currentHiddenLevel < maxHiddenLevel) {
- maxHiddenLevel = currentHiddenLevel;
- }
- }
- }
- return composedPath.map((p) => p.item);
- }
-
- get NONE() {
- return Event.NONE;
- }
- set NONE(_) {
- // this is a no-op because this member is readonly
- }
- get CAPTURING_PHASE() {
- return Event.CAPTURING_PHASE;
- }
- set CAPTURING_PHASE(_) {
- // this is a no-op because this member is readonly
- }
- get AT_TARGET() {
- return Event.AT_TARGET;
- }
- set AT_TARGET(_) {
- // this is a no-op because this member is readonly
- }
- get BUBBLING_PHASE() {
- return Event.BUBBLING_PHASE;
- }
- set BUBBLING_PHASE(_) {
- // this is a no-op because this member is readonly
- }
- static get NONE() {
- return 0;
- }
- static set NONE(_) {
- // this is a no-op because this member is readonly
- }
- static get CAPTURING_PHASE() {
- return 1;
- }
- static set CAPTURING_PHASE(_) {
- // this is a no-op because this member is readonly
- }
- static get AT_TARGET() {
- return 2;
- }
- static set AT_TARGET(_) {
- // this is a no-op because this member is readonly
- }
- static get BUBBLING_PHASE() {
- return 3;
- }
- static set BUBBLING_PHASE(_) {
- // this is a no-op because this member is readonly
- }
- get eventPhase() {
- return this[_attributes].eventPhase;
- }
- set eventPhase(_) {
- // this is a no-op because this member is readonly
- }
-
- stopPropagation() {
- this[_stopPropagationFlag] = true;
- }
- get cancelBubble() {
- return this[_stopPropagationFlag];
- }
- set cancelBubble(value) {
- this[_stopPropagationFlag] = webidl.converters.boolean(value);
- }
- stopImmediatePropagation() {
- this[_stopPropagationFlag] = true;
- this[_stopImmediatePropagationFlag] = true;
- }
-
- get bubbles() {
- return this[_attributes].bubbles;
- }
- set bubbles(_) {
- // this is a no-op because this member is readonly
- }
- get cancelable() {
- return this[_attributes].cancelable;
- }
- set cancelable(value) {
- // this is a no-op because this member is readonly
- }
- get returnValue() {
- return !this[_canceledFlag];
- }
- set returnValue(value) {
- if (!webidl.converters.boolean(value)) {
- this[_canceledFlag] = true;
- }
- }
- preventDefault() {
- if (this[_attributes].cancelable && !this[_inPassiveListener]) {
- this[_canceledFlag] = true;
- }
- }
- get defaultPrevented() {
- return this[_canceledFlag];
- }
- set defaultPrevented(_) {
- // this is a no-op because this member is readonly
- }
- get composed() {
- return this[_attributes].composed;
- }
- set composed(_) {
- // this is a no-op because this member is readonly
- }
-
- get initialized() {
- return true;
- }
-
- get timeStamp() {
- return this[_attributes].timeStamp;
- }
- set timeStamp(_) {
- // this is a no-op because this member is readonly
- }
- }
-
- function buildCustomInspectOutput(object, keys, inspect) {
- const inspectObject = Object.fromEntries(keys.map((k) => [k, object[k]]));
- return `${object.constructor.name} ${inspect(inspectObject)}`;
- }
-
- function defineEnumerableProps(
- Ctor,
- props,
- ) {
- for (const prop of props) {
- Reflect.defineProperty(Ctor.prototype, prop, { enumerable: true });
- }
- }
-
- const EVENT_PROPS = [
- "bubbles",
- "cancelable",
- "composed",
- "currentTarget",
- "defaultPrevented",
- "eventPhase",
- "srcElement",
- "target",
- "returnValue",
- "timeStamp",
- "type",
- ];
-
- defineEnumerableProps(Event, EVENT_PROPS);
-
- // This is currently the only node type we are using, so instead of implementing
- // the whole of the Node interface at the moment, this just gives us the one
- // value to power the standards based logic
- const DOCUMENT_FRAGMENT_NODE = 11;
-
- // DOM Logic Helper functions and type guards
-
- /** Get the parent node, for event targets that have a parent.
- *
- * Ref: https://dom.spec.whatwg.org/#get-the-parent */
- function getParent(eventTarget) {
- return isNode(eventTarget) ? eventTarget.parentNode : null;
- }
-
- function getRoot(eventTarget) {
- return isNode(eventTarget)
- ? eventTarget.getRootNode({ composed: true })
- : null;
- }
-
- function isNode(
- eventTarget,
- ) {
- return Boolean(eventTarget && "nodeType" in eventTarget);
- }
-
- // https://dom.spec.whatwg.org/#concept-shadow-including-inclusive-ancestor
- function isShadowInclusiveAncestor(
- ancestor,
- node,
- ) {
- while (isNode(node)) {
- if (node === ancestor) {
- return true;
- }
-
- if (isShadowRoot(node)) {
- node = node && getHost(node);
- } else {
- node = getParent(node);
- }
- }
-
- return false;
- }
-
- function isShadowRoot(nodeImpl) {
- return Boolean(
- nodeImpl &&
- isNode(nodeImpl) &&
- nodeImpl.nodeType === DOCUMENT_FRAGMENT_NODE &&
- getHost(nodeImpl) != null,
- );
- }
-
- function isSlotable(
- nodeImpl,
- ) {
- return Boolean(isNode(nodeImpl) && "assignedSlot" in nodeImpl);
- }
-
- // DOM Logic functions
-
- /** Append a path item to an event's path.
- *
- * Ref: https://dom.spec.whatwg.org/#concept-event-path-append
- */
- function appendToEventPath(
- eventImpl,
- target,
- targetOverride,
- relatedTarget,
- touchTargets,
- slotInClosedTree,
- ) {
- const itemInShadowTree = isNode(target) && isShadowRoot(getRoot(target));
- const rootOfClosedTree = isShadowRoot(target) &&
- getMode(target) === "closed";
-
- getPath(eventImpl).push({
- item: target,
- itemInShadowTree,
- target: targetOverride,
- relatedTarget,
- touchTargetList: touchTargets,
- rootOfClosedTree,
- slotInClosedTree,
- });
- }
-
- function dispatch(
- targetImpl,
- eventImpl,
- targetOverride,
- ) {
- let clearTargets = false;
- let activationTarget = null;
-
- setDispatched(eventImpl, true);
-
- targetOverride = targetOverride ?? targetImpl;
- const eventRelatedTarget = hasRelatedTarget(eventImpl)
- ? eventImpl.relatedTarget
- : null;
- let relatedTarget = retarget(eventRelatedTarget, targetImpl);
-
- if (targetImpl !== relatedTarget || targetImpl === eventRelatedTarget) {
- const touchTargets = [];
-
- appendToEventPath(
- eventImpl,
- targetImpl,
- targetOverride,
- relatedTarget,
- touchTargets,
- false,
- );
-
- const isActivationEvent = eventImpl.type === "click";
-
- if (isActivationEvent && getHasActivationBehavior(targetImpl)) {
- activationTarget = targetImpl;
- }
-
- let slotInClosedTree = false;
- let slotable = isSlotable(targetImpl) && getAssignedSlot(targetImpl)
- ? targetImpl
- : null;
- let parent = getParent(targetImpl);
-
- // Populate event path
- // https://dom.spec.whatwg.org/#event-path
- while (parent !== null) {
- if (slotable !== null) {
- slotable = null;
-
- const parentRoot = getRoot(parent);
- if (
- isShadowRoot(parentRoot) &&
- parentRoot &&
- getMode(parentRoot) === "closed"
- ) {
- slotInClosedTree = true;
- }
- }
-
- relatedTarget = retarget(eventRelatedTarget, parent);
-
- if (
- isNode(parent) &&
- isShadowInclusiveAncestor(getRoot(targetImpl), parent)
- ) {
- appendToEventPath(
- eventImpl,
- parent,
- null,
- relatedTarget,
- touchTargets,
- slotInClosedTree,
- );
- } else if (parent === relatedTarget) {
- parent = null;
- } else {
- targetImpl = parent;
-
- if (
- isActivationEvent &&
- activationTarget === null &&
- getHasActivationBehavior(targetImpl)
- ) {
- activationTarget = targetImpl;
- }
-
- appendToEventPath(
- eventImpl,
- parent,
- targetImpl,
- relatedTarget,
- touchTargets,
- slotInClosedTree,
- );
- }
-
- if (parent !== null) {
- parent = getParent(parent);
- }
-
- slotInClosedTree = false;
- }
-
- let clearTargetsTupleIndex = -1;
- const path = getPath(eventImpl);
- for (
- let i = path.length - 1;
- i >= 0 && clearTargetsTupleIndex === -1;
- i--
- ) {
- if (path[i].target !== null) {
- clearTargetsTupleIndex = i;
- }
- }
- const clearTargetsTuple = path[clearTargetsTupleIndex];
-
- clearTargets = (isNode(clearTargetsTuple.target) &&
- isShadowRoot(getRoot(clearTargetsTuple.target))) ||
- (isNode(clearTargetsTuple.relatedTarget) &&
- isShadowRoot(getRoot(clearTargetsTuple.relatedTarget)));
-
- setEventPhase(eventImpl, Event.CAPTURING_PHASE);
-
- for (let i = path.length - 1; i >= 0; --i) {
- const tuple = path[i];
-
- if (tuple.target === null) {
- invokeEventListeners(tuple, eventImpl);
- }
- }
-
- for (let i = 0; i < path.length; i++) {
- const tuple = path[i];
-
- if (tuple.target !== null) {
- setEventPhase(eventImpl, Event.AT_TARGET);
- } else {
- setEventPhase(eventImpl, Event.BUBBLING_PHASE);
- }
-
- if (
- (eventImpl.eventPhase === Event.BUBBLING_PHASE &&
- eventImpl.bubbles) ||
- eventImpl.eventPhase === Event.AT_TARGET
- ) {
- invokeEventListeners(tuple, eventImpl);
- }
- }
- }
-
- setEventPhase(eventImpl, Event.NONE);
- setCurrentTarget(eventImpl, null);
- setPath(eventImpl, []);
- setDispatched(eventImpl, false);
- eventImpl.cancelBubble = false;
- setStopImmediatePropagation(eventImpl, false);
-
- if (clearTargets) {
- setTarget(eventImpl, null);
- setRelatedTarget(eventImpl, null);
- }
-
- // TODO(bartlomieju): invoke activation targets if HTML nodes will be implemented
- // if (activationTarget !== null) {
- // if (!eventImpl.defaultPrevented) {
- // activationTarget._activationBehavior();
- // }
- // }
-
- return !eventImpl.defaultPrevented;
- }
-
- /** Inner invoking of the event listeners where the resolved listeners are
- * called.
- *
- * Ref: https://dom.spec.whatwg.org/#concept-event-listener-inner-invoke */
- function innerInvokeEventListeners(
- eventImpl,
- targetListeners,
- ) {
- let found = false;
-
- const { type } = eventImpl;
-
- if (!targetListeners || !targetListeners[type]) {
- return found;
- }
-
- // Copy event listeners before iterating since the list can be modified during the iteration.
- const handlers = targetListeners[type].slice();
-
- for (let i = 0; i < handlers.length; i++) {
- const listener = handlers[i];
-
- let capture, once, passive, signal;
- if (typeof listener.options === "boolean") {
- capture = listener.options;
- once = false;
- passive = false;
- } else {
- capture = listener.options.capture;
- once = listener.options.once;
- passive = listener.options.passive;
- }
-
- // Check if the event listener has been removed since the listeners has been cloned.
- if (!targetListeners[type].includes(listener)) {
- continue;
- }
-
- found = true;
-
- if (
- (eventImpl.eventPhase === Event.CAPTURING_PHASE && !capture) ||
- (eventImpl.eventPhase === Event.BUBBLING_PHASE && capture)
- ) {
- continue;
- }
-
- if (once) {
- targetListeners[type].splice(
- targetListeners[type].indexOf(listener),
- 1,
- );
- }
-
- if (passive) {
- setInPassiveListener(eventImpl, true);
- }
-
- if (typeof listener.callback === "object") {
- if (typeof listener.callback.handleEvent === "function") {
- listener.callback.handleEvent(eventImpl);
- }
- } else {
- listener.callback.call(eventImpl.currentTarget, eventImpl);
- }
-
- setInPassiveListener(eventImpl, false);
-
- if (getStopImmediatePropagation(eventImpl)) {
- return found;
- }
- }
-
- return found;
- }
-
- /** Invokes the listeners on a given event path with the supplied event.
- *
- * Ref: https://dom.spec.whatwg.org/#concept-event-listener-invoke */
- function invokeEventListeners(tuple, eventImpl) {
- const path = getPath(eventImpl);
- const tupleIndex = path.indexOf(tuple);
- for (let i = tupleIndex; i >= 0; i--) {
- const t = path[i];
- if (t.target) {
- setTarget(eventImpl, t.target);
- break;
- }
- }
-
- setRelatedTarget(eventImpl, tuple.relatedTarget);
-
- if (eventImpl.cancelBubble) {
- return;
- }
-
- setCurrentTarget(eventImpl, tuple.item);
-
- innerInvokeEventListeners(eventImpl, getListeners(tuple.item));
- }
-
- function normalizeAddEventHandlerOptions(
- options,
- ) {
- if (typeof options === "boolean" || typeof options === "undefined") {
- return {
- capture: Boolean(options),
- once: false,
- passive: false,
- };
- } else {
- return options;
- }
- }
-
- function normalizeEventHandlerOptions(
- options,
- ) {
- if (typeof options === "boolean" || typeof options === "undefined") {
- return {
- capture: Boolean(options),
- };
- } else {
- return options;
- }
- }
-
- /** Retarget the target following the spec logic.
- *
- * Ref: https://dom.spec.whatwg.org/#retarget */
- function retarget(a, b) {
- while (true) {
- if (!isNode(a)) {
- return a;
- }
-
- const aRoot = a.getRootNode();
-
- if (aRoot) {
- if (
- !isShadowRoot(aRoot) ||
- (isNode(b) && isShadowInclusiveAncestor(aRoot, b))
- ) {
- return a;
- }
-
- a = getHost(aRoot);
- }
- }
- }
-
- // Accessors for non-public data
-
- const eventTargetData = new WeakMap();
-
- function setEventTargetData(value) {
- eventTargetData.set(value, getDefaultTargetData());
- }
-
- function getAssignedSlot(target) {
- return Boolean(eventTargetData.get(target)?.assignedSlot);
- }
-
- function getHasActivationBehavior(target) {
- return Boolean(
- eventTargetData.get(target)?.hasActivationBehavior,
- );
- }
-
- function getHost(target) {
- return eventTargetData.get(target)?.host ?? null;
- }
-
- function getListeners(target) {
- return eventTargetData.get(target)?.listeners ?? {};
- }
-
- function getMode(target) {
- return eventTargetData.get(target)?.mode ?? null;
- }
-
- function getDefaultTargetData() {
- return {
- assignedSlot: false,
- hasActivationBehavior: false,
- host: null,
- listeners: Object.create(null),
- mode: "",
- };
- }
-
- class EventTarget {
- constructor() {
- eventTargetData.set(this, getDefaultTargetData());
- }
-
- addEventListener(
- type,
- callback,
- options,
- ) {
- webidl.requiredArguments(arguments.length, 2, {
- prefix: "Failed to execute 'addEventListener' on 'EventTarget'",
- });
- if (callback === null) {
- return;
- }
-
- options = normalizeAddEventHandlerOptions(options);
- const { listeners } = eventTargetData.get(this ?? globalThis);
-
- if (!(type in listeners)) {
- listeners[type] = [];
- }
-
- for (const listener of listeners[type]) {
- if (
- ((typeof listener.options === "boolean" &&
- listener.options === options.capture) ||
- (typeof listener.options === "object" &&
- listener.options.capture === options.capture)) &&
- listener.callback === callback
- ) {
- return;
- }
- }
- if (options?.signal) {
- const signal = options?.signal;
- if (signal.aborted) {
- // If signal is not null and its aborted flag is set, then return.
- return;
- } else {
- // If listener’s signal is not null, then add the following abort
- // abort steps to it: Remove an event listener.
- signal.addEventListener("abort", () => {
- this.removeEventListener(type, callback, options);
- });
- }
- }
- listeners[type].push({ callback, options });
- }
-
- removeEventListener(
- type,
- callback,
- options,
- ) {
- webidl.requiredArguments(arguments.length, 2, {
- prefix: "Failed to execute 'removeEventListener' on 'EventTarget'",
- });
-
- const listeners = eventTargetData.get(this ?? globalThis).listeners;
- if (callback !== null && type in listeners) {
- listeners[type] = listeners[type].filter(
- (listener) => listener.callback !== callback,
- );
- } else if (callback === null || !listeners[type]) {
- return;
- }
-
- options = normalizeEventHandlerOptions(options);
-
- for (let i = 0; i < listeners[type].length; ++i) {
- const listener = listeners[type][i];
- if (
- ((typeof listener.options === "boolean" &&
- listener.options === options.capture) ||
- (typeof listener.options === "object" &&
- listener.options.capture === options.capture)) &&
- listener.callback === callback
- ) {
- listeners[type].splice(i, 1);
- break;
- }
- }
- }
-
- dispatchEvent(event) {
- webidl.requiredArguments(arguments.length, 1, {
- prefix: "Failed to execute 'dispatchEvent' on 'EventTarget'",
- });
- const self = this ?? globalThis;
-
- const listeners = eventTargetData.get(self).listeners;
- if (!(event.type in listeners)) {
- setTarget(event, this);
- return true;
- }
-
- if (getDispatched(event)) {
- throw new DOMException("Invalid event state.", "InvalidStateError");
- }
-
- if (event.eventPhase !== Event.NONE) {
- throw new DOMException("Invalid event state.", "InvalidStateError");
- }
-
- return dispatch(self, event);
- }
-
- get [Symbol.toStringTag]() {
- return "EventTarget";
- }
-
- getParent(_event) {
- return null;
- }
- }
-
- defineEnumerableProps(EventTarget, [
- "addEventListener",
- "removeEventListener",
- "dispatchEvent",
- ]);
-
- class ErrorEvent extends Event {
- #message = "";
- #filename = "";
- #lineno = "";
- #colno = "";
- #error = "";
-
- get message() {
- return this.#message;
- }
- get filename() {
- return this.#filename;
- }
- get lineno() {
- return this.#lineno;
- }
- get colno() {
- return this.#colno;
- }
- get error() {
- return this.#error;
- }
-
- constructor(
- type,
- {
- bubbles,
- cancelable,
- composed,
- message = "",
- filename = "",
- lineno = 0,
- colno = 0,
- error = null,
- } = {},
- ) {
- super(type, {
- bubbles: bubbles,
- cancelable: cancelable,
- composed: composed,
- });
-
- this.#message = message;
- this.#filename = filename;
- this.#lineno = lineno;
- this.#colno = colno;
- this.#error = error;
- }
-
- get [Symbol.toStringTag]() {
- return "ErrorEvent";
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return buildCustomInspectOutput(this, [
- ...EVENT_PROPS,
- "message",
- "filename",
- "lineno",
- "colno",
- "error",
- ], inspect);
- }
- }
-
- defineEnumerableProps(ErrorEvent, [
- "message",
- "filename",
- "lineno",
- "colno",
- "error",
- ]);
-
- class CloseEvent extends Event {
- #wasClean = "";
- #code = "";
- #reason = "";
-
- get wasClean() {
- return this.#wasClean;
- }
- get code() {
- return this.#code;
- }
- get reason() {
- return this.#reason;
- }
-
- constructor(type, {
- bubbles,
- cancelable,
- composed,
- wasClean = false,
- code = 0,
- reason = "",
- } = {}) {
- super(type, {
- bubbles: bubbles,
- cancelable: cancelable,
- composed: composed,
- });
-
- this.#wasClean = wasClean;
- this.#code = code;
- this.#reason = reason;
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return buildCustomInspectOutput(this, [
- ...EVENT_PROPS,
- "wasClean",
- "code",
- "reason",
- ], inspect);
- }
- }
-
- class MessageEvent extends Event {
- constructor(type, eventInitDict) {
- super(type, {
- bubbles: eventInitDict?.bubbles ?? false,
- cancelable: eventInitDict?.cancelable ?? false,
- composed: eventInitDict?.composed ?? false,
- });
-
- this.data = eventInitDict?.data ?? null;
- this.origin = eventInitDict?.origin ?? "";
- this.lastEventId = eventInitDict?.lastEventId ?? "";
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return buildCustomInspectOutput(this, [
- ...EVENT_PROPS,
- "data",
- "origin",
- "lastEventId",
- ], inspect);
- }
- }
-
- class CustomEvent extends Event {
- #detail = null;
-
- constructor(type, eventInitDict = {}) {
- super(type, eventInitDict);
- webidl.requiredArguments(arguments.length, 1, {
- prefix: "Failed to construct 'CustomEvent'",
- });
- const { detail } = eventInitDict;
- this.#detail = detail;
- }
-
- get detail() {
- return this.#detail;
- }
-
- get [Symbol.toStringTag]() {
- return "CustomEvent";
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return buildCustomInspectOutput(this, [
- ...EVENT_PROPS,
- "detail",
- ], inspect);
- }
- }
-
- Reflect.defineProperty(CustomEvent.prototype, "detail", {
- enumerable: true,
- });
-
- // ProgressEvent could also be used in other DOM progress event emits.
- // Current use is for FileReader.
- class ProgressEvent extends Event {
- constructor(type, eventInitDict = {}) {
- super(type, eventInitDict);
-
- this.lengthComputable = eventInitDict?.lengthComputable ?? false;
- this.loaded = eventInitDict?.loaded ?? 0;
- this.total = eventInitDict?.total ?? 0;
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return buildCustomInspectOutput(this, [
- ...EVENT_PROPS,
- "lengthComputable",
- "loaded",
- "total",
- ], inspect);
- }
- }
-
- window.Event = Event;
- window.EventTarget = EventTarget;
- window.ErrorEvent = ErrorEvent;
- window.CloseEvent = CloseEvent;
- window.MessageEvent = MessageEvent;
- window.CustomEvent = CustomEvent;
- window.ProgressEvent = ProgressEvent;
- window.dispatchEvent = EventTarget.prototype.dispatchEvent;
- window.addEventListener = EventTarget.prototype.addEventListener;
- window.removeEventListener = EventTarget.prototype.removeEventListener;
- window.__bootstrap.eventTarget = {
- EventTarget,
- setEventTargetData,
- };
- window.__bootstrap.event = {
- setIsTrusted,
- };
-})(this);
diff --git a/op_crates/web/03_abort_signal.js b/op_crates/web/03_abort_signal.js
deleted file mode 100644
index e2648e778..000000000
--- a/op_crates/web/03_abort_signal.js
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-"use strict";
-
-((window) => {
- const webidl = window.__bootstrap.webidl;
- const { setIsTrusted } = window.__bootstrap.event;
-
- const add = Symbol("add");
- const signalAbort = Symbol("signalAbort");
- const remove = Symbol("remove");
-
- const illegalConstructorKey = Symbol("illegalConstructorKey");
-
- class AbortSignal extends EventTarget {
- #aborted = false;
- #abortAlgorithms = new Set();
-
- static abort() {
- const signal = new AbortSignal(illegalConstructorKey);
- signal[signalAbort]();
- return signal;
- }
-
- [add](algorithm) {
- this.#abortAlgorithms.add(algorithm);
- }
-
- [signalAbort]() {
- if (this.#aborted) {
- return;
- }
- this.#aborted = true;
- for (const algorithm of this.#abortAlgorithms) {
- algorithm();
- }
- this.#abortAlgorithms.clear();
- const event = new Event("abort");
- setIsTrusted(event, true);
- this.dispatchEvent(event);
- }
-
- [remove](algorithm) {
- this.#abortAlgorithms.delete(algorithm);
- }
-
- constructor(key = null) {
- if (key != illegalConstructorKey) {
- throw new TypeError("Illegal constructor.");
- }
- super();
- this[webidl.brand] = webidl.brand;
- }
-
- get aborted() {
- return Boolean(this.#aborted);
- }
-
- get [Symbol.toStringTag]() {
- return "AbortSignal";
- }
- }
- defineEventHandler(AbortSignal.prototype, "abort");
- class AbortController {
- #signal = new AbortSignal(illegalConstructorKey);
-
- get signal() {
- return this.#signal;
- }
-
- abort() {
- this.#signal[signalAbort]();
- }
-
- get [Symbol.toStringTag]() {
- return "AbortController";
- }
- }
-
- const handlerSymbol = Symbol("eventHandlers");
-
- function makeWrappedHandler(handler) {
- function wrappedHandler(...args) {
- if (typeof wrappedHandler.handler !== "function") {
- return;
- }
- return wrappedHandler.handler.call(this, ...args);
- }
- wrappedHandler.handler = handler;
- return wrappedHandler;
- }
- // TODO(benjamingr) reuse this here and websocket where possible
- function defineEventHandler(emitter, name) {
- // HTML specification section 8.1.5.1
- Object.defineProperty(emitter, `on${name}`, {
- get() {
- return this[handlerSymbol]?.get(name)?.handler;
- },
- set(value) {
- if (!this[handlerSymbol]) {
- this[handlerSymbol] = new Map();
- }
- let handlerWrapper = this[handlerSymbol]?.get(name);
- if (handlerWrapper) {
- handlerWrapper.handler = value;
- } else {
- handlerWrapper = makeWrappedHandler(value);
- this.addEventListener(name, handlerWrapper);
- }
- this[handlerSymbol].set(name, handlerWrapper);
- },
- configurable: true,
- enumerable: true,
- });
- }
-
- webidl.converters["AbortSignal"] = webidl.createInterfaceConverter(
- "AbortSignal",
- AbortSignal,
- );
-
- window.AbortSignal = AbortSignal;
- window.AbortController = AbortController;
- window.__bootstrap.abortSignal = {
- add,
- signalAbort,
- remove,
- };
-})(this);
diff --git a/op_crates/web/04_global_interfaces.js b/op_crates/web/04_global_interfaces.js
deleted file mode 100644
index c3181fb66..000000000
--- a/op_crates/web/04_global_interfaces.js
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-"use strict";
-((window) => {
- const { EventTarget } = window;
-
- const illegalConstructorKey = Symbol("illegalConstructorKey");
-
- class Window extends EventTarget {
- constructor(key = null) {
- if (key !== illegalConstructorKey) {
- throw new TypeError("Illegal constructor.");
- }
- super();
- }
-
- get [Symbol.toStringTag]() {
- return "Window";
- }
- }
-
- class WorkerGlobalScope extends EventTarget {
- constructor(key = null) {
- if (key != illegalConstructorKey) {
- throw new TypeError("Illegal constructor.");
- }
- super();
- }
-
- get [Symbol.toStringTag]() {
- return "WorkerGlobalScope";
- }
- }
-
- class DedicatedWorkerGlobalScope extends WorkerGlobalScope {
- constructor(key = null) {
- if (key != illegalConstructorKey) {
- throw new TypeError("Illegal constructor.");
- }
- super();
- }
-
- get [Symbol.toStringTag]() {
- return "DedicatedWorkerGlobalScope";
- }
- }
-
- window.__bootstrap.globalInterfaces = {
- DedicatedWorkerGlobalScope,
- Window,
- WorkerGlobalScope,
- dedicatedWorkerGlobalScopeConstructorDescriptor: {
- configurable: true,
- enumerable: false,
- value: DedicatedWorkerGlobalScope,
- writable: true,
- },
- windowConstructorDescriptor: {
- configurable: true,
- enumerable: false,
- value: Window,
- writable: true,
- },
- workerGlobalScopeConstructorDescriptor: {
- configurable: true,
- enumerable: false,
- value: WorkerGlobalScope,
- writable: true,
- },
- };
-})(this);
diff --git a/op_crates/web/08_text_encoding.js b/op_crates/web/08_text_encoding.js
deleted file mode 100644
index 7e7d4a573..000000000
--- a/op_crates/web/08_text_encoding.js
+++ /dev/null
@@ -1,4564 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// The following code is based off of text-encoding at:
-// https://github.com/inexorabletash/text-encoding
-//
-// Anyone is free to copy, modify, publish, use, compile, sell, or
-// distribute this software, either in source code form or as a compiled
-// binary, for any purpose, commercial or non-commercial, and by any
-// means.
-//
-// In jurisdictions that recognize copyright laws, the author or authors
-// of this software dedicate any and all copyright interest in the
-// software to the public domain. We make this dedication for the benefit
-// of the public at large and to the detriment of our heirs and
-// successors. We intend this dedication to be an overt act of
-// relinquishment in perpetuity of all present and future rights to this
-// software under copyright law.
-//
-// 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 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.
-"use strict";
-
-((window) => {
- const webidl = window.__bootstrap.webidl;
- const core = Deno.core;
-
- const CONTINUE = null;
- const END_OF_STREAM = -1;
- const FINISHED = -1;
-
- function decoderError(fatal) {
- if (fatal) {
- throw new TypeError("Decoder error.");
- }
- return 0xfffd; // default code point
- }
-
- function inRange(a, min, max) {
- return min <= a && a <= max;
- }
-
- function isASCIIByte(a) {
- return inRange(a, 0x00, 0x7f);
- }
-
- function stringToCodePoints(input) {
- const u = [];
- for (const c of input) {
- u.push(c.codePointAt(0));
- }
- return u;
- }
-
- class UTF8Encoder {
- handler(codePoint) {
- if (codePoint === END_OF_STREAM) {
- return "finished";
- }
-
- if (inRange(codePoint, 0x00, 0x7f)) {
- return [codePoint];
- }
-
- let count;
- let offset;
- if (inRange(codePoint, 0x0080, 0x07ff)) {
- count = 1;
- offset = 0xc0;
- } else if (inRange(codePoint, 0x0800, 0xffff)) {
- count = 2;
- offset = 0xe0;
- } else if (inRange(codePoint, 0x10000, 0x10ffff)) {
- count = 3;
- offset = 0xf0;
- } else {
- throw TypeError(
- `Code point out of range: \\x${codePoint.toString(16)}`,
- );
- }
-
- const bytes = [(codePoint >> (6 * count)) + offset];
-
- while (count > 0) {
- const temp = codePoint >> (6 * (count - 1));
- bytes.push(0x80 | (temp & 0x3f));
- count--;
- }
-
- return bytes;
- }
- }
-
- function atob(s) {
- s = String(s);
- s = s.replace(/[\t\n\f\r ]/g, "");
-
- if (s.length % 4 === 0) {
- s = s.replace(/==?$/, "");
- }
-
- const rem = s.length % 4;
- if (rem === 1 || /[^+/0-9A-Za-z]/.test(s)) {
- throw new DOMException(
- "The string to be decoded is not correctly encoded",
- "InvalidCharacterError",
- );
- }
-
- // base64-js requires length exactly times of 4
- if (rem > 0) {
- s = s.padEnd(s.length + (4 - rem), "=");
- }
-
- const byteArray = base64.toByteArray(s);
- let result = "";
- for (let i = 0; i < byteArray.length; i++) {
- result += String.fromCharCode(byteArray[i]);
- }
- return result;
- }
-
- function btoa(s) {
- s = webidl.converters.DOMString(s, {
- prefix: "Failed to execute 'btoa'",
- context: "Argument 1",
- });
- const byteArray = [];
- for (let i = 0; i < s.length; i++) {
- const charCode = s[i].charCodeAt(0);
- if (charCode > 0xff) {
- throw new DOMException(
- "The string to be encoded contains characters outside of the Latin1 range.",
- "InvalidCharacterError",
- );
- }
- byteArray.push(charCode);
- }
- const result = base64.fromByteArray(Uint8Array.from(byteArray));
- return result;
- }
-
- function Big5Decoder(big5, bytes, fatal = false, ignoreBOM = false) {
- if (ignoreBOM) {
- throw new TypeError("Ignoring the BOM is available only with utf-8.");
- }
- const res = [];
- let lead = 0x00;
- for (let i = 0; i < bytes.length; i++) {
- const byte = bytes[i];
- if (lead !== 0x00) {
- let pointer = null;
- const offset = byte < 0x7f ? 0x40 : 0x62;
- const leadCopy = lead;
- lead = 0x00;
- if (inRange(byte, 0x40, 0x7e) || inRange(byte, 0xa1, 0xfe)) {
- pointer = (leadCopy - 0x81) * 157 + (byte - offset);
- }
- if (pointer === 1133) {
- res.push(202);
- continue;
- }
- if (pointer === 1135) {
- res.push(202);
- continue;
- }
- if (pointer === 1164) {
- res.push(234);
- continue;
- }
- if (pointer === 1166) {
- res.push(234);
- continue;
- }
- const code = pointer === null ? null : big5[pointer];
- if (code === null && isASCIIByte(byte)) {
- i--;
- }
- if (code === null) {
- res.push(decoderError(fatal));
- continue;
- }
- res.push(code);
- continue;
- }
- if (isASCIIByte(byte)) {
- res.push(byte);
- continue;
- }
- if (inRange(byte, 0x81, 0xFE)) {
- lead = byte;
- continue;
- }
- res.push(decoderError(fatal));
- continue;
- }
- if (lead !== 0x00) {
- lead = 0x00;
- res.push(decoderError(fatal));
- }
- return res;
- }
-
- function Utf16ByteDecoder(
- bytes,
- be = false,
- fatal = false,
- ignoreBOM = false,
- ) {
- let leadByte = null;
- let leadSurrogate = null;
- const result = [];
-
- for (let i = 0; i < bytes.length; i++) {
- const byte = bytes[i];
- if (leadByte === null) {
- leadByte = byte;
- continue;
- }
- const codeUnit = be ? (leadByte << 8) + byte : (byte << 8) + leadByte;
- leadByte = null;
- if (codeUnit === 65279 && !ignoreBOM) {
- continue;
- }
- if (leadSurrogate !== null) {
- if (inRange(codeUnit, 0xDC00, 0xDFFF)) {
- result.push(leadSurrogate, codeUnit);
- leadSurrogate = null;
- continue;
- }
- leadSurrogate = null;
- const byte1 = codeUnit >> 8;
- const byte2 = codeUnit & 0xFF;
- result.push(decoderError(fatal));
- result.push(byte1 & byte2);
- continue;
- }
- if (inRange(codeUnit, 0xD800, 0xDBFF)) {
- leadSurrogate = codeUnit;
- continue;
- }
- if (inRange(codeUnit, 0xDC00, 0xDFFF)) {
- result.push(decoderError(fatal));
- continue;
- }
- result.push(codeUnit);
- }
- if (!(leadByte === null && leadSurrogate === null)) {
- result.push(decoderError(fatal));
- }
- return result;
- }
-
- const gb18030Ranges = {
- 0: 128,
- 36: 165,
- 38: 169,
- 45: 178,
- 50: 184,
- 81: 216,
- 89: 226,
- 95: 235,
- 96: 238,
- 100: 244,
- 103: 248,
- 104: 251,
- 105: 253,
- 109: 258,
- 126: 276,
- 133: 284,
- 148: 300,
- 172: 325,
- 175: 329,
- 179: 334,
- 208: 364,
- 306: 463,
- 307: 465,
- 308: 467,
- 309: 469,
- 310: 471,
- 311: 473,
- 312: 475,
- 313: 477,
- 341: 506,
- 428: 594,
- 443: 610,
- 544: 712,
- 545: 716,
- 558: 730,
- 741: 930,
- 742: 938,
- 749: 962,
- 750: 970,
- 805: 1026,
- 819: 1104,
- 820: 1106,
- 7922: 8209,
- 7924: 8215,
- 7925: 8218,
- 7927: 8222,
- 7934: 8231,
- 7943: 8241,
- 7944: 8244,
- 7945: 8246,
- 7950: 8252,
- 8062: 8365,
- 8148: 8452,
- 8149: 8454,
- 8152: 8458,
- 8164: 8471,
- 8174: 8482,
- 8236: 8556,
- 8240: 8570,
- 8262: 8596,
- 8264: 8602,
- 8374: 8713,
- 8380: 8720,
- 8381: 8722,
- 8384: 8726,
- 8388: 8731,
- 8390: 8737,
- 8392: 8740,
- 8393: 8742,
- 8394: 8748,
- 8396: 8751,
- 8401: 8760,
- 8406: 8766,
- 8416: 8777,
- 8419: 8781,
- 8424: 8787,
- 8437: 8802,
- 8439: 8808,
- 8445: 8816,
- 8482: 8854,
- 8485: 8858,
- 8496: 8870,
- 8521: 8896,
- 8603: 8979,
- 8936: 9322,
- 8946: 9372,
- 9046: 9548,
- 9050: 9588,
- 9063: 9616,
- 9066: 9622,
- 9076: 9634,
- 9092: 9652,
- 9100: 9662,
- 9108: 9672,
- 9111: 9676,
- 9113: 9680,
- 9131: 9702,
- 9162: 9735,
- 9164: 9738,
- 9218: 9793,
- 9219: 9795,
- 11329: 11906,
- 11331: 11909,
- 11334: 11913,
- 11336: 11917,
- 11346: 11928,
- 11361: 11944,
- 11363: 11947,
- 11366: 11951,
- 11370: 11956,
- 11372: 11960,
- 11375: 11964,
- 11389: 11979,
- 11682: 12284,
- 11686: 12292,
- 11687: 12312,
- 11692: 12319,
- 11694: 12330,
- 11714: 12351,
- 11716: 12436,
- 11723: 12447,
- 11725: 12535,
- 11730: 12543,
- 11736: 12586,
- 11982: 12842,
- 11989: 12850,
- 12102: 12964,
- 12336: 13200,
- 12348: 13215,
- 12350: 13218,
- 12384: 13253,
- 12393: 13263,
- 12395: 13267,
- 12397: 13270,
- 12510: 13384,
- 12553: 13428,
- 12851: 13727,
- 12962: 13839,
- 12973: 13851,
- 13738: 14617,
- 13823: 14703,
- 13919: 14801,
- 13933: 14816,
- 14080: 14964,
- 14298: 15183,
- 14585: 15471,
- 14698: 15585,
- 15583: 16471,
- 15847: 16736,
- 16318: 17208,
- 16434: 17325,
- 16438: 17330,
- 16481: 17374,
- 16729: 17623,
- 17102: 17997,
- 17122: 18018,
- 17315: 18212,
- 17320: 18218,
- 17402: 18301,
- 17418: 18318,
- 17859: 18760,
- 17909: 18811,
- 17911: 18814,
- 17915: 18820,
- 17916: 18823,
- 17936: 18844,
- 17939: 18848,
- 17961: 18872,
- 18664: 19576,
- 18703: 19620,
- 18814: 19738,
- 18962: 19887,
- 19043: 40870,
- 33469: 59244,
- 33470: 59336,
- 33471: 59367,
- 33484: 59413,
- 33485: 59417,
- 33490: 59423,
- 33497: 59431,
- 33501: 59437,
- 33505: 59443,
- 33513: 59452,
- 33520: 59460,
- 33536: 59478,
- 33550: 59493,
- 37845: 63789,
- 37921: 63866,
- 37948: 63894,
- 38029: 63976,
- 38038: 63986,
- 38064: 64016,
- 38065: 64018,
- 38066: 64021,
- 38069: 64025,
- 38075: 64034,
- 38076: 64037,
- 38078: 64042,
- 39108: 65074,
- 39109: 65093,
- 39113: 65107,
- 39114: 65112,
- 39115: 65127,
- 39116: 65132,
- 39265: 65375,
- 39394: 65510,
- 189000: 65536,
- };
-
- const gb18030RangesKeys = Object.keys(gb18030Ranges).map(Number);
-
- function customBinarySearch(arr, ind) {
- let l = 0;
- let h = arr.length;
- let m = Math.floor(h / 2);
- while (l !== h) {
- if (arr[m] < ind) {
- l = m + 1;
- } else {
- h = m - 1;
- }
- m = Math.floor((l + h) / 2);
- if (arr[m] < ind && arr[m + 1] > ind) {
- return m;
- }
- }
- }
-
- function gb18030RangesCodePoint(pointer) {
- if ((pointer > 39419 && pointer < 189000) || pointer > 1237575) {
- return null;
- }
- if (pointer === 7457) {
- return 0xe7c7;
- }
- let offset;
- if (gb18030Ranges[pointer]) {
- offset = pointer;
- } else if (pointer > 189000) {
- offset = 189000;
- } else {
- offset =
- gb18030RangesKeys[customBinarySearch(gb18030RangesKeys, pointer)];
- }
- const codePointOffset = gb18030Ranges[offset];
- return codePointOffset + pointer - offset;
- }
-
- function gb18030Decoder(
- indexGb18030,
- bytes,
- fatal = false,
- ignoreBOM = false,
- ) {
- if (ignoreBOM) {
- throw new TypeError("Ignoring the BOM is available only with utf-8.");
- }
- const result = [];
- let first = 0x00;
- let second = 0x00;
- let third = 0x00;
- for (let i = 0; i < bytes.length; i++) {
- const byte = bytes[i];
- if (third !== 0x00) {
- if (inRange(byte, 0x30, 0x39)) {
- const codePoint = gb18030RangesCodePoint(
- (first - 0x81) * (10 * 126 * 10) +
- (second - 0x30) * (10 * 126) +
- (third - 0x81) * 10 +
- byte -
- 0x30,
- );
- if (codePoint === null) {
- first = 0x00;
- second = 0x00;
- third = 0x00;
- result.push(decoderError(fatal));
- continue;
- }
- result.push(codePoint);
- } else {
- result.push(decoderError(fatal), second, decoderError(fatal), byte);
- }
- first = 0x00;
- second = 0x00;
- third = 0x00;
- continue;
- }
- if (second !== 0x00) {
- if (inRange(byte, 0x81, 0xfe)) {
- third = byte;
- continue;
- }
- result.push(decoderError(fatal));
- result.push(second);
- continue;
- }
- if (first !== 0x00) {
- if (inRange(byte, 0x30, 0x39)) {
- second = byte;
- continue;
- }
- const lead = first;
- const offset = byte < 0x7f ? 0x40 : 0x41;
- const pointer = inRange(byte, 0x40, 0x7e) || inRange(byte, 0x80, 0xfe)
- ? (lead - 0x81) * 190 + (byte - offset)
- : null;
- first = 0x00;
- const codePoint = pointer === null ? null : indexGb18030[pointer];
- if (codePoint) {
- result.push(codePoint);
- continue;
- }
- result.push(decoderError(fatal));
- if (isASCIIByte(byte)) {
- result.push(byte);
- }
- continue;
- }
- if (isASCIIByte(byte)) {
- result.push(byte);
- continue;
- }
- if (byte === 0x80) {
- result.push(0x20ac);
- continue;
- }
- if (inRange(byte, 0x81, 0xfe)) {
- first = byte;
- continue;
- }
- result.push(decoderError(fatal));
- }
- if (!(first === 0x00 && second === 0x00 && third === 0x00)) {
- result.push(decoderError(fatal));
- }
- return result;
- }
-
- class SingleByteDecoder {
- #index = [];
- #fatal = false;
-
- constructor(index, { ignoreBOM = false, fatal = false } = {}) {
- if (ignoreBOM) {
- throw new TypeError("Ignoring the BOM is available only with utf-8.");
- }
- this.#fatal = fatal;
- this.#index = index;
- }
- handler(_stream, byte) {
- if (byte === END_OF_STREAM) {
- return FINISHED;
- }
- if (isASCIIByte(byte)) {
- return byte;
- }
- const codePoint = this.#index[byte - 0x80];
-
- if (codePoint == null) {
- return decoderError(this.#fatal);
- }
-
- return codePoint;
- }
- }
-
- // The encodingMap is a hash of labels that are indexed by the conical
- // encoding.
- const encodingMap = {
- "utf-8": [
- "unicode-1-1-utf-8",
- "unicode11utf8",
- "unicode20utf8",
- "utf-8",
- "utf8",
- "x-unicode20utf8",
- ],
- ibm866: ["866", "cp866", "csibm866", "ibm866"],
- "iso-8859-2": [
- "csisolatin2",
- "iso-8859-2",
- "iso-ir-101",
- "iso8859-2",
- "iso88592",
- "iso_8859-2",
- "iso_8859-2:1987",
- "l2",
- "latin2",
- ],
- "iso-8859-3": [
- "csisolatin3",
- "iso-8859-3",
- "iso-ir-109",
- "iso8859-3",
- "iso88593",
- "iso_8859-3",
- "iso_8859-3:1988",
- "l3",
- "latin3",
- ],
- "iso-8859-4": [
- "csisolatin4",
- "iso-8859-4",
- "iso-ir-110",
- "iso8859-4",
- "iso88594",
- "iso_8859-4",
- "iso_8859-4:1988",
- "l4",
- "latin4",
- ],
- "iso-8859-5": [
- "csisolatincyrillic",
- "cyrillic",
- "iso-8859-5",
- "iso-ir-144",
- "iso8859-5",
- "iso88595",
- "iso_8859-5",
- "iso_8859-5:1988",
- ],
- "iso-8859-6": [
- "arabic",
- "asmo-708",
- "csiso88596e",
- "csiso88596i",
- "csisolatinarabic",
- "ecma-114",
- "iso-8859-6",
- "iso-8859-6-e",
- "iso-8859-6-i",
- "iso-ir-127",
- "iso8859-6",
- "iso88596",
- "iso_8859-6",
- "iso_8859-6:1987",
- ],
- "iso-8859-7": [
- "csisolatingreek",
- "ecma-118",
- "elot_928",
- "greek",
- "greek8",
- "iso-8859-7",
- "iso-ir-126",
- "iso8859-7",
- "iso88597",
- "iso_8859-7",
- "iso_8859-7:1987",
- "sun_eu_greek",
- ],
- "iso-8859-8": [
- "csiso88598e",
- "csisolatinhebrew",
- "hebrew",
- "iso-8859-8",
- "iso-8859-8-e",
- "iso-ir-138",
- "iso8859-8",
- "iso88598",
- "iso_8859-8",
- "iso_8859-8:1988",
- "visual",
- ],
- "iso-8859-8-i": [
- "csiso88598i",
- "iso-8859-8-i",
- "logical",
- ],
- "iso-8859-10": [
- "csisolatin6",
- "iso-8859-10",
- "iso-ir-157",
- "iso8859-10",
- "iso885910",
- "l6",
- "latin6",
- ],
- "iso-8859-13": ["iso-8859-13", "iso8859-13", "iso885913"],
- "iso-8859-14": ["iso-8859-14", "iso8859-14", "iso885914"],
- "iso-8859-15": [
- "csisolatin9",
- "iso-8859-15",
- "iso8859-15",
- "iso885915",
- "iso_8859-15",
- "l9",
- ],
- "iso-8859-16": ["iso-8859-16"],
- "koi8-r": ["cskoi8r", "koi", "koi8", "koi8-r", "koi8_r"],
- "koi8-u": ["koi8-ru", "koi8-u"],
- macintosh: ["csmacintosh", "mac", "macintosh", "x-mac-roman"],
- "windows-874": [
- "dos-874",
- "iso-8859-11",
- "iso8859-11",
- "iso885911",
- "tis-620",
- "windows-874",
- ],
- "windows-1250": ["cp1250", "windows-1250", "x-cp1250"],
- "windows-1251": ["cp1251", "windows-1251", "x-cp1251"],
- "windows-1252": [
- "ansi_x3.4-1968",
- "ascii",
- "cp1252",
- "cp819",
- "csisolatin1",
- "ibm819",
- "iso-8859-1",
- "iso-ir-100",
- "iso8859-1",
- "iso88591",
- "iso_8859-1",
- "iso_8859-1:1987",
- "l1",
- "latin1",
- "us-ascii",
- "windows-1252",
- "x-cp1252",
- ],
- "windows-1253": ["cp1253", "windows-1253", "x-cp1253"],
- "windows-1254": [
- "cp1254",
- "csisolatin5",
- "iso-8859-9",
- "iso-ir-148",
- "iso8859-9",
- "iso88599",
- "iso_8859-9",
- "iso_8859-9:1989",
- "l5",
- "latin5",
- "windows-1254",
- "x-cp1254",
- ],
- "windows-1255": ["cp1255", "windows-1255", "x-cp1255"],
- "windows-1256": ["cp1256", "windows-1256", "x-cp1256"],
- "windows-1257": ["cp1257", "windows-1257", "x-cp1257"],
- "windows-1258": ["cp1258", "windows-1258", "x-cp1258"],
- "x-mac-cyrillic": ["x-mac-cyrillic", "x-mac-ukrainian"],
- gbk: [
- "chinese",
- "csgb2312",
- "csiso58gb231280",
- "gb2312",
- "gb_2312",
- "gb_2312-80",
- "gbk",
- "iso-ir-58",
- "x-gbk",
- ],
- gb18030: ["gb18030"],
- big5: ["big5", "big5-hkscs", "cn-big5", "csbig5", "x-x-big5"],
- "utf-16be": ["unicodefffe", "utf-16be"],
- "utf-16le": [
- "csunicode",
- "iso-10646-ucs-2",
- "ucs-2",
- "unicode",
- "unicodefeff",
- "utf-16",
- "utf-16le",
- ],
- };
- // We convert these into a Map where every label resolves to its canonical
- // encoding type.
- const encodings = new Map();
- for (const key of Object.keys(encodingMap)) {
- const labels = encodingMap[key];
- for (const label of labels) {
- encodings.set(label, key);
- }
- }
-
- // A map of functions that return new instances of a decoder indexed by the
- // encoding type.
- const decoders = new Map();
-
- // Single byte decoders are an array of code point lookups
- const encodingIndexes = new Map();
- // deno-fmt-ignore
- encodingIndexes.set("windows-1252", [
- 8364, 129, 8218, 402, 8222, 8230, 8224, 8225, 710,
- 8240, 352, 8249, 338, 141, 381, 143, 144,
- 8216, 8217, 8220, 8221, 8226, 8211, 8212, 732,
- 8482, 353, 8250, 339, 157, 382, 376, 160,
- 161, 162, 163, 164, 165, 166, 167, 168,
- 169, 170, 171, 172, 173, 174, 175, 176,
- 177, 178, 179, 180, 181, 182, 183, 184,
- 185, 186, 187, 188, 189, 190, 191, 192,
- 193, 194, 195, 196, 197, 198, 199, 200,
- 201, 202, 203, 204, 205, 206, 207, 208,
- 209, 210, 211, 212, 213, 214, 215, 216,
- 217, 218, 219, 220, 221, 222, 223, 224,
- 225, 226, 227, 228, 229, 230, 231, 232,
- 233, 234, 235, 236, 237, 238, 239, 240,
- 241, 242, 243, 244, 245, 246, 247, 248,
- 249, 250, 251, 252, 253, 254, 255,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("ibm866", [
- 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047,
- 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055,
- 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063,
- 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071,
- 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079,
- 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087,
- 9617, 9618, 9619, 9474, 9508, 9569, 9570, 9558,
- 9557, 9571, 9553, 9559, 9565, 9564, 9563, 9488,
- 9492, 9524, 9516, 9500, 9472, 9532, 9566, 9567,
- 9562, 9556, 9577, 9574, 9568, 9552, 9580, 9575,
- 9576, 9572, 9573, 9561, 9560, 9554, 9555, 9579,
- 9578, 9496, 9484, 9608, 9604, 9612, 9616, 9600,
- 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095,
- 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103,
- 1025, 1105, 1028, 1108, 1031, 1111, 1038, 1118,
- 176, 8729, 183, 8730, 8470, 164, 9632, 160,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("iso-8859-2", [
- 128, 129, 130, 131, 132, 133, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151,
- 152, 153, 154, 155, 156, 157, 158, 159,
- 160, 260, 728, 321, 164, 317, 346, 167,
- 168, 352, 350, 356, 377, 173, 381, 379,
- 176, 261, 731, 322, 180, 318, 347, 711,
- 184, 353, 351, 357, 378, 733, 382, 380,
- 340, 193, 194, 258, 196, 313, 262, 199,
- 268, 201, 280, 203, 282, 205, 206, 270,
- 272, 323, 327, 211, 212, 336, 214, 215,
- 344, 366, 218, 368, 220, 221, 354, 223,
- 341, 225, 226, 259, 228, 314, 263, 231,
- 269, 233, 281, 235, 283, 237, 238, 271,
- 273, 324, 328, 243, 244, 337, 246, 247,
- 345, 367, 250, 369, 252, 253, 355, 729,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("iso-8859-3", [
- 128, 129, 130, 131, 132, 133, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151,
- 152, 153, 154, 155, 156, 157, 158, 159,
- 160, 294, 728, 163, 164, null, 292, 167,
- 168, 304, 350, 286, 308, 173, null, 379,
- 176, 295, 178, 179, 180, 181, 293, 183,
- 184, 305, 351, 287, 309, 189, null, 380,
- 192, 193, 194, null, 196, 266, 264, 199,
- 200, 201, 202, 203, 204, 205, 206, 207,
- null, 209, 210, 211, 212, 288, 214, 215,
- 284, 217, 218, 219, 220, 364, 348, 223,
- 224, 225, 226, null, 228, 267, 265, 231,
- 232, 233, 234, 235, 236, 237, 238, 239,
- null, 241, 242, 243, 244, 289, 246, 247,
- 285, 249, 250, 251, 252, 365, 349, 729,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("iso-8859-4", [
- 128, 129, 130, 131, 132, 133, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151,
- 152, 153, 154, 155, 156, 157, 158, 159,
- 160, 260, 312, 342, 164, 296, 315, 167,
- 168, 352, 274, 290, 358, 173, 381, 175,
- 176, 261, 731, 343, 180, 297, 316, 711,
- 184, 353, 275, 291, 359, 330, 382, 331,
- 256, 193, 194, 195, 196, 197, 198, 302,
- 268, 201, 280, 203, 278, 205, 206, 298,
- 272, 325, 332, 310, 212, 213, 214, 215,
- 216, 370, 218, 219, 220, 360, 362, 223,
- 257, 225, 226, 227, 228, 229, 230, 303,
- 269, 233, 281, 235, 279, 237, 238, 299,
- 273, 326, 333, 311, 244, 245, 246, 247,
- 248, 371, 250, 251, 252, 361, 363, 729,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("iso-8859-5", [
- 128, 129, 130, 131, 132, 133, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151,
- 152, 153, 154, 155, 156, 157, 158, 159,
- 160, 1025, 1026, 1027, 1028, 1029, 1030, 1031,
- 1032, 1033, 1034, 1035, 1036, 173, 1038, 1039,
- 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047,
- 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055,
- 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063,
- 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071,
- 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079,
- 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087,
- 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095,
- 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103,
- 8470, 1105, 1106, 1107, 1108, 1109, 1110, 1111,
- 1112, 1113, 1114, 1115, 1116, 167, 1118, 1119,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("iso-8859-6", [
- 128, 129, 130, 131, 132, 133, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151,
- 152, 153, 154, 155, 156, 157, 158, 159,
- 160, null, null, null, 164, null, null, null,
- null, null, null, null, 1548, 173, null, null,
- null, null, null, null, null, null, null, null,
- null, null, null, 1563, null, null, null, 1567,
- null, 1569, 1570, 1571, 1572, 1573, 1574, 1575,
- 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583,
- 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591,
- 1592, 1593, 1594, null, null, null, null, null,
- 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607,
- 1608, 1609, 1610, 1611, 1612, 1613, 1614, 1615,
- 1616, 1617, 1618, null, null, null, null, null,
- null, null, null, null, null, null, null, null,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("iso-8859-7", [
- 128, 129, 130, 131, 132, 133, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151,
- 152, 153, 154, 155, 156, 157, 158, 159,
- 160, 8216, 8217, 163, 8364, 8367, 166, 167,
- 168, 169, 890, 171, 172, 173, null, 8213,
- 176, 177, 178, 179, 900, 901, 902, 183,
- 904, 905, 906, 187, 908, 189, 910, 911,
- 912, 913, 914, 915, 916, 917, 918, 919,
- 920, 921, 922, 923, 924, 925, 926, 927,
- 928, 929, null, 931, 932, 933, 934, 935,
- 936, 937, 938, 939, 940, 941, 942, 943,
- 944, 945, 946, 947, 948, 949, 950, 951,
- 952, 953, 954, 955, 956, 957, 958, 959,
- 960, 961, 962, 963, 964, 965, 966, 967,
- 968, 969, 970, 971, 972, 973, 974, null,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("iso-8859-8", [
- 128, 129, 130, 131, 132, 133, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151,
- 152, 153, 154, 155, 156, 157, 158, 159,
- 160, null, 162, 163, 164, 165, 166, 167,
- 168, 169, 215, 171, 172, 173, 174, 175,
- 176, 177, 178, 179, 180, 181, 182, 183,
- 184, 185, 247, 187, 188, 189, 190, null,
- null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, 8215,
- 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495,
- 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503,
- 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511,
- 1512, 1513, 1514, null, null, 8206, 8207, null,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("iso-8859-8-i", [
- 128, 129, 130, 131, 132, 133, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151,
- 152, 153, 154, 155, 156, 157, 158, 159,
- 160, null, 162, 163, 164, 165, 166, 167,
- 168, 169, 215, 171, 172, 173, 174, 175,
- 176, 177, 178, 179, 180, 181, 182, 183,
- 184, 185, 247, 187, 188, 189, 190, null,
- null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, 8215,
- 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495,
- 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503,
- 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511,
- 1512, 1513, 1514, null, null, 8206, 8207, null,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("iso-8859-10", [
- 128, 129, 130, 131, 132, 133, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151,
- 152, 153, 154, 155, 156, 157, 158, 159,
- 160, 260, 274, 290, 298, 296, 310, 167,
- 315, 272, 352, 358, 381, 173, 362, 330,
- 176, 261, 275, 291, 299, 297, 311, 183,
- 316, 273, 353, 359, 382, 8213, 363, 331,
- 256, 193, 194, 195, 196, 197, 198, 302,
- 268, 201, 280, 203, 278, 205, 206, 207,
- 208, 325, 332, 211, 212, 213, 214, 360,
- 216, 370, 218, 219, 220, 221, 222, 223,
- 257, 225, 226, 227, 228, 229, 230, 303,
- 269, 233, 281, 235, 279, 237, 238, 239,
- 240, 326, 333, 243, 244, 245, 246, 361,
- 248, 371, 250, 251, 252, 253, 254, 312,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("iso-8859-13", [
- 128, 129, 130, 131, 132, 133, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151,
- 152, 153, 154, 155, 156, 157, 158, 159,
- 160, 8221, 162, 163, 164, 8222, 166, 167,
- 216, 169, 342, 171, 172, 173, 174, 198,
- 176, 177, 178, 179, 8220, 181, 182, 183,
- 248, 185, 343, 187, 188, 189, 190, 230,
- 260, 302, 256, 262, 196, 197, 280, 274,
- 268, 201, 377, 278, 290, 310, 298, 315,
- 352, 323, 325, 211, 332, 213, 214, 215,
- 370, 321, 346, 362, 220, 379, 381, 223,
- 261, 303, 257, 263, 228, 229, 281, 275,
- 269, 233, 378, 279, 291, 311, 299, 316,
- 353, 324, 326, 243, 333, 245, 246, 247,
- 371, 322, 347, 363, 252, 380, 382, 8217,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("iso-8859-14", [
- 128, 129, 130, 131, 132, 133, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151,
- 152, 153, 154, 155, 156, 157, 158, 159,
- 160, 7682, 7683, 163, 266, 267, 7690, 167,
- 7808, 169, 7810, 7691, 7922, 173, 174, 376,
- 7710, 7711, 288, 289, 7744, 7745, 182, 7766,
- 7809, 7767, 7811, 7776, 7923, 7812, 7813, 7777,
- 192, 193, 194, 195, 196, 197, 198, 199,
- 200, 201, 202, 203, 204, 205, 206, 207,
- 372, 209, 210, 211, 212, 213, 214, 7786,
- 216, 217, 218, 219, 220, 221, 374, 223,
- 224, 225, 226, 227, 228, 229, 230, 231,
- 232, 233, 234, 235, 236, 237, 238, 239,
- 373, 241, 242, 243, 244, 245, 246, 7787,
- 248, 249, 250, 251, 252, 253, 375, 255,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("iso-8859-15", [
- 128, 129, 130, 131, 132, 133, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151,
- 152, 153, 154, 155, 156, 157, 158, 159,
- 160, 161, 162, 163, 8364, 165, 352, 167,
- 353, 169, 170, 171, 172, 173, 174, 175,
- 176, 177, 178, 179, 381, 181, 182, 183,
- 382, 185, 186, 187, 338, 339, 376, 191,
- 192, 193, 194, 195, 196, 197, 198, 199,
- 200, 201, 202, 203, 204, 205, 206, 207,
- 208, 209, 210, 211, 212, 213, 214, 215,
- 216, 217, 218, 219, 220, 221, 222, 223,
- 224, 225, 226, 227, 228, 229, 230, 231,
- 232, 233, 234, 235, 236, 237, 238, 239,
- 240, 241, 242, 243, 244, 245, 246, 247,
- 248, 249, 250, 251, 252, 253, 254, 255,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("iso-8859-16", [
- 128, 129, 130, 131, 132, 133, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151,
- 152, 153, 154, 155, 156, 157, 158, 159,
- 160, 260, 261, 321, 8364, 8222, 352, 167,
- 353, 169, 536, 171, 377, 173, 378, 379,
- 176, 177, 268, 322, 381, 8221, 182, 183,
- 382, 269, 537, 187, 338, 339, 376, 380,
- 192, 193, 194, 258, 196, 262, 198, 199,
- 200, 201, 202, 203, 204, 205, 206, 207,
- 272, 323, 210, 211, 212, 336, 214, 346,
- 368, 217, 218, 219, 220, 280, 538, 223,
- 224, 225, 226, 259, 228, 263, 230, 231,
- 232, 233, 234, 235, 236, 237, 238, 239,
- 273, 324, 242, 243, 244, 337, 246, 347,
- 369, 249, 250, 251, 252, 281, 539, 255,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("koi8-r", [
- 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508,
- 9516, 9524, 9532, 9600, 9604, 9608, 9612, 9616,
- 9617, 9618, 9619, 8992, 9632, 8729, 8730, 8776,
- 8804, 8805, 160, 8993, 176, 178, 183, 247,
- 9552, 9553, 9554, 1105, 9555, 9556, 9557, 9558,
- 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566,
- 9567, 9568, 9569, 1025, 9570, 9571, 9572, 9573,
- 9574, 9575, 9576, 9577, 9578, 9579, 9580, 169,
- 1102, 1072, 1073, 1094, 1076, 1077, 1092, 1075,
- 1093, 1080, 1081, 1082, 1083, 1084, 1085, 1086,
- 1087, 1103, 1088, 1089, 1090, 1091, 1078, 1074,
- 1100, 1099, 1079, 1096, 1101, 1097, 1095, 1098,
- 1070, 1040, 1041, 1062, 1044, 1045, 1060, 1043,
- 1061, 1048, 1049, 1050, 1051, 1052, 1053, 1054,
- 1055, 1071, 1056, 1057, 1058, 1059, 1046, 1042,
- 1068, 1067, 1047, 1064, 1069, 1065, 1063, 1066,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("koi8-u", [
- 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508,
- 9516, 9524, 9532, 9600, 9604, 9608, 9612, 9616,
- 9617, 9618, 9619, 8992, 9632, 8729, 8730, 8776,
- 8804, 8805, 160, 8993, 176, 178, 183, 247,
- 9552, 9553, 9554, 1105, 1108, 9556, 1110, 1111,
- 9559, 9560, 9561, 9562, 9563, 1169, 1118, 9566,
- 9567, 9568, 9569, 1025, 1028, 9571, 1030, 1031,
- 9574, 9575, 9576, 9577, 9578, 1168, 1038, 169,
- 1102, 1072, 1073, 1094, 1076, 1077, 1092, 1075,
- 1093, 1080, 1081, 1082, 1083, 1084, 1085, 1086,
- 1087, 1103, 1088, 1089, 1090, 1091, 1078, 1074,
- 1100, 1099, 1079, 1096, 1101, 1097, 1095, 1098,
- 1070, 1040, 1041, 1062, 1044, 1045, 1060, 1043,
- 1061, 1048, 1049, 1050, 1051, 1052, 1053, 1054,
- 1055, 1071, 1056, 1057, 1058, 1059, 1046, 1042,
- 1068, 1067, 1047, 1064, 1069, 1065, 1063, 1066,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("macintosh", [
- 196, 197, 199, 201, 209, 214, 220, 225,
- 224, 226, 228, 227, 229, 231, 233, 232,
- 234, 235, 237, 236, 238, 239, 241, 243,
- 242, 244, 246, 245, 250, 249, 251, 252,
- 8224, 176, 162, 163, 167, 8226, 182, 223,
- 174, 169, 8482, 180, 168, 8800, 198, 216,
- 8734, 177, 8804, 8805, 165, 181, 8706, 8721,
- 8719, 960, 8747, 170, 186, 937, 230, 248,
- 191, 161, 172, 8730, 402, 8776, 8710, 171,
- 187, 8230, 160, 192, 195, 213, 338, 339,
- 8211, 8212, 8220, 8221, 8216, 8217, 247, 9674,
- 255, 376, 8260, 8364, 8249, 8250, 64257, 64258,
- 8225, 183, 8218, 8222, 8240, 194, 202, 193,
- 203, 200, 205, 206, 207, 204, 211, 212,
- 63743, 210, 218, 219, 217, 305, 710, 732,
- 175, 728, 729, 730, 184, 733, 731, 711,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("windows-874", [
- 8364, 129, 130, 131, 132, 8230, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212,
- 152, 153, 154, 155, 156, 157, 158, 159,
- 160, 3585, 3586, 3587, 3588, 3589, 3590, 3591,
- 3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599,
- 3600, 3601, 3602, 3603, 3604, 3605, 3606, 3607,
- 3608, 3609, 3610, 3611, 3612, 3613, 3614, 3615,
- 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623,
- 3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631,
- 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639,
- 3640, 3641, 3642, null, null, null, null, 3647,
- 3648, 3649, 3650, 3651, 3652, 3653, 3654, 3655,
- 3656, 3657, 3658, 3659, 3660, 3661, 3662, 3663,
- 3664, 3665, 3666, 3667, 3668, 3669, 3670, 3671,
- 3672, 3673, 3674, 3675, null, null, null, null,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("windows-1250", [
- 8364, 129, 8218, 131, 8222, 8230, 8224, 8225,
- 136, 8240, 352, 8249, 346, 356, 381, 377,
- 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212,
- 152, 8482, 353, 8250, 347, 357, 382, 378,
- 160, 711, 728, 321, 164, 260, 166, 167,
- 168, 169, 350, 171, 172, 173, 174, 379,
- 176, 177, 731, 322, 180, 181, 182, 183,
- 184, 261, 351, 187, 317, 733, 318, 380,
- 340, 193, 194, 258, 196, 313, 262, 199,
- 268, 201, 280, 203, 282, 205, 206, 270,
- 272, 323, 327, 211, 212, 336, 214, 215,
- 344, 366, 218, 368, 220, 221, 354, 223,
- 341, 225, 226, 259, 228, 314, 263, 231,
- 269, 233, 281, 235, 283, 237, 238, 271,
- 273, 324, 328, 243, 244, 337, 246, 247,
- 345, 367, 250, 369, 252, 253, 355, 729,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("windows-1251", [
- 1026, 1027, 8218, 1107, 8222, 8230, 8224, 8225,
- 8364, 8240, 1033, 8249, 1034, 1036, 1035, 1039,
- 1106, 8216, 8217, 8220, 8221, 8226, 8211, 8212,
- 152, 8482, 1113, 8250, 1114, 1116, 1115, 1119,
- 160, 1038, 1118, 1032, 164, 1168, 166, 167,
- 1025, 169, 1028, 171, 172, 173, 174, 1031,
- 176, 177, 1030, 1110, 1169, 181, 182, 183,
- 1105, 8470, 1108, 187, 1112, 1029, 1109, 1111,
- 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047,
- 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055,
- 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063,
- 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071,
- 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079,
- 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087,
- 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095,
- 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("windows-1253", [
- 8364, 129, 8218, 402, 8222, 8230, 8224, 8225,
- 136, 8240, 138, 8249, 140, 141, 142, 143,
- 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212,
- 152, 8482, 154, 8250, 156, 157, 158, 159,
- 160, 901, 902, 163, 164, 165, 166, 167,
- 168, 169, null, 171, 172, 173, 174, 8213,
- 176, 177, 178, 179, 900, 181, 182, 183,
- 904, 905, 906, 187, 908, 189, 910, 911,
- 912, 913, 914, 915, 916, 917, 918, 919,
- 920, 921, 922, 923, 924, 925, 926, 927,
- 928, 929, null, 931, 932, 933, 934, 935,
- 936, 937, 938, 939, 940, 941, 942, 943,
- 944, 945, 946, 947, 948, 949, 950, 951,
- 952, 953, 954, 955, 956, 957, 958, 959,
- 960, 961, 962, 963, 964, 965, 966, 967,
- 968, 969, 970, 971, 972, 973, 974, null,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("windows-1254", [
- 8364, 129, 8218, 402, 8222, 8230, 8224, 8225,
- 710, 8240, 352, 8249, 338, 141, 142, 143,
- 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212,
- 732, 8482, 353, 8250, 339, 157, 158, 376,
- 160, 161, 162, 163, 164, 165, 166, 167,
- 168, 169, 170, 171, 172, 173, 174, 175,
- 176, 177, 178, 179, 180, 181, 182, 183,
- 184, 185, 186, 187, 188, 189, 190, 191,
- 192, 193, 194, 195, 196, 197, 198, 199,
- 200, 201, 202, 203, 204, 205, 206, 207,
- 286, 209, 210, 211, 212, 213, 214, 215,
- 216, 217, 218, 219, 220, 304, 350, 223,
- 224, 225, 226, 227, 228, 229, 230, 231,
- 232, 233, 234, 235, 236, 237, 238, 239,
- 287, 241, 242, 243, 244, 245, 246, 247,
- 248, 249, 250, 251, 252, 305, 351, 255,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("windows-1255", [
- 8364, 129, 8218, 402, 8222, 8230, 8224, 8225,
- 710, 8240, 138, 8249, 140, 141, 142, 143,
- 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212,
- 732, 8482, 154, 8250, 156, 157, 158, 159,
- 160, 161, 162, 163, 8362, 165, 166, 167,
- 168, 169, 215, 171, 172, 173, 174, 175,
- 176, 177, 178, 179, 180, 181, 182, 183,
- 184, 185, 247, 187, 188, 189, 190, 191,
- 1456, 1457, 1458, 1459, 1460, 1461, 1462, 1463,
- 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1471,
- 1472, 1473, 1474, 1475, 1520, 1521, 1522, 1523,
- 1524, null, null, null, null, null, null, null,
- 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495,
- 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503,
- 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511,
- 1512, 1513, 1514, null, null, 8206, 8207, null,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("windows-1256", [
- 8364, 1662, 8218, 402, 8222, 8230, 8224, 8225,
- 710, 8240, 1657, 8249, 338, 1670, 1688, 1672,
- 1711, 8216, 8217, 8220, 8221, 8226, 8211, 8212,
- 1705, 8482, 1681, 8250, 339, 8204, 8205, 1722,
- 160, 1548, 162, 163, 164, 165, 166, 167,
- 168, 169, 1726, 171, 172, 173, 174, 175,
- 176, 177, 178, 179, 180, 181, 182, 183,
- 184, 185, 1563, 187, 188, 189, 190, 1567,
- 1729, 1569, 1570, 1571, 1572, 1573, 1574, 1575,
- 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583,
- 1584, 1585, 1586, 1587, 1588, 1589, 1590, 215,
- 1591, 1592, 1593, 1594, 1600, 1601, 1602, 1603,
- 224, 1604, 226, 1605, 1606, 1607, 1608, 231,
- 232, 233, 234, 235, 1609, 1610, 238, 239,
- 1611, 1612, 1613, 1614, 244, 1615, 1616, 247,
- 1617, 249, 1618, 251, 252, 8206, 8207, 1746,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("windows-1257", [
- 8364, 129, 8218, 131, 8222, 8230, 8224, 8225,
- 136, 8240, 138, 8249, 140, 168, 711, 184,
- 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212,
- 152, 8482, 154, 8250, 156, 175, 731, 159,
- 160, null, 162, 163, 164, null, 166, 167,
- 216, 169, 342, 171, 172, 173, 174, 198,
- 176, 177, 178, 179, 180, 181, 182, 183,
- 248, 185, 343, 187, 188, 189, 190, 230,
- 260, 302, 256, 262, 196, 197, 280, 274,
- 268, 201, 377, 278, 290, 310, 298, 315,
- 352, 323, 325, 211, 332, 213, 214, 215,
- 370, 321, 346, 362, 220, 379, 381, 223,
- 261, 303, 257, 263, 228, 229, 281, 275,
- 269, 233, 378, 279, 291, 311, 299, 316,
- 353, 324, 326, 243, 333, 245, 246, 247,
- 371, 322, 347, 363, 252, 380, 382, 729,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("windows-1258", [
- 8364, 129, 8218, 402, 8222, 8230, 8224, 8225,
- 710, 8240, 138, 8249, 338, 141, 142, 143,
- 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212,
- 732, 8482, 154, 8250, 339, 157, 158, 376,
- 160, 161, 162, 163, 164, 165, 166, 167,
- 168, 169, 170, 171, 172, 173, 174, 175,
- 176, 177, 178, 179, 180, 181, 182, 183,
- 184, 185, 186, 187, 188, 189, 190, 191,
- 192, 193, 194, 258, 196, 197, 198, 199,
- 200, 201, 202, 203, 768, 205, 206, 207,
- 272, 209, 777, 211, 212, 416, 214, 215,
- 216, 217, 218, 219, 220, 431, 771, 223,
- 224, 225, 226, 259, 228, 229, 230, 231,
- 232, 233, 234, 235, 769, 237, 238, 239,
- 273, 241, 803, 243, 244, 417, 246, 247,
- 248, 249, 250, 251, 252, 432, 8363, 255,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("x-mac-cyrillic", [
- 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047,
- 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055,
- 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063,
- 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071,
- 8224, 176, 1168, 163, 167, 8226, 182, 1030,
- 174, 169, 8482, 1026, 1106, 8800, 1027, 1107,
- 8734, 177, 8804, 8805, 1110, 181, 1169, 1032,
- 1028, 1108, 1031, 1111, 1033, 1113, 1034, 1114,
- 1112, 1029, 172, 8730, 402, 8776, 8710, 171,
- 187, 8230, 160, 1035, 1115, 1036, 1116, 1109,
- 8211, 8212, 8220, 8221, 8216, 8217, 247, 8222,
- 1038, 1118, 1039, 1119, 8470, 1025, 1105, 1103,
- 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079,
- 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087,
- 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095,
- 1096, 1097, 1098, 1099, 1100, 1101, 1102, 8364,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("big5", [
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, 17392, 19506, 17923, 17830, 17784, 160359, 19831, 17843, 162993, 19682, 163013, 15253, 18230, 18244, 19527, 19520, 148159, 144919,
- 160594, 159371, 159954, 19543, 172881, 18255, 17882, 19589, 162924, 19719, 19108, 18081, 158499, 29221, 154196, 137827, 146950, 147297, 26189, 22267,
- null, 32149, 22813, 166841, 15860, 38708, 162799, 23515, 138590, 23204, 13861, 171696, 23249, 23479, 23804, 26478, 34195, 170309, 29793, 29853,
- 14453, 138579, 145054, 155681, 16108, 153822, 15093, 31484, 40855, 147809, 166157, 143850, 133770, 143966, 17162, 33924, 40854, 37935, 18736, 34323,
- 22678, 38730, 37400, 31184, 31282, 26208, 27177, 34973, 29772, 31685, 26498, 31276, 21071, 36934, 13542, 29636, 155065, 29894, 40903, 22451,
- 18735, 21580, 16689, 145038, 22552, 31346, 162661, 35727, 18094, 159368, 16769, 155033, 31662, 140476, 40904, 140481, 140489, 140492, 40905, 34052,
- 144827, 16564, 40906, 17633, 175615, 25281, 28782, 40907, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 12736,
- 12737, 12738, 12739, 12740, 131340, 12741, 131281, 131277, 12742, 12743, 131275, 139240, 12744, 131274, 12745, 12746, 12747, 12748, 131342, 12749,
- 12750, 256, 193, 461, 192, 274, 201, 282, 200, 332, 211, 465, 210, null, 7870, null, 7872, 202, 257, 225,
- 462, 224, 593, 275, 233, 283, 232, 299, 237, 464, 236, 333, 243, 466, 242, 363, 250, 468, 249, 470,
- 472, 474, 476, 252, null, 7871, null, 7873, 234, 609, 9178, 9179, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 172969, 135493, null, 25866,
- null, null, 20029, 28381, 40270, 37343, null, null, 161589, 25745, 20250, 20264, 20392, 20822, 20852, 20892, 20964, 21153, 21160, 21307,
- 21326, 21457, 21464, 22242, 22768, 22788, 22791, 22834, 22836, 23398, 23454, 23455, 23706, 24198, 24635, 25993, 26622, 26628, 26725, 27982,
- 28860, 30005, 32420, 32428, 32442, 32455, 32463, 32479, 32518, 32567, 33402, 33487, 33647, 35270, 35774, 35810, 36710, 36711, 36718, 29713,
- 31996, 32205, 26950, 31433, 21031, null, null, null, null, 37260, 30904, 37214, 32956, null, 36107, 33014, 133607, null, null, 32927,
- 40647, 19661, 40393, 40460, 19518, 171510, 159758, 40458, 172339, 13761, null, 28314, 33342, 29977, null, 18705, 39532, 39567, 40857, 31111,
- 164972, 138698, 132560, 142054, 20004, 20097, 20096, 20103, 20159, 20203, 20279, 13388, 20413, 15944, 20483, 20616, 13437, 13459, 13477, 20870,
- 22789, 20955, 20988, 20997, 20105, 21113, 21136, 21287, 13767, 21417, 13649, 21424, 13651, 21442, 21539, 13677, 13682, 13953, 21651, 21667,
- 21684, 21689, 21712, 21743, 21784, 21795, 21800, 13720, 21823, 13733, 13759, 21975, 13765, 163204, 21797, null, 134210, 134421, 151851, 21904,
- 142534, 14828, 131905, 36422, 150968, 169189, 16467, 164030, 30586, 142392, 14900, 18389, 164189, 158194, 151018, 25821, 134524, 135092, 134357, 135412,
- 25741, 36478, 134806, 134155, 135012, 142505, 164438, 148691, null, 134470, 170573, 164073, 18420, 151207, 142530, 39602, 14951, 169460, 16365, 13574,
- 152263, 169940, 161992, 142660, 40302, 38933, null, 17369, 155813, 25780, 21731, 142668, 142282, 135287, 14843, 135279, 157402, 157462, 162208, 25834,
- 151634, 134211, 36456, 139681, 166732, 132913, null, 18443, 131497, 16378, 22643, 142733, null, 148936, 132348, 155799, 134988, 134550, 21881, 16571,
- 17338, null, 19124, 141926, 135325, 33194, 39157, 134556, 25465, 14846, 141173, 36288, 22177, 25724, 15939, null, 173569, 134665, 142031, 142537,
- null, 135368, 145858, 14738, 14854, 164507, 13688, 155209, 139463, 22098, 134961, 142514, 169760, 13500, 27709, 151099, null, null, 161140, 142987,
- 139784, 173659, 167117, 134778, 134196, 157724, 32659, 135375, 141315, 141625, 13819, 152035, 134796, 135053, 134826, 16275, 134960, 134471, 135503, 134732,
- null, 134827, 134057, 134472, 135360, 135485, 16377, 140950, 25650, 135085, 144372, 161337, 142286, 134526, 134527, 142417, 142421, 14872, 134808, 135367,
- 134958, 173618, 158544, 167122, 167321, 167114, 38314, 21708, 33476, 21945, null, 171715, 39974, 39606, 161630, 142830, 28992, 33133, 33004, 23580,
- 157042, 33076, 14231, 21343, 164029, 37302, 134906, 134671, 134775, 134907, 13789, 151019, 13833, 134358, 22191, 141237, 135369, 134672, 134776, 135288,
- 135496, 164359, 136277, 134777, 151120, 142756, 23124, 135197, 135198, 135413, 135414, 22428, 134673, 161428, 164557, 135093, 134779, 151934, 14083, 135094,
- 135552, 152280, 172733, 149978, 137274, 147831, 164476, 22681, 21096, 13850, 153405, 31666, 23400, 18432, 19244, 40743, 18919, 39967, 39821, 154484,
- 143677, 22011, 13810, 22153, 20008, 22786, 138177, 194680, 38737, 131206, 20059, 20155, 13630, 23587, 24401, 24516, 14586, 25164, 25909, 27514,
- 27701, 27706, 28780, 29227, 20012, 29357, 149737, 32594, 31035, 31993, 32595, 156266, 13505, null, 156491, 32770, 32896, 157202, 158033, 21341,
- 34916, 35265, 161970, 35744, 36125, 38021, 38264, 38271, 38376, 167439, 38886, 39029, 39118, 39134, 39267, 170000, 40060, 40479, 40644, 27503,
- 63751, 20023, 131207, 38429, 25143, 38050, null, 20539, 28158, 171123, 40870, 15817, 34959, 147790, 28791, 23797, 19232, 152013, 13657, 154928,
- 24866, 166450, 36775, 37366, 29073, 26393, 29626, 144001, 172295, 15499, 137600, 19216, 30948, 29698, 20910, 165647, 16393, 27235, 172730, 16931,
- 34319, 133743, 31274, 170311, 166634, 38741, 28749, 21284, 139390, 37876, 30425, 166371, 40871, 30685, 20131, 20464, 20668, 20015, 20247, 40872,
- 21556, 32139, 22674, 22736, 138678, 24210, 24217, 24514, 141074, 25995, 144377, 26905, 27203, 146531, 27903, null, 29184, 148741, 29580, 16091,
- 150035, 23317, 29881, 35715, 154788, 153237, 31379, 31724, 31939, 32364, 33528, 34199, 40873, 34960, 40874, 36537, 40875, 36815, 34143, 39392,
- 37409, 40876, 167353, 136255, 16497, 17058, 23066, null, null, null, 39016, 26475, 17014, 22333, null, 34262, 149883, 33471, 160013, 19585,
- 159092, 23931, 158485, 159678, 40877, 40878, 23446, 40879, 26343, 32347, 28247, 31178, 15752, 17603, 143958, 141206, 17306, 17718, null, 23765,
- 146202, 35577, 23672, 15634, 144721, 23928, 40882, 29015, 17752, 147692, 138787, 19575, 14712, 13386, 131492, 158785, 35532, 20404, 131641, 22975,
- 33132, 38998, 170234, 24379, 134047, null, 139713, 166253, 16642, 18107, 168057, 16135, 40883, 172469, 16632, 14294, 18167, 158790, 16764, 165554,
- 160767, 17773, 14548, 152730, 17761, 17691, 19849, 19579, 19830, 17898, 16328, 150287, 13921, 17630, 17597, 16877, 23870, 23880, 23894, 15868,
- 14351, 23972, 23993, 14368, 14392, 24130, 24253, 24357, 24451, 14600, 14612, 14655, 14669, 24791, 24893, 23781, 14729, 25015, 25017, 25039,
- 14776, 25132, 25232, 25317, 25368, 14840, 22193, 14851, 25570, 25595, 25607, 25690, 14923, 25792, 23829, 22049, 40863, 14999, 25990, 15037,
- 26111, 26195, 15090, 26258, 15138, 26390, 15170, 26532, 26624, 15192, 26698, 26756, 15218, 15217, 15227, 26889, 26947, 29276, 26980, 27039,
- 27013, 15292, 27094, 15325, 27237, 27252, 27249, 27266, 15340, 27289, 15346, 27307, 27317, 27348, 27382, 27521, 27585, 27626, 27765, 27818,
- 15563, 27906, 27910, 27942, 28033, 15599, 28068, 28081, 28181, 28184, 28201, 28294, 166336, 28347, 28386, 28378, 40831, 28392, 28393, 28452,
- 28468, 15686, 147265, 28545, 28606, 15722, 15733, 29111, 23705, 15754, 28716, 15761, 28752, 28756, 28783, 28799, 28809, 131877, 17345, 13809,
- 134872, 147159, 22462, 159443, 28990, 153568, 13902, 27042, 166889, 23412, 31305, 153825, 169177, 31333, 31357, 154028, 31419, 31408, 31426, 31427,
- 29137, 156813, 16842, 31450, 31453, 31466, 16879, 21682, 154625, 31499, 31573, 31529, 152334, 154878, 31650, 31599, 33692, 154548, 158847, 31696,
- 33825, 31634, 31672, 154912, 15789, 154725, 33938, 31738, 31750, 31797, 154817, 31812, 31875, 149634, 31910, 26237, 148856, 31945, 31943, 31974,
- 31860, 31987, 31989, 31950, 32359, 17693, 159300, 32093, 159446, 29837, 32137, 32171, 28981, 32179, 32210, 147543, 155689, 32228, 15635, 32245,
- 137209, 32229, 164717, 32285, 155937, 155994, 32366, 32402, 17195, 37996, 32295, 32576, 32577, 32583, 31030, 156368, 39393, 32663, 156497, 32675,
- 136801, 131176, 17756, 145254, 17667, 164666, 32762, 156809, 32773, 32776, 32797, 32808, 32815, 172167, 158915, 32827, 32828, 32865, 141076, 18825,
- 157222, 146915, 157416, 26405, 32935, 166472, 33031, 33050, 22704, 141046, 27775, 156824, 151480, 25831, 136330, 33304, 137310, 27219, 150117, 150165,
- 17530, 33321, 133901, 158290, 146814, 20473, 136445, 34018, 33634, 158474, 149927, 144688, 137075, 146936, 33450, 26907, 194964, 16859, 34123, 33488,
- 33562, 134678, 137140, 14017, 143741, 144730, 33403, 33506, 33560, 147083, 159139, 158469, 158615, 144846, 15807, 33565, 21996, 33669, 17675, 159141,
- 33708, 33729, 33747, 13438, 159444, 27223, 34138, 13462, 159298, 143087, 33880, 154596, 33905, 15827, 17636, 27303, 33866, 146613, 31064, 33960,
- 158614, 159351, 159299, 34014, 33807, 33681, 17568, 33939, 34020, 154769, 16960, 154816, 17731, 34100, 23282, 159385, 17703, 34163, 17686, 26559,
- 34326, 165413, 165435, 34241, 159880, 34306, 136578, 159949, 194994, 17770, 34344, 13896, 137378, 21495, 160666, 34430, 34673, 172280, 34798, 142375,
- 34737, 34778, 34831, 22113, 34412, 26710, 17935, 34885, 34886, 161248, 146873, 161252, 34910, 34972, 18011, 34996, 34997, 25537, 35013, 30583,
- 161551, 35207, 35210, 35238, 35241, 35239, 35260, 166437, 35303, 162084, 162493, 35484, 30611, 37374, 35472, 162393, 31465, 162618, 147343, 18195,
- 162616, 29052, 35596, 35615, 152624, 152933, 35647, 35660, 35661, 35497, 150138, 35728, 35739, 35503, 136927, 17941, 34895, 35995, 163156, 163215,
- 195028, 14117, 163155, 36054, 163224, 163261, 36114, 36099, 137488, 36059, 28764, 36113, 150729, 16080, 36215, 36265, 163842, 135188, 149898, 15228,
- 164284, 160012, 31463, 36525, 36534, 36547, 37588, 36633, 36653, 164709, 164882, 36773, 37635, 172703, 133712, 36787, 18730, 166366, 165181, 146875,
- 24312, 143970, 36857, 172052, 165564, 165121, 140069, 14720, 159447, 36919, 165180, 162494, 36961, 165228, 165387, 37032, 165651, 37060, 165606, 37038,
- 37117, 37223, 15088, 37289, 37316, 31916, 166195, 138889, 37390, 27807, 37441, 37474, 153017, 37561, 166598, 146587, 166668, 153051, 134449, 37676,
- 37739, 166625, 166891, 28815, 23235, 166626, 166629, 18789, 37444, 166892, 166969, 166911, 37747, 37979, 36540, 38277, 38310, 37926, 38304, 28662,
- 17081, 140922, 165592, 135804, 146990, 18911, 27676, 38523, 38550, 16748, 38563, 159445, 25050, 38582, 30965, 166624, 38589, 21452, 18849, 158904,
- 131700, 156688, 168111, 168165, 150225, 137493, 144138, 38705, 34370, 38710, 18959, 17725, 17797, 150249, 28789, 23361, 38683, 38748, 168405, 38743,
- 23370, 168427, 38751, 37925, 20688, 143543, 143548, 38793, 38815, 38833, 38846, 38848, 38866, 38880, 152684, 38894, 29724, 169011, 38911, 38901,
- 168989, 162170, 19153, 38964, 38963, 38987, 39014, 15118, 160117, 15697, 132656, 147804, 153350, 39114, 39095, 39112, 39111, 19199, 159015, 136915,
- 21936, 39137, 39142, 39148, 37752, 39225, 150057, 19314, 170071, 170245, 39413, 39436, 39483, 39440, 39512, 153381, 14020, 168113, 170965, 39648,
- 39650, 170757, 39668, 19470, 39700, 39725, 165376, 20532, 39732, 158120, 14531, 143485, 39760, 39744, 171326, 23109, 137315, 39822, 148043, 39938,
- 39935, 39948, 171624, 40404, 171959, 172434, 172459, 172257, 172323, 172511, 40318, 40323, 172340, 40462, 26760, 40388, 139611, 172435, 172576, 137531,
- 172595, 40249, 172217, 172724, 40592, 40597, 40606, 40610, 19764, 40618, 40623, 148324, 40641, 15200, 14821, 15645, 20274, 14270, 166955, 40706,
- 40712, 19350, 37924, 159138, 40727, 40726, 40761, 22175, 22154, 40773, 39352, 168075, 38898, 33919, 40802, 40809, 31452, 40846, 29206, 19390,
- 149877, 149947, 29047, 150008, 148296, 150097, 29598, 166874, 137466, 31135, 166270, 167478, 37737, 37875, 166468, 37612, 37761, 37835, 166252, 148665,
- 29207, 16107, 30578, 31299, 28880, 148595, 148472, 29054, 137199, 28835, 137406, 144793, 16071, 137349, 152623, 137208, 14114, 136955, 137273, 14049,
- 137076, 137425, 155467, 14115, 136896, 22363, 150053, 136190, 135848, 136134, 136374, 34051, 145062, 34051, 33877, 149908, 160101, 146993, 152924, 147195,
- 159826, 17652, 145134, 170397, 159526, 26617, 14131, 15381, 15847, 22636, 137506, 26640, 16471, 145215, 147681, 147595, 147727, 158753, 21707, 22174,
- 157361, 22162, 135135, 134056, 134669, 37830, 166675, 37788, 20216, 20779, 14361, 148534, 20156, 132197, 131967, 20299, 20362, 153169, 23144, 131499,
- 132043, 14745, 131850, 132116, 13365, 20265, 131776, 167603, 131701, 35546, 131596, 20120, 20685, 20749, 20386, 20227, 150030, 147082, 20290, 20526,
- 20588, 20609, 20428, 20453, 20568, 20732, 20825, 20827, 20829, 20830, 28278, 144789, 147001, 147135, 28018, 137348, 147081, 20904, 20931, 132576,
- 17629, 132259, 132242, 132241, 36218, 166556, 132878, 21081, 21156, 133235, 21217, 37742, 18042, 29068, 148364, 134176, 149932, 135396, 27089, 134685,
- 29817, 16094, 29849, 29716, 29782, 29592, 19342, 150204, 147597, 21456, 13700, 29199, 147657, 21940, 131909, 21709, 134086, 22301, 37469, 38644,
- 37734, 22493, 22413, 22399, 13886, 22731, 23193, 166470, 136954, 137071, 136976, 23084, 22968, 37519, 23166, 23247, 23058, 153926, 137715, 137313,
- 148117, 14069, 27909, 29763, 23073, 155267, 23169, 166871, 132115, 37856, 29836, 135939, 28933, 18802, 37896, 166395, 37821, 14240, 23582, 23710,
- 24158, 24136, 137622, 137596, 146158, 24269, 23375, 137475, 137476, 14081, 137376, 14045, 136958, 14035, 33066, 166471, 138682, 144498, 166312, 24332,
- 24334, 137511, 137131, 23147, 137019, 23364, 34324, 161277, 34912, 24702, 141408, 140843, 24539, 16056, 140719, 140734, 168072, 159603, 25024, 131134,
- 131142, 140827, 24985, 24984, 24693, 142491, 142599, 149204, 168269, 25713, 149093, 142186, 14889, 142114, 144464, 170218, 142968, 25399, 173147, 25782,
- 25393, 25553, 149987, 142695, 25252, 142497, 25659, 25963, 26994, 15348, 143502, 144045, 149897, 144043, 21773, 144096, 137433, 169023, 26318, 144009,
- 143795, 15072, 16784, 152964, 166690, 152975, 136956, 152923, 152613, 30958, 143619, 137258, 143924, 13412, 143887, 143746, 148169, 26254, 159012, 26219,
- 19347, 26160, 161904, 138731, 26211, 144082, 144097, 26142, 153714, 14545, 145466, 145340, 15257, 145314, 144382, 29904, 15254, 26511, 149034, 26806,
- 26654, 15300, 27326, 14435, 145365, 148615, 27187, 27218, 27337, 27397, 137490, 25873, 26776, 27212, 15319, 27258, 27479, 147392, 146586, 37792,
- 37618, 166890, 166603, 37513, 163870, 166364, 37991, 28069, 28427, 149996, 28007, 147327, 15759, 28164, 147516, 23101, 28170, 22599, 27940, 30786,
- 28987, 148250, 148086, 28913, 29264, 29319, 29332, 149391, 149285, 20857, 150180, 132587, 29818, 147192, 144991, 150090, 149783, 155617, 16134, 16049,
- 150239, 166947, 147253, 24743, 16115, 29900, 29756, 37767, 29751, 17567, 159210, 17745, 30083, 16227, 150745, 150790, 16216, 30037, 30323, 173510,
- 15129, 29800, 166604, 149931, 149902, 15099, 15821, 150094, 16127, 149957, 149747, 37370, 22322, 37698, 166627, 137316, 20703, 152097, 152039, 30584,
- 143922, 30478, 30479, 30587, 149143, 145281, 14942, 149744, 29752, 29851, 16063, 150202, 150215, 16584, 150166, 156078, 37639, 152961, 30750, 30861,
- 30856, 30930, 29648, 31065, 161601, 153315, 16654, 31131, 33942, 31141, 27181, 147194, 31290, 31220, 16750, 136934, 16690, 37429, 31217, 134476,
- 149900, 131737, 146874, 137070, 13719, 21867, 13680, 13994, 131540, 134157, 31458, 23129, 141045, 154287, 154268, 23053, 131675, 30960, 23082, 154566,
- 31486, 16889, 31837, 31853, 16913, 154547, 155324, 155302, 31949, 150009, 137136, 31886, 31868, 31918, 27314, 32220, 32263, 32211, 32590, 156257,
- 155996, 162632, 32151, 155266, 17002, 158581, 133398, 26582, 131150, 144847, 22468, 156690, 156664, 149858, 32733, 31527, 133164, 154345, 154947, 31500,
- 155150, 39398, 34373, 39523, 27164, 144447, 14818, 150007, 157101, 39455, 157088, 33920, 160039, 158929, 17642, 33079, 17410, 32966, 33033, 33090,
- 157620, 39107, 158274, 33378, 33381, 158289, 33875, 159143, 34320, 160283, 23174, 16767, 137280, 23339, 137377, 23268, 137432, 34464, 195004, 146831,
- 34861, 160802, 23042, 34926, 20293, 34951, 35007, 35046, 35173, 35149, 153219, 35156, 161669, 161668, 166901, 166873, 166812, 166393, 16045, 33955,
- 18165, 18127, 14322, 35389, 35356, 169032, 24397, 37419, 148100, 26068, 28969, 28868, 137285, 40301, 35999, 36073, 163292, 22938, 30659, 23024,
- 17262, 14036, 36394, 36519, 150537, 36656, 36682, 17140, 27736, 28603, 140065, 18587, 28537, 28299, 137178, 39913, 14005, 149807, 37051, 37015,
- 21873, 18694, 37307, 37892, 166475, 16482, 166652, 37927, 166941, 166971, 34021, 35371, 38297, 38311, 38295, 38294, 167220, 29765, 16066, 149759,
- 150082, 148458, 16103, 143909, 38543, 167655, 167526, 167525, 16076, 149997, 150136, 147438, 29714, 29803, 16124, 38721, 168112, 26695, 18973, 168083,
- 153567, 38749, 37736, 166281, 166950, 166703, 156606, 37562, 23313, 35689, 18748, 29689, 147995, 38811, 38769, 39224, 134950, 24001, 166853, 150194,
- 38943, 169178, 37622, 169431, 37349, 17600, 166736, 150119, 166756, 39132, 166469, 16128, 37418, 18725, 33812, 39227, 39245, 162566, 15869, 39323,
- 19311, 39338, 39516, 166757, 153800, 27279, 39457, 23294, 39471, 170225, 19344, 170312, 39356, 19389, 19351, 37757, 22642, 135938, 22562, 149944,
- 136424, 30788, 141087, 146872, 26821, 15741, 37976, 14631, 24912, 141185, 141675, 24839, 40015, 40019, 40059, 39989, 39952, 39807, 39887, 171565,
- 39839, 172533, 172286, 40225, 19630, 147716, 40472, 19632, 40204, 172468, 172269, 172275, 170287, 40357, 33981, 159250, 159711, 158594, 34300, 17715,
- 159140, 159364, 159216, 33824, 34286, 159232, 145367, 155748, 31202, 144796, 144960, 18733, 149982, 15714, 37851, 37566, 37704, 131775, 30905, 37495,
- 37965, 20452, 13376, 36964, 152925, 30781, 30804, 30902, 30795, 137047, 143817, 149825, 13978, 20338, 28634, 28633, 28702, 28702, 21524, 147893,
- 22459, 22771, 22410, 40214, 22487, 28980, 13487, 147884, 29163, 158784, 151447, 23336, 137141, 166473, 24844, 23246, 23051, 17084, 148616, 14124,
- 19323, 166396, 37819, 37816, 137430, 134941, 33906, 158912, 136211, 148218, 142374, 148417, 22932, 146871, 157505, 32168, 155995, 155812, 149945, 149899,
- 166394, 37605, 29666, 16105, 29876, 166755, 137375, 16097, 150195, 27352, 29683, 29691, 16086, 150078, 150164, 137177, 150118, 132007, 136228, 149989,
- 29768, 149782, 28837, 149878, 37508, 29670, 37727, 132350, 37681, 166606, 166422, 37766, 166887, 153045, 18741, 166530, 29035, 149827, 134399, 22180,
- 132634, 134123, 134328, 21762, 31172, 137210, 32254, 136898, 150096, 137298, 17710, 37889, 14090, 166592, 149933, 22960, 137407, 137347, 160900, 23201,
- 14050, 146779, 14000, 37471, 23161, 166529, 137314, 37748, 15565, 133812, 19094, 14730, 20724, 15721, 15692, 136092, 29045, 17147, 164376, 28175,
- 168164, 17643, 27991, 163407, 28775, 27823, 15574, 147437, 146989, 28162, 28428, 15727, 132085, 30033, 14012, 13512, 18048, 16090, 18545, 22980,
- 37486, 18750, 36673, 166940, 158656, 22546, 22472, 14038, 136274, 28926, 148322, 150129, 143331, 135856, 140221, 26809, 26983, 136088, 144613, 162804,
- 145119, 166531, 145366, 144378, 150687, 27162, 145069, 158903, 33854, 17631, 17614, 159014, 159057, 158850, 159710, 28439, 160009, 33597, 137018, 33773,
- 158848, 159827, 137179, 22921, 23170, 137139, 23137, 23153, 137477, 147964, 14125, 23023, 137020, 14023, 29070, 37776, 26266, 148133, 23150, 23083,
- 148115, 27179, 147193, 161590, 148571, 148170, 28957, 148057, 166369, 20400, 159016, 23746, 148686, 163405, 148413, 27148, 148054, 135940, 28838, 28979,
- 148457, 15781, 27871, 194597, 150095, 32357, 23019, 23855, 15859, 24412, 150109, 137183, 32164, 33830, 21637, 146170, 144128, 131604, 22398, 133333,
- 132633, 16357, 139166, 172726, 28675, 168283, 23920, 29583, 31955, 166489, 168992, 20424, 32743, 29389, 29456, 162548, 29496, 29497, 153334, 29505,
- 29512, 16041, 162584, 36972, 29173, 149746, 29665, 33270, 16074, 30476, 16081, 27810, 22269, 29721, 29726, 29727, 16098, 16112, 16116, 16122,
- 29907, 16142, 16211, 30018, 30061, 30066, 30093, 16252, 30152, 30172, 16320, 30285, 16343, 30324, 16348, 30330, 151388, 29064, 22051, 35200,
- 22633, 16413, 30531, 16441, 26465, 16453, 13787, 30616, 16490, 16495, 23646, 30654, 30667, 22770, 30744, 28857, 30748, 16552, 30777, 30791,
- 30801, 30822, 33864, 152885, 31027, 26627, 31026, 16643, 16649, 31121, 31129, 36795, 31238, 36796, 16743, 31377, 16818, 31420, 33401, 16836,
- 31439, 31451, 16847, 20001, 31586, 31596, 31611, 31762, 31771, 16992, 17018, 31867, 31900, 17036, 31928, 17044, 31981, 36755, 28864, 134351,
- 32207, 32212, 32208, 32253, 32686, 32692, 29343, 17303, 32800, 32805, 31545, 32814, 32817, 32852, 15820, 22452, 28832, 32951, 33001, 17389,
- 33036, 29482, 33038, 33042, 30048, 33044, 17409, 15161, 33110, 33113, 33114, 17427, 22586, 33148, 33156, 17445, 33171, 17453, 33189, 22511,
- 33217, 33252, 33364, 17551, 33446, 33398, 33482, 33496, 33535, 17584, 33623, 38505, 27018, 33797, 28917, 33892, 24803, 33928, 17668, 33982,
- 34017, 34040, 34064, 34104, 34130, 17723, 34159, 34160, 34272, 17783, 34418, 34450, 34482, 34543, 38469, 34699, 17926, 17943, 34990, 35071,
- 35108, 35143, 35217, 162151, 35369, 35384, 35476, 35508, 35921, 36052, 36082, 36124, 18328, 22623, 36291, 18413, 20206, 36410, 21976, 22356,
- 36465, 22005, 36528, 18487, 36558, 36578, 36580, 36589, 36594, 36791, 36801, 36810, 36812, 36915, 39364, 18605, 39136, 37395, 18718, 37416,
- 37464, 37483, 37553, 37550, 37567, 37603, 37611, 37619, 37620, 37629, 37699, 37764, 37805, 18757, 18769, 40639, 37911, 21249, 37917, 37933,
- 37950, 18794, 37972, 38009, 38189, 38306, 18855, 38388, 38451, 18917, 26528, 18980, 38720, 18997, 38834, 38850, 22100, 19172, 24808, 39097,
- 19225, 39153, 22596, 39182, 39193, 20916, 39196, 39223, 39234, 39261, 39266, 19312, 39365, 19357, 39484, 39695, 31363, 39785, 39809, 39901,
- 39921, 39924, 19565, 39968, 14191, 138178, 40265, 39994, 40702, 22096, 40339, 40381, 40384, 40444, 38134, 36790, 40571, 40620, 40625, 40637,
- 40646, 38108, 40674, 40689, 40696, 31432, 40772, 131220, 131767, 132000, 26906, 38083, 22956, 132311, 22592, 38081, 14265, 132565, 132629, 132726,
- 136890, 22359, 29043, 133826, 133837, 134079, 21610, 194619, 134091, 21662, 134139, 134203, 134227, 134245, 134268, 24807, 134285, 22138, 134325, 134365,
- 134381, 134511, 134578, 134600, 26965, 39983, 34725, 134660, 134670, 134871, 135056, 134957, 134771, 23584, 135100, 24075, 135260, 135247, 135286, 26398,
- 135291, 135304, 135318, 13895, 135359, 135379, 135471, 135483, 21348, 33965, 135907, 136053, 135990, 35713, 136567, 136729, 137155, 137159, 20088, 28859,
- 137261, 137578, 137773, 137797, 138282, 138352, 138412, 138952, 25283, 138965, 139029, 29080, 26709, 139333, 27113, 14024, 139900, 140247, 140282, 141098,
- 141425, 141647, 33533, 141671, 141715, 142037, 35237, 142056, 36768, 142094, 38840, 142143, 38983, 39613, 142412, null, 142472, 142519, 154600, 142600,
- 142610, 142775, 142741, 142914, 143220, 143308, 143411, 143462, 144159, 144350, 24497, 26184, 26303, 162425, 144743, 144883, 29185, 149946, 30679, 144922,
- 145174, 32391, 131910, 22709, 26382, 26904, 146087, 161367, 155618, 146961, 147129, 161278, 139418, 18640, 19128, 147737, 166554, 148206, 148237, 147515,
- 148276, 148374, 150085, 132554, 20946, 132625, 22943, 138920, 15294, 146687, 148484, 148694, 22408, 149108, 14747, 149295, 165352, 170441, 14178, 139715,
- 35678, 166734, 39382, 149522, 149755, 150037, 29193, 150208, 134264, 22885, 151205, 151430, 132985, 36570, 151596, 21135, 22335, 29041, 152217, 152601,
- 147274, 150183, 21948, 152646, 152686, 158546, 37332, 13427, 152895, 161330, 152926, 18200, 152930, 152934, 153543, 149823, 153693, 20582, 13563, 144332,
- 24798, 153859, 18300, 166216, 154286, 154505, 154630, 138640, 22433, 29009, 28598, 155906, 162834, 36950, 156082, 151450, 35682, 156674, 156746, 23899,
- 158711, 36662, 156804, 137500, 35562, 150006, 156808, 147439, 156946, 19392, 157119, 157365, 141083, 37989, 153569, 24981, 23079, 194765, 20411, 22201,
- 148769, 157436, 20074, 149812, 38486, 28047, 158909, 13848, 35191, 157593, 157806, 156689, 157790, 29151, 157895, 31554, 168128, 133649, 157990, 37124,
- 158009, 31301, 40432, 158202, 39462, 158253, 13919, 156777, 131105, 31107, 158260, 158555, 23852, 144665, 33743, 158621, 18128, 158884, 30011, 34917,
- 159150, 22710, 14108, 140685, 159819, 160205, 15444, 160384, 160389, 37505, 139642, 160395, 37680, 160486, 149968, 27705, 38047, 160848, 134904, 34855,
- 35061, 141606, 164979, 137137, 28344, 150058, 137248, 14756, 14009, 23568, 31203, 17727, 26294, 171181, 170148, 35139, 161740, 161880, 22230, 16607,
- 136714, 14753, 145199, 164072, 136133, 29101, 33638, 162269, 168360, 23143, 19639, 159919, 166315, 162301, 162314, 162571, 163174, 147834, 31555, 31102,
- 163849, 28597, 172767, 27139, 164632, 21410, 159239, 37823, 26678, 38749, 164207, 163875, 158133, 136173, 143919, 163912, 23941, 166960, 163971, 22293,
- 38947, 166217, 23979, 149896, 26046, 27093, 21458, 150181, 147329, 15377, 26422, 163984, 164084, 164142, 139169, 164175, 164233, 164271, 164378, 164614,
- 164655, 164746, 13770, 164968, 165546, 18682, 25574, 166230, 30728, 37461, 166328, 17394, 166375, 17375, 166376, 166726, 166868, 23032, 166921, 36619,
- 167877, 168172, 31569, 168208, 168252, 15863, 168286, 150218, 36816, 29327, 22155, 169191, 169449, 169392, 169400, 169778, 170193, 170313, 170346, 170435,
- 170536, 170766, 171354, 171419, 32415, 171768, 171811, 19620, 38215, 172691, 29090, 172799, 19857, 36882, 173515, 19868, 134300, 36798, 21953, 36794,
- 140464, 36793, 150163, 17673, 32383, 28502, 27313, 20202, 13540, 166700, 161949, 14138, 36480, 137205, 163876, 166764, 166809, 162366, 157359, 15851,
- 161365, 146615, 153141, 153942, 20122, 155265, 156248, 22207, 134765, 36366, 23405, 147080, 150686, 25566, 25296, 137206, 137339, 25904, 22061, 154698,
- 21530, 152337, 15814, 171416, 19581, 22050, 22046, 32585, 155352, 22901, 146752, 34672, 19996, 135146, 134473, 145082, 33047, 40286, 36120, 30267,
- 40005, 30286, 30649, 37701, 21554, 33096, 33527, 22053, 33074, 33816, 32957, 21994, 31074, 22083, 21526, 134813, 13774, 22021, 22001, 26353,
- 164578, 13869, 30004, 22000, 21946, 21655, 21874, 134209, 134294, 24272, 151880, 134774, 142434, 134818, 40619, 32090, 21982, 135285, 25245, 38765,
- 21652, 36045, 29174, 37238, 25596, 25529, 25598, 21865, 142147, 40050, 143027, 20890, 13535, 134567, 20903, 21581, 21790, 21779, 30310, 36397,
- 157834, 30129, 32950, 34820, 34694, 35015, 33206, 33820, 135361, 17644, 29444, 149254, 23440, 33547, 157843, 22139, 141044, 163119, 147875, 163187,
- 159440, 160438, 37232, 135641, 37384, 146684, 173737, 134828, 134905, 29286, 138402, 18254, 151490, 163833, 135147, 16634, 40029, 25887, 142752, 18675,
- 149472, 171388, 135148, 134666, 24674, 161187, 135149, null, 155720, 135559, 29091, 32398, 40272, 19994, 19972, 13687, 23309, 27826, 21351, 13996,
- 14812, 21373, 13989, 149016, 22682, 150382, 33325, 21579, 22442, 154261, 133497, null, 14930, 140389, 29556, 171692, 19721, 39917, 146686, 171824,
- 19547, 151465, 169374, 171998, 33884, 146870, 160434, 157619, 145184, 25390, 32037, 147191, 146988, 14890, 36872, 21196, 15988, 13946, 17897, 132238,
- 30272, 23280, 134838, 30842, 163630, 22695, 16575, 22140, 39819, 23924, 30292, 173108, 40581, 19681, 30201, 14331, 24857, 143578, 148466, null,
- 22109, 135849, 22439, 149859, 171526, 21044, 159918, 13741, 27722, 40316, 31830, 39737, 22494, 137068, 23635, 25811, 169168, 156469, 160100, 34477,
- 134440, 159010, 150242, 134513, null, 20990, 139023, 23950, 38659, 138705, 40577, 36940, 31519, 39682, 23761, 31651, 25192, 25397, 39679, 31695,
- 39722, 31870, 39726, 31810, 31878, 39957, 31740, 39689, 40727, 39963, 149822, 40794, 21875, 23491, 20477, 40600, 20466, 21088, 15878, 21201,
- 22375, 20566, 22967, 24082, 38856, 40363, 36700, 21609, 38836, 39232, 38842, 21292, 24880, 26924, 21466, 39946, 40194, 19515, 38465, 27008,
- 20646, 30022, 137069, 39386, 21107, null, 37209, 38529, 37212, null, 37201, 167575, 25471, 159011, 27338, 22033, 37262, 30074, 25221, 132092,
- 29519, 31856, 154657, 146685, null, 149785, 30422, 39837, 20010, 134356, 33726, 34882, null, 23626, 27072, 20717, 22394, 21023, 24053, 20174,
- 27697, 131570, 20281, 21660, 21722, 21146, 36226, 13822, 24332, 13811, null, 27474, 37244, 40869, 39831, 38958, 39092, 39610, 40616, 40580,
- 29050, 31508, null, 27642, 34840, 32632, null, 22048, 173642, 36471, 40787, null, 36308, 36431, 40476, 36353, 25218, 164733, 36392, 36469,
- 31443, 150135, 31294, 30936, 27882, 35431, 30215, 166490, 40742, 27854, 34774, 30147, 172722, 30803, 194624, 36108, 29410, 29553, 35629, 29442,
- 29937, 36075, 150203, 34351, 24506, 34976, 17591, null, 137275, 159237, null, 35454, 140571, null, 24829, 30311, 39639, 40260, 37742, 39823,
- 34805, null, 34831, 36087, 29484, 38689, 39856, 13782, 29362, 19463, 31825, 39242, 155993, 24921, 19460, 40598, 24957, null, 22367, 24943,
- 25254, 25145, 25294, 14940, 25058, 21418, 144373, 25444, 26626, 13778, 23895, 166850, 36826, 167481, null, 20697, 138566, 30982, 21298, 38456,
- 134971, 16485, null, 30718, null, 31938, 155418, 31962, 31277, 32870, 32867, 32077, 29957, 29938, 35220, 33306, 26380, 32866, 160902, 32859,
- 29936, 33027, 30500, 35209, 157644, 30035, 159441, 34729, 34766, 33224, 34700, 35401, 36013, 35651, 30507, 29944, 34010, 13877, 27058, 36262,
- null, 35241, 29800, 28089, 34753, 147473, 29927, 15835, 29046, 24740, 24988, 15569, 29026, 24695, null, 32625, 166701, 29264, 24809, 19326,
- 21024, 15384, 146631, 155351, 161366, 152881, 137540, 135934, 170243, 159196, 159917, 23745, 156077, 166415, 145015, 131310, 157766, 151310, 17762, 23327,
- 156492, 40784, 40614, 156267, 12288, 65292, 12289, 12290, 65294, 8231, 65307, 65306, 65311, 65281, 65072, 8230, 8229, 65104, 65105, 65106,
- 183, 65108, 65109, 65110, 65111, 65372, 8211, 65073, 8212, 65075, 9588, 65076, 65103, 65288, 65289, 65077, 65078, 65371, 65373, 65079,
- 65080, 12308, 12309, 65081, 65082, 12304, 12305, 65083, 65084, 12298, 12299, 65085, 65086, 12296, 12297, 65087, 65088, 12300, 12301, 65089,
- 65090, 12302, 12303, 65091, 65092, 65113, 65114, 65115, 65116, 65117, 65118, 8216, 8217, 8220, 8221, 12317, 12318, 8245, 8242, 65283,
- 65286, 65290, 8251, 167, 12291, 9675, 9679, 9651, 9650, 9678, 9734, 9733, 9671, 9670, 9633, 9632, 9661, 9660, 12963, 8453,
- 175, 65507, 65343, 717, 65097, 65098, 65101, 65102, 65099, 65100, 65119, 65120, 65121, 65291, 65293, 215, 247, 177, 8730, 65308,
- 65310, 65309, 8806, 8807, 8800, 8734, 8786, 8801, 65122, 65123, 65124, 65125, 65126, 65374, 8745, 8746, 8869, 8736, 8735, 8895,
- 13266, 13265, 8747, 8750, 8757, 8756, 9792, 9794, 8853, 8857, 8593, 8595, 8592, 8594, 8598, 8599, 8601, 8600, 8741, 8739,
- 65295, 65340, 8725, 65128, 65284, 65509, 12306, 65504, 65505, 65285, 65312, 8451, 8457, 65129, 65130, 65131, 13269, 13212, 13213, 13214,
- 13262, 13217, 13198, 13199, 13252, 176, 20825, 20827, 20830, 20829, 20833, 20835, 21991, 29929, 31950, 9601, 9602, 9603, 9604, 9605,
- 9606, 9607, 9608, 9615, 9614, 9613, 9612, 9611, 9610, 9609, 9532, 9524, 9516, 9508, 9500, 9620, 9472, 9474, 9621, 9484,
- 9488, 9492, 9496, 9581, 9582, 9584, 9583, 9552, 9566, 9578, 9569, 9698, 9699, 9701, 9700, 9585, 9586, 9587, 65296, 65297,
- 65298, 65299, 65300, 65301, 65302, 65303, 65304, 65305, 8544, 8545, 8546, 8547, 8548, 8549, 8550, 8551, 8552, 8553, 12321, 12322,
- 12323, 12324, 12325, 12326, 12327, 12328, 12329, 21313, 21316, 21317, 65313, 65314, 65315, 65316, 65317, 65318, 65319, 65320, 65321, 65322,
- 65323, 65324, 65325, 65326, 65327, 65328, 65329, 65330, 65331, 65332, 65333, 65334, 65335, 65336, 65337, 65338, 65345, 65346, 65347, 65348,
- 65349, 65350, 65351, 65352, 65353, 65354, 65355, 65356, 65357, 65358, 65359, 65360, 65361, 65362, 65363, 65364, 65365, 65366, 65367, 65368,
- 65369, 65370, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931,
- 932, 933, 934, 935, 936, 937, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958,
- 959, 960, 961, 963, 964, 965, 966, 967, 968, 969, 12549, 12550, 12551, 12552, 12553, 12554, 12555, 12556, 12557, 12558,
- 12559, 12560, 12561, 12562, 12563, 12564, 12565, 12566, 12567, 12568, 12569, 12570, 12571, 12572, 12573, 12574, 12575, 12576, 12577, 12578,
- 12579, 12580, 12581, 12582, 12583, 12584, 12585, 729, 713, 714, 711, 715, 9216, 9217, 9218, 9219, 9220, 9221, 9222, 9223,
- 9224, 9225, 9226, 9227, 9228, 9229, 9230, 9231, 9232, 9233, 9234, 9235, 9236, 9237, 9238, 9239, 9240, 9241, 9242, 9243,
- 9244, 9245, 9246, 9247, 9249, 8364, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19968, 20057, 19969, 19971, 20035,
- 20061, 20102, 20108, 20154, 20799, 20837, 20843, 20960, 20992, 20993, 21147, 21269, 21313, 21340, 21448, 19977, 19979, 19976, 19978, 20011,
- 20024, 20961, 20037, 20040, 20063, 20062, 20110, 20129, 20800, 20995, 21242, 21315, 21449, 21475, 22303, 22763, 22805, 22823, 22899, 23376,
- 23377, 23379, 23544, 23567, 23586, 23608, 23665, 24029, 24037, 24049, 24050, 24051, 24062, 24178, 24318, 24331, 24339, 25165, 19985, 19984,
- 19981, 20013, 20016, 20025, 20043, 23609, 20104, 20113, 20117, 20114, 20116, 20130, 20161, 20160, 20163, 20166, 20167, 20173, 20170, 20171,
- 20164, 20803, 20801, 20839, 20845, 20846, 20844, 20887, 20982, 20998, 20999, 21000, 21243, 21246, 21247, 21270, 21305, 21320, 21319, 21317,
- 21342, 21380, 21451, 21450, 21453, 22764, 22825, 22827, 22826, 22829, 23380, 23569, 23588, 23610, 23663, 24052, 24187, 24319, 24340, 24341,
- 24515, 25096, 25142, 25163, 25166, 25903, 25991, 26007, 26020, 26041, 26085, 26352, 26376, 26408, 27424, 27490, 27513, 27595, 27604, 27611,
- 27663, 27700, 28779, 29226, 29238, 29243, 29255, 29273, 29275, 29356, 29579, 19993, 19990, 19989, 19988, 19992, 20027, 20045, 20047, 20046,
- 20197, 20184, 20180, 20181, 20182, 20183, 20195, 20196, 20185, 20190, 20805, 20804, 20873, 20874, 20908, 20985, 20986, 20984, 21002, 21152,
- 21151, 21253, 21254, 21271, 21277, 20191, 21322, 21321, 21345, 21344, 21359, 21358, 21435, 21487, 21476, 21491, 21484, 21486, 21481, 21480,
- 21500, 21496, 21493, 21483, 21478, 21482, 21490, 21489, 21488, 21477, 21485, 21499, 22235, 22234, 22806, 22830, 22833, 22900, 22902, 23381,
- 23427, 23612, 24040, 24039, 24038, 24066, 24067, 24179, 24188, 24321, 24344, 24343, 24517, 25098, 25171, 25172, 25170, 25169, 26021, 26086,
- 26414, 26412, 26410, 26411, 26413, 27491, 27597, 27665, 27664, 27704, 27713, 27712, 27710, 29359, 29572, 29577, 29916, 29926, 29976, 29983,
- 29992, 29993, 30000, 30001, 30002, 30003, 30091, 30333, 30382, 30399, 30446, 30683, 30690, 30707, 31034, 31166, 31348, 31435, 19998, 19999,
- 20050, 20051, 20073, 20121, 20132, 20134, 20133, 20223, 20233, 20249, 20234, 20245, 20237, 20240, 20241, 20239, 20210, 20214, 20219, 20208,
- 20211, 20221, 20225, 20235, 20809, 20807, 20806, 20808, 20840, 20849, 20877, 20912, 21015, 21009, 21010, 21006, 21014, 21155, 21256, 21281,
- 21280, 21360, 21361, 21513, 21519, 21516, 21514, 21520, 21505, 21515, 21508, 21521, 21517, 21512, 21507, 21518, 21510, 21522, 22240, 22238,
- 22237, 22323, 22320, 22312, 22317, 22316, 22319, 22313, 22809, 22810, 22839, 22840, 22916, 22904, 22915, 22909, 22905, 22914, 22913, 23383,
- 23384, 23431, 23432, 23429, 23433, 23546, 23574, 23673, 24030, 24070, 24182, 24180, 24335, 24347, 24537, 24534, 25102, 25100, 25101, 25104,
- 25187, 25179, 25176, 25910, 26089, 26088, 26092, 26093, 26354, 26355, 26377, 26429, 26420, 26417, 26421, 27425, 27492, 27515, 27670, 27741,
- 27735, 27737, 27743, 27744, 27728, 27733, 27745, 27739, 27725, 27726, 28784, 29279, 29277, 30334, 31481, 31859, 31992, 32566, 32650, 32701,
- 32769, 32771, 32780, 32786, 32819, 32895, 32905, 32907, 32908, 33251, 33258, 33267, 33276, 33292, 33307, 33311, 33390, 33394, 33406, 34411,
- 34880, 34892, 34915, 35199, 38433, 20018, 20136, 20301, 20303, 20295, 20311, 20318, 20276, 20315, 20309, 20272, 20304, 20305, 20285, 20282,
- 20280, 20291, 20308, 20284, 20294, 20323, 20316, 20320, 20271, 20302, 20278, 20313, 20317, 20296, 20314, 20812, 20811, 20813, 20853, 20918,
- 20919, 21029, 21028, 21033, 21034, 21032, 21163, 21161, 21162, 21164, 21283, 21363, 21365, 21533, 21549, 21534, 21566, 21542, 21582, 21543,
- 21574, 21571, 21555, 21576, 21570, 21531, 21545, 21578, 21561, 21563, 21560, 21550, 21557, 21558, 21536, 21564, 21568, 21553, 21547, 21535,
- 21548, 22250, 22256, 22244, 22251, 22346, 22353, 22336, 22349, 22343, 22350, 22334, 22352, 22351, 22331, 22767, 22846, 22941, 22930, 22952,
- 22942, 22947, 22937, 22934, 22925, 22948, 22931, 22922, 22949, 23389, 23388, 23386, 23387, 23436, 23435, 23439, 23596, 23616, 23617, 23615,
- 23614, 23696, 23697, 23700, 23692, 24043, 24076, 24207, 24199, 24202, 24311, 24324, 24351, 24420, 24418, 24439, 24441, 24536, 24524, 24535,
- 24525, 24561, 24555, 24568, 24554, 25106, 25105, 25220, 25239, 25238, 25216, 25206, 25225, 25197, 25226, 25212, 25214, 25209, 25203, 25234,
- 25199, 25240, 25198, 25237, 25235, 25233, 25222, 25913, 25915, 25912, 26097, 26356, 26463, 26446, 26447, 26448, 26449, 26460, 26454, 26462,
- 26441, 26438, 26464, 26451, 26455, 27493, 27599, 27714, 27742, 27801, 27777, 27784, 27785, 27781, 27803, 27754, 27770, 27792, 27760, 27788,
- 27752, 27798, 27794, 27773, 27779, 27762, 27774, 27764, 27782, 27766, 27789, 27796, 27800, 27778, 28790, 28796, 28797, 28792, 29282, 29281,
- 29280, 29380, 29378, 29590, 29996, 29995, 30007, 30008, 30338, 30447, 30691, 31169, 31168, 31167, 31350, 31995, 32597, 32918, 32915, 32925,
- 32920, 32923, 32922, 32946, 33391, 33426, 33419, 33421, 35211, 35282, 35328, 35895, 35910, 35925, 35997, 36196, 36208, 36275, 36523, 36554,
- 36763, 36784, 36802, 36806, 36805, 36804, 24033, 37009, 37026, 37034, 37030, 37027, 37193, 37318, 37324, 38450, 38446, 38449, 38442, 38444,
- 20006, 20054, 20083, 20107, 20123, 20126, 20139, 20140, 20335, 20381, 20365, 20339, 20351, 20332, 20379, 20363, 20358, 20355, 20336, 20341,
- 20360, 20329, 20347, 20374, 20350, 20367, 20369, 20346, 20820, 20818, 20821, 20841, 20855, 20854, 20856, 20925, 20989, 21051, 21048, 21047,
- 21050, 21040, 21038, 21046, 21057, 21182, 21179, 21330, 21332, 21331, 21329, 21350, 21367, 21368, 21369, 21462, 21460, 21463, 21619, 21621,
- 21654, 21624, 21653, 21632, 21627, 21623, 21636, 21650, 21638, 21628, 21648, 21617, 21622, 21644, 21658, 21602, 21608, 21643, 21629, 21646,
- 22266, 22403, 22391, 22378, 22377, 22369, 22374, 22372, 22396, 22812, 22857, 22855, 22856, 22852, 22868, 22974, 22971, 22996, 22969, 22958,
- 22993, 22982, 22992, 22989, 22987, 22995, 22986, 22959, 22963, 22994, 22981, 23391, 23396, 23395, 23447, 23450, 23448, 23452, 23449, 23451,
- 23578, 23624, 23621, 23622, 23735, 23713, 23736, 23721, 23723, 23729, 23731, 24088, 24090, 24086, 24085, 24091, 24081, 24184, 24218, 24215,
- 24220, 24213, 24214, 24310, 24358, 24359, 24361, 24448, 24449, 24447, 24444, 24541, 24544, 24573, 24565, 24575, 24591, 24596, 24623, 24629,
- 24598, 24618, 24597, 24609, 24615, 24617, 24619, 24603, 25110, 25109, 25151, 25150, 25152, 25215, 25289, 25292, 25284, 25279, 25282, 25273,
- 25298, 25307, 25259, 25299, 25300, 25291, 25288, 25256, 25277, 25276, 25296, 25305, 25287, 25293, 25269, 25306, 25265, 25304, 25302, 25303,
- 25286, 25260, 25294, 25918, 26023, 26044, 26106, 26132, 26131, 26124, 26118, 26114, 26126, 26112, 26127, 26133, 26122, 26119, 26381, 26379,
- 26477, 26507, 26517, 26481, 26524, 26483, 26487, 26503, 26525, 26519, 26479, 26480, 26495, 26505, 26494, 26512, 26485, 26522, 26515, 26492,
- 26474, 26482, 27427, 27494, 27495, 27519, 27667, 27675, 27875, 27880, 27891, 27825, 27852, 27877, 27827, 27837, 27838, 27836, 27874, 27819,
- 27861, 27859, 27832, 27844, 27833, 27841, 27822, 27863, 27845, 27889, 27839, 27835, 27873, 27867, 27850, 27820, 27887, 27868, 27862, 27872,
- 28821, 28814, 28818, 28810, 28825, 29228, 29229, 29240, 29256, 29287, 29289, 29376, 29390, 29401, 29399, 29392, 29609, 29608, 29599, 29611,
- 29605, 30013, 30109, 30105, 30106, 30340, 30402, 30450, 30452, 30693, 30717, 31038, 31040, 31041, 31177, 31176, 31354, 31353, 31482, 31998,
- 32596, 32652, 32651, 32773, 32954, 32933, 32930, 32945, 32929, 32939, 32937, 32948, 32938, 32943, 33253, 33278, 33293, 33459, 33437, 33433,
- 33453, 33469, 33439, 33465, 33457, 33452, 33445, 33455, 33464, 33443, 33456, 33470, 33463, 34382, 34417, 21021, 34920, 36555, 36814, 36820,
- 36817, 37045, 37048, 37041, 37046, 37319, 37329, 38263, 38272, 38428, 38464, 38463, 38459, 38468, 38466, 38585, 38632, 38738, 38750, 20127,
- 20141, 20142, 20449, 20405, 20399, 20415, 20448, 20433, 20431, 20445, 20419, 20406, 20440, 20447, 20426, 20439, 20398, 20432, 20420, 20418,
- 20442, 20430, 20446, 20407, 20823, 20882, 20881, 20896, 21070, 21059, 21066, 21069, 21068, 21067, 21063, 21191, 21193, 21187, 21185, 21261,
- 21335, 21371, 21402, 21467, 21676, 21696, 21672, 21710, 21705, 21688, 21670, 21683, 21703, 21698, 21693, 21674, 21697, 21700, 21704, 21679,
- 21675, 21681, 21691, 21673, 21671, 21695, 22271, 22402, 22411, 22432, 22435, 22434, 22478, 22446, 22419, 22869, 22865, 22863, 22862, 22864,
- 23004, 23000, 23039, 23011, 23016, 23043, 23013, 23018, 23002, 23014, 23041, 23035, 23401, 23459, 23462, 23460, 23458, 23461, 23553, 23630,
- 23631, 23629, 23627, 23769, 23762, 24055, 24093, 24101, 24095, 24189, 24224, 24230, 24314, 24328, 24365, 24421, 24456, 24453, 24458, 24459,
- 24455, 24460, 24457, 24594, 24605, 24608, 24613, 24590, 24616, 24653, 24688, 24680, 24674, 24646, 24643, 24684, 24683, 24682, 24676, 25153,
- 25308, 25366, 25353, 25340, 25325, 25345, 25326, 25341, 25351, 25329, 25335, 25327, 25324, 25342, 25332, 25361, 25346, 25919, 25925, 26027,
- 26045, 26082, 26149, 26157, 26144, 26151, 26159, 26143, 26152, 26161, 26148, 26359, 26623, 26579, 26609, 26580, 26576, 26604, 26550, 26543,
- 26613, 26601, 26607, 26564, 26577, 26548, 26586, 26597, 26552, 26575, 26590, 26611, 26544, 26585, 26594, 26589, 26578, 27498, 27523, 27526,
- 27573, 27602, 27607, 27679, 27849, 27915, 27954, 27946, 27969, 27941, 27916, 27953, 27934, 27927, 27963, 27965, 27966, 27958, 27931, 27893,
- 27961, 27943, 27960, 27945, 27950, 27957, 27918, 27947, 28843, 28858, 28851, 28844, 28847, 28845, 28856, 28846, 28836, 29232, 29298, 29295,
- 29300, 29417, 29408, 29409, 29623, 29642, 29627, 29618, 29645, 29632, 29619, 29978, 29997, 30031, 30028, 30030, 30027, 30123, 30116, 30117,
- 30114, 30115, 30328, 30342, 30343, 30344, 30408, 30406, 30403, 30405, 30465, 30457, 30456, 30473, 30475, 30462, 30460, 30471, 30684, 30722,
- 30740, 30732, 30733, 31046, 31049, 31048, 31047, 31161, 31162, 31185, 31186, 31179, 31359, 31361, 31487, 31485, 31869, 32002, 32005, 32000,
- 32009, 32007, 32004, 32006, 32568, 32654, 32703, 32772, 32784, 32781, 32785, 32822, 32982, 32997, 32986, 32963, 32964, 32972, 32993, 32987,
- 32974, 32990, 32996, 32989, 33268, 33314, 33511, 33539, 33541, 33507, 33499, 33510, 33540, 33509, 33538, 33545, 33490, 33495, 33521, 33537,
- 33500, 33492, 33489, 33502, 33491, 33503, 33519, 33542, 34384, 34425, 34427, 34426, 34893, 34923, 35201, 35284, 35336, 35330, 35331, 35998,
- 36000, 36212, 36211, 36276, 36557, 36556, 36848, 36838, 36834, 36842, 36837, 36845, 36843, 36836, 36840, 37066, 37070, 37057, 37059, 37195,
- 37194, 37325, 38274, 38480, 38475, 38476, 38477, 38754, 38761, 38859, 38893, 38899, 38913, 39080, 39131, 39135, 39318, 39321, 20056, 20147,
- 20492, 20493, 20515, 20463, 20518, 20517, 20472, 20521, 20502, 20486, 20540, 20511, 20506, 20498, 20497, 20474, 20480, 20500, 20520, 20465,
- 20513, 20491, 20505, 20504, 20467, 20462, 20525, 20522, 20478, 20523, 20489, 20860, 20900, 20901, 20898, 20941, 20940, 20934, 20939, 21078,
- 21084, 21076, 21083, 21085, 21290, 21375, 21407, 21405, 21471, 21736, 21776, 21761, 21815, 21756, 21733, 21746, 21766, 21754, 21780, 21737,
- 21741, 21729, 21769, 21742, 21738, 21734, 21799, 21767, 21757, 21775, 22275, 22276, 22466, 22484, 22475, 22467, 22537, 22799, 22871, 22872,
- 22874, 23057, 23064, 23068, 23071, 23067, 23059, 23020, 23072, 23075, 23081, 23077, 23052, 23049, 23403, 23640, 23472, 23475, 23478, 23476,
- 23470, 23477, 23481, 23480, 23556, 23633, 23637, 23632, 23789, 23805, 23803, 23786, 23784, 23792, 23798, 23809, 23796, 24046, 24109, 24107,
- 24235, 24237, 24231, 24369, 24466, 24465, 24464, 24665, 24675, 24677, 24656, 24661, 24685, 24681, 24687, 24708, 24735, 24730, 24717, 24724,
- 24716, 24709, 24726, 25159, 25331, 25352, 25343, 25422, 25406, 25391, 25429, 25410, 25414, 25423, 25417, 25402, 25424, 25405, 25386, 25387,
- 25384, 25421, 25420, 25928, 25929, 26009, 26049, 26053, 26178, 26185, 26191, 26179, 26194, 26188, 26181, 26177, 26360, 26388, 26389, 26391,
- 26657, 26680, 26696, 26694, 26707, 26681, 26690, 26708, 26665, 26803, 26647, 26700, 26705, 26685, 26612, 26704, 26688, 26684, 26691, 26666,
- 26693, 26643, 26648, 26689, 27530, 27529, 27575, 27683, 27687, 27688, 27686, 27684, 27888, 28010, 28053, 28040, 28039, 28006, 28024, 28023,
- 27993, 28051, 28012, 28041, 28014, 27994, 28020, 28009, 28044, 28042, 28025, 28037, 28005, 28052, 28874, 28888, 28900, 28889, 28872, 28879,
- 29241, 29305, 29436, 29433, 29437, 29432, 29431, 29574, 29677, 29705, 29678, 29664, 29674, 29662, 30036, 30045, 30044, 30042, 30041, 30142,
- 30149, 30151, 30130, 30131, 30141, 30140, 30137, 30146, 30136, 30347, 30384, 30410, 30413, 30414, 30505, 30495, 30496, 30504, 30697, 30768,
- 30759, 30776, 30749, 30772, 30775, 30757, 30765, 30752, 30751, 30770, 31061, 31056, 31072, 31071, 31062, 31070, 31069, 31063, 31066, 31204,
- 31203, 31207, 31199, 31206, 31209, 31192, 31364, 31368, 31449, 31494, 31505, 31881, 32033, 32023, 32011, 32010, 32032, 32034, 32020, 32016,
- 32021, 32026, 32028, 32013, 32025, 32027, 32570, 32607, 32660, 32709, 32705, 32774, 32792, 32789, 32793, 32791, 32829, 32831, 33009, 33026,
- 33008, 33029, 33005, 33012, 33030, 33016, 33011, 33032, 33021, 33034, 33020, 33007, 33261, 33260, 33280, 33296, 33322, 33323, 33320, 33324,
- 33467, 33579, 33618, 33620, 33610, 33592, 33616, 33609, 33589, 33588, 33615, 33586, 33593, 33590, 33559, 33600, 33585, 33576, 33603, 34388,
- 34442, 34474, 34451, 34468, 34473, 34444, 34467, 34460, 34928, 34935, 34945, 34946, 34941, 34937, 35352, 35344, 35342, 35340, 35349, 35338,
- 35351, 35347, 35350, 35343, 35345, 35912, 35962, 35961, 36001, 36002, 36215, 36524, 36562, 36564, 36559, 36785, 36865, 36870, 36855, 36864,
- 36858, 36852, 36867, 36861, 36869, 36856, 37013, 37089, 37085, 37090, 37202, 37197, 37196, 37336, 37341, 37335, 37340, 37337, 38275, 38498,
- 38499, 38497, 38491, 38493, 38500, 38488, 38494, 38587, 39138, 39340, 39592, 39640, 39717, 39730, 39740, 20094, 20602, 20605, 20572, 20551,
- 20547, 20556, 20570, 20553, 20581, 20598, 20558, 20565, 20597, 20596, 20599, 20559, 20495, 20591, 20589, 20828, 20885, 20976, 21098, 21103,
- 21202, 21209, 21208, 21205, 21264, 21263, 21273, 21311, 21312, 21310, 21443, 26364, 21830, 21866, 21862, 21828, 21854, 21857, 21827, 21834,
- 21809, 21846, 21839, 21845, 21807, 21860, 21816, 21806, 21852, 21804, 21859, 21811, 21825, 21847, 22280, 22283, 22281, 22495, 22533, 22538,
- 22534, 22496, 22500, 22522, 22530, 22581, 22519, 22521, 22816, 22882, 23094, 23105, 23113, 23142, 23146, 23104, 23100, 23138, 23130, 23110,
- 23114, 23408, 23495, 23493, 23492, 23490, 23487, 23494, 23561, 23560, 23559, 23648, 23644, 23645, 23815, 23814, 23822, 23835, 23830, 23842,
- 23825, 23849, 23828, 23833, 23844, 23847, 23831, 24034, 24120, 24118, 24115, 24119, 24247, 24248, 24246, 24245, 24254, 24373, 24375, 24407,
- 24428, 24425, 24427, 24471, 24473, 24478, 24472, 24481, 24480, 24476, 24703, 24739, 24713, 24736, 24744, 24779, 24756, 24806, 24765, 24773,
- 24763, 24757, 24796, 24764, 24792, 24789, 24774, 24799, 24760, 24794, 24775, 25114, 25115, 25160, 25504, 25511, 25458, 25494, 25506, 25509,
- 25463, 25447, 25496, 25514, 25457, 25513, 25481, 25475, 25499, 25451, 25512, 25476, 25480, 25497, 25505, 25516, 25490, 25487, 25472, 25467,
- 25449, 25448, 25466, 25949, 25942, 25937, 25945, 25943, 21855, 25935, 25944, 25941, 25940, 26012, 26011, 26028, 26063, 26059, 26060, 26062,
- 26205, 26202, 26212, 26216, 26214, 26206, 26361, 21207, 26395, 26753, 26799, 26786, 26771, 26805, 26751, 26742, 26801, 26791, 26775, 26800,
- 26755, 26820, 26797, 26758, 26757, 26772, 26781, 26792, 26783, 26785, 26754, 27442, 27578, 27627, 27628, 27691, 28046, 28092, 28147, 28121,
- 28082, 28129, 28108, 28132, 28155, 28154, 28165, 28103, 28107, 28079, 28113, 28078, 28126, 28153, 28088, 28151, 28149, 28101, 28114, 28186,
- 28085, 28122, 28139, 28120, 28138, 28145, 28142, 28136, 28102, 28100, 28074, 28140, 28095, 28134, 28921, 28937, 28938, 28925, 28911, 29245,
- 29309, 29313, 29468, 29467, 29462, 29459, 29465, 29575, 29701, 29706, 29699, 29702, 29694, 29709, 29920, 29942, 29943, 29980, 29986, 30053,
- 30054, 30050, 30064, 30095, 30164, 30165, 30133, 30154, 30157, 30350, 30420, 30418, 30427, 30519, 30526, 30524, 30518, 30520, 30522, 30827,
- 30787, 30798, 31077, 31080, 31085, 31227, 31378, 31381, 31520, 31528, 31515, 31532, 31526, 31513, 31518, 31534, 31890, 31895, 31893, 32070,
- 32067, 32113, 32046, 32057, 32060, 32064, 32048, 32051, 32068, 32047, 32066, 32050, 32049, 32573, 32670, 32666, 32716, 32718, 32722, 32796,
- 32842, 32838, 33071, 33046, 33059, 33067, 33065, 33072, 33060, 33282, 33333, 33335, 33334, 33337, 33678, 33694, 33688, 33656, 33698, 33686,
- 33725, 33707, 33682, 33674, 33683, 33673, 33696, 33655, 33659, 33660, 33670, 33703, 34389, 24426, 34503, 34496, 34486, 34500, 34485, 34502,
- 34507, 34481, 34479, 34505, 34899, 34974, 34952, 34987, 34962, 34966, 34957, 34955, 35219, 35215, 35370, 35357, 35363, 35365, 35377, 35373,
- 35359, 35355, 35362, 35913, 35930, 36009, 36012, 36011, 36008, 36010, 36007, 36199, 36198, 36286, 36282, 36571, 36575, 36889, 36877, 36890,
- 36887, 36899, 36895, 36893, 36880, 36885, 36894, 36896, 36879, 36898, 36886, 36891, 36884, 37096, 37101, 37117, 37207, 37326, 37365, 37350,
- 37347, 37351, 37357, 37353, 38281, 38506, 38517, 38515, 38520, 38512, 38516, 38518, 38519, 38508, 38592, 38634, 38633, 31456, 31455, 38914,
- 38915, 39770, 40165, 40565, 40575, 40613, 40635, 20642, 20621, 20613, 20633, 20625, 20608, 20630, 20632, 20634, 26368, 20977, 21106, 21108,
- 21109, 21097, 21214, 21213, 21211, 21338, 21413, 21883, 21888, 21927, 21884, 21898, 21917, 21912, 21890, 21916, 21930, 21908, 21895, 21899,
- 21891, 21939, 21934, 21919, 21822, 21938, 21914, 21947, 21932, 21937, 21886, 21897, 21931, 21913, 22285, 22575, 22570, 22580, 22564, 22576,
- 22577, 22561, 22557, 22560, 22777, 22778, 22880, 23159, 23194, 23167, 23186, 23195, 23207, 23411, 23409, 23506, 23500, 23507, 23504, 23562,
- 23563, 23601, 23884, 23888, 23860, 23879, 24061, 24133, 24125, 24128, 24131, 24190, 24266, 24257, 24258, 24260, 24380, 24429, 24489, 24490,
- 24488, 24785, 24801, 24754, 24758, 24800, 24860, 24867, 24826, 24853, 24816, 24827, 24820, 24936, 24817, 24846, 24822, 24841, 24832, 24850,
- 25119, 25161, 25507, 25484, 25551, 25536, 25577, 25545, 25542, 25549, 25554, 25571, 25552, 25569, 25558, 25581, 25582, 25462, 25588, 25578,
- 25563, 25682, 25562, 25593, 25950, 25958, 25954, 25955, 26001, 26000, 26031, 26222, 26224, 26228, 26230, 26223, 26257, 26234, 26238, 26231,
- 26366, 26367, 26399, 26397, 26874, 26837, 26848, 26840, 26839, 26885, 26847, 26869, 26862, 26855, 26873, 26834, 26866, 26851, 26827, 26829,
- 26893, 26898, 26894, 26825, 26842, 26990, 26875, 27454, 27450, 27453, 27544, 27542, 27580, 27631, 27694, 27695, 27692, 28207, 28216, 28244,
- 28193, 28210, 28263, 28234, 28192, 28197, 28195, 28187, 28251, 28248, 28196, 28246, 28270, 28205, 28198, 28271, 28212, 28237, 28218, 28204,
- 28227, 28189, 28222, 28363, 28297, 28185, 28238, 28259, 28228, 28274, 28265, 28255, 28953, 28954, 28966, 28976, 28961, 28982, 29038, 28956,
- 29260, 29316, 29312, 29494, 29477, 29492, 29481, 29754, 29738, 29747, 29730, 29733, 29749, 29750, 29748, 29743, 29723, 29734, 29736, 29989,
- 29990, 30059, 30058, 30178, 30171, 30179, 30169, 30168, 30174, 30176, 30331, 30332, 30358, 30355, 30388, 30428, 30543, 30701, 30813, 30828,
- 30831, 31245, 31240, 31243, 31237, 31232, 31384, 31383, 31382, 31461, 31459, 31561, 31574, 31558, 31568, 31570, 31572, 31565, 31563, 31567,
- 31569, 31903, 31909, 32094, 32080, 32104, 32085, 32043, 32110, 32114, 32097, 32102, 32098, 32112, 32115, 21892, 32724, 32725, 32779, 32850,
- 32901, 33109, 33108, 33099, 33105, 33102, 33081, 33094, 33086, 33100, 33107, 33140, 33298, 33308, 33769, 33795, 33784, 33805, 33760, 33733,
- 33803, 33729, 33775, 33777, 33780, 33879, 33802, 33776, 33804, 33740, 33789, 33778, 33738, 33848, 33806, 33796, 33756, 33799, 33748, 33759,
- 34395, 34527, 34521, 34541, 34516, 34523, 34532, 34512, 34526, 34903, 35009, 35010, 34993, 35203, 35222, 35387, 35424, 35413, 35422, 35388,
- 35393, 35412, 35419, 35408, 35398, 35380, 35386, 35382, 35414, 35937, 35970, 36015, 36028, 36019, 36029, 36033, 36027, 36032, 36020, 36023,
- 36022, 36031, 36024, 36234, 36229, 36225, 36302, 36317, 36299, 36314, 36305, 36300, 36315, 36294, 36603, 36600, 36604, 36764, 36910, 36917,
- 36913, 36920, 36914, 36918, 37122, 37109, 37129, 37118, 37219, 37221, 37327, 37396, 37397, 37411, 37385, 37406, 37389, 37392, 37383, 37393,
- 38292, 38287, 38283, 38289, 38291, 38290, 38286, 38538, 38542, 38539, 38525, 38533, 38534, 38541, 38514, 38532, 38593, 38597, 38596, 38598,
- 38599, 38639, 38642, 38860, 38917, 38918, 38920, 39143, 39146, 39151, 39145, 39154, 39149, 39342, 39341, 40643, 40653, 40657, 20098, 20653,
- 20661, 20658, 20659, 20677, 20670, 20652, 20663, 20667, 20655, 20679, 21119, 21111, 21117, 21215, 21222, 21220, 21218, 21219, 21295, 21983,
- 21992, 21971, 21990, 21966, 21980, 21959, 21969, 21987, 21988, 21999, 21978, 21985, 21957, 21958, 21989, 21961, 22290, 22291, 22622, 22609,
- 22616, 22615, 22618, 22612, 22635, 22604, 22637, 22602, 22626, 22610, 22603, 22887, 23233, 23241, 23244, 23230, 23229, 23228, 23219, 23234,
- 23218, 23913, 23919, 24140, 24185, 24265, 24264, 24338, 24409, 24492, 24494, 24858, 24847, 24904, 24863, 24819, 24859, 24825, 24833, 24840,
- 24910, 24908, 24900, 24909, 24894, 24884, 24871, 24845, 24838, 24887, 25121, 25122, 25619, 25662, 25630, 25642, 25645, 25661, 25644, 25615,
- 25628, 25620, 25613, 25654, 25622, 25623, 25606, 25964, 26015, 26032, 26263, 26249, 26247, 26248, 26262, 26244, 26264, 26253, 26371, 27028,
- 26989, 26970, 26999, 26976, 26964, 26997, 26928, 27010, 26954, 26984, 26987, 26974, 26963, 27001, 27014, 26973, 26979, 26971, 27463, 27506,
- 27584, 27583, 27603, 27645, 28322, 28335, 28371, 28342, 28354, 28304, 28317, 28359, 28357, 28325, 28312, 28348, 28346, 28331, 28369, 28310,
- 28316, 28356, 28372, 28330, 28327, 28340, 29006, 29017, 29033, 29028, 29001, 29031, 29020, 29036, 29030, 29004, 29029, 29022, 28998, 29032,
- 29014, 29242, 29266, 29495, 29509, 29503, 29502, 29807, 29786, 29781, 29791, 29790, 29761, 29759, 29785, 29787, 29788, 30070, 30072, 30208,
- 30192, 30209, 30194, 30193, 30202, 30207, 30196, 30195, 30430, 30431, 30555, 30571, 30566, 30558, 30563, 30585, 30570, 30572, 30556, 30565,
- 30568, 30562, 30702, 30862, 30896, 30871, 30872, 30860, 30857, 30844, 30865, 30867, 30847, 31098, 31103, 31105, 33836, 31165, 31260, 31258,
- 31264, 31252, 31263, 31262, 31391, 31392, 31607, 31680, 31584, 31598, 31591, 31921, 31923, 31925, 32147, 32121, 32145, 32129, 32143, 32091,
- 32622, 32617, 32618, 32626, 32681, 32680, 32676, 32854, 32856, 32902, 32900, 33137, 33136, 33144, 33125, 33134, 33139, 33131, 33145, 33146,
- 33126, 33285, 33351, 33922, 33911, 33853, 33841, 33909, 33894, 33899, 33865, 33900, 33883, 33852, 33845, 33889, 33891, 33897, 33901, 33862,
- 34398, 34396, 34399, 34553, 34579, 34568, 34567, 34560, 34558, 34555, 34562, 34563, 34566, 34570, 34905, 35039, 35028, 35033, 35036, 35032,
- 35037, 35041, 35018, 35029, 35026, 35228, 35299, 35435, 35442, 35443, 35430, 35433, 35440, 35463, 35452, 35427, 35488, 35441, 35461, 35437,
- 35426, 35438, 35436, 35449, 35451, 35390, 35432, 35938, 35978, 35977, 36042, 36039, 36040, 36036, 36018, 36035, 36034, 36037, 36321, 36319,
- 36328, 36335, 36339, 36346, 36330, 36324, 36326, 36530, 36611, 36617, 36606, 36618, 36767, 36786, 36939, 36938, 36947, 36930, 36948, 36924,
- 36949, 36944, 36935, 36943, 36942, 36941, 36945, 36926, 36929, 37138, 37143, 37228, 37226, 37225, 37321, 37431, 37463, 37432, 37437, 37440,
- 37438, 37467, 37451, 37476, 37457, 37428, 37449, 37453, 37445, 37433, 37439, 37466, 38296, 38552, 38548, 38549, 38605, 38603, 38601, 38602,
- 38647, 38651, 38649, 38646, 38742, 38772, 38774, 38928, 38929, 38931, 38922, 38930, 38924, 39164, 39156, 39165, 39166, 39347, 39345, 39348,
- 39649, 40169, 40578, 40718, 40723, 40736, 20711, 20718, 20709, 20694, 20717, 20698, 20693, 20687, 20689, 20721, 20686, 20713, 20834, 20979,
- 21123, 21122, 21297, 21421, 22014, 22016, 22043, 22039, 22013, 22036, 22022, 22025, 22029, 22030, 22007, 22038, 22047, 22024, 22032, 22006,
- 22296, 22294, 22645, 22654, 22659, 22675, 22666, 22649, 22661, 22653, 22781, 22821, 22818, 22820, 22890, 22889, 23265, 23270, 23273, 23255,
- 23254, 23256, 23267, 23413, 23518, 23527, 23521, 23525, 23526, 23528, 23522, 23524, 23519, 23565, 23650, 23940, 23943, 24155, 24163, 24149,
- 24151, 24148, 24275, 24278, 24330, 24390, 24432, 24505, 24903, 24895, 24907, 24951, 24930, 24931, 24927, 24922, 24920, 24949, 25130, 25735,
- 25688, 25684, 25764, 25720, 25695, 25722, 25681, 25703, 25652, 25709, 25723, 25970, 26017, 26071, 26070, 26274, 26280, 26269, 27036, 27048,
- 27029, 27073, 27054, 27091, 27083, 27035, 27063, 27067, 27051, 27060, 27088, 27085, 27053, 27084, 27046, 27075, 27043, 27465, 27468, 27699,
- 28467, 28436, 28414, 28435, 28404, 28457, 28478, 28448, 28460, 28431, 28418, 28450, 28415, 28399, 28422, 28465, 28472, 28466, 28451, 28437,
- 28459, 28463, 28552, 28458, 28396, 28417, 28402, 28364, 28407, 29076, 29081, 29053, 29066, 29060, 29074, 29246, 29330, 29334, 29508, 29520,
- 29796, 29795, 29802, 29808, 29805, 29956, 30097, 30247, 30221, 30219, 30217, 30227, 30433, 30435, 30596, 30589, 30591, 30561, 30913, 30879,
- 30887, 30899, 30889, 30883, 31118, 31119, 31117, 31278, 31281, 31402, 31401, 31469, 31471, 31649, 31637, 31627, 31605, 31639, 31645, 31636,
- 31631, 31672, 31623, 31620, 31929, 31933, 31934, 32187, 32176, 32156, 32189, 32190, 32160, 32202, 32180, 32178, 32177, 32186, 32162, 32191,
- 32181, 32184, 32173, 32210, 32199, 32172, 32624, 32736, 32737, 32735, 32862, 32858, 32903, 33104, 33152, 33167, 33160, 33162, 33151, 33154,
- 33255, 33274, 33287, 33300, 33310, 33355, 33993, 33983, 33990, 33988, 33945, 33950, 33970, 33948, 33995, 33976, 33984, 34003, 33936, 33980,
- 34001, 33994, 34623, 34588, 34619, 34594, 34597, 34612, 34584, 34645, 34615, 34601, 35059, 35074, 35060, 35065, 35064, 35069, 35048, 35098,
- 35055, 35494, 35468, 35486, 35491, 35469, 35489, 35475, 35492, 35498, 35493, 35496, 35480, 35473, 35482, 35495, 35946, 35981, 35980, 36051,
- 36049, 36050, 36203, 36249, 36245, 36348, 36628, 36626, 36629, 36627, 36771, 36960, 36952, 36956, 36963, 36953, 36958, 36962, 36957, 36955,
- 37145, 37144, 37150, 37237, 37240, 37239, 37236, 37496, 37504, 37509, 37528, 37526, 37499, 37523, 37532, 37544, 37500, 37521, 38305, 38312,
- 38313, 38307, 38309, 38308, 38553, 38556, 38555, 38604, 38610, 38656, 38780, 38789, 38902, 38935, 38936, 39087, 39089, 39171, 39173, 39180,
- 39177, 39361, 39599, 39600, 39654, 39745, 39746, 40180, 40182, 40179, 40636, 40763, 40778, 20740, 20736, 20731, 20725, 20729, 20738, 20744,
- 20745, 20741, 20956, 21127, 21128, 21129, 21133, 21130, 21232, 21426, 22062, 22075, 22073, 22066, 22079, 22068, 22057, 22099, 22094, 22103,
- 22132, 22070, 22063, 22064, 22656, 22687, 22686, 22707, 22684, 22702, 22697, 22694, 22893, 23305, 23291, 23307, 23285, 23308, 23304, 23534,
- 23532, 23529, 23531, 23652, 23653, 23965, 23956, 24162, 24159, 24161, 24290, 24282, 24287, 24285, 24291, 24288, 24392, 24433, 24503, 24501,
- 24950, 24935, 24942, 24925, 24917, 24962, 24956, 24944, 24939, 24958, 24999, 24976, 25003, 24974, 25004, 24986, 24996, 24980, 25006, 25134,
- 25705, 25711, 25721, 25758, 25778, 25736, 25744, 25776, 25765, 25747, 25749, 25769, 25746, 25774, 25773, 25771, 25754, 25772, 25753, 25762,
- 25779, 25973, 25975, 25976, 26286, 26283, 26292, 26289, 27171, 27167, 27112, 27137, 27166, 27161, 27133, 27169, 27155, 27146, 27123, 27138,
- 27141, 27117, 27153, 27472, 27470, 27556, 27589, 27590, 28479, 28540, 28548, 28497, 28518, 28500, 28550, 28525, 28507, 28536, 28526, 28558,
- 28538, 28528, 28516, 28567, 28504, 28373, 28527, 28512, 28511, 29087, 29100, 29105, 29096, 29270, 29339, 29518, 29527, 29801, 29835, 29827,
- 29822, 29824, 30079, 30240, 30249, 30239, 30244, 30246, 30241, 30242, 30362, 30394, 30436, 30606, 30599, 30604, 30609, 30603, 30923, 30917,
- 30906, 30922, 30910, 30933, 30908, 30928, 31295, 31292, 31296, 31293, 31287, 31291, 31407, 31406, 31661, 31665, 31684, 31668, 31686, 31687,
- 31681, 31648, 31692, 31946, 32224, 32244, 32239, 32251, 32216, 32236, 32221, 32232, 32227, 32218, 32222, 32233, 32158, 32217, 32242, 32249,
- 32629, 32631, 32687, 32745, 32806, 33179, 33180, 33181, 33184, 33178, 33176, 34071, 34109, 34074, 34030, 34092, 34093, 34067, 34065, 34083,
- 34081, 34068, 34028, 34085, 34047, 34054, 34690, 34676, 34678, 34656, 34662, 34680, 34664, 34649, 34647, 34636, 34643, 34907, 34909, 35088,
- 35079, 35090, 35091, 35093, 35082, 35516, 35538, 35527, 35524, 35477, 35531, 35576, 35506, 35529, 35522, 35519, 35504, 35542, 35533, 35510,
- 35513, 35547, 35916, 35918, 35948, 36064, 36062, 36070, 36068, 36076, 36077, 36066, 36067, 36060, 36074, 36065, 36205, 36255, 36259, 36395,
- 36368, 36381, 36386, 36367, 36393, 36383, 36385, 36382, 36538, 36637, 36635, 36639, 36649, 36646, 36650, 36636, 36638, 36645, 36969, 36974,
- 36968, 36973, 36983, 37168, 37165, 37159, 37169, 37255, 37257, 37259, 37251, 37573, 37563, 37559, 37610, 37548, 37604, 37569, 37555, 37564,
- 37586, 37575, 37616, 37554, 38317, 38321, 38660, 38662, 38663, 38665, 38752, 38797, 38795, 38799, 38945, 38955, 38940, 39091, 39178, 39187,
- 39186, 39192, 39389, 39376, 39391, 39387, 39377, 39381, 39378, 39385, 39607, 39662, 39663, 39719, 39749, 39748, 39799, 39791, 40198, 40201,
- 40195, 40617, 40638, 40654, 22696, 40786, 20754, 20760, 20756, 20752, 20757, 20864, 20906, 20957, 21137, 21139, 21235, 22105, 22123, 22137,
- 22121, 22116, 22136, 22122, 22120, 22117, 22129, 22127, 22124, 22114, 22134, 22721, 22718, 22727, 22725, 22894, 23325, 23348, 23416, 23536,
- 23566, 24394, 25010, 24977, 25001, 24970, 25037, 25014, 25022, 25034, 25032, 25136, 25797, 25793, 25803, 25787, 25788, 25818, 25796, 25799,
- 25794, 25805, 25791, 25810, 25812, 25790, 25972, 26310, 26313, 26297, 26308, 26311, 26296, 27197, 27192, 27194, 27225, 27243, 27224, 27193,
- 27204, 27234, 27233, 27211, 27207, 27189, 27231, 27208, 27481, 27511, 27653, 28610, 28593, 28577, 28611, 28580, 28609, 28583, 28595, 28608,
- 28601, 28598, 28582, 28576, 28596, 29118, 29129, 29136, 29138, 29128, 29141, 29113, 29134, 29145, 29148, 29123, 29124, 29544, 29852, 29859,
- 29848, 29855, 29854, 29922, 29964, 29965, 30260, 30264, 30266, 30439, 30437, 30624, 30622, 30623, 30629, 30952, 30938, 30956, 30951, 31142,
- 31309, 31310, 31302, 31308, 31307, 31418, 31705, 31761, 31689, 31716, 31707, 31713, 31721, 31718, 31957, 31958, 32266, 32273, 32264, 32283,
- 32291, 32286, 32285, 32265, 32272, 32633, 32690, 32752, 32753, 32750, 32808, 33203, 33193, 33192, 33275, 33288, 33368, 33369, 34122, 34137,
- 34120, 34152, 34153, 34115, 34121, 34157, 34154, 34142, 34691, 34719, 34718, 34722, 34701, 34913, 35114, 35122, 35109, 35115, 35105, 35242,
- 35238, 35558, 35578, 35563, 35569, 35584, 35548, 35559, 35566, 35582, 35585, 35586, 35575, 35565, 35571, 35574, 35580, 35947, 35949, 35987,
- 36084, 36420, 36401, 36404, 36418, 36409, 36405, 36667, 36655, 36664, 36659, 36776, 36774, 36981, 36980, 36984, 36978, 36988, 36986, 37172,
- 37266, 37664, 37686, 37624, 37683, 37679, 37666, 37628, 37675, 37636, 37658, 37648, 37670, 37665, 37653, 37678, 37657, 38331, 38567, 38568,
- 38570, 38613, 38670, 38673, 38678, 38669, 38675, 38671, 38747, 38748, 38758, 38808, 38960, 38968, 38971, 38967, 38957, 38969, 38948, 39184,
- 39208, 39198, 39195, 39201, 39194, 39405, 39394, 39409, 39608, 39612, 39675, 39661, 39720, 39825, 40213, 40227, 40230, 40232, 40210, 40219,
- 40664, 40660, 40845, 40860, 20778, 20767, 20769, 20786, 21237, 22158, 22144, 22160, 22149, 22151, 22159, 22741, 22739, 22737, 22734, 23344,
- 23338, 23332, 23418, 23607, 23656, 23996, 23994, 23997, 23992, 24171, 24396, 24509, 25033, 25026, 25031, 25062, 25035, 25138, 25140, 25806,
- 25802, 25816, 25824, 25840, 25830, 25836, 25841, 25826, 25837, 25986, 25987, 26329, 26326, 27264, 27284, 27268, 27298, 27292, 27355, 27299,
- 27262, 27287, 27280, 27296, 27484, 27566, 27610, 27656, 28632, 28657, 28639, 28640, 28635, 28644, 28651, 28655, 28544, 28652, 28641, 28649,
- 28629, 28654, 28656, 29159, 29151, 29166, 29158, 29157, 29165, 29164, 29172, 29152, 29237, 29254, 29552, 29554, 29865, 29872, 29862, 29864,
- 30278, 30274, 30284, 30442, 30643, 30634, 30640, 30636, 30631, 30637, 30703, 30967, 30970, 30964, 30959, 30977, 31143, 31146, 31319, 31423,
- 31751, 31757, 31742, 31735, 31756, 31712, 31968, 31964, 31966, 31970, 31967, 31961, 31965, 32302, 32318, 32326, 32311, 32306, 32323, 32299,
- 32317, 32305, 32325, 32321, 32308, 32313, 32328, 32309, 32319, 32303, 32580, 32755, 32764, 32881, 32882, 32880, 32879, 32883, 33222, 33219,
- 33210, 33218, 33216, 33215, 33213, 33225, 33214, 33256, 33289, 33393, 34218, 34180, 34174, 34204, 34193, 34196, 34223, 34203, 34183, 34216,
- 34186, 34407, 34752, 34769, 34739, 34770, 34758, 34731, 34747, 34746, 34760, 34763, 35131, 35126, 35140, 35128, 35133, 35244, 35598, 35607,
- 35609, 35611, 35594, 35616, 35613, 35588, 35600, 35905, 35903, 35955, 36090, 36093, 36092, 36088, 36091, 36264, 36425, 36427, 36424, 36426,
- 36676, 36670, 36674, 36677, 36671, 36991, 36989, 36996, 36993, 36994, 36992, 37177, 37283, 37278, 37276, 37709, 37762, 37672, 37749, 37706,
- 37733, 37707, 37656, 37758, 37740, 37723, 37744, 37722, 37716, 38346, 38347, 38348, 38344, 38342, 38577, 38584, 38614, 38684, 38686, 38816,
- 38867, 38982, 39094, 39221, 39425, 39423, 39854, 39851, 39850, 39853, 40251, 40255, 40587, 40655, 40670, 40668, 40669, 40667, 40766, 40779,
- 21474, 22165, 22190, 22745, 22744, 23352, 24413, 25059, 25139, 25844, 25842, 25854, 25862, 25850, 25851, 25847, 26039, 26332, 26406, 27315,
- 27308, 27331, 27323, 27320, 27330, 27310, 27311, 27487, 27512, 27567, 28681, 28683, 28670, 28678, 28666, 28689, 28687, 29179, 29180, 29182,
- 29176, 29559, 29557, 29863, 29887, 29973, 30294, 30296, 30290, 30653, 30655, 30651, 30652, 30990, 31150, 31329, 31330, 31328, 31428, 31429,
- 31787, 31783, 31786, 31774, 31779, 31777, 31975, 32340, 32341, 32350, 32346, 32353, 32338, 32345, 32584, 32761, 32763, 32887, 32886, 33229,
- 33231, 33290, 34255, 34217, 34253, 34256, 34249, 34224, 34234, 34233, 34214, 34799, 34796, 34802, 34784, 35206, 35250, 35316, 35624, 35641,
- 35628, 35627, 35920, 36101, 36441, 36451, 36454, 36452, 36447, 36437, 36544, 36681, 36685, 36999, 36995, 37000, 37291, 37292, 37328, 37780,
- 37770, 37782, 37794, 37811, 37806, 37804, 37808, 37784, 37786, 37783, 38356, 38358, 38352, 38357, 38626, 38620, 38617, 38619, 38622, 38692,
- 38819, 38822, 38829, 38905, 38989, 38991, 38988, 38990, 38995, 39098, 39230, 39231, 39229, 39214, 39333, 39438, 39617, 39683, 39686, 39759,
- 39758, 39757, 39882, 39881, 39933, 39880, 39872, 40273, 40285, 40288, 40672, 40725, 40748, 20787, 22181, 22750, 22751, 22754, 23541, 40848,
- 24300, 25074, 25079, 25078, 25077, 25856, 25871, 26336, 26333, 27365, 27357, 27354, 27347, 28699, 28703, 28712, 28698, 28701, 28693, 28696,
- 29190, 29197, 29272, 29346, 29560, 29562, 29885, 29898, 29923, 30087, 30086, 30303, 30305, 30663, 31001, 31153, 31339, 31337, 31806, 31807,
- 31800, 31805, 31799, 31808, 32363, 32365, 32377, 32361, 32362, 32645, 32371, 32694, 32697, 32696, 33240, 34281, 34269, 34282, 34261, 34276,
- 34277, 34295, 34811, 34821, 34829, 34809, 34814, 35168, 35167, 35158, 35166, 35649, 35676, 35672, 35657, 35674, 35662, 35663, 35654, 35673,
- 36104, 36106, 36476, 36466, 36487, 36470, 36460, 36474, 36468, 36692, 36686, 36781, 37002, 37003, 37297, 37294, 37857, 37841, 37855, 37827,
- 37832, 37852, 37853, 37846, 37858, 37837, 37848, 37860, 37847, 37864, 38364, 38580, 38627, 38698, 38695, 38753, 38876, 38907, 39006, 39000,
- 39003, 39100, 39237, 39241, 39446, 39449, 39693, 39912, 39911, 39894, 39899, 40329, 40289, 40306, 40298, 40300, 40594, 40599, 40595, 40628,
- 21240, 22184, 22199, 22198, 22196, 22204, 22756, 23360, 23363, 23421, 23542, 24009, 25080, 25082, 25880, 25876, 25881, 26342, 26407, 27372,
- 28734, 28720, 28722, 29200, 29563, 29903, 30306, 30309, 31014, 31018, 31020, 31019, 31431, 31478, 31820, 31811, 31821, 31983, 31984, 36782,
- 32381, 32380, 32386, 32588, 32768, 33242, 33382, 34299, 34297, 34321, 34298, 34310, 34315, 34311, 34314, 34836, 34837, 35172, 35258, 35320,
- 35696, 35692, 35686, 35695, 35679, 35691, 36111, 36109, 36489, 36481, 36485, 36482, 37300, 37323, 37912, 37891, 37885, 38369, 38704, 39108,
- 39250, 39249, 39336, 39467, 39472, 39479, 39477, 39955, 39949, 40569, 40629, 40680, 40751, 40799, 40803, 40801, 20791, 20792, 22209, 22208,
- 22210, 22804, 23660, 24013, 25084, 25086, 25885, 25884, 26005, 26345, 27387, 27396, 27386, 27570, 28748, 29211, 29351, 29910, 29908, 30313,
- 30675, 31824, 32399, 32396, 32700, 34327, 34349, 34330, 34851, 34850, 34849, 34847, 35178, 35180, 35261, 35700, 35703, 35709, 36115, 36490,
- 36493, 36491, 36703, 36783, 37306, 37934, 37939, 37941, 37946, 37944, 37938, 37931, 38370, 38712, 38713, 38706, 38911, 39015, 39013, 39255,
- 39493, 39491, 39488, 39486, 39631, 39764, 39761, 39981, 39973, 40367, 40372, 40386, 40376, 40605, 40687, 40729, 40796, 40806, 40807, 20796,
- 20795, 22216, 22218, 22217, 23423, 24020, 24018, 24398, 25087, 25892, 27402, 27489, 28753, 28760, 29568, 29924, 30090, 30318, 30316, 31155,
- 31840, 31839, 32894, 32893, 33247, 35186, 35183, 35324, 35712, 36118, 36119, 36497, 36499, 36705, 37192, 37956, 37969, 37970, 38717, 38718,
- 38851, 38849, 39019, 39253, 39509, 39501, 39634, 39706, 40009, 39985, 39998, 39995, 40403, 40407, 40756, 40812, 40810, 40852, 22220, 24022,
- 25088, 25891, 25899, 25898, 26348, 27408, 29914, 31434, 31844, 31843, 31845, 32403, 32406, 32404, 33250, 34360, 34367, 34865, 35722, 37008,
- 37007, 37987, 37984, 37988, 38760, 39023, 39260, 39514, 39515, 39511, 39635, 39636, 39633, 40020, 40023, 40022, 40421, 40607, 40692, 22225,
- 22761, 25900, 28766, 30321, 30322, 30679, 32592, 32648, 34870, 34873, 34914, 35731, 35730, 35734, 33399, 36123, 37312, 37994, 38722, 38728,
- 38724, 38854, 39024, 39519, 39714, 39768, 40031, 40441, 40442, 40572, 40573, 40711, 40823, 40818, 24307, 27414, 28771, 31852, 31854, 34875,
- 35264, 36513, 37313, 38002, 38000, 39025, 39262, 39638, 39715, 40652, 28772, 30682, 35738, 38007, 38857, 39522, 39525, 32412, 35740, 36522,
- 37317, 38013, 38014, 38012, 40055, 40056, 40695, 35924, 38015, 40474, 29224, 39530, 39729, 40475, 40478, 31858, 9312, 9313, 9314, 9315,
- 9316, 9317, 9318, 9319, 9320, 9321, 9332, 9333, 9334, 9335, 9336, 9337, 9338, 9339, 9340, 9341, 8560, 8561, 8562, 8563,
- 8564, 8565, 8566, 8567, 8568, 8569, 20022, 20031, 20101, 20128, 20866, 20886, 20907, 21241, 21304, 21353, 21430, 22794, 23424, 24027,
- 12083, 24191, 24308, 24400, 24417, 25908, 26080, 30098, 30326, 36789, 38582, 168, 710, 12541, 12542, 12445, 12446, 12291, 20189, 12293,
- 12294, 12295, 12540, 65339, 65341, 10045, 12353, 12354, 12355, 12356, 12357, 12358, 12359, 12360, 12361, 12362, 12363, 12364, 12365, 12366,
- 12367, 12368, 12369, 12370, 12371, 12372, 12373, 12374, 12375, 12376, 12377, 12378, 12379, 12380, 12381, 12382, 12383, 12384, 12385, 12386,
- 12387, 12388, 12389, 12390, 12391, 12392, 12393, 12394, 12395, 12396, 12397, 12398, 12399, 12400, 12401, 12402, 12403, 12404, 12405, 12406,
- 12407, 12408, 12409, 12410, 12411, 12412, 12413, 12414, 12415, 12416, 12417, 12418, 12419, 12420, 12421, 12422, 12423, 12424, 12425, 12426,
- 12427, 12428, 12429, 12430, 12431, 12432, 12433, 12434, 12435, 12449, 12450, 12451, 12452, 12453, 12454, 12455, 12456, 12457, 12458, 12459,
- 12460, 12461, 12462, 12463, 12464, 12465, 12466, 12467, 12468, 12469, 12470, 12471, 12472, 12473, 12474, 12475, 12476, 12477, 12478, 12479,
- 12480, 12481, 12482, 12483, 12484, 12485, 12486, 12487, 12488, 12489, 12490, 12491, 12492, 12493, 12494, 12495, 12496, 12497, 12498, 12499,
- 12500, 12501, 12502, 12503, 12504, 12505, 12506, 12507, 12508, 12509, 12510, 12511, 12512, 12513, 12514, 12515, 12516, 12517, 12518, 12519,
- 12520, 12521, 12522, 12523, 12524, 12525, 12526, 12527, 12528, 12529, 12530, 12531, 12532, 12533, 12534, 1040, 1041, 1042, 1043, 1044,
- 1045, 1025, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063,
- 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1105, 1078, 1079, 1080, 1081, 1082,
- 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102,
- 1103, 8679, 8632, 8633, 12751, 131276, 20058, 131210, 20994, 17553, 40880, 20872, 40881, 161287, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null, 65506, 65508, 65287, 65282, 12849, 8470,
- 8481, 12443, 12444, 11904, 11908, 11910, 11911, 11912, 11914, 11916, 11917, 11925, 11932, 11933, 11941, 11943, 11946, 11948, 11950, 11958,
- 11964, 11966, 11974, 11978, 11980, 11981, 11983, 11990, 11991, 11998, 12003, null, null, null, 643, 592, 603, 596, 629, 339,
- 248, 331, 650, 618, 20034, 20060, 20981, 21274, 21378, 19975, 19980, 20039, 20109, 22231, 64012, 23662, 24435, 19983, 20871, 19982,
- 20014, 20115, 20162, 20169, 20168, 20888, 21244, 21356, 21433, 22304, 22787, 22828, 23568, 24063, 26081, 27571, 27596, 27668, 29247, 20017,
- 20028, 20200, 20188, 20201, 20193, 20189, 20186, 21004, 21276, 21324, 22306, 22307, 22807, 22831, 23425, 23428, 23570, 23611, 23668, 23667,
- 24068, 24192, 24194, 24521, 25097, 25168, 27669, 27702, 27715, 27711, 27707, 29358, 29360, 29578, 31160, 32906, 38430, 20238, 20248, 20268,
- 20213, 20244, 20209, 20224, 20215, 20232, 20253, 20226, 20229, 20258, 20243, 20228, 20212, 20242, 20913, 21011, 21001, 21008, 21158, 21282,
- 21279, 21325, 21386, 21511, 22241, 22239, 22318, 22314, 22324, 22844, 22912, 22908, 22917, 22907, 22910, 22903, 22911, 23382, 23573, 23589,
- 23676, 23674, 23675, 23678, 24031, 24181, 24196, 24322, 24346, 24436, 24533, 24532, 24527, 25180, 25182, 25188, 25185, 25190, 25186, 25177,
- 25184, 25178, 25189, 26095, 26094, 26430, 26425, 26424, 26427, 26426, 26431, 26428, 26419, 27672, 27718, 27730, 27740, 27727, 27722, 27732,
- 27723, 27724, 28785, 29278, 29364, 29365, 29582, 29994, 30335, 31349, 32593, 33400, 33404, 33408, 33405, 33407, 34381, 35198, 37017, 37015,
- 37016, 37019, 37012, 38434, 38436, 38432, 38435, 20310, 20283, 20322, 20297, 20307, 20324, 20286, 20327, 20306, 20319, 20289, 20312, 20269,
- 20275, 20287, 20321, 20879, 20921, 21020, 21022, 21025, 21165, 21166, 21257, 21347, 21362, 21390, 21391, 21552, 21559, 21546, 21588, 21573,
- 21529, 21532, 21541, 21528, 21565, 21583, 21569, 21544, 21540, 21575, 22254, 22247, 22245, 22337, 22341, 22348, 22345, 22347, 22354, 22790,
- 22848, 22950, 22936, 22944, 22935, 22926, 22946, 22928, 22927, 22951, 22945, 23438, 23442, 23592, 23594, 23693, 23695, 23688, 23691, 23689,
- 23698, 23690, 23686, 23699, 23701, 24032, 24074, 24078, 24203, 24201, 24204, 24200, 24205, 24325, 24349, 24440, 24438, 24530, 24529, 24528,
- 24557, 24552, 24558, 24563, 24545, 24548, 24547, 24570, 24559, 24567, 24571, 24576, 24564, 25146, 25219, 25228, 25230, 25231, 25236, 25223,
- 25201, 25211, 25210, 25200, 25217, 25224, 25207, 25213, 25202, 25204, 25911, 26096, 26100, 26099, 26098, 26101, 26437, 26439, 26457, 26453,
- 26444, 26440, 26461, 26445, 26458, 26443, 27600, 27673, 27674, 27768, 27751, 27755, 27780, 27787, 27791, 27761, 27759, 27753, 27802, 27757,
- 27783, 27797, 27804, 27750, 27763, 27749, 27771, 27790, 28788, 28794, 29283, 29375, 29373, 29379, 29382, 29377, 29370, 29381, 29589, 29591,
- 29587, 29588, 29586, 30010, 30009, 30100, 30101, 30337, 31037, 32820, 32917, 32921, 32912, 32914, 32924, 33424, 33423, 33413, 33422, 33425,
- 33427, 33418, 33411, 33412, 35960, 36809, 36799, 37023, 37025, 37029, 37022, 37031, 37024, 38448, 38440, 38447, 38445, 20019, 20376, 20348,
- 20357, 20349, 20352, 20359, 20342, 20340, 20361, 20356, 20343, 20300, 20375, 20330, 20378, 20345, 20353, 20344, 20368, 20380, 20372, 20382,
- 20370, 20354, 20373, 20331, 20334, 20894, 20924, 20926, 21045, 21042, 21043, 21062, 21041, 21180, 21258, 21259, 21308, 21394, 21396, 21639,
- 21631, 21633, 21649, 21634, 21640, 21611, 21626, 21630, 21605, 21612, 21620, 21606, 21645, 21615, 21601, 21600, 21656, 21603, 21607, 21604,
- 22263, 22265, 22383, 22386, 22381, 22379, 22385, 22384, 22390, 22400, 22389, 22395, 22387, 22388, 22370, 22376, 22397, 22796, 22853, 22965,
- 22970, 22991, 22990, 22962, 22988, 22977, 22966, 22972, 22979, 22998, 22961, 22973, 22976, 22984, 22964, 22983, 23394, 23397, 23443, 23445,
- 23620, 23623, 23726, 23716, 23712, 23733, 23727, 23720, 23724, 23711, 23715, 23725, 23714, 23722, 23719, 23709, 23717, 23734, 23728, 23718,
- 24087, 24084, 24089, 24360, 24354, 24355, 24356, 24404, 24450, 24446, 24445, 24542, 24549, 24621, 24614, 24601, 24626, 24587, 24628, 24586,
- 24599, 24627, 24602, 24606, 24620, 24610, 24589, 24592, 24622, 24595, 24593, 24588, 24585, 24604, 25108, 25149, 25261, 25268, 25297, 25278,
- 25258, 25270, 25290, 25262, 25267, 25263, 25275, 25257, 25264, 25272, 25917, 26024, 26043, 26121, 26108, 26116, 26130, 26120, 26107, 26115,
- 26123, 26125, 26117, 26109, 26129, 26128, 26358, 26378, 26501, 26476, 26510, 26514, 26486, 26491, 26520, 26502, 26500, 26484, 26509, 26508,
- 26490, 26527, 26513, 26521, 26499, 26493, 26497, 26488, 26489, 26516, 27429, 27520, 27518, 27614, 27677, 27795, 27884, 27883, 27886, 27865,
- 27830, 27860, 27821, 27879, 27831, 27856, 27842, 27834, 27843, 27846, 27885, 27890, 27858, 27869, 27828, 27786, 27805, 27776, 27870, 27840,
- 27952, 27853, 27847, 27824, 27897, 27855, 27881, 27857, 28820, 28824, 28805, 28819, 28806, 28804, 28817, 28822, 28802, 28826, 28803, 29290,
- 29398, 29387, 29400, 29385, 29404, 29394, 29396, 29402, 29388, 29393, 29604, 29601, 29613, 29606, 29602, 29600, 29612, 29597, 29917, 29928,
- 30015, 30016, 30014, 30092, 30104, 30383, 30451, 30449, 30448, 30453, 30712, 30716, 30713, 30715, 30714, 30711, 31042, 31039, 31173, 31352,
- 31355, 31483, 31861, 31997, 32821, 32911, 32942, 32931, 32952, 32949, 32941, 33312, 33440, 33472, 33451, 33434, 33432, 33435, 33461, 33447,
- 33454, 33468, 33438, 33466, 33460, 33448, 33441, 33449, 33474, 33444, 33475, 33462, 33442, 34416, 34415, 34413, 34414, 35926, 36818, 36811,
- 36819, 36813, 36822, 36821, 36823, 37042, 37044, 37039, 37043, 37040, 38457, 38461, 38460, 38458, 38467, 20429, 20421, 20435, 20402, 20425,
- 20427, 20417, 20436, 20444, 20441, 20411, 20403, 20443, 20423, 20438, 20410, 20416, 20409, 20460, 21060, 21065, 21184, 21186, 21309, 21372,
- 21399, 21398, 21401, 21400, 21690, 21665, 21677, 21669, 21711, 21699, 33549, 21687, 21678, 21718, 21686, 21701, 21702, 21664, 21616, 21692,
- 21666, 21694, 21618, 21726, 21680, 22453, 22430, 22431, 22436, 22412, 22423, 22429, 22427, 22420, 22424, 22415, 22425, 22437, 22426, 22421,
- 22772, 22797, 22867, 23009, 23006, 23022, 23040, 23025, 23005, 23034, 23037, 23036, 23030, 23012, 23026, 23031, 23003, 23017, 23027, 23029,
- 23008, 23038, 23028, 23021, 23464, 23628, 23760, 23768, 23756, 23767, 23755, 23771, 23774, 23770, 23753, 23751, 23754, 23766, 23763, 23764,
- 23759, 23752, 23750, 23758, 23775, 23800, 24057, 24097, 24098, 24099, 24096, 24100, 24240, 24228, 24226, 24219, 24227, 24229, 24327, 24366,
- 24406, 24454, 24631, 24633, 24660, 24690, 24670, 24645, 24659, 24647, 24649, 24667, 24652, 24640, 24642, 24671, 24612, 24644, 24664, 24678,
- 24686, 25154, 25155, 25295, 25357, 25355, 25333, 25358, 25347, 25323, 25337, 25359, 25356, 25336, 25334, 25344, 25363, 25364, 25338, 25365,
- 25339, 25328, 25921, 25923, 26026, 26047, 26166, 26145, 26162, 26165, 26140, 26150, 26146, 26163, 26155, 26170, 26141, 26164, 26169, 26158,
- 26383, 26384, 26561, 26610, 26568, 26554, 26588, 26555, 26616, 26584, 26560, 26551, 26565, 26603, 26596, 26591, 26549, 26573, 26547, 26615,
- 26614, 26606, 26595, 26562, 26553, 26574, 26599, 26608, 26546, 26620, 26566, 26605, 26572, 26542, 26598, 26587, 26618, 26569, 26570, 26563,
- 26602, 26571, 27432, 27522, 27524, 27574, 27606, 27608, 27616, 27680, 27681, 27944, 27956, 27949, 27935, 27964, 27967, 27922, 27914, 27866,
- 27955, 27908, 27929, 27962, 27930, 27921, 27904, 27933, 27970, 27905, 27928, 27959, 27907, 27919, 27968, 27911, 27936, 27948, 27912, 27938,
- 27913, 27920, 28855, 28831, 28862, 28849, 28848, 28833, 28852, 28853, 28841, 29249, 29257, 29258, 29292, 29296, 29299, 29294, 29386, 29412,
- 29416, 29419, 29407, 29418, 29414, 29411, 29573, 29644, 29634, 29640, 29637, 29625, 29622, 29621, 29620, 29675, 29631, 29639, 29630, 29635,
- 29638, 29624, 29643, 29932, 29934, 29998, 30023, 30024, 30119, 30122, 30329, 30404, 30472, 30467, 30468, 30469, 30474, 30455, 30459, 30458,
- 30695, 30696, 30726, 30737, 30738, 30725, 30736, 30735, 30734, 30729, 30723, 30739, 31050, 31052, 31051, 31045, 31044, 31189, 31181, 31183,
- 31190, 31182, 31360, 31358, 31441, 31488, 31489, 31866, 31864, 31865, 31871, 31872, 31873, 32003, 32008, 32001, 32600, 32657, 32653, 32702,
- 32775, 32782, 32783, 32788, 32823, 32984, 32967, 32992, 32977, 32968, 32962, 32976, 32965, 32995, 32985, 32988, 32970, 32981, 32969, 32975,
- 32983, 32998, 32973, 33279, 33313, 33428, 33497, 33534, 33529, 33543, 33512, 33536, 33493, 33594, 33515, 33494, 33524, 33516, 33505, 33522,
- 33525, 33548, 33531, 33526, 33520, 33514, 33508, 33504, 33530, 33523, 33517, 34423, 34420, 34428, 34419, 34881, 34894, 34919, 34922, 34921,
- 35283, 35332, 35335, 36210, 36835, 36833, 36846, 36832, 37105, 37053, 37055, 37077, 37061, 37054, 37063, 37067, 37064, 37332, 37331, 38484,
- 38479, 38481, 38483, 38474, 38478, 20510, 20485, 20487, 20499, 20514, 20528, 20507, 20469, 20468, 20531, 20535, 20524, 20470, 20471, 20503,
- 20508, 20512, 20519, 20533, 20527, 20529, 20494, 20826, 20884, 20883, 20938, 20932, 20933, 20936, 20942, 21089, 21082, 21074, 21086, 21087,
- 21077, 21090, 21197, 21262, 21406, 21798, 21730, 21783, 21778, 21735, 21747, 21732, 21786, 21759, 21764, 21768, 21739, 21777, 21765, 21745,
- 21770, 21755, 21751, 21752, 21728, 21774, 21763, 21771, 22273, 22274, 22476, 22578, 22485, 22482, 22458, 22470, 22461, 22460, 22456, 22454,
- 22463, 22471, 22480, 22457, 22465, 22798, 22858, 23065, 23062, 23085, 23086, 23061, 23055, 23063, 23050, 23070, 23091, 23404, 23463, 23469,
- 23468, 23555, 23638, 23636, 23788, 23807, 23790, 23793, 23799, 23808, 23801, 24105, 24104, 24232, 24238, 24234, 24236, 24371, 24368, 24423,
- 24669, 24666, 24679, 24641, 24738, 24712, 24704, 24722, 24705, 24733, 24707, 24725, 24731, 24727, 24711, 24732, 24718, 25113, 25158, 25330,
- 25360, 25430, 25388, 25412, 25413, 25398, 25411, 25572, 25401, 25419, 25418, 25404, 25385, 25409, 25396, 25432, 25428, 25433, 25389, 25415,
- 25395, 25434, 25425, 25400, 25431, 25408, 25416, 25930, 25926, 26054, 26051, 26052, 26050, 26186, 26207, 26183, 26193, 26386, 26387, 26655,
- 26650, 26697, 26674, 26675, 26683, 26699, 26703, 26646, 26673, 26652, 26677, 26667, 26669, 26671, 26702, 26692, 26676, 26653, 26642, 26644,
- 26662, 26664, 26670, 26701, 26682, 26661, 26656, 27436, 27439, 27437, 27441, 27444, 27501, 32898, 27528, 27622, 27620, 27624, 27619, 27618,
- 27623, 27685, 28026, 28003, 28004, 28022, 27917, 28001, 28050, 27992, 28002, 28013, 28015, 28049, 28045, 28143, 28031, 28038, 27998, 28007,
- 28000, 28055, 28016, 28028, 27999, 28034, 28056, 27951, 28008, 28043, 28030, 28032, 28036, 27926, 28035, 28027, 28029, 28021, 28048, 28892,
- 28883, 28881, 28893, 28875, 32569, 28898, 28887, 28882, 28894, 28896, 28884, 28877, 28869, 28870, 28871, 28890, 28878, 28897, 29250, 29304,
- 29303, 29302, 29440, 29434, 29428, 29438, 29430, 29427, 29435, 29441, 29651, 29657, 29669, 29654, 29628, 29671, 29667, 29673, 29660, 29650,
- 29659, 29652, 29661, 29658, 29655, 29656, 29672, 29918, 29919, 29940, 29941, 29985, 30043, 30047, 30128, 30145, 30139, 30148, 30144, 30143,
- 30134, 30138, 30346, 30409, 30493, 30491, 30480, 30483, 30482, 30499, 30481, 30485, 30489, 30490, 30498, 30503, 30755, 30764, 30754, 30773,
- 30767, 30760, 30766, 30763, 30753, 30761, 30771, 30762, 30769, 31060, 31067, 31055, 31068, 31059, 31058, 31057, 31211, 31212, 31200, 31214,
- 31213, 31210, 31196, 31198, 31197, 31366, 31369, 31365, 31371, 31372, 31370, 31367, 31448, 31504, 31492, 31507, 31493, 31503, 31496, 31498,
- 31502, 31497, 31506, 31876, 31889, 31882, 31884, 31880, 31885, 31877, 32030, 32029, 32017, 32014, 32024, 32022, 32019, 32031, 32018, 32015,
- 32012, 32604, 32609, 32606, 32608, 32605, 32603, 32662, 32658, 32707, 32706, 32704, 32790, 32830, 32825, 33018, 33010, 33017, 33013, 33025,
- 33019, 33024, 33281, 33327, 33317, 33587, 33581, 33604, 33561, 33617, 33573, 33622, 33599, 33601, 33574, 33564, 33570, 33602, 33614, 33563,
- 33578, 33544, 33596, 33613, 33558, 33572, 33568, 33591, 33583, 33577, 33607, 33605, 33612, 33619, 33566, 33580, 33611, 33575, 33608, 34387,
- 34386, 34466, 34472, 34454, 34445, 34449, 34462, 34439, 34455, 34438, 34443, 34458, 34437, 34469, 34457, 34465, 34471, 34453, 34456, 34446,
- 34461, 34448, 34452, 34883, 34884, 34925, 34933, 34934, 34930, 34944, 34929, 34943, 34927, 34947, 34942, 34932, 34940, 35346, 35911, 35927,
- 35963, 36004, 36003, 36214, 36216, 36277, 36279, 36278, 36561, 36563, 36862, 36853, 36866, 36863, 36859, 36868, 36860, 36854, 37078, 37088,
- 37081, 37082, 37091, 37087, 37093, 37080, 37083, 37079, 37084, 37092, 37200, 37198, 37199, 37333, 37346, 37338, 38492, 38495, 38588, 39139,
- 39647, 39727, 20095, 20592, 20586, 20577, 20574, 20576, 20563, 20555, 20573, 20594, 20552, 20557, 20545, 20571, 20554, 20578, 20501, 20549,
- 20575, 20585, 20587, 20579, 20580, 20550, 20544, 20590, 20595, 20567, 20561, 20944, 21099, 21101, 21100, 21102, 21206, 21203, 21293, 21404,
- 21877, 21878, 21820, 21837, 21840, 21812, 21802, 21841, 21858, 21814, 21813, 21808, 21842, 21829, 21772, 21810, 21861, 21838, 21817, 21832,
- 21805, 21819, 21824, 21835, 22282, 22279, 22523, 22548, 22498, 22518, 22492, 22516, 22528, 22509, 22525, 22536, 22520, 22539, 22515, 22479,
- 22535, 22510, 22499, 22514, 22501, 22508, 22497, 22542, 22524, 22544, 22503, 22529, 22540, 22513, 22505, 22512, 22541, 22532, 22876, 23136,
- 23128, 23125, 23143, 23134, 23096, 23093, 23149, 23120, 23135, 23141, 23148, 23123, 23140, 23127, 23107, 23133, 23122, 23108, 23131, 23112,
- 23182, 23102, 23117, 23097, 23116, 23152, 23145, 23111, 23121, 23126, 23106, 23132, 23410, 23406, 23489, 23488, 23641, 23838, 23819, 23837,
- 23834, 23840, 23820, 23848, 23821, 23846, 23845, 23823, 23856, 23826, 23843, 23839, 23854, 24126, 24116, 24241, 24244, 24249, 24242, 24243,
- 24374, 24376, 24475, 24470, 24479, 24714, 24720, 24710, 24766, 24752, 24762, 24787, 24788, 24783, 24804, 24793, 24797, 24776, 24753, 24795,
- 24759, 24778, 24767, 24771, 24781, 24768, 25394, 25445, 25482, 25474, 25469, 25533, 25502, 25517, 25501, 25495, 25515, 25486, 25455, 25479,
- 25488, 25454, 25519, 25461, 25500, 25453, 25518, 25468, 25508, 25403, 25503, 25464, 25477, 25473, 25489, 25485, 25456, 25939, 26061, 26213,
- 26209, 26203, 26201, 26204, 26210, 26392, 26745, 26759, 26768, 26780, 26733, 26734, 26798, 26795, 26966, 26735, 26787, 26796, 26793, 26741,
- 26740, 26802, 26767, 26743, 26770, 26748, 26731, 26738, 26794, 26752, 26737, 26750, 26779, 26774, 26763, 26784, 26761, 26788, 26744, 26747,
- 26769, 26764, 26762, 26749, 27446, 27443, 27447, 27448, 27537, 27535, 27533, 27534, 27532, 27690, 28096, 28075, 28084, 28083, 28276, 28076,
- 28137, 28130, 28087, 28150, 28116, 28160, 28104, 28128, 28127, 28118, 28094, 28133, 28124, 28125, 28123, 28148, 28106, 28093, 28141, 28144,
- 28090, 28117, 28098, 28111, 28105, 28112, 28146, 28115, 28157, 28119, 28109, 28131, 28091, 28922, 28941, 28919, 28951, 28916, 28940, 28912,
- 28932, 28915, 28944, 28924, 28927, 28934, 28947, 28928, 28920, 28918, 28939, 28930, 28942, 29310, 29307, 29308, 29311, 29469, 29463, 29447,
- 29457, 29464, 29450, 29448, 29439, 29455, 29470, 29576, 29686, 29688, 29685, 29700, 29697, 29693, 29703, 29696, 29690, 29692, 29695, 29708,
- 29707, 29684, 29704, 30052, 30051, 30158, 30162, 30159, 30155, 30156, 30161, 30160, 30351, 30345, 30419, 30521, 30511, 30509, 30513, 30514,
- 30516, 30515, 30525, 30501, 30523, 30517, 30792, 30802, 30793, 30797, 30794, 30796, 30758, 30789, 30800, 31076, 31079, 31081, 31082, 31075,
- 31083, 31073, 31163, 31226, 31224, 31222, 31223, 31375, 31380, 31376, 31541, 31559, 31540, 31525, 31536, 31522, 31524, 31539, 31512, 31530,
- 31517, 31537, 31531, 31533, 31535, 31538, 31544, 31514, 31523, 31892, 31896, 31894, 31907, 32053, 32061, 32056, 32054, 32058, 32069, 32044,
- 32041, 32065, 32071, 32062, 32063, 32074, 32059, 32040, 32611, 32661, 32668, 32669, 32667, 32714, 32715, 32717, 32720, 32721, 32711, 32719,
- 32713, 32799, 32798, 32795, 32839, 32835, 32840, 33048, 33061, 33049, 33051, 33069, 33055, 33068, 33054, 33057, 33045, 33063, 33053, 33058,
- 33297, 33336, 33331, 33338, 33332, 33330, 33396, 33680, 33699, 33704, 33677, 33658, 33651, 33700, 33652, 33679, 33665, 33685, 33689, 33653,
- 33684, 33705, 33661, 33667, 33676, 33693, 33691, 33706, 33675, 33662, 33701, 33711, 33672, 33687, 33712, 33663, 33702, 33671, 33710, 33654,
- 33690, 34393, 34390, 34495, 34487, 34498, 34497, 34501, 34490, 34480, 34504, 34489, 34483, 34488, 34508, 34484, 34491, 34492, 34499, 34493,
- 34494, 34898, 34953, 34965, 34984, 34978, 34986, 34970, 34961, 34977, 34975, 34968, 34983, 34969, 34971, 34967, 34980, 34988, 34956, 34963,
- 34958, 35202, 35286, 35289, 35285, 35376, 35367, 35372, 35358, 35897, 35899, 35932, 35933, 35965, 36005, 36221, 36219, 36217, 36284, 36290,
- 36281, 36287, 36289, 36568, 36574, 36573, 36572, 36567, 36576, 36577, 36900, 36875, 36881, 36892, 36876, 36897, 37103, 37098, 37104, 37108,
- 37106, 37107, 37076, 37099, 37100, 37097, 37206, 37208, 37210, 37203, 37205, 37356, 37364, 37361, 37363, 37368, 37348, 37369, 37354, 37355,
- 37367, 37352, 37358, 38266, 38278, 38280, 38524, 38509, 38507, 38513, 38511, 38591, 38762, 38916, 39141, 39319, 20635, 20629, 20628, 20638,
- 20619, 20643, 20611, 20620, 20622, 20637, 20584, 20636, 20626, 20610, 20615, 20831, 20948, 21266, 21265, 21412, 21415, 21905, 21928, 21925,
- 21933, 21879, 22085, 21922, 21907, 21896, 21903, 21941, 21889, 21923, 21906, 21924, 21885, 21900, 21926, 21887, 21909, 21921, 21902, 22284,
- 22569, 22583, 22553, 22558, 22567, 22563, 22568, 22517, 22600, 22565, 22556, 22555, 22579, 22591, 22582, 22574, 22585, 22584, 22573, 22572,
- 22587, 22881, 23215, 23188, 23199, 23162, 23202, 23198, 23160, 23206, 23164, 23205, 23212, 23189, 23214, 23095, 23172, 23178, 23191, 23171,
- 23179, 23209, 23163, 23165, 23180, 23196, 23183, 23187, 23197, 23530, 23501, 23499, 23508, 23505, 23498, 23502, 23564, 23600, 23863, 23875,
- 23915, 23873, 23883, 23871, 23861, 23889, 23886, 23893, 23859, 23866, 23890, 23869, 23857, 23897, 23874, 23865, 23881, 23864, 23868, 23858,
- 23862, 23872, 23877, 24132, 24129, 24408, 24486, 24485, 24491, 24777, 24761, 24780, 24802, 24782, 24772, 24852, 24818, 24842, 24854, 24837,
- 24821, 24851, 24824, 24828, 24830, 24769, 24835, 24856, 24861, 24848, 24831, 24836, 24843, 25162, 25492, 25521, 25520, 25550, 25573, 25576,
- 25583, 25539, 25757, 25587, 25546, 25568, 25590, 25557, 25586, 25589, 25697, 25567, 25534, 25565, 25564, 25540, 25560, 25555, 25538, 25543,
- 25548, 25547, 25544, 25584, 25559, 25561, 25906, 25959, 25962, 25956, 25948, 25960, 25957, 25996, 26013, 26014, 26030, 26064, 26066, 26236,
- 26220, 26235, 26240, 26225, 26233, 26218, 26226, 26369, 26892, 26835, 26884, 26844, 26922, 26860, 26858, 26865, 26895, 26838, 26871, 26859,
- 26852, 26870, 26899, 26896, 26867, 26849, 26887, 26828, 26888, 26992, 26804, 26897, 26863, 26822, 26900, 26872, 26832, 26877, 26876, 26856,
- 26891, 26890, 26903, 26830, 26824, 26845, 26846, 26854, 26868, 26833, 26886, 26836, 26857, 26901, 26917, 26823, 27449, 27451, 27455, 27452,
- 27540, 27543, 27545, 27541, 27581, 27632, 27634, 27635, 27696, 28156, 28230, 28231, 28191, 28233, 28296, 28220, 28221, 28229, 28258, 28203,
- 28223, 28225, 28253, 28275, 28188, 28211, 28235, 28224, 28241, 28219, 28163, 28206, 28254, 28264, 28252, 28257, 28209, 28200, 28256, 28273,
- 28267, 28217, 28194, 28208, 28243, 28261, 28199, 28280, 28260, 28279, 28245, 28281, 28242, 28262, 28213, 28214, 28250, 28960, 28958, 28975,
- 28923, 28974, 28977, 28963, 28965, 28962, 28978, 28959, 28968, 28986, 28955, 29259, 29274, 29320, 29321, 29318, 29317, 29323, 29458, 29451,
- 29488, 29474, 29489, 29491, 29479, 29490, 29485, 29478, 29475, 29493, 29452, 29742, 29740, 29744, 29739, 29718, 29722, 29729, 29741, 29745,
- 29732, 29731, 29725, 29737, 29728, 29746, 29947, 29999, 30063, 30060, 30183, 30170, 30177, 30182, 30173, 30175, 30180, 30167, 30357, 30354,
- 30426, 30534, 30535, 30532, 30541, 30533, 30538, 30542, 30539, 30540, 30686, 30700, 30816, 30820, 30821, 30812, 30829, 30833, 30826, 30830,
- 30832, 30825, 30824, 30814, 30818, 31092, 31091, 31090, 31088, 31234, 31242, 31235, 31244, 31236, 31385, 31462, 31460, 31562, 31547, 31556,
- 31560, 31564, 31566, 31552, 31576, 31557, 31906, 31902, 31912, 31905, 32088, 32111, 32099, 32083, 32086, 32103, 32106, 32079, 32109, 32092,
- 32107, 32082, 32084, 32105, 32081, 32095, 32078, 32574, 32575, 32613, 32614, 32674, 32672, 32673, 32727, 32849, 32847, 32848, 33022, 32980,
- 33091, 33098, 33106, 33103, 33095, 33085, 33101, 33082, 33254, 33262, 33271, 33272, 33273, 33284, 33340, 33341, 33343, 33397, 33595, 33743,
- 33785, 33827, 33728, 33768, 33810, 33767, 33764, 33788, 33782, 33808, 33734, 33736, 33771, 33763, 33727, 33793, 33757, 33765, 33752, 33791,
- 33761, 33739, 33742, 33750, 33781, 33737, 33801, 33807, 33758, 33809, 33798, 33730, 33779, 33749, 33786, 33735, 33745, 33770, 33811, 33731,
- 33772, 33774, 33732, 33787, 33751, 33762, 33819, 33755, 33790, 34520, 34530, 34534, 34515, 34531, 34522, 34538, 34525, 34539, 34524, 34540,
- 34537, 34519, 34536, 34513, 34888, 34902, 34901, 35002, 35031, 35001, 35000, 35008, 35006, 34998, 35004, 34999, 35005, 34994, 35073, 35017,
- 35221, 35224, 35223, 35293, 35290, 35291, 35406, 35405, 35385, 35417, 35392, 35415, 35416, 35396, 35397, 35410, 35400, 35409, 35402, 35404,
- 35407, 35935, 35969, 35968, 36026, 36030, 36016, 36025, 36021, 36228, 36224, 36233, 36312, 36307, 36301, 36295, 36310, 36316, 36303, 36309,
- 36313, 36296, 36311, 36293, 36591, 36599, 36602, 36601, 36582, 36590, 36581, 36597, 36583, 36584, 36598, 36587, 36593, 36588, 36596, 36585,
- 36909, 36916, 36911, 37126, 37164, 37124, 37119, 37116, 37128, 37113, 37115, 37121, 37120, 37127, 37125, 37123, 37217, 37220, 37215, 37218,
- 37216, 37377, 37386, 37413, 37379, 37402, 37414, 37391, 37388, 37376, 37394, 37375, 37373, 37382, 37380, 37415, 37378, 37404, 37412, 37401,
- 37399, 37381, 37398, 38267, 38285, 38284, 38288, 38535, 38526, 38536, 38537, 38531, 38528, 38594, 38600, 38595, 38641, 38640, 38764, 38768,
- 38766, 38919, 39081, 39147, 40166, 40697, 20099, 20100, 20150, 20669, 20671, 20678, 20654, 20676, 20682, 20660, 20680, 20674, 20656, 20673,
- 20666, 20657, 20683, 20681, 20662, 20664, 20951, 21114, 21112, 21115, 21116, 21955, 21979, 21964, 21968, 21963, 21962, 21981, 21952, 21972,
- 21956, 21993, 21951, 21970, 21901, 21967, 21973, 21986, 21974, 21960, 22002, 21965, 21977, 21954, 22292, 22611, 22632, 22628, 22607, 22605,
- 22601, 22639, 22613, 22606, 22621, 22617, 22629, 22619, 22589, 22627, 22641, 22780, 23239, 23236, 23243, 23226, 23224, 23217, 23221, 23216,
- 23231, 23240, 23227, 23238, 23223, 23232, 23242, 23220, 23222, 23245, 23225, 23184, 23510, 23512, 23513, 23583, 23603, 23921, 23907, 23882,
- 23909, 23922, 23916, 23902, 23912, 23911, 23906, 24048, 24143, 24142, 24138, 24141, 24139, 24261, 24268, 24262, 24267, 24263, 24384, 24495,
- 24493, 24823, 24905, 24906, 24875, 24901, 24886, 24882, 24878, 24902, 24879, 24911, 24873, 24896, 25120, 37224, 25123, 25125, 25124, 25541,
- 25585, 25579, 25616, 25618, 25609, 25632, 25636, 25651, 25667, 25631, 25621, 25624, 25657, 25655, 25634, 25635, 25612, 25638, 25648, 25640,
- 25665, 25653, 25647, 25610, 25626, 25664, 25637, 25639, 25611, 25575, 25627, 25646, 25633, 25614, 25967, 26002, 26067, 26246, 26252, 26261,
- 26256, 26251, 26250, 26265, 26260, 26232, 26400, 26982, 26975, 26936, 26958, 26978, 26993, 26943, 26949, 26986, 26937, 26946, 26967, 26969,
- 27002, 26952, 26953, 26933, 26988, 26931, 26941, 26981, 26864, 27000, 26932, 26985, 26944, 26991, 26948, 26998, 26968, 26945, 26996, 26956,
- 26939, 26955, 26935, 26972, 26959, 26961, 26930, 26962, 26927, 27003, 26940, 27462, 27461, 27459, 27458, 27464, 27457, 27547, 64013, 27643,
- 27644, 27641, 27639, 27640, 28315, 28374, 28360, 28303, 28352, 28319, 28307, 28308, 28320, 28337, 28345, 28358, 28370, 28349, 28353, 28318,
- 28361, 28343, 28336, 28365, 28326, 28367, 28338, 28350, 28355, 28380, 28376, 28313, 28306, 28302, 28301, 28324, 28321, 28351, 28339, 28368,
- 28362, 28311, 28334, 28323, 28999, 29012, 29010, 29027, 29024, 28993, 29021, 29026, 29042, 29048, 29034, 29025, 28994, 29016, 28995, 29003,
- 29040, 29023, 29008, 29011, 28996, 29005, 29018, 29263, 29325, 29324, 29329, 29328, 29326, 29500, 29506, 29499, 29498, 29504, 29514, 29513,
- 29764, 29770, 29771, 29778, 29777, 29783, 29760, 29775, 29776, 29774, 29762, 29766, 29773, 29780, 29921, 29951, 29950, 29949, 29981, 30073,
- 30071, 27011, 30191, 30223, 30211, 30199, 30206, 30204, 30201, 30200, 30224, 30203, 30198, 30189, 30197, 30205, 30361, 30389, 30429, 30549,
- 30559, 30560, 30546, 30550, 30554, 30569, 30567, 30548, 30553, 30573, 30688, 30855, 30874, 30868, 30863, 30852, 30869, 30853, 30854, 30881,
- 30851, 30841, 30873, 30848, 30870, 30843, 31100, 31106, 31101, 31097, 31249, 31256, 31257, 31250, 31255, 31253, 31266, 31251, 31259, 31248,
- 31395, 31394, 31390, 31467, 31590, 31588, 31597, 31604, 31593, 31602, 31589, 31603, 31601, 31600, 31585, 31608, 31606, 31587, 31922, 31924,
- 31919, 32136, 32134, 32128, 32141, 32127, 32133, 32122, 32142, 32123, 32131, 32124, 32140, 32148, 32132, 32125, 32146, 32621, 32619, 32615,
- 32616, 32620, 32678, 32677, 32679, 32731, 32732, 32801, 33124, 33120, 33143, 33116, 33129, 33115, 33122, 33138, 26401, 33118, 33142, 33127,
- 33135, 33092, 33121, 33309, 33353, 33348, 33344, 33346, 33349, 34033, 33855, 33878, 33910, 33913, 33935, 33933, 33893, 33873, 33856, 33926,
- 33895, 33840, 33869, 33917, 33882, 33881, 33908, 33907, 33885, 34055, 33886, 33847, 33850, 33844, 33914, 33859, 33912, 33842, 33861, 33833,
- 33753, 33867, 33839, 33858, 33837, 33887, 33904, 33849, 33870, 33868, 33874, 33903, 33989, 33934, 33851, 33863, 33846, 33843, 33896, 33918,
- 33860, 33835, 33888, 33876, 33902, 33872, 34571, 34564, 34551, 34572, 34554, 34518, 34549, 34637, 34552, 34574, 34569, 34561, 34550, 34573,
- 34565, 35030, 35019, 35021, 35022, 35038, 35035, 35034, 35020, 35024, 35205, 35227, 35295, 35301, 35300, 35297, 35296, 35298, 35292, 35302,
- 35446, 35462, 35455, 35425, 35391, 35447, 35458, 35460, 35445, 35459, 35457, 35444, 35450, 35900, 35915, 35914, 35941, 35940, 35942, 35974,
- 35972, 35973, 36044, 36200, 36201, 36241, 36236, 36238, 36239, 36237, 36243, 36244, 36240, 36242, 36336, 36320, 36332, 36337, 36334, 36304,
- 36329, 36323, 36322, 36327, 36338, 36331, 36340, 36614, 36607, 36609, 36608, 36613, 36615, 36616, 36610, 36619, 36946, 36927, 36932, 36937,
- 36925, 37136, 37133, 37135, 37137, 37142, 37140, 37131, 37134, 37230, 37231, 37448, 37458, 37424, 37434, 37478, 37427, 37477, 37470, 37507,
- 37422, 37450, 37446, 37485, 37484, 37455, 37472, 37479, 37487, 37430, 37473, 37488, 37425, 37460, 37475, 37456, 37490, 37454, 37459, 37452,
- 37462, 37426, 38303, 38300, 38302, 38299, 38546, 38547, 38545, 38551, 38606, 38650, 38653, 38648, 38645, 38771, 38775, 38776, 38770, 38927,
- 38925, 38926, 39084, 39158, 39161, 39343, 39346, 39344, 39349, 39597, 39595, 39771, 40170, 40173, 40167, 40576, 40701, 20710, 20692, 20695,
- 20712, 20723, 20699, 20714, 20701, 20708, 20691, 20716, 20720, 20719, 20707, 20704, 20952, 21120, 21121, 21225, 21227, 21296, 21420, 22055,
- 22037, 22028, 22034, 22012, 22031, 22044, 22017, 22035, 22018, 22010, 22045, 22020, 22015, 22009, 22665, 22652, 22672, 22680, 22662, 22657,
- 22655, 22644, 22667, 22650, 22663, 22673, 22670, 22646, 22658, 22664, 22651, 22676, 22671, 22782, 22891, 23260, 23278, 23269, 23253, 23274,
- 23258, 23277, 23275, 23283, 23266, 23264, 23259, 23276, 23262, 23261, 23257, 23272, 23263, 23415, 23520, 23523, 23651, 23938, 23936, 23933,
- 23942, 23930, 23937, 23927, 23946, 23945, 23944, 23934, 23932, 23949, 23929, 23935, 24152, 24153, 24147, 24280, 24273, 24279, 24270, 24284,
- 24277, 24281, 24274, 24276, 24388, 24387, 24431, 24502, 24876, 24872, 24897, 24926, 24945, 24947, 24914, 24915, 24946, 24940, 24960, 24948,
- 24916, 24954, 24923, 24933, 24891, 24938, 24929, 24918, 25129, 25127, 25131, 25643, 25677, 25691, 25693, 25716, 25718, 25714, 25715, 25725,
- 25717, 25702, 25766, 25678, 25730, 25694, 25692, 25675, 25683, 25696, 25680, 25727, 25663, 25708, 25707, 25689, 25701, 25719, 25971, 26016,
- 26273, 26272, 26271, 26373, 26372, 26402, 27057, 27062, 27081, 27040, 27086, 27030, 27056, 27052, 27068, 27025, 27033, 27022, 27047, 27021,
- 27049, 27070, 27055, 27071, 27076, 27069, 27044, 27092, 27065, 27082, 27034, 27087, 27059, 27027, 27050, 27041, 27038, 27097, 27031, 27024,
- 27074, 27061, 27045, 27078, 27466, 27469, 27467, 27550, 27551, 27552, 27587, 27588, 27646, 28366, 28405, 28401, 28419, 28453, 28408, 28471,
- 28411, 28462, 28425, 28494, 28441, 28442, 28455, 28440, 28475, 28434, 28397, 28426, 28470, 28531, 28409, 28398, 28461, 28480, 28464, 28476,
- 28469, 28395, 28423, 28430, 28483, 28421, 28413, 28406, 28473, 28444, 28412, 28474, 28447, 28429, 28446, 28424, 28449, 29063, 29072, 29065,
- 29056, 29061, 29058, 29071, 29051, 29062, 29057, 29079, 29252, 29267, 29335, 29333, 29331, 29507, 29517, 29521, 29516, 29794, 29811, 29809,
- 29813, 29810, 29799, 29806, 29952, 29954, 29955, 30077, 30096, 30230, 30216, 30220, 30229, 30225, 30218, 30228, 30392, 30593, 30588, 30597,
- 30594, 30574, 30592, 30575, 30590, 30595, 30898, 30890, 30900, 30893, 30888, 30846, 30891, 30878, 30885, 30880, 30892, 30882, 30884, 31128,
- 31114, 31115, 31126, 31125, 31124, 31123, 31127, 31112, 31122, 31120, 31275, 31306, 31280, 31279, 31272, 31270, 31400, 31403, 31404, 31470,
- 31624, 31644, 31626, 31633, 31632, 31638, 31629, 31628, 31643, 31630, 31621, 31640, 21124, 31641, 31652, 31618, 31931, 31935, 31932, 31930,
- 32167, 32183, 32194, 32163, 32170, 32193, 32192, 32197, 32157, 32206, 32196, 32198, 32203, 32204, 32175, 32185, 32150, 32188, 32159, 32166,
- 32174, 32169, 32161, 32201, 32627, 32738, 32739, 32741, 32734, 32804, 32861, 32860, 33161, 33158, 33155, 33159, 33165, 33164, 33163, 33301,
- 33943, 33956, 33953, 33951, 33978, 33998, 33986, 33964, 33966, 33963, 33977, 33972, 33985, 33997, 33962, 33946, 33969, 34000, 33949, 33959,
- 33979, 33954, 33940, 33991, 33996, 33947, 33961, 33967, 33960, 34006, 33944, 33974, 33999, 33952, 34007, 34004, 34002, 34011, 33968, 33937,
- 34401, 34611, 34595, 34600, 34667, 34624, 34606, 34590, 34593, 34585, 34587, 34627, 34604, 34625, 34622, 34630, 34592, 34610, 34602, 34605,
- 34620, 34578, 34618, 34609, 34613, 34626, 34598, 34599, 34616, 34596, 34586, 34608, 34577, 35063, 35047, 35057, 35058, 35066, 35070, 35054,
- 35068, 35062, 35067, 35056, 35052, 35051, 35229, 35233, 35231, 35230, 35305, 35307, 35304, 35499, 35481, 35467, 35474, 35471, 35478, 35901,
- 35944, 35945, 36053, 36047, 36055, 36246, 36361, 36354, 36351, 36365, 36349, 36362, 36355, 36359, 36358, 36357, 36350, 36352, 36356, 36624,
- 36625, 36622, 36621, 37155, 37148, 37152, 37154, 37151, 37149, 37146, 37156, 37153, 37147, 37242, 37234, 37241, 37235, 37541, 37540, 37494,
- 37531, 37498, 37536, 37524, 37546, 37517, 37542, 37530, 37547, 37497, 37527, 37503, 37539, 37614, 37518, 37506, 37525, 37538, 37501, 37512,
- 37537, 37514, 37510, 37516, 37529, 37543, 37502, 37511, 37545, 37533, 37515, 37421, 38558, 38561, 38655, 38744, 38781, 38778, 38782, 38787,
- 38784, 38786, 38779, 38788, 38785, 38783, 38862, 38861, 38934, 39085, 39086, 39170, 39168, 39175, 39325, 39324, 39363, 39353, 39355, 39354,
- 39362, 39357, 39367, 39601, 39651, 39655, 39742, 39743, 39776, 39777, 39775, 40177, 40178, 40181, 40615, 20735, 20739, 20784, 20728, 20742,
- 20743, 20726, 20734, 20747, 20748, 20733, 20746, 21131, 21132, 21233, 21231, 22088, 22082, 22092, 22069, 22081, 22090, 22089, 22086, 22104,
- 22106, 22080, 22067, 22077, 22060, 22078, 22072, 22058, 22074, 22298, 22699, 22685, 22705, 22688, 22691, 22703, 22700, 22693, 22689, 22783,
- 23295, 23284, 23293, 23287, 23286, 23299, 23288, 23298, 23289, 23297, 23303, 23301, 23311, 23655, 23961, 23959, 23967, 23954, 23970, 23955,
- 23957, 23968, 23964, 23969, 23962, 23966, 24169, 24157, 24160, 24156, 32243, 24283, 24286, 24289, 24393, 24498, 24971, 24963, 24953, 25009,
- 25008, 24994, 24969, 24987, 24979, 25007, 25005, 24991, 24978, 25002, 24993, 24973, 24934, 25011, 25133, 25710, 25712, 25750, 25760, 25733,
- 25751, 25756, 25743, 25739, 25738, 25740, 25763, 25759, 25704, 25777, 25752, 25974, 25978, 25977, 25979, 26034, 26035, 26293, 26288, 26281,
- 26290, 26295, 26282, 26287, 27136, 27142, 27159, 27109, 27128, 27157, 27121, 27108, 27168, 27135, 27116, 27106, 27163, 27165, 27134, 27175,
- 27122, 27118, 27156, 27127, 27111, 27200, 27144, 27110, 27131, 27149, 27132, 27115, 27145, 27140, 27160, 27173, 27151, 27126, 27174, 27143,
- 27124, 27158, 27473, 27557, 27555, 27554, 27558, 27649, 27648, 27647, 27650, 28481, 28454, 28542, 28551, 28614, 28562, 28557, 28553, 28556,
- 28514, 28495, 28549, 28506, 28566, 28534, 28524, 28546, 28501, 28530, 28498, 28496, 28503, 28564, 28563, 28509, 28416, 28513, 28523, 28541,
- 28519, 28560, 28499, 28555, 28521, 28543, 28565, 28515, 28535, 28522, 28539, 29106, 29103, 29083, 29104, 29088, 29082, 29097, 29109, 29085,
- 29093, 29086, 29092, 29089, 29098, 29084, 29095, 29107, 29336, 29338, 29528, 29522, 29534, 29535, 29536, 29533, 29531, 29537, 29530, 29529,
- 29538, 29831, 29833, 29834, 29830, 29825, 29821, 29829, 29832, 29820, 29817, 29960, 29959, 30078, 30245, 30238, 30233, 30237, 30236, 30243,
- 30234, 30248, 30235, 30364, 30365, 30366, 30363, 30605, 30607, 30601, 30600, 30925, 30907, 30927, 30924, 30929, 30926, 30932, 30920, 30915,
- 30916, 30921, 31130, 31137, 31136, 31132, 31138, 31131, 27510, 31289, 31410, 31412, 31411, 31671, 31691, 31678, 31660, 31694, 31663, 31673,
- 31690, 31669, 31941, 31944, 31948, 31947, 32247, 32219, 32234, 32231, 32215, 32225, 32259, 32250, 32230, 32246, 32241, 32240, 32238, 32223,
- 32630, 32684, 32688, 32685, 32749, 32747, 32746, 32748, 32742, 32744, 32868, 32871, 33187, 33183, 33182, 33173, 33186, 33177, 33175, 33302,
- 33359, 33363, 33362, 33360, 33358, 33361, 34084, 34107, 34063, 34048, 34089, 34062, 34057, 34061, 34079, 34058, 34087, 34076, 34043, 34091,
- 34042, 34056, 34060, 34036, 34090, 34034, 34069, 34039, 34027, 34035, 34044, 34066, 34026, 34025, 34070, 34046, 34088, 34077, 34094, 34050,
- 34045, 34078, 34038, 34097, 34086, 34023, 34024, 34032, 34031, 34041, 34072, 34080, 34096, 34059, 34073, 34095, 34402, 34646, 34659, 34660,
- 34679, 34785, 34675, 34648, 34644, 34651, 34642, 34657, 34650, 34641, 34654, 34669, 34666, 34640, 34638, 34655, 34653, 34671, 34668, 34682,
- 34670, 34652, 34661, 34639, 34683, 34677, 34658, 34663, 34665, 34906, 35077, 35084, 35092, 35083, 35095, 35096, 35097, 35078, 35094, 35089,
- 35086, 35081, 35234, 35236, 35235, 35309, 35312, 35308, 35535, 35526, 35512, 35539, 35537, 35540, 35541, 35515, 35543, 35518, 35520, 35525,
- 35544, 35523, 35514, 35517, 35545, 35902, 35917, 35983, 36069, 36063, 36057, 36072, 36058, 36061, 36071, 36256, 36252, 36257, 36251, 36384,
- 36387, 36389, 36388, 36398, 36373, 36379, 36374, 36369, 36377, 36390, 36391, 36372, 36370, 36376, 36371, 36380, 36375, 36378, 36652, 36644,
- 36632, 36634, 36640, 36643, 36630, 36631, 36979, 36976, 36975, 36967, 36971, 37167, 37163, 37161, 37162, 37170, 37158, 37166, 37253, 37254,
- 37258, 37249, 37250, 37252, 37248, 37584, 37571, 37572, 37568, 37593, 37558, 37583, 37617, 37599, 37592, 37609, 37591, 37597, 37580, 37615,
- 37570, 37608, 37578, 37576, 37582, 37606, 37581, 37589, 37577, 37600, 37598, 37607, 37585, 37587, 37557, 37601, 37574, 37556, 38268, 38316,
- 38315, 38318, 38320, 38564, 38562, 38611, 38661, 38664, 38658, 38746, 38794, 38798, 38792, 38864, 38863, 38942, 38941, 38950, 38953, 38952,
- 38944, 38939, 38951, 39090, 39176, 39162, 39185, 39188, 39190, 39191, 39189, 39388, 39373, 39375, 39379, 39380, 39374, 39369, 39382, 39384,
- 39371, 39383, 39372, 39603, 39660, 39659, 39667, 39666, 39665, 39750, 39747, 39783, 39796, 39793, 39782, 39798, 39797, 39792, 39784, 39780,
- 39788, 40188, 40186, 40189, 40191, 40183, 40199, 40192, 40185, 40187, 40200, 40197, 40196, 40579, 40659, 40719, 40720, 20764, 20755, 20759,
- 20762, 20753, 20958, 21300, 21473, 22128, 22112, 22126, 22131, 22118, 22115, 22125, 22130, 22110, 22135, 22300, 22299, 22728, 22717, 22729,
- 22719, 22714, 22722, 22716, 22726, 23319, 23321, 23323, 23329, 23316, 23315, 23312, 23318, 23336, 23322, 23328, 23326, 23535, 23980, 23985,
- 23977, 23975, 23989, 23984, 23982, 23978, 23976, 23986, 23981, 23983, 23988, 24167, 24168, 24166, 24175, 24297, 24295, 24294, 24296, 24293,
- 24395, 24508, 24989, 25000, 24982, 25029, 25012, 25030, 25025, 25036, 25018, 25023, 25016, 24972, 25815, 25814, 25808, 25807, 25801, 25789,
- 25737, 25795, 25819, 25843, 25817, 25907, 25983, 25980, 26018, 26312, 26302, 26304, 26314, 26315, 26319, 26301, 26299, 26298, 26316, 26403,
- 27188, 27238, 27209, 27239, 27186, 27240, 27198, 27229, 27245, 27254, 27227, 27217, 27176, 27226, 27195, 27199, 27201, 27242, 27236, 27216,
- 27215, 27220, 27247, 27241, 27232, 27196, 27230, 27222, 27221, 27213, 27214, 27206, 27477, 27476, 27478, 27559, 27562, 27563, 27592, 27591,
- 27652, 27651, 27654, 28589, 28619, 28579, 28615, 28604, 28622, 28616, 28510, 28612, 28605, 28574, 28618, 28584, 28676, 28581, 28590, 28602,
- 28588, 28586, 28623, 28607, 28600, 28578, 28617, 28587, 28621, 28591, 28594, 28592, 29125, 29122, 29119, 29112, 29142, 29120, 29121, 29131,
- 29140, 29130, 29127, 29135, 29117, 29144, 29116, 29126, 29146, 29147, 29341, 29342, 29545, 29542, 29543, 29548, 29541, 29547, 29546, 29823,
- 29850, 29856, 29844, 29842, 29845, 29857, 29963, 30080, 30255, 30253, 30257, 30269, 30259, 30268, 30261, 30258, 30256, 30395, 30438, 30618,
- 30621, 30625, 30620, 30619, 30626, 30627, 30613, 30617, 30615, 30941, 30953, 30949, 30954, 30942, 30947, 30939, 30945, 30946, 30957, 30943,
- 30944, 31140, 31300, 31304, 31303, 31414, 31416, 31413, 31409, 31415, 31710, 31715, 31719, 31709, 31701, 31717, 31706, 31720, 31737, 31700,
- 31722, 31714, 31708, 31723, 31704, 31711, 31954, 31956, 31959, 31952, 31953, 32274, 32289, 32279, 32268, 32287, 32288, 32275, 32270, 32284,
- 32277, 32282, 32290, 32267, 32271, 32278, 32269, 32276, 32293, 32292, 32579, 32635, 32636, 32634, 32689, 32751, 32810, 32809, 32876, 33201,
- 33190, 33198, 33209, 33205, 33195, 33200, 33196, 33204, 33202, 33207, 33191, 33266, 33365, 33366, 33367, 34134, 34117, 34155, 34125, 34131,
- 34145, 34136, 34112, 34118, 34148, 34113, 34146, 34116, 34129, 34119, 34147, 34110, 34139, 34161, 34126, 34158, 34165, 34133, 34151, 34144,
- 34188, 34150, 34141, 34132, 34149, 34156, 34403, 34405, 34404, 34715, 34703, 34711, 34707, 34706, 34696, 34689, 34710, 34712, 34681, 34695,
- 34723, 34693, 34704, 34705, 34717, 34692, 34708, 34716, 34714, 34697, 35102, 35110, 35120, 35117, 35118, 35111, 35121, 35106, 35113, 35107,
- 35119, 35116, 35103, 35313, 35552, 35554, 35570, 35572, 35573, 35549, 35604, 35556, 35551, 35568, 35528, 35550, 35553, 35560, 35583, 35567,
- 35579, 35985, 35986, 35984, 36085, 36078, 36081, 36080, 36083, 36204, 36206, 36261, 36263, 36403, 36414, 36408, 36416, 36421, 36406, 36412,
- 36413, 36417, 36400, 36415, 36541, 36662, 36654, 36661, 36658, 36665, 36663, 36660, 36982, 36985, 36987, 36998, 37114, 37171, 37173, 37174,
- 37267, 37264, 37265, 37261, 37263, 37671, 37662, 37640, 37663, 37638, 37647, 37754, 37688, 37692, 37659, 37667, 37650, 37633, 37702, 37677,
- 37646, 37645, 37579, 37661, 37626, 37669, 37651, 37625, 37623, 37684, 37634, 37668, 37631, 37673, 37689, 37685, 37674, 37652, 37644, 37643,
- 37630, 37641, 37632, 37627, 37654, 38332, 38349, 38334, 38329, 38330, 38326, 38335, 38325, 38333, 38569, 38612, 38667, 38674, 38672, 38809,
- 38807, 38804, 38896, 38904, 38965, 38959, 38962, 39204, 39199, 39207, 39209, 39326, 39406, 39404, 39397, 39396, 39408, 39395, 39402, 39401,
- 39399, 39609, 39615, 39604, 39611, 39670, 39674, 39673, 39671, 39731, 39808, 39813, 39815, 39804, 39806, 39803, 39810, 39827, 39826, 39824,
- 39802, 39829, 39805, 39816, 40229, 40215, 40224, 40222, 40212, 40233, 40221, 40216, 40226, 40208, 40217, 40223, 40584, 40582, 40583, 40622,
- 40621, 40661, 40662, 40698, 40722, 40765, 20774, 20773, 20770, 20772, 20768, 20777, 21236, 22163, 22156, 22157, 22150, 22148, 22147, 22142,
- 22146, 22143, 22145, 22742, 22740, 22735, 22738, 23341, 23333, 23346, 23331, 23340, 23335, 23334, 23343, 23342, 23419, 23537, 23538, 23991,
- 24172, 24170, 24510, 24507, 25027, 25013, 25020, 25063, 25056, 25061, 25060, 25064, 25054, 25839, 25833, 25827, 25835, 25828, 25832, 25985,
- 25984, 26038, 26074, 26322, 27277, 27286, 27265, 27301, 27273, 27295, 27291, 27297, 27294, 27271, 27283, 27278, 27285, 27267, 27304, 27300,
- 27281, 27263, 27302, 27290, 27269, 27276, 27282, 27483, 27565, 27657, 28620, 28585, 28660, 28628, 28643, 28636, 28653, 28647, 28646, 28638,
- 28658, 28637, 28642, 28648, 29153, 29169, 29160, 29170, 29156, 29168, 29154, 29555, 29550, 29551, 29847, 29874, 29867, 29840, 29866, 29869,
- 29873, 29861, 29871, 29968, 29969, 29970, 29967, 30084, 30275, 30280, 30281, 30279, 30372, 30441, 30645, 30635, 30642, 30647, 30646, 30644,
- 30641, 30632, 30704, 30963, 30973, 30978, 30971, 30972, 30962, 30981, 30969, 30974, 30980, 31147, 31144, 31324, 31323, 31318, 31320, 31316,
- 31322, 31422, 31424, 31425, 31749, 31759, 31730, 31744, 31743, 31739, 31758, 31732, 31755, 31731, 31746, 31753, 31747, 31745, 31736, 31741,
- 31750, 31728, 31729, 31760, 31754, 31976, 32301, 32316, 32322, 32307, 38984, 32312, 32298, 32329, 32320, 32327, 32297, 32332, 32304, 32315,
- 32310, 32324, 32314, 32581, 32639, 32638, 32637, 32756, 32754, 32812, 33211, 33220, 33228, 33226, 33221, 33223, 33212, 33257, 33371, 33370,
- 33372, 34179, 34176, 34191, 34215, 34197, 34208, 34187, 34211, 34171, 34212, 34202, 34206, 34167, 34172, 34185, 34209, 34170, 34168, 34135,
- 34190, 34198, 34182, 34189, 34201, 34205, 34177, 34210, 34178, 34184, 34181, 34169, 34166, 34200, 34192, 34207, 34408, 34750, 34730, 34733,
- 34757, 34736, 34732, 34745, 34741, 34748, 34734, 34761, 34755, 34754, 34764, 34743, 34735, 34756, 34762, 34740, 34742, 34751, 34744, 34749,
- 34782, 34738, 35125, 35123, 35132, 35134, 35137, 35154, 35127, 35138, 35245, 35247, 35246, 35314, 35315, 35614, 35608, 35606, 35601, 35589,
- 35595, 35618, 35599, 35602, 35605, 35591, 35597, 35592, 35590, 35612, 35603, 35610, 35919, 35952, 35954, 35953, 35951, 35989, 35988, 36089,
- 36207, 36430, 36429, 36435, 36432, 36428, 36423, 36675, 36672, 36997, 36990, 37176, 37274, 37282, 37275, 37273, 37279, 37281, 37277, 37280,
- 37793, 37763, 37807, 37732, 37718, 37703, 37756, 37720, 37724, 37750, 37705, 37712, 37713, 37728, 37741, 37775, 37708, 37738, 37753, 37719,
- 37717, 37714, 37711, 37745, 37751, 37755, 37729, 37726, 37731, 37735, 37760, 37710, 37721, 38343, 38336, 38345, 38339, 38341, 38327, 38574,
- 38576, 38572, 38688, 38687, 38680, 38685, 38681, 38810, 38817, 38812, 38814, 38813, 38869, 38868, 38897, 38977, 38980, 38986, 38985, 38981,
- 38979, 39205, 39211, 39212, 39210, 39219, 39218, 39215, 39213, 39217, 39216, 39320, 39331, 39329, 39426, 39418, 39412, 39415, 39417, 39416,
- 39414, 39419, 39421, 39422, 39420, 39427, 39614, 39678, 39677, 39681, 39676, 39752, 39834, 39848, 39838, 39835, 39846, 39841, 39845, 39844,
- 39814, 39842, 39840, 39855, 40243, 40257, 40295, 40246, 40238, 40239, 40241, 40248, 40240, 40261, 40258, 40259, 40254, 40247, 40256, 40253,
- 32757, 40237, 40586, 40585, 40589, 40624, 40648, 40666, 40699, 40703, 40740, 40739, 40738, 40788, 40864, 20785, 20781, 20782, 22168, 22172,
- 22167, 22170, 22173, 22169, 22896, 23356, 23657, 23658, 24000, 24173, 24174, 25048, 25055, 25069, 25070, 25073, 25066, 25072, 25067, 25046,
- 25065, 25855, 25860, 25853, 25848, 25857, 25859, 25852, 26004, 26075, 26330, 26331, 26328, 27333, 27321, 27325, 27361, 27334, 27322, 27318,
- 27319, 27335, 27316, 27309, 27486, 27593, 27659, 28679, 28684, 28685, 28673, 28677, 28692, 28686, 28671, 28672, 28667, 28710, 28668, 28663,
- 28682, 29185, 29183, 29177, 29187, 29181, 29558, 29880, 29888, 29877, 29889, 29886, 29878, 29883, 29890, 29972, 29971, 30300, 30308, 30297,
- 30288, 30291, 30295, 30298, 30374, 30397, 30444, 30658, 30650, 30975, 30988, 30995, 30996, 30985, 30992, 30994, 30993, 31149, 31148, 31327,
- 31772, 31785, 31769, 31776, 31775, 31789, 31773, 31782, 31784, 31778, 31781, 31792, 32348, 32336, 32342, 32355, 32344, 32354, 32351, 32337,
- 32352, 32343, 32339, 32693, 32691, 32759, 32760, 32885, 33233, 33234, 33232, 33375, 33374, 34228, 34246, 34240, 34243, 34242, 34227, 34229,
- 34237, 34247, 34244, 34239, 34251, 34254, 34248, 34245, 34225, 34230, 34258, 34340, 34232, 34231, 34238, 34409, 34791, 34790, 34786, 34779,
- 34795, 34794, 34789, 34783, 34803, 34788, 34772, 34780, 34771, 34797, 34776, 34787, 34724, 34775, 34777, 34817, 34804, 34792, 34781, 35155,
- 35147, 35151, 35148, 35142, 35152, 35153, 35145, 35626, 35623, 35619, 35635, 35632, 35637, 35655, 35631, 35644, 35646, 35633, 35621, 35639,
- 35622, 35638, 35630, 35620, 35643, 35645, 35642, 35906, 35957, 35993, 35992, 35991, 36094, 36100, 36098, 36096, 36444, 36450, 36448, 36439,
- 36438, 36446, 36453, 36455, 36443, 36442, 36449, 36445, 36457, 36436, 36678, 36679, 36680, 36683, 37160, 37178, 37179, 37182, 37288, 37285,
- 37287, 37295, 37290, 37813, 37772, 37778, 37815, 37787, 37789, 37769, 37799, 37774, 37802, 37790, 37798, 37781, 37768, 37785, 37791, 37773,
- 37809, 37777, 37810, 37796, 37800, 37812, 37795, 37797, 38354, 38355, 38353, 38579, 38615, 38618, 24002, 38623, 38616, 38621, 38691, 38690,
- 38693, 38828, 38830, 38824, 38827, 38820, 38826, 38818, 38821, 38871, 38873, 38870, 38872, 38906, 38992, 38993, 38994, 39096, 39233, 39228,
- 39226, 39439, 39435, 39433, 39437, 39428, 39441, 39434, 39429, 39431, 39430, 39616, 39644, 39688, 39684, 39685, 39721, 39733, 39754, 39756,
- 39755, 39879, 39878, 39875, 39871, 39873, 39861, 39864, 39891, 39862, 39876, 39865, 39869, 40284, 40275, 40271, 40266, 40283, 40267, 40281,
- 40278, 40268, 40279, 40274, 40276, 40287, 40280, 40282, 40590, 40588, 40671, 40705, 40704, 40726, 40741, 40747, 40746, 40745, 40744, 40780,
- 40789, 20788, 20789, 21142, 21239, 21428, 22187, 22189, 22182, 22183, 22186, 22188, 22746, 22749, 22747, 22802, 23357, 23358, 23359, 24003,
- 24176, 24511, 25083, 25863, 25872, 25869, 25865, 25868, 25870, 25988, 26078, 26077, 26334, 27367, 27360, 27340, 27345, 27353, 27339, 27359,
- 27356, 27344, 27371, 27343, 27341, 27358, 27488, 27568, 27660, 28697, 28711, 28704, 28694, 28715, 28705, 28706, 28707, 28713, 28695, 28708,
- 28700, 28714, 29196, 29194, 29191, 29186, 29189, 29349, 29350, 29348, 29347, 29345, 29899, 29893, 29879, 29891, 29974, 30304, 30665, 30666,
- 30660, 30705, 31005, 31003, 31009, 31004, 30999, 31006, 31152, 31335, 31336, 31795, 31804, 31801, 31788, 31803, 31980, 31978, 32374, 32373,
- 32376, 32368, 32375, 32367, 32378, 32370, 32372, 32360, 32587, 32586, 32643, 32646, 32695, 32765, 32766, 32888, 33239, 33237, 33380, 33377,
- 33379, 34283, 34289, 34285, 34265, 34273, 34280, 34266, 34263, 34284, 34290, 34296, 34264, 34271, 34275, 34268, 34257, 34288, 34278, 34287,
- 34270, 34274, 34816, 34810, 34819, 34806, 34807, 34825, 34828, 34827, 34822, 34812, 34824, 34815, 34826, 34818, 35170, 35162, 35163, 35159,
- 35169, 35164, 35160, 35165, 35161, 35208, 35255, 35254, 35318, 35664, 35656, 35658, 35648, 35667, 35670, 35668, 35659, 35669, 35665, 35650,
- 35666, 35671, 35907, 35959, 35958, 35994, 36102, 36103, 36105, 36268, 36266, 36269, 36267, 36461, 36472, 36467, 36458, 36463, 36475, 36546,
- 36690, 36689, 36687, 36688, 36691, 36788, 37184, 37183, 37296, 37293, 37854, 37831, 37839, 37826, 37850, 37840, 37881, 37868, 37836, 37849,
- 37801, 37862, 37834, 37844, 37870, 37859, 37845, 37828, 37838, 37824, 37842, 37863, 38269, 38362, 38363, 38625, 38697, 38699, 38700, 38696,
- 38694, 38835, 38839, 38838, 38877, 38878, 38879, 39004, 39001, 39005, 38999, 39103, 39101, 39099, 39102, 39240, 39239, 39235, 39334, 39335,
- 39450, 39445, 39461, 39453, 39460, 39451, 39458, 39456, 39463, 39459, 39454, 39452, 39444, 39618, 39691, 39690, 39694, 39692, 39735, 39914,
- 39915, 39904, 39902, 39908, 39910, 39906, 39920, 39892, 39895, 39916, 39900, 39897, 39909, 39893, 39905, 39898, 40311, 40321, 40330, 40324,
- 40328, 40305, 40320, 40312, 40326, 40331, 40332, 40317, 40299, 40308, 40309, 40304, 40297, 40325, 40307, 40315, 40322, 40303, 40313, 40319,
- 40327, 40296, 40596, 40593, 40640, 40700, 40749, 40768, 40769, 40781, 40790, 40791, 40792, 21303, 22194, 22197, 22195, 22755, 23365, 24006,
- 24007, 24302, 24303, 24512, 24513, 25081, 25879, 25878, 25877, 25875, 26079, 26344, 26339, 26340, 27379, 27376, 27370, 27368, 27385, 27377,
- 27374, 27375, 28732, 28725, 28719, 28727, 28724, 28721, 28738, 28728, 28735, 28730, 28729, 28736, 28731, 28723, 28737, 29203, 29204, 29352,
- 29565, 29564, 29882, 30379, 30378, 30398, 30445, 30668, 30670, 30671, 30669, 30706, 31013, 31011, 31015, 31016, 31012, 31017, 31154, 31342,
- 31340, 31341, 31479, 31817, 31816, 31818, 31815, 31813, 31982, 32379, 32382, 32385, 32384, 32698, 32767, 32889, 33243, 33241, 33291, 33384,
- 33385, 34338, 34303, 34305, 34302, 34331, 34304, 34294, 34308, 34313, 34309, 34316, 34301, 34841, 34832, 34833, 34839, 34835, 34838, 35171,
- 35174, 35257, 35319, 35680, 35690, 35677, 35688, 35683, 35685, 35687, 35693, 36270, 36486, 36488, 36484, 36697, 36694, 36695, 36693, 36696,
- 36698, 37005, 37187, 37185, 37303, 37301, 37298, 37299, 37899, 37907, 37883, 37920, 37903, 37908, 37886, 37909, 37904, 37928, 37913, 37901,
- 37877, 37888, 37879, 37895, 37902, 37910, 37906, 37882, 37897, 37880, 37898, 37887, 37884, 37900, 37878, 37905, 37894, 38366, 38368, 38367,
- 38702, 38703, 38841, 38843, 38909, 38910, 39008, 39010, 39011, 39007, 39105, 39106, 39248, 39246, 39257, 39244, 39243, 39251, 39474, 39476,
- 39473, 39468, 39466, 39478, 39465, 39470, 39480, 39469, 39623, 39626, 39622, 39696, 39698, 39697, 39947, 39944, 39927, 39941, 39954, 39928,
- 40000, 39943, 39950, 39942, 39959, 39956, 39945, 40351, 40345, 40356, 40349, 40338, 40344, 40336, 40347, 40352, 40340, 40348, 40362, 40343,
- 40353, 40346, 40354, 40360, 40350, 40355, 40383, 40361, 40342, 40358, 40359, 40601, 40603, 40602, 40677, 40676, 40679, 40678, 40752, 40750,
- 40795, 40800, 40798, 40797, 40793, 40849, 20794, 20793, 21144, 21143, 22211, 22205, 22206, 23368, 23367, 24011, 24015, 24305, 25085, 25883,
- 27394, 27388, 27395, 27384, 27392, 28739, 28740, 28746, 28744, 28745, 28741, 28742, 29213, 29210, 29209, 29566, 29975, 30314, 30672, 31021,
- 31025, 31023, 31828, 31827, 31986, 32394, 32391, 32392, 32395, 32390, 32397, 32589, 32699, 32816, 33245, 34328, 34346, 34342, 34335, 34339,
- 34332, 34329, 34343, 34350, 34337, 34336, 34345, 34334, 34341, 34857, 34845, 34843, 34848, 34852, 34844, 34859, 34890, 35181, 35177, 35182,
- 35179, 35322, 35705, 35704, 35653, 35706, 35707, 36112, 36116, 36271, 36494, 36492, 36702, 36699, 36701, 37190, 37188, 37189, 37305, 37951,
- 37947, 37942, 37929, 37949, 37948, 37936, 37945, 37930, 37943, 37932, 37952, 37937, 38373, 38372, 38371, 38709, 38714, 38847, 38881, 39012,
- 39113, 39110, 39104, 39256, 39254, 39481, 39485, 39494, 39492, 39490, 39489, 39482, 39487, 39629, 39701, 39703, 39704, 39702, 39738, 39762,
- 39979, 39965, 39964, 39980, 39971, 39976, 39977, 39972, 39969, 40375, 40374, 40380, 40385, 40391, 40394, 40399, 40382, 40389, 40387, 40379,
- 40373, 40398, 40377, 40378, 40364, 40392, 40369, 40365, 40396, 40371, 40397, 40370, 40570, 40604, 40683, 40686, 40685, 40731, 40728, 40730,
- 40753, 40782, 40805, 40804, 40850, 20153, 22214, 22213, 22219, 22897, 23371, 23372, 24021, 24017, 24306, 25889, 25888, 25894, 25890, 27403,
- 27400, 27401, 27661, 28757, 28758, 28759, 28754, 29214, 29215, 29353, 29567, 29912, 29909, 29913, 29911, 30317, 30381, 31029, 31156, 31344,
- 31345, 31831, 31836, 31833, 31835, 31834, 31988, 31985, 32401, 32591, 32647, 33246, 33387, 34356, 34357, 34355, 34348, 34354, 34358, 34860,
- 34856, 34854, 34858, 34853, 35185, 35263, 35262, 35323, 35710, 35716, 35714, 35718, 35717, 35711, 36117, 36501, 36500, 36506, 36498, 36496,
- 36502, 36503, 36704, 36706, 37191, 37964, 37968, 37962, 37963, 37967, 37959, 37957, 37960, 37961, 37958, 38719, 38883, 39018, 39017, 39115,
- 39252, 39259, 39502, 39507, 39508, 39500, 39503, 39496, 39498, 39497, 39506, 39504, 39632, 39705, 39723, 39739, 39766, 39765, 40006, 40008,
- 39999, 40004, 39993, 39987, 40001, 39996, 39991, 39988, 39986, 39997, 39990, 40411, 40402, 40414, 40410, 40395, 40400, 40412, 40401, 40415,
- 40425, 40409, 40408, 40406, 40437, 40405, 40413, 40630, 40688, 40757, 40755, 40754, 40770, 40811, 40853, 40866, 20797, 21145, 22760, 22759,
- 22898, 23373, 24024, 34863, 24399, 25089, 25091, 25092, 25897, 25893, 26006, 26347, 27409, 27410, 27407, 27594, 28763, 28762, 29218, 29570,
- 29569, 29571, 30320, 30676, 31847, 31846, 32405, 33388, 34362, 34368, 34361, 34364, 34353, 34363, 34366, 34864, 34866, 34862, 34867, 35190,
- 35188, 35187, 35326, 35724, 35726, 35723, 35720, 35909, 36121, 36504, 36708, 36707, 37308, 37986, 37973, 37981, 37975, 37982, 38852, 38853,
- 38912, 39510, 39513, 39710, 39711, 39712, 40018, 40024, 40016, 40010, 40013, 40011, 40021, 40025, 40012, 40014, 40443, 40439, 40431, 40419,
- 40427, 40440, 40420, 40438, 40417, 40430, 40422, 40434, 40432, 40418, 40428, 40436, 40435, 40424, 40429, 40642, 40656, 40690, 40691, 40710,
- 40732, 40760, 40759, 40758, 40771, 40783, 40817, 40816, 40814, 40815, 22227, 22221, 23374, 23661, 25901, 26349, 26350, 27411, 28767, 28769,
- 28765, 28768, 29219, 29915, 29925, 30677, 31032, 31159, 31158, 31850, 32407, 32649, 33389, 34371, 34872, 34871, 34869, 34891, 35732, 35733,
- 36510, 36511, 36512, 36509, 37310, 37309, 37314, 37995, 37992, 37993, 38629, 38726, 38723, 38727, 38855, 38885, 39518, 39637, 39769, 40035,
- 40039, 40038, 40034, 40030, 40032, 40450, 40446, 40455, 40451, 40454, 40453, 40448, 40449, 40457, 40447, 40445, 40452, 40608, 40734, 40774,
- 40820, 40821, 40822, 22228, 25902, 26040, 27416, 27417, 27415, 27418, 28770, 29222, 29354, 30680, 30681, 31033, 31849, 31851, 31990, 32410,
- 32408, 32411, 32409, 33248, 33249, 34374, 34375, 34376, 35193, 35194, 35196, 35195, 35327, 35736, 35737, 36517, 36516, 36515, 37998, 37997,
- 37999, 38001, 38003, 38729, 39026, 39263, 40040, 40046, 40045, 40459, 40461, 40464, 40463, 40466, 40465, 40609, 40693, 40713, 40775, 40824,
- 40827, 40826, 40825, 22302, 28774, 31855, 34876, 36274, 36518, 37315, 38004, 38008, 38006, 38005, 39520, 40052, 40051, 40049, 40053, 40468,
- 40467, 40694, 40714, 40868, 28776, 28773, 31991, 34410, 34878, 34877, 34879, 35742, 35996, 36521, 36553, 38731, 39027, 39028, 39116, 39265,
- 39339, 39524, 39526, 39527, 39716, 40469, 40471, 40776, 25095, 27422, 29223, 34380, 36520, 38018, 38016, 38017, 39529, 39528, 39726, 40473,
- 29225, 34379, 35743, 38019, 40057, 40631, 30325, 39531, 40058, 40477, 28777, 28778, 40612, 40830, 40777, 40856, 30849, 37561, 35023, 22715,
- 24658, 31911, 23290, 9556, 9574, 9559, 9568, 9580, 9571, 9562, 9577, 9565, 9554, 9572, 9557, 9566, 9578, 9569, 9560, 9575,
- 9563, 9555, 9573, 9558, 9567, 9579, 9570, 9561, 9576, 9564, 9553, 9552, 9581, 9582, 9584, 9583, 65517, 132423, 37595, 132575,
- 147397, 34124, 17077, 29679, 20917, 13897, 149826, 166372, 37700, 137691, 33518, 146632, 30780, 26436, 25311, 149811, 166314, 131744, 158643, 135941,
- 20395, 140525, 20488, 159017, 162436, 144896, 150193, 140563, 20521, 131966, 24484, 131968, 131911, 28379, 132127, 20605, 20737, 13434, 20750, 39020,
- 14147, 33814, 149924, 132231, 20832, 144308, 20842, 134143, 139516, 131813, 140592, 132494, 143923, 137603, 23426, 34685, 132531, 146585, 20914, 20920,
- 40244, 20937, 20943, 20945, 15580, 20947, 150182, 20915, 20962, 21314, 20973, 33741, 26942, 145197, 24443, 21003, 21030, 21052, 21173, 21079,
- 21140, 21177, 21189, 31765, 34114, 21216, 34317, 158483, 21253, 166622, 21833, 28377, 147328, 133460, 147436, 21299, 21316, 134114, 27851, 136998,
- 26651, 29653, 24650, 16042, 14540, 136936, 29149, 17570, 21357, 21364, 165547, 21374, 21375, 136598, 136723, 30694, 21395, 166555, 21408, 21419,
- 21422, 29607, 153458, 16217, 29596, 21441, 21445, 27721, 20041, 22526, 21465, 15019, 134031, 21472, 147435, 142755, 21494, 134263, 21523, 28793,
- 21803, 26199, 27995, 21613, 158547, 134516, 21853, 21647, 21668, 18342, 136973, 134877, 15796, 134477, 166332, 140952, 21831, 19693, 21551, 29719,
- 21894, 21929, 22021, 137431, 147514, 17746, 148533, 26291, 135348, 22071, 26317, 144010, 26276, 26285, 22093, 22095, 30961, 22257, 38791, 21502,
- 22272, 22255, 22253, 166758, 13859, 135759, 22342, 147877, 27758, 28811, 22338, 14001, 158846, 22502, 136214, 22531, 136276, 148323, 22566, 150517,
- 22620, 22698, 13665, 22752, 22748, 135740, 22779, 23551, 22339, 172368, 148088, 37843, 13729, 22815, 26790, 14019, 28249, 136766, 23076, 21843,
- 136850, 34053, 22985, 134478, 158849, 159018, 137180, 23001, 137211, 137138, 159142, 28017, 137256, 136917, 23033, 159301, 23211, 23139, 14054, 149929,
- 23159, 14088, 23190, 29797, 23251, 159649, 140628, 15749, 137489, 14130, 136888, 24195, 21200, 23414, 25992, 23420, 162318, 16388, 18525, 131588,
- 23509, 24928, 137780, 154060, 132517, 23539, 23453, 19728, 23557, 138052, 23571, 29646, 23572, 138405, 158504, 23625, 18653, 23685, 23785, 23791,
- 23947, 138745, 138807, 23824, 23832, 23878, 138916, 23738, 24023, 33532, 14381, 149761, 139337, 139635, 33415, 14390, 15298, 24110, 27274, 24181,
- 24186, 148668, 134355, 21414, 20151, 24272, 21416, 137073, 24073, 24308, 164994, 24313, 24315, 14496, 24316, 26686, 37915, 24333, 131521, 194708,
- 15070, 18606, 135994, 24378, 157832, 140240, 24408, 140401, 24419, 38845, 159342, 24434, 37696, 166454, 24487, 23990, 15711, 152144, 139114, 159992,
- 140904, 37334, 131742, 166441, 24625, 26245, 137335, 14691, 15815, 13881, 22416, 141236, 31089, 15936, 24734, 24740, 24755, 149890, 149903, 162387,
- 29860, 20705, 23200, 24932, 33828, 24898, 194726, 159442, 24961, 20980, 132694, 24967, 23466, 147383, 141407, 25043, 166813, 170333, 25040, 14642,
- 141696, 141505, 24611, 24924, 25886, 25483, 131352, 25285, 137072, 25301, 142861, 25452, 149983, 14871, 25656, 25592, 136078, 137212, 25744, 28554,
- 142902, 38932, 147596, 153373, 25825, 25829, 38011, 14950, 25658, 14935, 25933, 28438, 150056, 150051, 25989, 25965, 25951, 143486, 26037, 149824,
- 19255, 26065, 16600, 137257, 26080, 26083, 24543, 144384, 26136, 143863, 143864, 26180, 143780, 143781, 26187, 134773, 26215, 152038, 26227, 26228,
- 138813, 143921, 165364, 143816, 152339, 30661, 141559, 39332, 26370, 148380, 150049, 15147, 27130, 145346, 26462, 26471, 26466, 147917, 168173, 26583,
- 17641, 26658, 28240, 37436, 26625, 144358, 159136, 26717, 144495, 27105, 27147, 166623, 26995, 26819, 144845, 26881, 26880, 15666, 14849, 144956,
- 15232, 26540, 26977, 166474, 17148, 26934, 27032, 15265, 132041, 33635, 20624, 27129, 144985, 139562, 27205, 145155, 27293, 15347, 26545, 27336,
- 168348, 15373, 27421, 133411, 24798, 27445, 27508, 141261, 28341, 146139, 132021, 137560, 14144, 21537, 146266, 27617, 147196, 27612, 27703, 140427,
- 149745, 158545, 27738, 33318, 27769, 146876, 17605, 146877, 147876, 149772, 149760, 146633, 14053, 15595, 134450, 39811, 143865, 140433, 32655, 26679,
- 159013, 159137, 159211, 28054, 27996, 28284, 28420, 149887, 147589, 159346, 34099, 159604, 20935, 27804, 28189, 33838, 166689, 28207, 146991, 29779,
- 147330, 31180, 28239, 23185, 143435, 28664, 14093, 28573, 146992, 28410, 136343, 147517, 17749, 37872, 28484, 28508, 15694, 28532, 168304, 15675,
- 28575, 147780, 28627, 147601, 147797, 147513, 147440, 147380, 147775, 20959, 147798, 147799, 147776, 156125, 28747, 28798, 28839, 28801, 28876, 28885,
- 28886, 28895, 16644, 15848, 29108, 29078, 148087, 28971, 28997, 23176, 29002, 29038, 23708, 148325, 29007, 37730, 148161, 28972, 148570, 150055,
- 150050, 29114, 166888, 28861, 29198, 37954, 29205, 22801, 37955, 29220, 37697, 153093, 29230, 29248, 149876, 26813, 29269, 29271, 15957, 143428,
- 26637, 28477, 29314, 29482, 29483, 149539, 165931, 18669, 165892, 29480, 29486, 29647, 29610, 134202, 158254, 29641, 29769, 147938, 136935, 150052,
- 26147, 14021, 149943, 149901, 150011, 29687, 29717, 26883, 150054, 29753, 132547, 16087, 29788, 141485, 29792, 167602, 29767, 29668, 29814, 33721,
- 29804, 14128, 29812, 37873, 27180, 29826, 18771, 150156, 147807, 150137, 166799, 23366, 166915, 137374, 29896, 137608, 29966, 29929, 29982, 167641,
- 137803, 23511, 167596, 37765, 30029, 30026, 30055, 30062, 151426, 16132, 150803, 30094, 29789, 30110, 30132, 30210, 30252, 30289, 30287, 30319,
- 30326, 156661, 30352, 33263, 14328, 157969, 157966, 30369, 30373, 30391, 30412, 159647, 33890, 151709, 151933, 138780, 30494, 30502, 30528, 25775,
- 152096, 30552, 144044, 30639, 166244, 166248, 136897, 30708, 30729, 136054, 150034, 26826, 30895, 30919, 30931, 38565, 31022, 153056, 30935, 31028,
- 30897, 161292, 36792, 34948, 166699, 155779, 140828, 31110, 35072, 26882, 31104, 153687, 31133, 162617, 31036, 31145, 28202, 160038, 16040, 31174,
- 168205, 31188,
- ]);
-
- // deno-fmt-ignore
- encodingIndexes.set("gb18030", [
- 19970, 19972, 19973, 19974, 19983, 19986, 19991, 19999, 20000, 20001, 20003, 20006, 20009, 20014, 20015,
- 20017, 20019, 20021, 20023, 20028, 20032, 20033, 20034, 20036, 20038, 20042, 20049, 20053, 20055, 20058,
- 20059, 20066, 20067, 20068, 20069, 20071, 20072, 20074, 20075, 20076, 20077, 20078, 20079, 20082, 20084,
- 20085, 20086, 20087, 20088, 20089, 20090, 20091, 20092, 20093, 20095, 20096, 20097, 20098, 20099, 20100,
- 20101, 20103, 20106, 20112, 20118, 20119, 20121, 20124, 20125, 20126, 20131, 20138, 20143, 20144, 20145,
- 20148, 20150, 20151, 20152, 20153, 20156, 20157, 20158, 20168, 20172, 20175, 20176, 20178, 20186, 20187,
- 20188, 20192, 20194, 20198, 20199, 20201, 20205, 20206, 20207, 20209, 20212, 20216, 20217, 20218, 20220,
- 20222, 20224, 20226, 20227, 20228, 20229, 20230, 20231, 20232, 20235, 20236, 20242, 20243, 20244, 20245,
- 20246, 20252, 20253, 20257, 20259, 20264, 20265, 20268, 20269, 20270, 20273, 20275, 20277, 20279, 20281,
- 20283, 20286, 20287, 20288, 20289, 20290, 20292, 20293, 20295, 20296, 20297, 20298, 20299, 20300, 20306,
- 20308, 20310, 20321, 20322, 20326, 20328, 20330, 20331, 20333, 20334, 20337, 20338, 20341, 20343, 20344,
- 20345, 20346, 20349, 20352, 20353, 20354, 20357, 20358, 20359, 20362, 20364, 20366, 20368, 20370, 20371,
- 20373, 20374, 20376, 20377, 20378, 20380, 20382, 20383, 20385, 20386, 20388, 20395, 20397, 20400, 20401,
- 20402, 20403, 20404, 20406, 20407, 20408, 20409, 20410, 20411, 20412, 20413, 20414, 20416, 20417, 20418,
- 20422, 20423, 20424, 20425, 20427, 20428, 20429, 20434, 20435, 20436, 20437, 20438, 20441, 20443, 20448,
- 20450, 20452, 20453, 20455, 20459, 20460, 20464, 20466, 20468, 20469, 20470, 20471, 20473, 20475, 20476,
- 20477, 20479, 20480, 20481, 20482, 20483, 20484, 20485, 20486, 20487, 20488, 20489, 20490, 20491, 20494,
- 20496, 20497, 20499, 20501, 20502, 20503, 20507, 20509, 20510, 20512, 20514, 20515, 20516, 20519, 20523,
- 20527, 20528, 20529, 20530, 20531, 20532, 20533, 20534, 20535, 20536, 20537, 20539, 20541, 20543, 20544,
- 20545, 20546, 20548, 20549, 20550, 20553, 20554, 20555, 20557, 20560, 20561, 20562, 20563, 20564, 20566,
- 20567, 20568, 20569, 20571, 20573, 20574, 20575, 20576, 20577, 20578, 20579, 20580, 20582, 20583, 20584,
- 20585, 20586, 20587, 20589, 20590, 20591, 20592, 20593, 20594, 20595, 20596, 20597, 20600, 20601, 20602,
- 20604, 20605, 20609, 20610, 20611, 20612, 20614, 20615, 20617, 20618, 20619, 20620, 20622, 20623, 20624,
- 20625, 20626, 20627, 20628, 20629, 20630, 20631, 20632, 20633, 20634, 20635, 20636, 20637, 20638, 20639,
- 20640, 20641, 20642, 20644, 20646, 20650, 20651, 20653, 20654, 20655, 20656, 20657, 20659, 20660, 20661,
- 20662, 20663, 20664, 20665, 20668, 20669, 20670, 20671, 20672, 20673, 20674, 20675, 20676, 20677, 20678,
- 20679, 20680, 20681, 20682, 20683, 20684, 20685, 20686, 20688, 20689, 20690, 20691, 20692, 20693, 20695,
- 20696, 20697, 20699, 20700, 20701, 20702, 20703, 20704, 20705, 20706, 20707, 20708, 20709, 20712, 20713,
- 20714, 20715, 20719, 20720, 20721, 20722, 20724, 20726, 20727, 20728, 20729, 20730, 20732, 20733, 20734,
- 20735, 20736, 20737, 20738, 20739, 20740, 20741, 20744, 20745, 20746, 20748, 20749, 20750, 20751, 20752,
- 20753, 20755, 20756, 20757, 20758, 20759, 20760, 20761, 20762, 20763, 20764, 20765, 20766, 20767, 20768,
- 20770, 20771, 20772, 20773, 20774, 20775, 20776, 20777, 20778, 20779, 20780, 20781, 20782, 20783, 20784,
- 20785, 20786, 20787, 20788, 20789, 20790, 20791, 20792, 20793, 20794, 20795, 20796, 20797, 20798, 20802,
- 20807, 20810, 20812, 20814, 20815, 20816, 20818, 20819, 20823, 20824, 20825, 20827, 20829, 20830, 20831,
- 20832, 20833, 20835, 20836, 20838, 20839, 20841, 20842, 20847, 20850, 20858, 20862, 20863, 20867, 20868,
- 20870, 20871, 20874, 20875, 20878, 20879, 20880, 20881, 20883, 20884, 20888, 20890, 20893, 20894, 20895,
- 20897, 20899, 20902, 20903, 20904, 20905, 20906, 20909, 20910, 20916, 20920, 20921, 20922, 20926, 20927,
- 20929, 20930, 20931, 20933, 20936, 20938, 20941, 20942, 20944, 20946, 20947, 20948, 20949, 20950, 20951,
- 20952, 20953, 20954, 20956, 20958, 20959, 20962, 20963, 20965, 20966, 20967, 20968, 20969, 20970, 20972,
- 20974, 20977, 20978, 20980, 20983, 20990, 20996, 20997, 21001, 21003, 21004, 21007, 21008, 21011, 21012,
- 21013, 21020, 21022, 21023, 21025, 21026, 21027, 21029, 21030, 21031, 21034, 21036, 21039, 21041, 21042,
- 21044, 21045, 21052, 21054, 21060, 21061, 21062, 21063, 21064, 21065, 21067, 21070, 21071, 21074, 21075,
- 21077, 21079, 21080, 21081, 21082, 21083, 21085, 21087, 21088, 21090, 21091, 21092, 21094, 21096, 21099,
- 21100, 21101, 21102, 21104, 21105, 21107, 21108, 21109, 21110, 21111, 21112, 21113, 21114, 21115, 21116,
- 21118, 21120, 21123, 21124, 21125, 21126, 21127, 21129, 21130, 21131, 21132, 21133, 21134, 21135, 21137,
- 21138, 21140, 21141, 21142, 21143, 21144, 21145, 21146, 21148, 21156, 21157, 21158, 21159, 21166, 21167,
- 21168, 21172, 21173, 21174, 21175, 21176, 21177, 21178, 21179, 21180, 21181, 21184, 21185, 21186, 21188,
- 21189, 21190, 21192, 21194, 21196, 21197, 21198, 21199, 21201, 21203, 21204, 21205, 21207, 21209, 21210,
- 21211, 21212, 21213, 21214, 21216, 21217, 21218, 21219, 21221, 21222, 21223, 21224, 21225, 21226, 21227,
- 21228, 21229, 21230, 21231, 21233, 21234, 21235, 21236, 21237, 21238, 21239, 21240, 21243, 21244, 21245,
- 21249, 21250, 21251, 21252, 21255, 21257, 21258, 21259, 21260, 21262, 21265, 21266, 21267, 21268, 21272,
- 21275, 21276, 21278, 21279, 21282, 21284, 21285, 21287, 21288, 21289, 21291, 21292, 21293, 21295, 21296,
- 21297, 21298, 21299, 21300, 21301, 21302, 21303, 21304, 21308, 21309, 21312, 21314, 21316, 21318, 21323,
- 21324, 21325, 21328, 21332, 21336, 21337, 21339, 21341, 21349, 21352, 21354, 21356, 21357, 21362, 21366,
- 21369, 21371, 21372, 21373, 21374, 21376, 21377, 21379, 21383, 21384, 21386, 21390, 21391, 21392, 21393,
- 21394, 21395, 21396, 21398, 21399, 21401, 21403, 21404, 21406, 21408, 21409, 21412, 21415, 21418, 21419,
- 21420, 21421, 21423, 21424, 21425, 21426, 21427, 21428, 21429, 21431, 21432, 21433, 21434, 21436, 21437,
- 21438, 21440, 21443, 21444, 21445, 21446, 21447, 21454, 21455, 21456, 21458, 21459, 21461, 21466, 21468,
- 21469, 21470, 21473, 21474, 21479, 21492, 21498, 21502, 21503, 21504, 21506, 21509, 21511, 21515, 21524,
- 21528, 21529, 21530, 21532, 21538, 21540, 21541, 21546, 21552, 21555, 21558, 21559, 21562, 21565, 21567,
- 21569, 21570, 21572, 21573, 21575, 21577, 21580, 21581, 21582, 21583, 21585, 21594, 21597, 21598, 21599,
- 21600, 21601, 21603, 21605, 21607, 21609, 21610, 21611, 21612, 21613, 21614, 21615, 21616, 21620, 21625,
- 21626, 21630, 21631, 21633, 21635, 21637, 21639, 21640, 21641, 21642, 21645, 21649, 21651, 21655, 21656,
- 21660, 21662, 21663, 21664, 21665, 21666, 21669, 21678, 21680, 21682, 21685, 21686, 21687, 21689, 21690,
- 21692, 21694, 21699, 21701, 21706, 21707, 21718, 21720, 21723, 21728, 21729, 21730, 21731, 21732, 21739,
- 21740, 21743, 21744, 21745, 21748, 21749, 21750, 21751, 21752, 21753, 21755, 21758, 21760, 21762, 21763,
- 21764, 21765, 21768, 21770, 21771, 21772, 21773, 21774, 21778, 21779, 21781, 21782, 21783, 21784, 21785,
- 21786, 21788, 21789, 21790, 21791, 21793, 21797, 21798, 21800, 21801, 21803, 21805, 21810, 21812, 21813,
- 21814, 21816, 21817, 21818, 21819, 21821, 21824, 21826, 21829, 21831, 21832, 21835, 21836, 21837, 21838,
- 21839, 21841, 21842, 21843, 21844, 21847, 21848, 21849, 21850, 21851, 21853, 21854, 21855, 21856, 21858,
- 21859, 21864, 21865, 21867, 21871, 21872, 21873, 21874, 21875, 21876, 21881, 21882, 21885, 21887, 21893,
- 21894, 21900, 21901, 21902, 21904, 21906, 21907, 21909, 21910, 21911, 21914, 21915, 21918, 21920, 21921,
- 21922, 21923, 21924, 21925, 21926, 21928, 21929, 21930, 21931, 21932, 21933, 21934, 21935, 21936, 21938,
- 21940, 21942, 21944, 21946, 21948, 21951, 21952, 21953, 21954, 21955, 21958, 21959, 21960, 21962, 21963,
- 21966, 21967, 21968, 21973, 21975, 21976, 21977, 21978, 21979, 21982, 21984, 21986, 21991, 21993, 21997,
- 21998, 22000, 22001, 22004, 22006, 22008, 22009, 22010, 22011, 22012, 22015, 22018, 22019, 22020, 22021,
- 22022, 22023, 22026, 22027, 22029, 22032, 22033, 22034, 22035, 22036, 22037, 22038, 22039, 22041, 22042,
- 22044, 22045, 22048, 22049, 22050, 22053, 22054, 22056, 22057, 22058, 22059, 22062, 22063, 22064, 22067,
- 22069, 22071, 22072, 22074, 22076, 22077, 22078, 22080, 22081, 22082, 22083, 22084, 22085, 22086, 22087,
- 22088, 22089, 22090, 22091, 22095, 22096, 22097, 22098, 22099, 22101, 22102, 22106, 22107, 22109, 22110,
- 22111, 22112, 22113, 22115, 22117, 22118, 22119, 22125, 22126, 22127, 22128, 22130, 22131, 22132, 22133,
- 22135, 22136, 22137, 22138, 22141, 22142, 22143, 22144, 22145, 22146, 22147, 22148, 22151, 22152, 22153,
- 22154, 22155, 22156, 22157, 22160, 22161, 22162, 22164, 22165, 22166, 22167, 22168, 22169, 22170, 22171,
- 22172, 22173, 22174, 22175, 22176, 22177, 22178, 22180, 22181, 22182, 22183, 22184, 22185, 22186, 22187,
- 22188, 22189, 22190, 22192, 22193, 22194, 22195, 22196, 22197, 22198, 22200, 22201, 22202, 22203, 22205,
- 22206, 22207, 22208, 22209, 22210, 22211, 22212, 22213, 22214, 22215, 22216, 22217, 22219, 22220, 22221,
- 22222, 22223, 22224, 22225, 22226, 22227, 22229, 22230, 22232, 22233, 22236, 22243, 22245, 22246, 22247,
- 22248, 22249, 22250, 22252, 22254, 22255, 22258, 22259, 22262, 22263, 22264, 22267, 22268, 22272, 22273,
- 22274, 22277, 22279, 22283, 22284, 22285, 22286, 22287, 22288, 22289, 22290, 22291, 22292, 22293, 22294,
- 22295, 22296, 22297, 22298, 22299, 22301, 22302, 22304, 22305, 22306, 22308, 22309, 22310, 22311, 22315,
- 22321, 22322, 22324, 22325, 22326, 22327, 22328, 22332, 22333, 22335, 22337, 22339, 22340, 22341, 22342,
- 22344, 22345, 22347, 22354, 22355, 22356, 22357, 22358, 22360, 22361, 22370, 22371, 22373, 22375, 22380,
- 22382, 22384, 22385, 22386, 22388, 22389, 22392, 22393, 22394, 22397, 22398, 22399, 22400, 22401, 22407,
- 22408, 22409, 22410, 22413, 22414, 22415, 22416, 22417, 22420, 22421, 22422, 22423, 22424, 22425, 22426,
- 22428, 22429, 22430, 22431, 22437, 22440, 22442, 22444, 22447, 22448, 22449, 22451, 22453, 22454, 22455,
- 22457, 22458, 22459, 22460, 22461, 22462, 22463, 22464, 22465, 22468, 22469, 22470, 22471, 22472, 22473,
- 22474, 22476, 22477, 22480, 22481, 22483, 22486, 22487, 22491, 22492, 22494, 22497, 22498, 22499, 22501,
- 22502, 22503, 22504, 22505, 22506, 22507, 22508, 22510, 22512, 22513, 22514, 22515, 22517, 22518, 22519,
- 22523, 22524, 22526, 22527, 22529, 22531, 22532, 22533, 22536, 22537, 22538, 22540, 22542, 22543, 22544,
- 22546, 22547, 22548, 22550, 22551, 22552, 22554, 22555, 22556, 22557, 22559, 22562, 22563, 22565, 22566,
- 22567, 22568, 22569, 22571, 22572, 22573, 22574, 22575, 22577, 22578, 22579, 22580, 22582, 22583, 22584,
- 22585, 22586, 22587, 22588, 22589, 22590, 22591, 22592, 22593, 22594, 22595, 22597, 22598, 22599, 22600,
- 22601, 22602, 22603, 22606, 22607, 22608, 22610, 22611, 22613, 22614, 22615, 22617, 22618, 22619, 22620,
- 22621, 22623, 22624, 22625, 22626, 22627, 22628, 22630, 22631, 22632, 22633, 22634, 22637, 22638, 22639,
- 22640, 22641, 22642, 22643, 22644, 22645, 22646, 22647, 22648, 22649, 22650, 22651, 22652, 22653, 22655,
- 22658, 22660, 22662, 22663, 22664, 22666, 22667, 22668, 22669, 22670, 22671, 22672, 22673, 22676, 22677,
- 22678, 22679, 22680, 22683, 22684, 22685, 22688, 22689, 22690, 22691, 22692, 22693, 22694, 22695, 22698,
- 22699, 22700, 22701, 22702, 22703, 22704, 22705, 22706, 22707, 22708, 22709, 22710, 22711, 22712, 22713,
- 22714, 22715, 22717, 22718, 22719, 22720, 22722, 22723, 22724, 22726, 22727, 22728, 22729, 22730, 22731,
- 22732, 22733, 22734, 22735, 22736, 22738, 22739, 22740, 22742, 22743, 22744, 22745, 22746, 22747, 22748,
- 22749, 22750, 22751, 22752, 22753, 22754, 22755, 22757, 22758, 22759, 22760, 22761, 22762, 22765, 22767,
- 22769, 22770, 22772, 22773, 22775, 22776, 22778, 22779, 22780, 22781, 22782, 22783, 22784, 22785, 22787,
- 22789, 22790, 22792, 22793, 22794, 22795, 22796, 22798, 22800, 22801, 22802, 22803, 22807, 22808, 22811,
- 22813, 22814, 22816, 22817, 22818, 22819, 22822, 22824, 22828, 22832, 22834, 22835, 22837, 22838, 22843,
- 22845, 22846, 22847, 22848, 22851, 22853, 22854, 22858, 22860, 22861, 22864, 22866, 22867, 22873, 22875,
- 22876, 22877, 22878, 22879, 22881, 22883, 22884, 22886, 22887, 22888, 22889, 22890, 22891, 22892, 22893,
- 22894, 22895, 22896, 22897, 22898, 22901, 22903, 22906, 22907, 22908, 22910, 22911, 22912, 22917, 22921,
- 22923, 22924, 22926, 22927, 22928, 22929, 22932, 22933, 22936, 22938, 22939, 22940, 22941, 22943, 22944,
- 22945, 22946, 22950, 22951, 22956, 22957, 22960, 22961, 22963, 22964, 22965, 22966, 22967, 22968, 22970,
- 22972, 22973, 22975, 22976, 22977, 22978, 22979, 22980, 22981, 22983, 22984, 22985, 22988, 22989, 22990,
- 22991, 22997, 22998, 23001, 23003, 23006, 23007, 23008, 23009, 23010, 23012, 23014, 23015, 23017, 23018,
- 23019, 23021, 23022, 23023, 23024, 23025, 23026, 23027, 23028, 23029, 23030, 23031, 23032, 23034, 23036,
- 23037, 23038, 23040, 23042, 23050, 23051, 23053, 23054, 23055, 23056, 23058, 23060, 23061, 23062, 23063,
- 23065, 23066, 23067, 23069, 23070, 23073, 23074, 23076, 23078, 23079, 23080, 23082, 23083, 23084, 23085,
- 23086, 23087, 23088, 23091, 23093, 23095, 23096, 23097, 23098, 23099, 23101, 23102, 23103, 23105, 23106,
- 23107, 23108, 23109, 23111, 23112, 23115, 23116, 23117, 23118, 23119, 23120, 23121, 23122, 23123, 23124,
- 23126, 23127, 23128, 23129, 23131, 23132, 23133, 23134, 23135, 23136, 23137, 23139, 23140, 23141, 23142,
- 23144, 23145, 23147, 23148, 23149, 23150, 23151, 23152, 23153, 23154, 23155, 23160, 23161, 23163, 23164,
- 23165, 23166, 23168, 23169, 23170, 23171, 23172, 23173, 23174, 23175, 23176, 23177, 23178, 23179, 23180,
- 23181, 23182, 23183, 23184, 23185, 23187, 23188, 23189, 23190, 23191, 23192, 23193, 23196, 23197, 23198,
- 23199, 23200, 23201, 23202, 23203, 23204, 23205, 23206, 23207, 23208, 23209, 23211, 23212, 23213, 23214,
- 23215, 23216, 23217, 23220, 23222, 23223, 23225, 23226, 23227, 23228, 23229, 23231, 23232, 23235, 23236,
- 23237, 23238, 23239, 23240, 23242, 23243, 23245, 23246, 23247, 23248, 23249, 23251, 23253, 23255, 23257,
- 23258, 23259, 23261, 23262, 23263, 23266, 23268, 23269, 23271, 23272, 23274, 23276, 23277, 23278, 23279,
- 23280, 23282, 23283, 23284, 23285, 23286, 23287, 23288, 23289, 23290, 23291, 23292, 23293, 23294, 23295,
- 23296, 23297, 23298, 23299, 23300, 23301, 23302, 23303, 23304, 23306, 23307, 23308, 23309, 23310, 23311,
- 23312, 23313, 23314, 23315, 23316, 23317, 23320, 23321, 23322, 23323, 23324, 23325, 23326, 23327, 23328,
- 23329, 23330, 23331, 23332, 23333, 23334, 23335, 23336, 23337, 23338, 23339, 23340, 23341, 23342, 23343,
- 23344, 23345, 23347, 23349, 23350, 23352, 23353, 23354, 23355, 23356, 23357, 23358, 23359, 23361, 23362,
- 23363, 23364, 23365, 23366, 23367, 23368, 23369, 23370, 23371, 23372, 23373, 23374, 23375, 23378, 23382,
- 23390, 23392, 23393, 23399, 23400, 23403, 23405, 23406, 23407, 23410, 23412, 23414, 23415, 23416, 23417,
- 23419, 23420, 23422, 23423, 23426, 23430, 23434, 23437, 23438, 23440, 23441, 23442, 23444, 23446, 23455,
- 23463, 23464, 23465, 23468, 23469, 23470, 23471, 23473, 23474, 23479, 23482, 23483, 23484, 23488, 23489,
- 23491, 23496, 23497, 23498, 23499, 23501, 23502, 23503, 23505, 23508, 23509, 23510, 23511, 23512, 23513,
- 23514, 23515, 23516, 23520, 23522, 23523, 23526, 23527, 23529, 23530, 23531, 23532, 23533, 23535, 23537,
- 23538, 23539, 23540, 23541, 23542, 23543, 23549, 23550, 23552, 23554, 23555, 23557, 23559, 23560, 23563,
- 23564, 23565, 23566, 23568, 23570, 23571, 23575, 23577, 23579, 23582, 23583, 23584, 23585, 23587, 23590,
- 23592, 23593, 23594, 23595, 23597, 23598, 23599, 23600, 23602, 23603, 23605, 23606, 23607, 23619, 23620,
- 23622, 23623, 23628, 23629, 23634, 23635, 23636, 23638, 23639, 23640, 23642, 23643, 23644, 23645, 23647,
- 23650, 23652, 23655, 23656, 23657, 23658, 23659, 23660, 23661, 23664, 23666, 23667, 23668, 23669, 23670,
- 23671, 23672, 23675, 23676, 23677, 23678, 23680, 23683, 23684, 23685, 23686, 23687, 23689, 23690, 23691,
- 23694, 23695, 23698, 23699, 23701, 23709, 23710, 23711, 23712, 23713, 23716, 23717, 23718, 23719, 23720,
- 23722, 23726, 23727, 23728, 23730, 23732, 23734, 23737, 23738, 23739, 23740, 23742, 23744, 23746, 23747,
- 23749, 23750, 23751, 23752, 23753, 23754, 23756, 23757, 23758, 23759, 23760, 23761, 23763, 23764, 23765,
- 23766, 23767, 23768, 23770, 23771, 23772, 23773, 23774, 23775, 23776, 23778, 23779, 23783, 23785, 23787,
- 23788, 23790, 23791, 23793, 23794, 23795, 23796, 23797, 23798, 23799, 23800, 23801, 23802, 23804, 23805,
- 23806, 23807, 23808, 23809, 23812, 23813, 23816, 23817, 23818, 23819, 23820, 23821, 23823, 23824, 23825,
- 23826, 23827, 23829, 23831, 23832, 23833, 23834, 23836, 23837, 23839, 23840, 23841, 23842, 23843, 23845,
- 23848, 23850, 23851, 23852, 23855, 23856, 23857, 23858, 23859, 23861, 23862, 23863, 23864, 23865, 23866,
- 23867, 23868, 23871, 23872, 23873, 23874, 23875, 23876, 23877, 23878, 23880, 23881, 23885, 23886, 23887,
- 23888, 23889, 23890, 23891, 23892, 23893, 23894, 23895, 23897, 23898, 23900, 23902, 23903, 23904, 23905,
- 23906, 23907, 23908, 23909, 23910, 23911, 23912, 23914, 23917, 23918, 23920, 23921, 23922, 23923, 23925,
- 23926, 23927, 23928, 23929, 23930, 23931, 23932, 23933, 23934, 23935, 23936, 23937, 23939, 23940, 23941,
- 23942, 23943, 23944, 23945, 23946, 23947, 23948, 23949, 23950, 23951, 23952, 23953, 23954, 23955, 23956,
- 23957, 23958, 23959, 23960, 23962, 23963, 23964, 23966, 23967, 23968, 23969, 23970, 23971, 23972, 23973,
- 23974, 23975, 23976, 23977, 23978, 23979, 23980, 23981, 23982, 23983, 23984, 23985, 23986, 23987, 23988,
- 23989, 23990, 23992, 23993, 23994, 23995, 23996, 23997, 23998, 23999, 24000, 24001, 24002, 24003, 24004,
- 24006, 24007, 24008, 24009, 24010, 24011, 24012, 24014, 24015, 24016, 24017, 24018, 24019, 24020, 24021,
- 24022, 24023, 24024, 24025, 24026, 24028, 24031, 24032, 24035, 24036, 24042, 24044, 24045, 24048, 24053,
- 24054, 24056, 24057, 24058, 24059, 24060, 24063, 24064, 24068, 24071, 24073, 24074, 24075, 24077, 24078,
- 24082, 24083, 24087, 24094, 24095, 24096, 24097, 24098, 24099, 24100, 24101, 24104, 24105, 24106, 24107,
- 24108, 24111, 24112, 24114, 24115, 24116, 24117, 24118, 24121, 24122, 24126, 24127, 24128, 24129, 24131,
- 24134, 24135, 24136, 24137, 24138, 24139, 24141, 24142, 24143, 24144, 24145, 24146, 24147, 24150, 24151,
- 24152, 24153, 24154, 24156, 24157, 24159, 24160, 24163, 24164, 24165, 24166, 24167, 24168, 24169, 24170,
- 24171, 24172, 24173, 24174, 24175, 24176, 24177, 24181, 24183, 24185, 24190, 24193, 24194, 24195, 24197,
- 24200, 24201, 24204, 24205, 24206, 24210, 24216, 24219, 24221, 24225, 24226, 24227, 24228, 24232, 24233,
- 24234, 24235, 24236, 24238, 24239, 24240, 24241, 24242, 24244, 24250, 24251, 24252, 24253, 24255, 24256,
- 24257, 24258, 24259, 24260, 24261, 24262, 24263, 24264, 24267, 24268, 24269, 24270, 24271, 24272, 24276,
- 24277, 24279, 24280, 24281, 24282, 24284, 24285, 24286, 24287, 24288, 24289, 24290, 24291, 24292, 24293,
- 24294, 24295, 24297, 24299, 24300, 24301, 24302, 24303, 24304, 24305, 24306, 24307, 24309, 24312, 24313,
- 24315, 24316, 24317, 24325, 24326, 24327, 24329, 24332, 24333, 24334, 24336, 24338, 24340, 24342, 24345,
- 24346, 24348, 24349, 24350, 24353, 24354, 24355, 24356, 24360, 24363, 24364, 24366, 24368, 24370, 24371,
- 24372, 24373, 24374, 24375, 24376, 24379, 24381, 24382, 24383, 24385, 24386, 24387, 24388, 24389, 24390,
- 24391, 24392, 24393, 24394, 24395, 24396, 24397, 24398, 24399, 24401, 24404, 24409, 24410, 24411, 24412,
- 24414, 24415, 24416, 24419, 24421, 24423, 24424, 24427, 24430, 24431, 24434, 24436, 24437, 24438, 24440,
- 24442, 24445, 24446, 24447, 24451, 24454, 24461, 24462, 24463, 24465, 24467, 24468, 24470, 24474, 24475,
- 24477, 24478, 24479, 24480, 24482, 24483, 24484, 24485, 24486, 24487, 24489, 24491, 24492, 24495, 24496,
- 24497, 24498, 24499, 24500, 24502, 24504, 24505, 24506, 24507, 24510, 24511, 24512, 24513, 24514, 24519,
- 24520, 24522, 24523, 24526, 24531, 24532, 24533, 24538, 24539, 24540, 24542, 24543, 24546, 24547, 24549,
- 24550, 24552, 24553, 24556, 24559, 24560, 24562, 24563, 24564, 24566, 24567, 24569, 24570, 24572, 24583,
- 24584, 24585, 24587, 24588, 24592, 24593, 24595, 24599, 24600, 24602, 24606, 24607, 24610, 24611, 24612,
- 24620, 24621, 24622, 24624, 24625, 24626, 24627, 24628, 24630, 24631, 24632, 24633, 24634, 24637, 24638,
- 24640, 24644, 24645, 24646, 24647, 24648, 24649, 24650, 24652, 24654, 24655, 24657, 24659, 24660, 24662,
- 24663, 24664, 24667, 24668, 24670, 24671, 24672, 24673, 24677, 24678, 24686, 24689, 24690, 24692, 24693,
- 24695, 24702, 24704, 24705, 24706, 24709, 24710, 24711, 24712, 24714, 24715, 24718, 24719, 24720, 24721,
- 24723, 24725, 24727, 24728, 24729, 24732, 24734, 24737, 24738, 24740, 24741, 24743, 24745, 24746, 24750,
- 24752, 24755, 24757, 24758, 24759, 24761, 24762, 24765, 24766, 24767, 24768, 24769, 24770, 24771, 24772,
- 24775, 24776, 24777, 24780, 24781, 24782, 24783, 24784, 24786, 24787, 24788, 24790, 24791, 24793, 24795,
- 24798, 24801, 24802, 24803, 24804, 24805, 24810, 24817, 24818, 24821, 24823, 24824, 24827, 24828, 24829,
- 24830, 24831, 24834, 24835, 24836, 24837, 24839, 24842, 24843, 24844, 24848, 24849, 24850, 24851, 24852,
- 24854, 24855, 24856, 24857, 24859, 24860, 24861, 24862, 24865, 24866, 24869, 24872, 24873, 24874, 24876,
- 24877, 24878, 24879, 24880, 24881, 24882, 24883, 24884, 24885, 24886, 24887, 24888, 24889, 24890, 24891,
- 24892, 24893, 24894, 24896, 24897, 24898, 24899, 24900, 24901, 24902, 24903, 24905, 24907, 24909, 24911,
- 24912, 24914, 24915, 24916, 24918, 24919, 24920, 24921, 24922, 24923, 24924, 24926, 24927, 24928, 24929,
- 24931, 24932, 24933, 24934, 24937, 24938, 24939, 24940, 24941, 24942, 24943, 24945, 24946, 24947, 24948,
- 24950, 24952, 24953, 24954, 24955, 24956, 24957, 24958, 24959, 24960, 24961, 24962, 24963, 24964, 24965,
- 24966, 24967, 24968, 24969, 24970, 24972, 24973, 24975, 24976, 24977, 24978, 24979, 24981, 24982, 24983,
- 24984, 24985, 24986, 24987, 24988, 24990, 24991, 24992, 24993, 24994, 24995, 24996, 24997, 24998, 25002,
- 25003, 25005, 25006, 25007, 25008, 25009, 25010, 25011, 25012, 25013, 25014, 25016, 25017, 25018, 25019,
- 25020, 25021, 25023, 25024, 25025, 25027, 25028, 25029, 25030, 25031, 25033, 25036, 25037, 25038, 25039,
- 25040, 25043, 25045, 25046, 25047, 25048, 25049, 25050, 25051, 25052, 25053, 25054, 25055, 25056, 25057,
- 25058, 25059, 25060, 25061, 25063, 25064, 25065, 25066, 25067, 25068, 25069, 25070, 25071, 25072, 25073,
- 25074, 25075, 25076, 25078, 25079, 25080, 25081, 25082, 25083, 25084, 25085, 25086, 25088, 25089, 25090,
- 25091, 25092, 25093, 25095, 25097, 25107, 25108, 25113, 25116, 25117, 25118, 25120, 25123, 25126, 25127,
- 25128, 25129, 25131, 25133, 25135, 25136, 25137, 25138, 25141, 25142, 25144, 25145, 25146, 25147, 25148,
- 25154, 25156, 25157, 25158, 25162, 25167, 25168, 25173, 25174, 25175, 25177, 25178, 25180, 25181, 25182,
- 25183, 25184, 25185, 25186, 25188, 25189, 25192, 25201, 25202, 25204, 25205, 25207, 25208, 25210, 25211,
- 25213, 25217, 25218, 25219, 25221, 25222, 25223, 25224, 25227, 25228, 25229, 25230, 25231, 25232, 25236,
- 25241, 25244, 25245, 25246, 25251, 25254, 25255, 25257, 25258, 25261, 25262, 25263, 25264, 25266, 25267,
- 25268, 25270, 25271, 25272, 25274, 25278, 25280, 25281, 25283, 25291, 25295, 25297, 25301, 25309, 25310,
- 25312, 25313, 25316, 25322, 25323, 25328, 25330, 25333, 25336, 25337, 25338, 25339, 25344, 25347, 25348,
- 25349, 25350, 25354, 25355, 25356, 25357, 25359, 25360, 25362, 25363, 25364, 25365, 25367, 25368, 25369,
- 25372, 25382, 25383, 25385, 25388, 25389, 25390, 25392, 25393, 25395, 25396, 25397, 25398, 25399, 25400,
- 25403, 25404, 25406, 25407, 25408, 25409, 25412, 25415, 25416, 25418, 25425, 25426, 25427, 25428, 25430,
- 25431, 25432, 25433, 25434, 25435, 25436, 25437, 25440, 25444, 25445, 25446, 25448, 25450, 25451, 25452,
- 25455, 25456, 25458, 25459, 25460, 25461, 25464, 25465, 25468, 25469, 25470, 25471, 25473, 25475, 25476,
- 25477, 25478, 25483, 25485, 25489, 25491, 25492, 25493, 25495, 25497, 25498, 25499, 25500, 25501, 25502,
- 25503, 25505, 25508, 25510, 25515, 25519, 25521, 25522, 25525, 25526, 25529, 25531, 25533, 25535, 25536,
- 25537, 25538, 25539, 25541, 25543, 25544, 25546, 25547, 25548, 25553, 25555, 25556, 25557, 25559, 25560,
- 25561, 25562, 25563, 25564, 25565, 25567, 25570, 25572, 25573, 25574, 25575, 25576, 25579, 25580, 25582,
- 25583, 25584, 25585, 25587, 25589, 25591, 25593, 25594, 25595, 25596, 25598, 25603, 25604, 25606, 25607,
- 25608, 25609, 25610, 25613, 25614, 25617, 25618, 25621, 25622, 25623, 25624, 25625, 25626, 25629, 25631,
- 25634, 25635, 25636, 25637, 25639, 25640, 25641, 25643, 25646, 25647, 25648, 25649, 25650, 25651, 25653,
- 25654, 25655, 25656, 25657, 25659, 25660, 25662, 25664, 25666, 25667, 25673, 25675, 25676, 25677, 25678,
- 25679, 25680, 25681, 25683, 25685, 25686, 25687, 25689, 25690, 25691, 25692, 25693, 25695, 25696, 25697,
- 25698, 25699, 25700, 25701, 25702, 25704, 25706, 25707, 25708, 25710, 25711, 25712, 25713, 25714, 25715,
- 25716, 25717, 25718, 25719, 25723, 25724, 25725, 25726, 25727, 25728, 25729, 25731, 25734, 25736, 25737,
- 25738, 25739, 25740, 25741, 25742, 25743, 25744, 25747, 25748, 25751, 25752, 25754, 25755, 25756, 25757,
- 25759, 25760, 25761, 25762, 25763, 25765, 25766, 25767, 25768, 25770, 25771, 25775, 25777, 25778, 25779,
- 25780, 25782, 25785, 25787, 25789, 25790, 25791, 25793, 25795, 25796, 25798, 25799, 25800, 25801, 25802,
- 25803, 25804, 25807, 25809, 25811, 25812, 25813, 25814, 25817, 25818, 25819, 25820, 25821, 25823, 25824,
- 25825, 25827, 25829, 25831, 25832, 25833, 25834, 25835, 25836, 25837, 25838, 25839, 25840, 25841, 25842,
- 25843, 25844, 25845, 25846, 25847, 25848, 25849, 25850, 25851, 25852, 25853, 25854, 25855, 25857, 25858,
- 25859, 25860, 25861, 25862, 25863, 25864, 25866, 25867, 25868, 25869, 25870, 25871, 25872, 25873, 25875,
- 25876, 25877, 25878, 25879, 25881, 25882, 25883, 25884, 25885, 25886, 25887, 25888, 25889, 25890, 25891,
- 25892, 25894, 25895, 25896, 25897, 25898, 25900, 25901, 25904, 25905, 25906, 25907, 25911, 25914, 25916,
- 25917, 25920, 25921, 25922, 25923, 25924, 25926, 25927, 25930, 25931, 25933, 25934, 25936, 25938, 25939,
- 25940, 25943, 25944, 25946, 25948, 25951, 25952, 25953, 25956, 25957, 25959, 25960, 25961, 25962, 25965,
- 25966, 25967, 25969, 25971, 25973, 25974, 25976, 25977, 25978, 25979, 25980, 25981, 25982, 25983, 25984,
- 25985, 25986, 25987, 25988, 25989, 25990, 25992, 25993, 25994, 25997, 25998, 25999, 26002, 26004, 26005,
- 26006, 26008, 26010, 26013, 26014, 26016, 26018, 26019, 26022, 26024, 26026, 26028, 26030, 26033, 26034,
- 26035, 26036, 26037, 26038, 26039, 26040, 26042, 26043, 26046, 26047, 26048, 26050, 26055, 26056, 26057,
- 26058, 26061, 26064, 26065, 26067, 26068, 26069, 26072, 26073, 26074, 26075, 26076, 26077, 26078, 26079,
- 26081, 26083, 26084, 26090, 26091, 26098, 26099, 26100, 26101, 26104, 26105, 26107, 26108, 26109, 26110,
- 26111, 26113, 26116, 26117, 26119, 26120, 26121, 26123, 26125, 26128, 26129, 26130, 26134, 26135, 26136,
- 26138, 26139, 26140, 26142, 26145, 26146, 26147, 26148, 26150, 26153, 26154, 26155, 26156, 26158, 26160,
- 26162, 26163, 26167, 26168, 26169, 26170, 26171, 26173, 26175, 26176, 26178, 26180, 26181, 26182, 26183,
- 26184, 26185, 26186, 26189, 26190, 26192, 26193, 26200, 26201, 26203, 26204, 26205, 26206, 26208, 26210,
- 26211, 26213, 26215, 26217, 26218, 26219, 26220, 26221, 26225, 26226, 26227, 26229, 26232, 26233, 26235,
- 26236, 26237, 26239, 26240, 26241, 26243, 26245, 26246, 26248, 26249, 26250, 26251, 26253, 26254, 26255,
- 26256, 26258, 26259, 26260, 26261, 26264, 26265, 26266, 26267, 26268, 26270, 26271, 26272, 26273, 26274,
- 26275, 26276, 26277, 26278, 26281, 26282, 26283, 26284, 26285, 26287, 26288, 26289, 26290, 26291, 26293,
- 26294, 26295, 26296, 26298, 26299, 26300, 26301, 26303, 26304, 26305, 26306, 26307, 26308, 26309, 26310,
- 26311, 26312, 26313, 26314, 26315, 26316, 26317, 26318, 26319, 26320, 26321, 26322, 26323, 26324, 26325,
- 26326, 26327, 26328, 26330, 26334, 26335, 26336, 26337, 26338, 26339, 26340, 26341, 26343, 26344, 26346,
- 26347, 26348, 26349, 26350, 26351, 26353, 26357, 26358, 26360, 26362, 26363, 26365, 26369, 26370, 26371,
- 26372, 26373, 26374, 26375, 26380, 26382, 26383, 26385, 26386, 26387, 26390, 26392, 26393, 26394, 26396,
- 26398, 26400, 26401, 26402, 26403, 26404, 26405, 26407, 26409, 26414, 26416, 26418, 26419, 26422, 26423,
- 26424, 26425, 26427, 26428, 26430, 26431, 26433, 26436, 26437, 26439, 26442, 26443, 26445, 26450, 26452,
- 26453, 26455, 26456, 26457, 26458, 26459, 26461, 26466, 26467, 26468, 26470, 26471, 26475, 26476, 26478,
- 26481, 26484, 26486, 26488, 26489, 26490, 26491, 26493, 26496, 26498, 26499, 26501, 26502, 26504, 26506,
- 26508, 26509, 26510, 26511, 26513, 26514, 26515, 26516, 26518, 26521, 26523, 26527, 26528, 26529, 26532,
- 26534, 26537, 26540, 26542, 26545, 26546, 26548, 26553, 26554, 26555, 26556, 26557, 26558, 26559, 26560,
- 26562, 26565, 26566, 26567, 26568, 26569, 26570, 26571, 26572, 26573, 26574, 26581, 26582, 26583, 26587,
- 26591, 26593, 26595, 26596, 26598, 26599, 26600, 26602, 26603, 26605, 26606, 26610, 26613, 26614, 26615,
- 26616, 26617, 26618, 26619, 26620, 26622, 26625, 26626, 26627, 26628, 26630, 26637, 26640, 26642, 26644,
- 26645, 26648, 26649, 26650, 26651, 26652, 26654, 26655, 26656, 26658, 26659, 26660, 26661, 26662, 26663,
- 26664, 26667, 26668, 26669, 26670, 26671, 26672, 26673, 26676, 26677, 26678, 26682, 26683, 26687, 26695,
- 26699, 26701, 26703, 26706, 26710, 26711, 26712, 26713, 26714, 26715, 26716, 26717, 26718, 26719, 26730,
- 26732, 26733, 26734, 26735, 26736, 26737, 26738, 26739, 26741, 26744, 26745, 26746, 26747, 26748, 26749,
- 26750, 26751, 26752, 26754, 26756, 26759, 26760, 26761, 26762, 26763, 26764, 26765, 26766, 26768, 26769,
- 26770, 26772, 26773, 26774, 26776, 26777, 26778, 26779, 26780, 26781, 26782, 26783, 26784, 26785, 26787,
- 26788, 26789, 26793, 26794, 26795, 26796, 26798, 26801, 26802, 26804, 26806, 26807, 26808, 26809, 26810,
- 26811, 26812, 26813, 26814, 26815, 26817, 26819, 26820, 26821, 26822, 26823, 26824, 26826, 26828, 26830,
- 26831, 26832, 26833, 26835, 26836, 26838, 26839, 26841, 26843, 26844, 26845, 26846, 26847, 26849, 26850,
- 26852, 26853, 26854, 26855, 26856, 26857, 26858, 26859, 26860, 26861, 26863, 26866, 26867, 26868, 26870,
- 26871, 26872, 26875, 26877, 26878, 26879, 26880, 26882, 26883, 26884, 26886, 26887, 26888, 26889, 26890,
- 26892, 26895, 26897, 26899, 26900, 26901, 26902, 26903, 26904, 26905, 26906, 26907, 26908, 26909, 26910,
- 26913, 26914, 26915, 26917, 26918, 26919, 26920, 26921, 26922, 26923, 26924, 26926, 26927, 26929, 26930,
- 26931, 26933, 26934, 26935, 26936, 26938, 26939, 26940, 26942, 26944, 26945, 26947, 26948, 26949, 26950,
- 26951, 26952, 26953, 26954, 26955, 26956, 26957, 26958, 26959, 26960, 26961, 26962, 26963, 26965, 26966,
- 26968, 26969, 26971, 26972, 26975, 26977, 26978, 26980, 26981, 26983, 26984, 26985, 26986, 26988, 26989,
- 26991, 26992, 26994, 26995, 26996, 26997, 26998, 27002, 27003, 27005, 27006, 27007, 27009, 27011, 27013,
- 27018, 27019, 27020, 27022, 27023, 27024, 27025, 27026, 27027, 27030, 27031, 27033, 27034, 27037, 27038,
- 27039, 27040, 27041, 27042, 27043, 27044, 27045, 27046, 27049, 27050, 27052, 27054, 27055, 27056, 27058,
- 27059, 27061, 27062, 27064, 27065, 27066, 27068, 27069, 27070, 27071, 27072, 27074, 27075, 27076, 27077,
- 27078, 27079, 27080, 27081, 27083, 27085, 27087, 27089, 27090, 27091, 27093, 27094, 27095, 27096, 27097,
- 27098, 27100, 27101, 27102, 27105, 27106, 27107, 27108, 27109, 27110, 27111, 27112, 27113, 27114, 27115,
- 27116, 27118, 27119, 27120, 27121, 27123, 27124, 27125, 27126, 27127, 27128, 27129, 27130, 27131, 27132,
- 27134, 27136, 27137, 27138, 27139, 27140, 27141, 27142, 27143, 27144, 27145, 27147, 27148, 27149, 27150,
- 27151, 27152, 27153, 27154, 27155, 27156, 27157, 27158, 27161, 27162, 27163, 27164, 27165, 27166, 27168,
- 27170, 27171, 27172, 27173, 27174, 27175, 27177, 27179, 27180, 27181, 27182, 27184, 27186, 27187, 27188,
- 27190, 27191, 27192, 27193, 27194, 27195, 27196, 27199, 27200, 27201, 27202, 27203, 27205, 27206, 27208,
- 27209, 27210, 27211, 27212, 27213, 27214, 27215, 27217, 27218, 27219, 27220, 27221, 27222, 27223, 27226,
- 27228, 27229, 27230, 27231, 27232, 27234, 27235, 27236, 27238, 27239, 27240, 27241, 27242, 27243, 27244,
- 27245, 27246, 27247, 27248, 27250, 27251, 27252, 27253, 27254, 27255, 27256, 27258, 27259, 27261, 27262,
- 27263, 27265, 27266, 27267, 27269, 27270, 27271, 27272, 27273, 27274, 27275, 27276, 27277, 27279, 27282,
- 27283, 27284, 27285, 27286, 27288, 27289, 27290, 27291, 27292, 27293, 27294, 27295, 27297, 27298, 27299,
- 27300, 27301, 27302, 27303, 27304, 27306, 27309, 27310, 27311, 27312, 27313, 27314, 27315, 27316, 27317,
- 27318, 27319, 27320, 27321, 27322, 27323, 27324, 27325, 27326, 27327, 27328, 27329, 27330, 27331, 27332,
- 27333, 27334, 27335, 27336, 27337, 27338, 27339, 27340, 27341, 27342, 27343, 27344, 27345, 27346, 27347,
- 27348, 27349, 27350, 27351, 27352, 27353, 27354, 27355, 27356, 27357, 27358, 27359, 27360, 27361, 27362,
- 27363, 27364, 27365, 27366, 27367, 27368, 27369, 27370, 27371, 27372, 27373, 27374, 27375, 27376, 27377,
- 27378, 27379, 27380, 27381, 27382, 27383, 27384, 27385, 27386, 27387, 27388, 27389, 27390, 27391, 27392,
- 27393, 27394, 27395, 27396, 27397, 27398, 27399, 27400, 27401, 27402, 27403, 27404, 27405, 27406, 27407,
- 27408, 27409, 27410, 27411, 27412, 27413, 27414, 27415, 27416, 27417, 27418, 27419, 27420, 27421, 27422,
- 27423, 27429, 27430, 27432, 27433, 27434, 27435, 27436, 27437, 27438, 27439, 27440, 27441, 27443, 27444,
- 27445, 27446, 27448, 27451, 27452, 27453, 27455, 27456, 27457, 27458, 27460, 27461, 27464, 27466, 27467,
- 27469, 27470, 27471, 27472, 27473, 27474, 27475, 27476, 27477, 27478, 27479, 27480, 27482, 27483, 27484,
- 27485, 27486, 27487, 27488, 27489, 27496, 27497, 27499, 27500, 27501, 27502, 27503, 27504, 27505, 27506,
- 27507, 27508, 27509, 27510, 27511, 27512, 27514, 27517, 27518, 27519, 27520, 27525, 27528, 27532, 27534,
- 27535, 27536, 27537, 27540, 27541, 27543, 27544, 27545, 27548, 27549, 27550, 27551, 27552, 27554, 27555,
- 27556, 27557, 27558, 27559, 27560, 27561, 27563, 27564, 27565, 27566, 27567, 27568, 27569, 27570, 27574,
- 27576, 27577, 27578, 27579, 27580, 27581, 27582, 27584, 27587, 27588, 27590, 27591, 27592, 27593, 27594,
- 27596, 27598, 27600, 27601, 27608, 27610, 27612, 27613, 27614, 27615, 27616, 27618, 27619, 27620, 27621,
- 27622, 27623, 27624, 27625, 27628, 27629, 27630, 27632, 27633, 27634, 27636, 27638, 27639, 27640, 27642,
- 27643, 27644, 27646, 27647, 27648, 27649, 27650, 27651, 27652, 27656, 27657, 27658, 27659, 27660, 27662,
- 27666, 27671, 27676, 27677, 27678, 27680, 27683, 27685, 27691, 27692, 27693, 27697, 27699, 27702, 27703,
- 27705, 27706, 27707, 27708, 27710, 27711, 27715, 27716, 27717, 27720, 27723, 27724, 27725, 27726, 27727,
- 27729, 27730, 27731, 27734, 27736, 27737, 27738, 27746, 27747, 27749, 27750, 27751, 27755, 27756, 27757,
- 27758, 27759, 27761, 27763, 27765, 27767, 27768, 27770, 27771, 27772, 27775, 27776, 27780, 27783, 27786,
- 27787, 27789, 27790, 27793, 27794, 27797, 27798, 27799, 27800, 27802, 27804, 27805, 27806, 27808, 27810,
- 27816, 27820, 27823, 27824, 27828, 27829, 27830, 27831, 27834, 27840, 27841, 27842, 27843, 27846, 27847,
- 27848, 27851, 27853, 27854, 27855, 27857, 27858, 27864, 27865, 27866, 27868, 27869, 27871, 27876, 27878,
- 27879, 27881, 27884, 27885, 27890, 27892, 27897, 27903, 27904, 27906, 27907, 27909, 27910, 27912, 27913,
- 27914, 27917, 27919, 27920, 27921, 27923, 27924, 27925, 27926, 27928, 27932, 27933, 27935, 27936, 27937,
- 27938, 27939, 27940, 27942, 27944, 27945, 27948, 27949, 27951, 27952, 27956, 27958, 27959, 27960, 27962,
- 27967, 27968, 27970, 27972, 27977, 27980, 27984, 27989, 27990, 27991, 27992, 27995, 27997, 27999, 28001,
- 28002, 28004, 28005, 28007, 28008, 28011, 28012, 28013, 28016, 28017, 28018, 28019, 28021, 28022, 28025,
- 28026, 28027, 28029, 28030, 28031, 28032, 28033, 28035, 28036, 28038, 28039, 28042, 28043, 28045, 28047,
- 28048, 28050, 28054, 28055, 28056, 28057, 28058, 28060, 28066, 28069, 28076, 28077, 28080, 28081, 28083,
- 28084, 28086, 28087, 28089, 28090, 28091, 28092, 28093, 28094, 28097, 28098, 28099, 28104, 28105, 28106,
- 28109, 28110, 28111, 28112, 28114, 28115, 28116, 28117, 28119, 28122, 28123, 28124, 28127, 28130, 28131,
- 28133, 28135, 28136, 28137, 28138, 28141, 28143, 28144, 28146, 28148, 28149, 28150, 28152, 28154, 28157,
- 28158, 28159, 28160, 28161, 28162, 28163, 28164, 28166, 28167, 28168, 28169, 28171, 28175, 28178, 28179,
- 28181, 28184, 28185, 28187, 28188, 28190, 28191, 28194, 28198, 28199, 28200, 28202, 28204, 28206, 28208,
- 28209, 28211, 28213, 28214, 28215, 28217, 28219, 28220, 28221, 28222, 28223, 28224, 28225, 28226, 28229,
- 28230, 28231, 28232, 28233, 28234, 28235, 28236, 28239, 28240, 28241, 28242, 28245, 28247, 28249, 28250,
- 28252, 28253, 28254, 28256, 28257, 28258, 28259, 28260, 28261, 28262, 28263, 28264, 28265, 28266, 28268,
- 28269, 28271, 28272, 28273, 28274, 28275, 28276, 28277, 28278, 28279, 28280, 28281, 28282, 28283, 28284,
- 28285, 28288, 28289, 28290, 28292, 28295, 28296, 28298, 28299, 28300, 28301, 28302, 28305, 28306, 28307,
- 28308, 28309, 28310, 28311, 28313, 28314, 28315, 28317, 28318, 28320, 28321, 28323, 28324, 28326, 28328,
- 28329, 28331, 28332, 28333, 28334, 28336, 28339, 28341, 28344, 28345, 28348, 28350, 28351, 28352, 28355,
- 28356, 28357, 28358, 28360, 28361, 28362, 28364, 28365, 28366, 28368, 28370, 28374, 28376, 28377, 28379,
- 28380, 28381, 28387, 28391, 28394, 28395, 28396, 28397, 28398, 28399, 28400, 28401, 28402, 28403, 28405,
- 28406, 28407, 28408, 28410, 28411, 28412, 28413, 28414, 28415, 28416, 28417, 28419, 28420, 28421, 28423,
- 28424, 28426, 28427, 28428, 28429, 28430, 28432, 28433, 28434, 28438, 28439, 28440, 28441, 28442, 28443,
- 28444, 28445, 28446, 28447, 28449, 28450, 28451, 28453, 28454, 28455, 28456, 28460, 28462, 28464, 28466,
- 28468, 28469, 28471, 28472, 28473, 28474, 28475, 28476, 28477, 28479, 28480, 28481, 28482, 28483, 28484,
- 28485, 28488, 28489, 28490, 28492, 28494, 28495, 28496, 28497, 28498, 28499, 28500, 28501, 28502, 28503,
- 28505, 28506, 28507, 28509, 28511, 28512, 28513, 28515, 28516, 28517, 28519, 28520, 28521, 28522, 28523,
- 28524, 28527, 28528, 28529, 28531, 28533, 28534, 28535, 28537, 28539, 28541, 28542, 28543, 28544, 28545,
- 28546, 28547, 28549, 28550, 28551, 28554, 28555, 28559, 28560, 28561, 28562, 28563, 28564, 28565, 28566,
- 28567, 28568, 28569, 28570, 28571, 28573, 28574, 28575, 28576, 28578, 28579, 28580, 28581, 28582, 28584,
- 28585, 28586, 28587, 28588, 28589, 28590, 28591, 28592, 28593, 28594, 28596, 28597, 28599, 28600, 28602,
- 28603, 28604, 28605, 28606, 28607, 28609, 28611, 28612, 28613, 28614, 28615, 28616, 28618, 28619, 28620,
- 28621, 28622, 28623, 28624, 28627, 28628, 28629, 28630, 28631, 28632, 28633, 28634, 28635, 28636, 28637,
- 28639, 28642, 28643, 28644, 28645, 28646, 28647, 28648, 28649, 28650, 28651, 28652, 28653, 28656, 28657,
- 28658, 28659, 28660, 28661, 28662, 28663, 28664, 28665, 28666, 28667, 28668, 28669, 28670, 28671, 28672,
- 28673, 28674, 28675, 28676, 28677, 28678, 28679, 28680, 28681, 28682, 28683, 28684, 28685, 28686, 28687,
- 28688, 28690, 28691, 28692, 28693, 28694, 28695, 28696, 28697, 28700, 28701, 28702, 28703, 28704, 28705,
- 28706, 28708, 28709, 28710, 28711, 28712, 28713, 28714, 28715, 28716, 28717, 28718, 28719, 28720, 28721,
- 28722, 28723, 28724, 28726, 28727, 28728, 28730, 28731, 28732, 28733, 28734, 28735, 28736, 28737, 28738,
- 28739, 28740, 28741, 28742, 28743, 28744, 28745, 28746, 28747, 28749, 28750, 28752, 28753, 28754, 28755,
- 28756, 28757, 28758, 28759, 28760, 28761, 28762, 28763, 28764, 28765, 28767, 28768, 28769, 28770, 28771,
- 28772, 28773, 28774, 28775, 28776, 28777, 28778, 28782, 28785, 28786, 28787, 28788, 28791, 28793, 28794,
- 28795, 28797, 28801, 28802, 28803, 28804, 28806, 28807, 28808, 28811, 28812, 28813, 28815, 28816, 28817,
- 28819, 28823, 28824, 28826, 28827, 28830, 28831, 28832, 28833, 28834, 28835, 28836, 28837, 28838, 28839,
- 28840, 28841, 28842, 28848, 28850, 28852, 28853, 28854, 28858, 28862, 28863, 28868, 28869, 28870, 28871,
- 28873, 28875, 28876, 28877, 28878, 28879, 28880, 28881, 28882, 28883, 28884, 28885, 28886, 28887, 28890,
- 28892, 28893, 28894, 28896, 28897, 28898, 28899, 28901, 28906, 28910, 28912, 28913, 28914, 28915, 28916,
- 28917, 28918, 28920, 28922, 28923, 28924, 28926, 28927, 28928, 28929, 28930, 28931, 28932, 28933, 28934,
- 28935, 28936, 28939, 28940, 28941, 28942, 28943, 28945, 28946, 28948, 28951, 28955, 28956, 28957, 28958,
- 28959, 28960, 28961, 28962, 28963, 28964, 28965, 28967, 28968, 28969, 28970, 28971, 28972, 28973, 28974,
- 28978, 28979, 28980, 28981, 28983, 28984, 28985, 28986, 28987, 28988, 28989, 28990, 28991, 28992, 28993,
- 28994, 28995, 28996, 28998, 28999, 29000, 29001, 29003, 29005, 29007, 29008, 29009, 29010, 29011, 29012,
- 29013, 29014, 29015, 29016, 29017, 29018, 29019, 29021, 29023, 29024, 29025, 29026, 29027, 29029, 29033,
- 29034, 29035, 29036, 29037, 29039, 29040, 29041, 29044, 29045, 29046, 29047, 29049, 29051, 29052, 29054,
- 29055, 29056, 29057, 29058, 29059, 29061, 29062, 29063, 29064, 29065, 29067, 29068, 29069, 29070, 29072,
- 29073, 29074, 29075, 29077, 29078, 29079, 29082, 29083, 29084, 29085, 29086, 29089, 29090, 29091, 29092,
- 29093, 29094, 29095, 29097, 29098, 29099, 29101, 29102, 29103, 29104, 29105, 29106, 29108, 29110, 29111,
- 29112, 29114, 29115, 29116, 29117, 29118, 29119, 29120, 29121, 29122, 29124, 29125, 29126, 29127, 29128,
- 29129, 29130, 29131, 29132, 29133, 29135, 29136, 29137, 29138, 29139, 29142, 29143, 29144, 29145, 29146,
- 29147, 29148, 29149, 29150, 29151, 29153, 29154, 29155, 29156, 29158, 29160, 29161, 29162, 29163, 29164,
- 29165, 29167, 29168, 29169, 29170, 29171, 29172, 29173, 29174, 29175, 29176, 29178, 29179, 29180, 29181,
- 29182, 29183, 29184, 29185, 29186, 29187, 29188, 29189, 29191, 29192, 29193, 29194, 29195, 29196, 29197,
- 29198, 29199, 29200, 29201, 29202, 29203, 29204, 29205, 29206, 29207, 29208, 29209, 29210, 29211, 29212,
- 29214, 29215, 29216, 29217, 29218, 29219, 29220, 29221, 29222, 29223, 29225, 29227, 29229, 29230, 29231,
- 29234, 29235, 29236, 29242, 29244, 29246, 29248, 29249, 29250, 29251, 29252, 29253, 29254, 29257, 29258,
- 29259, 29262, 29263, 29264, 29265, 29267, 29268, 29269, 29271, 29272, 29274, 29276, 29278, 29280, 29283,
- 29284, 29285, 29288, 29290, 29291, 29292, 29293, 29296, 29297, 29299, 29300, 29302, 29303, 29304, 29307,
- 29308, 29309, 29314, 29315, 29317, 29318, 29319, 29320, 29321, 29324, 29326, 29328, 29329, 29331, 29332,
- 29333, 29334, 29335, 29336, 29337, 29338, 29339, 29340, 29341, 29342, 29344, 29345, 29346, 29347, 29348,
- 29349, 29350, 29351, 29352, 29353, 29354, 29355, 29358, 29361, 29362, 29363, 29365, 29370, 29371, 29372,
- 29373, 29374, 29375, 29376, 29381, 29382, 29383, 29385, 29386, 29387, 29388, 29391, 29393, 29395, 29396,
- 29397, 29398, 29400, 29402, 29403, 58566, 58567, 58568, 58569, 58570, 58571, 58572, 58573, 58574, 58575,
- 58576, 58577, 58578, 58579, 58580, 58581, 58582, 58583, 58584, 58585, 58586, 58587, 58588, 58589, 58590,
- 58591, 58592, 58593, 58594, 58595, 58596, 58597, 58598, 58599, 58600, 58601, 58602, 58603, 58604, 58605,
- 58606, 58607, 58608, 58609, 58610, 58611, 58612, 58613, 58614, 58615, 58616, 58617, 58618, 58619, 58620,
- 58621, 58622, 58623, 58624, 58625, 58626, 58627, 58628, 58629, 58630, 58631, 58632, 58633, 58634, 58635,
- 58636, 58637, 58638, 58639, 58640, 58641, 58642, 58643, 58644, 58645, 58646, 58647, 58648, 58649, 58650,
- 58651, 58652, 58653, 58654, 58655, 58656, 58657, 58658, 58659, 58660, 58661, 12288, 12289, 12290, 183,
- 713, 711, 168, 12291, 12293, 8212, 65374, 8214, 8230, 8216, 8217, 8220, 8221, 12308, 12309,
- 12296, 12297, 12298, 12299, 12300, 12301, 12302, 12303, 12310, 12311, 12304, 12305, 177, 215, 247,
- 8758, 8743, 8744, 8721, 8719, 8746, 8745, 8712, 8759, 8730, 8869, 8741, 8736, 8978, 8857,
- 8747, 8750, 8801, 8780, 8776, 8765, 8733, 8800, 8814, 8815, 8804, 8805, 8734, 8757, 8756,
- 9794, 9792, 176, 8242, 8243, 8451, 65284, 164, 65504, 65505, 8240, 167, 8470, 9734, 9733,
- 9675, 9679, 9678, 9671, 9670, 9633, 9632, 9651, 9650, 8251, 8594, 8592, 8593, 8595, 12307,
- 58662, 58663, 58664, 58665, 58666, 58667, 58668, 58669, 58670, 58671, 58672, 58673, 58674, 58675, 58676,
- 58677, 58678, 58679, 58680, 58681, 58682, 58683, 58684, 58685, 58686, 58687, 58688, 58689, 58690, 58691,
- 58692, 58693, 58694, 58695, 58696, 58697, 58698, 58699, 58700, 58701, 58702, 58703, 58704, 58705, 58706,
- 58707, 58708, 58709, 58710, 58711, 58712, 58713, 58714, 58715, 58716, 58717, 58718, 58719, 58720, 58721,
- 58722, 58723, 58724, 58725, 58726, 58727, 58728, 58729, 58730, 58731, 58732, 58733, 58734, 58735, 58736,
- 58737, 58738, 58739, 58740, 58741, 58742, 58743, 58744, 58745, 58746, 58747, 58748, 58749, 58750, 58751,
- 58752, 58753, 58754, 58755, 58756, 58757, 8560, 8561, 8562, 8563, 8564, 8565, 8566, 8567, 8568,
- 8569, 59238, 59239, 59240, 59241, 59242, 59243, 9352, 9353, 9354, 9355, 9356, 9357, 9358, 9359,
- 9360, 9361, 9362, 9363, 9364, 9365, 9366, 9367, 9368, 9369, 9370, 9371, 9332, 9333, 9334,
- 9335, 9336, 9337, 9338, 9339, 9340, 9341, 9342, 9343, 9344, 9345, 9346, 9347, 9348, 9349,
- 9350, 9351, 9312, 9313, 9314, 9315, 9316, 9317, 9318, 9319, 9320, 9321, 8364, 59245, 12832,
- 12833, 12834, 12835, 12836, 12837, 12838, 12839, 12840, 12841, 59246, 59247, 8544, 8545, 8546, 8547,
- 8548, 8549, 8550, 8551, 8552, 8553, 8554, 8555, 59248, 59249, 58758, 58759, 58760, 58761, 58762,
- 58763, 58764, 58765, 58766, 58767, 58768, 58769, 58770, 58771, 58772, 58773, 58774, 58775, 58776, 58777,
- 58778, 58779, 58780, 58781, 58782, 58783, 58784, 58785, 58786, 58787, 58788, 58789, 58790, 58791, 58792,
- 58793, 58794, 58795, 58796, 58797, 58798, 58799, 58800, 58801, 58802, 58803, 58804, 58805, 58806, 58807,
- 58808, 58809, 58810, 58811, 58812, 58813, 58814, 58815, 58816, 58817, 58818, 58819, 58820, 58821, 58822,
- 58823, 58824, 58825, 58826, 58827, 58828, 58829, 58830, 58831, 58832, 58833, 58834, 58835, 58836, 58837,
- 58838, 58839, 58840, 58841, 58842, 58843, 58844, 58845, 58846, 58847, 58848, 58849, 58850, 58851, 58852,
- 12288, 65281, 65282, 65283, 65509, 65285, 65286, 65287, 65288, 65289, 65290, 65291, 65292, 65293, 65294,
- 65295, 65296, 65297, 65298, 65299, 65300, 65301, 65302, 65303, 65304, 65305, 65306, 65307, 65308, 65309,
- 65310, 65311, 65312, 65313, 65314, 65315, 65316, 65317, 65318, 65319, 65320, 65321, 65322, 65323, 65324,
- 65325, 65326, 65327, 65328, 65329, 65330, 65331, 65332, 65333, 65334, 65335, 65336, 65337, 65338, 65339,
- 65340, 65341, 65342, 65343, 65344, 65345, 65346, 65347, 65348, 65349, 65350, 65351, 65352, 65353, 65354,
- 65355, 65356, 65357, 65358, 65359, 65360, 65361, 65362, 65363, 65364, 65365, 65366, 65367, 65368, 65369,
- 65370, 65371, 65372, 65373, 65507, 58854, 58855, 58856, 58857, 58858, 58859, 58860, 58861, 58862, 58863,
- 58864, 58865, 58866, 58867, 58868, 58869, 58870, 58871, 58872, 58873, 58874, 58875, 58876, 58877, 58878,
- 58879, 58880, 58881, 58882, 58883, 58884, 58885, 58886, 58887, 58888, 58889, 58890, 58891, 58892, 58893,
- 58894, 58895, 58896, 58897, 58898, 58899, 58900, 58901, 58902, 58903, 58904, 58905, 58906, 58907, 58908,
- 58909, 58910, 58911, 58912, 58913, 58914, 58915, 58916, 58917, 58918, 58919, 58920, 58921, 58922, 58923,
- 58924, 58925, 58926, 58927, 58928, 58929, 58930, 58931, 58932, 58933, 58934, 58935, 58936, 58937, 58938,
- 58939, 58940, 58941, 58942, 58943, 58944, 58945, 58946, 58947, 58948, 58949, 12353, 12354, 12355, 12356,
- 12357, 12358, 12359, 12360, 12361, 12362, 12363, 12364, 12365, 12366, 12367, 12368, 12369, 12370, 12371,
- 12372, 12373, 12374, 12375, 12376, 12377, 12378, 12379, 12380, 12381, 12382, 12383, 12384, 12385, 12386,
- 12387, 12388, 12389, 12390, 12391, 12392, 12393, 12394, 12395, 12396, 12397, 12398, 12399, 12400, 12401,
- 12402, 12403, 12404, 12405, 12406, 12407, 12408, 12409, 12410, 12411, 12412, 12413, 12414, 12415, 12416,
- 12417, 12418, 12419, 12420, 12421, 12422, 12423, 12424, 12425, 12426, 12427, 12428, 12429, 12430, 12431,
- 12432, 12433, 12434, 12435, 59250, 59251, 59252, 59253, 59254, 59255, 59256, 59257, 59258, 59259, 59260,
- 58950, 58951, 58952, 58953, 58954, 58955, 58956, 58957, 58958, 58959, 58960, 58961, 58962, 58963, 58964,
- 58965, 58966, 58967, 58968, 58969, 58970, 58971, 58972, 58973, 58974, 58975, 58976, 58977, 58978, 58979,
- 58980, 58981, 58982, 58983, 58984, 58985, 58986, 58987, 58988, 58989, 58990, 58991, 58992, 58993, 58994,
- 58995, 58996, 58997, 58998, 58999, 59000, 59001, 59002, 59003, 59004, 59005, 59006, 59007, 59008, 59009,
- 59010, 59011, 59012, 59013, 59014, 59015, 59016, 59017, 59018, 59019, 59020, 59021, 59022, 59023, 59024,
- 59025, 59026, 59027, 59028, 59029, 59030, 59031, 59032, 59033, 59034, 59035, 59036, 59037, 59038, 59039,
- 59040, 59041, 59042, 59043, 59044, 59045, 12449, 12450, 12451, 12452, 12453, 12454, 12455, 12456, 12457,
- 12458, 12459, 12460, 12461, 12462, 12463, 12464, 12465, 12466, 12467, 12468, 12469, 12470, 12471, 12472,
- 12473, 12474, 12475, 12476, 12477, 12478, 12479, 12480, 12481, 12482, 12483, 12484, 12485, 12486, 12487,
- 12488, 12489, 12490, 12491, 12492, 12493, 12494, 12495, 12496, 12497, 12498, 12499, 12500, 12501, 12502,
- 12503, 12504, 12505, 12506, 12507, 12508, 12509, 12510, 12511, 12512, 12513, 12514, 12515, 12516, 12517,
- 12518, 12519, 12520, 12521, 12522, 12523, 12524, 12525, 12526, 12527, 12528, 12529, 12530, 12531, 12532,
- 12533, 12534, 59261, 59262, 59263, 59264, 59265, 59266, 59267, 59268, 59046, 59047, 59048, 59049, 59050,
- 59051, 59052, 59053, 59054, 59055, 59056, 59057, 59058, 59059, 59060, 59061, 59062, 59063, 59064, 59065,
- 59066, 59067, 59068, 59069, 59070, 59071, 59072, 59073, 59074, 59075, 59076, 59077, 59078, 59079, 59080,
- 59081, 59082, 59083, 59084, 59085, 59086, 59087, 59088, 59089, 59090, 59091, 59092, 59093, 59094, 59095,
- 59096, 59097, 59098, 59099, 59100, 59101, 59102, 59103, 59104, 59105, 59106, 59107, 59108, 59109, 59110,
- 59111, 59112, 59113, 59114, 59115, 59116, 59117, 59118, 59119, 59120, 59121, 59122, 59123, 59124, 59125,
- 59126, 59127, 59128, 59129, 59130, 59131, 59132, 59133, 59134, 59135, 59136, 59137, 59138, 59139, 59140,
- 59141, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926,
- 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 59269, 59270, 59271, 59272, 59273,
- 59274, 59275, 59276, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956,
- 957, 958, 959, 960, 961, 963, 964, 965, 966, 967, 968, 969, 59277, 59278, 59279,
- 59280, 59281, 59282, 59283, 65077, 65078, 65081, 65082, 65087, 65088, 65085, 65086, 65089, 65090, 65091,
- 65092, 59284, 59285, 65083, 65084, 65079, 65080, 65073, 59286, 65075, 65076, 59287, 59288, 59289, 59290,
- 59291, 59292, 59293, 59294, 59295, 59142, 59143, 59144, 59145, 59146, 59147, 59148, 59149, 59150, 59151,
- 59152, 59153, 59154, 59155, 59156, 59157, 59158, 59159, 59160, 59161, 59162, 59163, 59164, 59165, 59166,
- 59167, 59168, 59169, 59170, 59171, 59172, 59173, 59174, 59175, 59176, 59177, 59178, 59179, 59180, 59181,
- 59182, 59183, 59184, 59185, 59186, 59187, 59188, 59189, 59190, 59191, 59192, 59193, 59194, 59195, 59196,
- 59197, 59198, 59199, 59200, 59201, 59202, 59203, 59204, 59205, 59206, 59207, 59208, 59209, 59210, 59211,
- 59212, 59213, 59214, 59215, 59216, 59217, 59218, 59219, 59220, 59221, 59222, 59223, 59224, 59225, 59226,
- 59227, 59228, 59229, 59230, 59231, 59232, 59233, 59234, 59235, 59236, 59237, 1040, 1041, 1042, 1043,
- 1044, 1045, 1025, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057,
- 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 59296,
- 59297, 59298, 59299, 59300, 59301, 59302, 59303, 59304, 59305, 59306, 59307, 59308, 59309, 59310, 1072,
- 1073, 1074, 1075, 1076, 1077, 1105, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086,
- 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101,
- 1102, 1103, 59311, 59312, 59313, 59314, 59315, 59316, 59317, 59318, 59319, 59320, 59321, 59322, 59323,
- 714, 715, 729, 8211, 8213, 8229, 8245, 8453, 8457, 8598, 8599, 8600, 8601, 8725, 8735,
- 8739, 8786, 8806, 8807, 8895, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561,
- 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576,
- 9577, 9578, 9579, 9580, 9581, 9582, 9583, 9584, 9585, 9586, 9587, 9601, 9602, 9603, 9604,
- 9605, 9606, 9607, 9608, 9609, 9610, 9611, 9612, 9613, 9614, 9615, 9619, 9620, 9621, 9660,
- 9661, 9698, 9699, 9700, 9701, 9737, 8853, 12306, 12317, 12318, 59324, 59325, 59326, 59327, 59328,
- 59329, 59330, 59331, 59332, 59333, 59334, 257, 225, 462, 224, 275, 233, 283, 232, 299,
- 237, 464, 236, 333, 243, 466, 242, 363, 250, 468, 249, 470, 472, 474, 476,
- 252, 234, 593, 7743, 324, 328, 505, 609, 59337, 59338, 59339, 59340, 12549, 12550, 12551,
- 12552, 12553, 12554, 12555, 12556, 12557, 12558, 12559, 12560, 12561, 12562, 12563, 12564, 12565, 12566,
- 12567, 12568, 12569, 12570, 12571, 12572, 12573, 12574, 12575, 12576, 12577, 12578, 12579, 12580, 12581,
- 12582, 12583, 12584, 12585, 59341, 59342, 59343, 59344, 59345, 59346, 59347, 59348, 59349, 59350, 59351,
- 59352, 59353, 59354, 59355, 59356, 59357, 59358, 59359, 59360, 59361, 12321, 12322, 12323, 12324, 12325,
- 12326, 12327, 12328, 12329, 12963, 13198, 13199, 13212, 13213, 13214, 13217, 13252, 13262, 13265, 13266,
- 13269, 65072, 65506, 65508, 59362, 8481, 12849, 59363, 8208, 59364, 59365, 59366, 12540, 12443, 12444,
- 12541, 12542, 12294, 12445, 12446, 65097, 65098, 65099, 65100, 65101, 65102, 65103, 65104, 65105, 65106,
- 65108, 65109, 65110, 65111, 65113, 65114, 65115, 65116, 65117, 65118, 65119, 65120, 65121, 65122, 65123,
- 65124, 65125, 65126, 65128, 65129, 65130, 65131, 12350, 12272, 12273, 12274, 12275, 12276, 12277, 12278,
- 12279, 12280, 12281, 12282, 12283, 12295, 59380, 59381, 59382, 59383, 59384, 59385, 59386, 59387, 59388,
- 59389, 59390, 59391, 59392, 9472, 9473, 9474, 9475, 9476, 9477, 9478, 9479, 9480, 9481, 9482,
- 9483, 9484, 9485, 9486, 9487, 9488, 9489, 9490, 9491, 9492, 9493, 9494, 9495, 9496, 9497,
- 9498, 9499, 9500, 9501, 9502, 9503, 9504, 9505, 9506, 9507, 9508, 9509, 9510, 9511, 9512,
- 9513, 9514, 9515, 9516, 9517, 9518, 9519, 9520, 9521, 9522, 9523, 9524, 9525, 9526, 9527,
- 9528, 9529, 9530, 9531, 9532, 9533, 9534, 9535, 9536, 9537, 9538, 9539, 9540, 9541, 9542,
- 9543, 9544, 9545, 9546, 9547, 59393, 59394, 59395, 59396, 59397, 59398, 59399, 59400, 59401, 59402,
- 59403, 59404, 59405, 59406, 59407, 29404, 29405, 29407, 29410, 29411, 29412, 29413, 29414, 29415, 29418,
- 29419, 29429, 29430, 29433, 29437, 29438, 29439, 29440, 29442, 29444, 29445, 29446, 29447, 29448, 29449,
- 29451, 29452, 29453, 29455, 29456, 29457, 29458, 29460, 29464, 29465, 29466, 29471, 29472, 29475, 29476,
- 29478, 29479, 29480, 29485, 29487, 29488, 29490, 29491, 29493, 29494, 29498, 29499, 29500, 29501, 29504,
- 29505, 29506, 29507, 29508, 29509, 29510, 29511, 29512, 29513, 29514, 29515, 29516, 29518, 29519, 29521,
- 29523, 29524, 29525, 29526, 29528, 29529, 29530, 29531, 29532, 29533, 29534, 29535, 29537, 29538, 29539,
- 29540, 29541, 29542, 29543, 29544, 29545, 29546, 29547, 29550, 29552, 29553, 57344, 57345, 57346, 57347,
- 57348, 57349, 57350, 57351, 57352, 57353, 57354, 57355, 57356, 57357, 57358, 57359, 57360, 57361, 57362,
- 57363, 57364, 57365, 57366, 57367, 57368, 57369, 57370, 57371, 57372, 57373, 57374, 57375, 57376, 57377,
- 57378, 57379, 57380, 57381, 57382, 57383, 57384, 57385, 57386, 57387, 57388, 57389, 57390, 57391, 57392,
- 57393, 57394, 57395, 57396, 57397, 57398, 57399, 57400, 57401, 57402, 57403, 57404, 57405, 57406, 57407,
- 57408, 57409, 57410, 57411, 57412, 57413, 57414, 57415, 57416, 57417, 57418, 57419, 57420, 57421, 57422,
- 57423, 57424, 57425, 57426, 57427, 57428, 57429, 57430, 57431, 57432, 57433, 57434, 57435, 57436, 57437,
- 29554, 29555, 29556, 29557, 29558, 29559, 29560, 29561, 29562, 29563, 29564, 29565, 29567, 29568, 29569,
- 29570, 29571, 29573, 29574, 29576, 29578, 29580, 29581, 29583, 29584, 29586, 29587, 29588, 29589, 29591,
- 29592, 29593, 29594, 29596, 29597, 29598, 29600, 29601, 29603, 29604, 29605, 29606, 29607, 29608, 29610,
- 29612, 29613, 29617, 29620, 29621, 29622, 29624, 29625, 29628, 29629, 29630, 29631, 29633, 29635, 29636,
- 29637, 29638, 29639, 29643, 29644, 29646, 29650, 29651, 29652, 29653, 29654, 29655, 29656, 29658, 29659,
- 29660, 29661, 29663, 29665, 29666, 29667, 29668, 29670, 29672, 29674, 29675, 29676, 29678, 29679, 29680,
- 29681, 29683, 29684, 29685, 29686, 29687, 57438, 57439, 57440, 57441, 57442, 57443, 57444, 57445, 57446,
- 57447, 57448, 57449, 57450, 57451, 57452, 57453, 57454, 57455, 57456, 57457, 57458, 57459, 57460, 57461,
- 57462, 57463, 57464, 57465, 57466, 57467, 57468, 57469, 57470, 57471, 57472, 57473, 57474, 57475, 57476,
- 57477, 57478, 57479, 57480, 57481, 57482, 57483, 57484, 57485, 57486, 57487, 57488, 57489, 57490, 57491,
- 57492, 57493, 57494, 57495, 57496, 57497, 57498, 57499, 57500, 57501, 57502, 57503, 57504, 57505, 57506,
- 57507, 57508, 57509, 57510, 57511, 57512, 57513, 57514, 57515, 57516, 57517, 57518, 57519, 57520, 57521,
- 57522, 57523, 57524, 57525, 57526, 57527, 57528, 57529, 57530, 57531, 29688, 29689, 29690, 29691, 29692,
- 29693, 29694, 29695, 29696, 29697, 29698, 29700, 29703, 29704, 29707, 29708, 29709, 29710, 29713, 29714,
- 29715, 29716, 29717, 29718, 29719, 29720, 29721, 29724, 29725, 29726, 29727, 29728, 29729, 29731, 29732,
- 29735, 29737, 29739, 29741, 29743, 29745, 29746, 29751, 29752, 29753, 29754, 29755, 29757, 29758, 29759,
- 29760, 29762, 29763, 29764, 29765, 29766, 29767, 29768, 29769, 29770, 29771, 29772, 29773, 29774, 29775,
- 29776, 29777, 29778, 29779, 29780, 29782, 29784, 29789, 29792, 29793, 29794, 29795, 29796, 29797, 29798,
- 29799, 29800, 29801, 29802, 29803, 29804, 29806, 29807, 29809, 29810, 29811, 29812, 29813, 29816, 29817,
- 29818, 57532, 57533, 57534, 57535, 57536, 57537, 57538, 57539, 57540, 57541, 57542, 57543, 57544, 57545,
- 57546, 57547, 57548, 57549, 57550, 57551, 57552, 57553, 57554, 57555, 57556, 57557, 57558, 57559, 57560,
- 57561, 57562, 57563, 57564, 57565, 57566, 57567, 57568, 57569, 57570, 57571, 57572, 57573, 57574, 57575,
- 57576, 57577, 57578, 57579, 57580, 57581, 57582, 57583, 57584, 57585, 57586, 57587, 57588, 57589, 57590,
- 57591, 57592, 57593, 57594, 57595, 57596, 57597, 57598, 57599, 57600, 57601, 57602, 57603, 57604, 57605,
- 57606, 57607, 57608, 57609, 57610, 57611, 57612, 57613, 57614, 57615, 57616, 57617, 57618, 57619, 57620,
- 57621, 57622, 57623, 57624, 57625, 29819, 29820, 29821, 29823, 29826, 29828, 29829, 29830, 29832, 29833,
- 29834, 29836, 29837, 29839, 29841, 29842, 29843, 29844, 29845, 29846, 29847, 29848, 29849, 29850, 29851,
- 29853, 29855, 29856, 29857, 29858, 29859, 29860, 29861, 29862, 29866, 29867, 29868, 29869, 29870, 29871,
- 29872, 29873, 29874, 29875, 29876, 29877, 29878, 29879, 29880, 29881, 29883, 29884, 29885, 29886, 29887,
- 29888, 29889, 29890, 29891, 29892, 29893, 29894, 29895, 29896, 29897, 29898, 29899, 29900, 29901, 29902,
- 29903, 29904, 29905, 29907, 29908, 29909, 29910, 29911, 29912, 29913, 29914, 29915, 29917, 29919, 29921,
- 29925, 29927, 29928, 29929, 29930, 29931, 29932, 29933, 29936, 29937, 29938, 57626, 57627, 57628, 57629,
- 57630, 57631, 57632, 57633, 57634, 57635, 57636, 57637, 57638, 57639, 57640, 57641, 57642, 57643, 57644,
- 57645, 57646, 57647, 57648, 57649, 57650, 57651, 57652, 57653, 57654, 57655, 57656, 57657, 57658, 57659,
- 57660, 57661, 57662, 57663, 57664, 57665, 57666, 57667, 57668, 57669, 57670, 57671, 57672, 57673, 57674,
- 57675, 57676, 57677, 57678, 57679, 57680, 57681, 57682, 57683, 57684, 57685, 57686, 57687, 57688, 57689,
- 57690, 57691, 57692, 57693, 57694, 57695, 57696, 57697, 57698, 57699, 57700, 57701, 57702, 57703, 57704,
- 57705, 57706, 57707, 57708, 57709, 57710, 57711, 57712, 57713, 57714, 57715, 57716, 57717, 57718, 57719,
- 29939, 29941, 29944, 29945, 29946, 29947, 29948, 29949, 29950, 29952, 29953, 29954, 29955, 29957, 29958,
- 29959, 29960, 29961, 29962, 29963, 29964, 29966, 29968, 29970, 29972, 29973, 29974, 29975, 29979, 29981,
- 29982, 29984, 29985, 29986, 29987, 29988, 29990, 29991, 29994, 29998, 30004, 30006, 30009, 30012, 30013,
- 30015, 30017, 30018, 30019, 30020, 30022, 30023, 30025, 30026, 30029, 30032, 30033, 30034, 30035, 30037,
- 30038, 30039, 30040, 30045, 30046, 30047, 30048, 30049, 30050, 30051, 30052, 30055, 30056, 30057, 30059,
- 30060, 30061, 30062, 30063, 30064, 30065, 30067, 30069, 30070, 30071, 30074, 30075, 30076, 30077, 30078,
- 30080, 30081, 30082, 30084, 30085, 30087, 57720, 57721, 57722, 57723, 57724, 57725, 57726, 57727, 57728,
- 57729, 57730, 57731, 57732, 57733, 57734, 57735, 57736, 57737, 57738, 57739, 57740, 57741, 57742, 57743,
- 57744, 57745, 57746, 57747, 57748, 57749, 57750, 57751, 57752, 57753, 57754, 57755, 57756, 57757, 57758,
- 57759, 57760, 57761, 57762, 57763, 57764, 57765, 57766, 57767, 57768, 57769, 57770, 57771, 57772, 57773,
- 57774, 57775, 57776, 57777, 57778, 57779, 57780, 57781, 57782, 57783, 57784, 57785, 57786, 57787, 57788,
- 57789, 57790, 57791, 57792, 57793, 57794, 57795, 57796, 57797, 57798, 57799, 57800, 57801, 57802, 57803,
- 57804, 57805, 57806, 57807, 57808, 57809, 57810, 57811, 57812, 57813, 30088, 30089, 30090, 30092, 30093,
- 30094, 30096, 30099, 30101, 30104, 30107, 30108, 30110, 30114, 30118, 30119, 30120, 30121, 30122, 30125,
- 30134, 30135, 30138, 30139, 30143, 30144, 30145, 30150, 30155, 30156, 30158, 30159, 30160, 30161, 30163,
- 30167, 30169, 30170, 30172, 30173, 30175, 30176, 30177, 30181, 30185, 30188, 30189, 30190, 30191, 30194,
- 30195, 30197, 30198, 30199, 30200, 30202, 30203, 30205, 30206, 30210, 30212, 30214, 30215, 30216, 30217,
- 30219, 30221, 30222, 30223, 30225, 30226, 30227, 30228, 30230, 30234, 30236, 30237, 30238, 30241, 30243,
- 30247, 30248, 30252, 30254, 30255, 30257, 30258, 30262, 30263, 30265, 30266, 30267, 30269, 30273, 30274,
- 30276, 57814, 57815, 57816, 57817, 57818, 57819, 57820, 57821, 57822, 57823, 57824, 57825, 57826, 57827,
- 57828, 57829, 57830, 57831, 57832, 57833, 57834, 57835, 57836, 57837, 57838, 57839, 57840, 57841, 57842,
- 57843, 57844, 57845, 57846, 57847, 57848, 57849, 57850, 57851, 57852, 57853, 57854, 57855, 57856, 57857,
- 57858, 57859, 57860, 57861, 57862, 57863, 57864, 57865, 57866, 57867, 57868, 57869, 57870, 57871, 57872,
- 57873, 57874, 57875, 57876, 57877, 57878, 57879, 57880, 57881, 57882, 57883, 57884, 57885, 57886, 57887,
- 57888, 57889, 57890, 57891, 57892, 57893, 57894, 57895, 57896, 57897, 57898, 57899, 57900, 57901, 57902,
- 57903, 57904, 57905, 57906, 57907, 30277, 30278, 30279, 30280, 30281, 30282, 30283, 30286, 30287, 30288,
- 30289, 30290, 30291, 30293, 30295, 30296, 30297, 30298, 30299, 30301, 30303, 30304, 30305, 30306, 30308,
- 30309, 30310, 30311, 30312, 30313, 30314, 30316, 30317, 30318, 30320, 30321, 30322, 30323, 30324, 30325,
- 30326, 30327, 30329, 30330, 30332, 30335, 30336, 30337, 30339, 30341, 30345, 30346, 30348, 30349, 30351,
- 30352, 30354, 30356, 30357, 30359, 30360, 30362, 30363, 30364, 30365, 30366, 30367, 30368, 30369, 30370,
- 30371, 30373, 30374, 30375, 30376, 30377, 30378, 30379, 30380, 30381, 30383, 30384, 30387, 30389, 30390,
- 30391, 30392, 30393, 30394, 30395, 30396, 30397, 30398, 30400, 30401, 30403, 21834, 38463, 22467, 25384,
- 21710, 21769, 21696, 30353, 30284, 34108, 30702, 33406, 30861, 29233, 38552, 38797, 27688, 23433, 20474,
- 25353, 26263, 23736, 33018, 26696, 32942, 26114, 30414, 20985, 25942, 29100, 32753, 34948, 20658, 22885,
- 25034, 28595, 33453, 25420, 25170, 21485, 21543, 31494, 20843, 30116, 24052, 25300, 36299, 38774, 25226,
- 32793, 22365, 38712, 32610, 29240, 30333, 26575, 30334, 25670, 20336, 36133, 25308, 31255, 26001, 29677,
- 25644, 25203, 33324, 39041, 26495, 29256, 25198, 25292, 20276, 29923, 21322, 21150, 32458, 37030, 24110,
- 26758, 27036, 33152, 32465, 26834, 30917, 34444, 38225, 20621, 35876, 33502, 32990, 21253, 35090, 21093,
- 30404, 30407, 30409, 30411, 30412, 30419, 30421, 30425, 30426, 30428, 30429, 30430, 30432, 30433, 30434,
- 30435, 30436, 30438, 30439, 30440, 30441, 30442, 30443, 30444, 30445, 30448, 30451, 30453, 30454, 30455,
- 30458, 30459, 30461, 30463, 30464, 30466, 30467, 30469, 30470, 30474, 30476, 30478, 30479, 30480, 30481,
- 30482, 30483, 30484, 30485, 30486, 30487, 30488, 30491, 30492, 30493, 30494, 30497, 30499, 30500, 30501,
- 30503, 30506, 30507, 30508, 30510, 30512, 30513, 30514, 30515, 30516, 30521, 30523, 30525, 30526, 30527,
- 30530, 30532, 30533, 30534, 30536, 30537, 30538, 30539, 30540, 30541, 30542, 30543, 30546, 30547, 30548,
- 30549, 30550, 30551, 30552, 30553, 30556, 34180, 38649, 20445, 22561, 39281, 23453, 25265, 25253, 26292,
- 35961, 40077, 29190, 26479, 30865, 24754, 21329, 21271, 36744, 32972, 36125, 38049, 20493, 29384, 22791,
- 24811, 28953, 34987, 22868, 33519, 26412, 31528, 23849, 32503, 29997, 27893, 36454, 36856, 36924, 40763,
- 27604, 37145, 31508, 24444, 30887, 34006, 34109, 27605, 27609, 27606, 24065, 24199, 30201, 38381, 25949,
- 24330, 24517, 36767, 22721, 33218, 36991, 38491, 38829, 36793, 32534, 36140, 25153, 20415, 21464, 21342,
- 36776, 36777, 36779, 36941, 26631, 24426, 33176, 34920, 40150, 24971, 21035, 30250, 24428, 25996, 28626,
- 28392, 23486, 25672, 20853, 20912, 26564, 19993, 31177, 39292, 28851, 30557, 30558, 30559, 30560, 30564,
- 30567, 30569, 30570, 30573, 30574, 30575, 30576, 30577, 30578, 30579, 30580, 30581, 30582, 30583, 30584,
- 30586, 30587, 30588, 30593, 30594, 30595, 30598, 30599, 30600, 30601, 30602, 30603, 30607, 30608, 30611,
- 30612, 30613, 30614, 30615, 30616, 30617, 30618, 30619, 30620, 30621, 30622, 30625, 30627, 30628, 30630,
- 30632, 30635, 30637, 30638, 30639, 30641, 30642, 30644, 30646, 30647, 30648, 30649, 30650, 30652, 30654,
- 30656, 30657, 30658, 30659, 30660, 30661, 30662, 30663, 30664, 30665, 30666, 30667, 30668, 30670, 30671,
- 30672, 30673, 30674, 30675, 30676, 30677, 30678, 30680, 30681, 30682, 30685, 30686, 30687, 30688, 30689,
- 30692, 30149, 24182, 29627, 33760, 25773, 25320, 38069, 27874, 21338, 21187, 25615, 38082, 31636, 20271,
- 24091, 33334, 33046, 33162, 28196, 27850, 39539, 25429, 21340, 21754, 34917, 22496, 19981, 24067, 27493,
- 31807, 37096, 24598, 25830, 29468, 35009, 26448, 25165, 36130, 30572, 36393, 37319, 24425, 33756, 34081,
- 39184, 21442, 34453, 27531, 24813, 24808, 28799, 33485, 33329, 20179, 27815, 34255, 25805, 31961, 27133,
- 26361, 33609, 21397, 31574, 20391, 20876, 27979, 23618, 36461, 25554, 21449, 33580, 33590, 26597, 30900,
- 25661, 23519, 23700, 24046, 35815, 25286, 26612, 35962, 25600, 25530, 34633, 39307, 35863, 32544, 38130,
- 20135, 38416, 39076, 26124, 29462, 30694, 30696, 30698, 30703, 30704, 30705, 30706, 30708, 30709, 30711,
- 30713, 30714, 30715, 30716, 30723, 30724, 30725, 30726, 30727, 30728, 30730, 30731, 30734, 30735, 30736,
- 30739, 30741, 30745, 30747, 30750, 30752, 30753, 30754, 30756, 30760, 30762, 30763, 30766, 30767, 30769,
- 30770, 30771, 30773, 30774, 30781, 30783, 30785, 30786, 30787, 30788, 30790, 30792, 30793, 30794, 30795,
- 30797, 30799, 30801, 30803, 30804, 30808, 30809, 30810, 30811, 30812, 30814, 30815, 30816, 30817, 30818,
- 30819, 30820, 30821, 30822, 30823, 30824, 30825, 30831, 30832, 30833, 30834, 30835, 30836, 30837, 30838,
- 30840, 30841, 30842, 30843, 30845, 30846, 30847, 30848, 30849, 30850, 30851, 22330, 23581, 24120, 38271,
- 20607, 32928, 21378, 25950, 30021, 21809, 20513, 36229, 25220, 38046, 26397, 22066, 28526, 24034, 21557,
- 28818, 36710, 25199, 25764, 25507, 24443, 28552, 37108, 33251, 36784, 23576, 26216, 24561, 27785, 38472,
- 36225, 34924, 25745, 31216, 22478, 27225, 25104, 21576, 20056, 31243, 24809, 28548, 35802, 25215, 36894,
- 39563, 31204, 21507, 30196, 25345, 21273, 27744, 36831, 24347, 39536, 32827, 40831, 20360, 23610, 36196,
- 32709, 26021, 28861, 20805, 20914, 34411, 23815, 23456, 25277, 37228, 30068, 36364, 31264, 24833, 31609,
- 20167, 32504, 30597, 19985, 33261, 21021, 20986, 27249, 21416, 36487, 38148, 38607, 28353, 38500, 26970,
- 30852, 30853, 30854, 30856, 30858, 30859, 30863, 30864, 30866, 30868, 30869, 30870, 30873, 30877, 30878,
- 30880, 30882, 30884, 30886, 30888, 30889, 30890, 30891, 30892, 30893, 30894, 30895, 30901, 30902, 30903,
- 30904, 30906, 30907, 30908, 30909, 30911, 30912, 30914, 30915, 30916, 30918, 30919, 30920, 30924, 30925,
- 30926, 30927, 30929, 30930, 30931, 30934, 30935, 30936, 30938, 30939, 30940, 30941, 30942, 30943, 30944,
- 30945, 30946, 30947, 30948, 30949, 30950, 30951, 30953, 30954, 30955, 30957, 30958, 30959, 30960, 30961,
- 30963, 30965, 30966, 30968, 30969, 30971, 30972, 30973, 30974, 30975, 30976, 30978, 30979, 30980, 30982,
- 30983, 30984, 30985, 30986, 30987, 30988, 30784, 20648, 30679, 25616, 35302, 22788, 25571, 24029, 31359,
- 26941, 20256, 33337, 21912, 20018, 30126, 31383, 24162, 24202, 38383, 21019, 21561, 28810, 25462, 38180,
- 22402, 26149, 26943, 37255, 21767, 28147, 32431, 34850, 25139, 32496, 30133, 33576, 30913, 38604, 36766,
- 24904, 29943, 35789, 27492, 21050, 36176, 27425, 32874, 33905, 22257, 21254, 20174, 19995, 20945, 31895,
- 37259, 31751, 20419, 36479, 31713, 31388, 25703, 23828, 20652, 33030, 30209, 31929, 28140, 32736, 26449,
- 23384, 23544, 30923, 25774, 25619, 25514, 25387, 38169, 25645, 36798, 31572, 30249, 25171, 22823, 21574,
- 27513, 20643, 25140, 24102, 27526, 20195, 36151, 34955, 24453, 36910, 30989, 30990, 30991, 30992, 30993,
- 30994, 30996, 30997, 30998, 30999, 31000, 31001, 31002, 31003, 31004, 31005, 31007, 31008, 31009, 31010,
- 31011, 31013, 31014, 31015, 31016, 31017, 31018, 31019, 31020, 31021, 31022, 31023, 31024, 31025, 31026,
- 31027, 31029, 31030, 31031, 31032, 31033, 31037, 31039, 31042, 31043, 31044, 31045, 31047, 31050, 31051,
- 31052, 31053, 31054, 31055, 31056, 31057, 31058, 31060, 31061, 31064, 31065, 31073, 31075, 31076, 31078,
- 31081, 31082, 31083, 31084, 31086, 31088, 31089, 31090, 31091, 31092, 31093, 31094, 31097, 31099, 31100,
- 31101, 31102, 31103, 31106, 31107, 31110, 31111, 31112, 31113, 31115, 31116, 31117, 31118, 31120, 31121,
- 31122, 24608, 32829, 25285, 20025, 21333, 37112, 25528, 32966, 26086, 27694, 20294, 24814, 28129, 35806,
- 24377, 34507, 24403, 25377, 20826, 33633, 26723, 20992, 25443, 36424, 20498, 23707, 31095, 23548, 21040,
- 31291, 24764, 36947, 30423, 24503, 24471, 30340, 36460, 28783, 30331, 31561, 30634, 20979, 37011, 22564,
- 20302, 28404, 36842, 25932, 31515, 29380, 28068, 32735, 23265, 25269, 24213, 22320, 33922, 31532, 24093,
- 24351, 36882, 32532, 39072, 25474, 28359, 30872, 28857, 20856, 38747, 22443, 30005, 20291, 30008, 24215,
- 24806, 22880, 28096, 27583, 30857, 21500, 38613, 20939, 20993, 25481, 21514, 38035, 35843, 36300, 29241,
- 30879, 34678, 36845, 35853, 21472, 31123, 31124, 31125, 31126, 31127, 31128, 31129, 31131, 31132, 31133,
- 31134, 31135, 31136, 31137, 31138, 31139, 31140, 31141, 31142, 31144, 31145, 31146, 31147, 31148, 31149,
- 31150, 31151, 31152, 31153, 31154, 31156, 31157, 31158, 31159, 31160, 31164, 31167, 31170, 31172, 31173,
- 31175, 31176, 31178, 31180, 31182, 31183, 31184, 31187, 31188, 31190, 31191, 31193, 31194, 31195, 31196,
- 31197, 31198, 31200, 31201, 31202, 31205, 31208, 31210, 31212, 31214, 31217, 31218, 31219, 31220, 31221,
- 31222, 31223, 31225, 31226, 31228, 31230, 31231, 31233, 31236, 31237, 31239, 31240, 31241, 31242, 31244,
- 31247, 31248, 31249, 31250, 31251, 31253, 31254, 31256, 31257, 31259, 31260, 19969, 30447, 21486, 38025,
- 39030, 40718, 38189, 23450, 35746, 20002, 19996, 20908, 33891, 25026, 21160, 26635, 20375, 24683, 20923,
- 27934, 20828, 25238, 26007, 38497, 35910, 36887, 30168, 37117, 30563, 27602, 29322, 29420, 35835, 22581,
- 30585, 36172, 26460, 38208, 32922, 24230, 28193, 22930, 31471, 30701, 38203, 27573, 26029, 32526, 22534,
- 20817, 38431, 23545, 22697, 21544, 36466, 25958, 39039, 22244, 38045, 30462, 36929, 25479, 21702, 22810,
- 22842, 22427, 36530, 26421, 36346, 33333, 21057, 24816, 22549, 34558, 23784, 40517, 20420, 39069, 35769,
- 23077, 24694, 21380, 25212, 36943, 37122, 39295, 24681, 32780, 20799, 32819, 23572, 39285, 27953, 20108,
- 31261, 31263, 31265, 31266, 31268, 31269, 31270, 31271, 31272, 31273, 31274, 31275, 31276, 31277, 31278,
- 31279, 31280, 31281, 31282, 31284, 31285, 31286, 31288, 31290, 31294, 31296, 31297, 31298, 31299, 31300,
- 31301, 31303, 31304, 31305, 31306, 31307, 31308, 31309, 31310, 31311, 31312, 31314, 31315, 31316, 31317,
- 31318, 31320, 31321, 31322, 31323, 31324, 31325, 31326, 31327, 31328, 31329, 31330, 31331, 31332, 31333,
- 31334, 31335, 31336, 31337, 31338, 31339, 31340, 31341, 31342, 31343, 31345, 31346, 31347, 31349, 31355,
- 31356, 31357, 31358, 31362, 31365, 31367, 31369, 31370, 31371, 31372, 31374, 31375, 31376, 31379, 31380,
- 31385, 31386, 31387, 31390, 31393, 31394, 36144, 21457, 32602, 31567, 20240, 20047, 38400, 27861, 29648,
- 34281, 24070, 30058, 32763, 27146, 30718, 38034, 32321, 20961, 28902, 21453, 36820, 33539, 36137, 29359,
- 39277, 27867, 22346, 33459, 26041, 32938, 25151, 38450, 22952, 20223, 35775, 32442, 25918, 33778, 38750,
- 21857, 39134, 32933, 21290, 35837, 21536, 32954, 24223, 27832, 36153, 33452, 37210, 21545, 27675, 20998,
- 32439, 22367, 28954, 27774, 31881, 22859, 20221, 24575, 24868, 31914, 20016, 23553, 26539, 34562, 23792,
- 38155, 39118, 30127, 28925, 36898, 20911, 32541, 35773, 22857, 20964, 20315, 21542, 22827, 25975, 32932,
- 23413, 25206, 25282, 36752, 24133, 27679, 31526, 20239, 20440, 26381, 31395, 31396, 31399, 31401, 31402,
- 31403, 31406, 31407, 31408, 31409, 31410, 31412, 31413, 31414, 31415, 31416, 31417, 31418, 31419, 31420,
- 31421, 31422, 31424, 31425, 31426, 31427, 31428, 31429, 31430, 31431, 31432, 31433, 31434, 31436, 31437,
- 31438, 31439, 31440, 31441, 31442, 31443, 31444, 31445, 31447, 31448, 31450, 31451, 31452, 31453, 31457,
- 31458, 31460, 31463, 31464, 31465, 31466, 31467, 31468, 31470, 31472, 31473, 31474, 31475, 31476, 31477,
- 31478, 31479, 31480, 31483, 31484, 31486, 31488, 31489, 31490, 31493, 31495, 31497, 31500, 31501, 31502,
- 31504, 31506, 31507, 31510, 31511, 31512, 31514, 31516, 31517, 31519, 31521, 31522, 31523, 31527, 31529,
- 31533, 28014, 28074, 31119, 34993, 24343, 29995, 25242, 36741, 20463, 37340, 26023, 33071, 33105, 24220,
- 33104, 36212, 21103, 35206, 36171, 22797, 20613, 20184, 38428, 29238, 33145, 36127, 23500, 35747, 38468,
- 22919, 32538, 21648, 22134, 22030, 35813, 25913, 27010, 38041, 30422, 28297, 24178, 29976, 26438, 26577,
- 31487, 32925, 36214, 24863, 31174, 25954, 36195, 20872, 21018, 38050, 32568, 32923, 32434, 23703, 28207,
- 26464, 31705, 30347, 39640, 33167, 32660, 31957, 25630, 38224, 31295, 21578, 21733, 27468, 25601, 25096,
- 40509, 33011, 30105, 21106, 38761, 33883, 26684, 34532, 38401, 38548, 38124, 20010, 21508, 32473, 26681,
- 36319, 32789, 26356, 24218, 32697, 31535, 31536, 31538, 31540, 31541, 31542, 31543, 31545, 31547, 31549,
- 31551, 31552, 31553, 31554, 31555, 31556, 31558, 31560, 31562, 31565, 31566, 31571, 31573, 31575, 31577,
- 31580, 31582, 31583, 31585, 31587, 31588, 31589, 31590, 31591, 31592, 31593, 31594, 31595, 31596, 31597,
- 31599, 31600, 31603, 31604, 31606, 31608, 31610, 31612, 31613, 31615, 31617, 31618, 31619, 31620, 31622,
- 31623, 31624, 31625, 31626, 31627, 31628, 31630, 31631, 31633, 31634, 31635, 31638, 31640, 31641, 31642,
- 31643, 31646, 31647, 31648, 31651, 31652, 31653, 31662, 31663, 31664, 31666, 31667, 31669, 31670, 31671,
- 31673, 31674, 31675, 31676, 31677, 31678, 31679, 31680, 31682, 31683, 31684, 22466, 32831, 26775, 24037,
- 25915, 21151, 24685, 40858, 20379, 36524, 20844, 23467, 24339, 24041, 27742, 25329, 36129, 20849, 38057,
- 21246, 27807, 33503, 29399, 22434, 26500, 36141, 22815, 36764, 33735, 21653, 31629, 20272, 27837, 23396,
- 22993, 40723, 21476, 34506, 39592, 35895, 32929, 25925, 39038, 22266, 38599, 21038, 29916, 21072, 23521,
- 25346, 35074, 20054, 25296, 24618, 26874, 20851, 23448, 20896, 35266, 31649, 39302, 32592, 24815, 28748,
- 36143, 20809, 24191, 36891, 29808, 35268, 22317, 30789, 24402, 40863, 38394, 36712, 39740, 35809, 30328,
- 26690, 26588, 36330, 36149, 21053, 36746, 28378, 26829, 38149, 37101, 22269, 26524, 35065, 36807, 21704,
- 31685, 31688, 31689, 31690, 31691, 31693, 31694, 31695, 31696, 31698, 31700, 31701, 31702, 31703, 31704,
- 31707, 31708, 31710, 31711, 31712, 31714, 31715, 31716, 31719, 31720, 31721, 31723, 31724, 31725, 31727,
- 31728, 31730, 31731, 31732, 31733, 31734, 31736, 31737, 31738, 31739, 31741, 31743, 31744, 31745, 31746,
- 31747, 31748, 31749, 31750, 31752, 31753, 31754, 31757, 31758, 31760, 31761, 31762, 31763, 31764, 31765,
- 31767, 31768, 31769, 31770, 31771, 31772, 31773, 31774, 31776, 31777, 31778, 31779, 31780, 31781, 31784,
- 31785, 31787, 31788, 31789, 31790, 31791, 31792, 31793, 31794, 31795, 31796, 31797, 31798, 31799, 31801,
- 31802, 31803, 31804, 31805, 31806, 31810, 39608, 23401, 28023, 27686, 20133, 23475, 39559, 37219, 25000,
- 37039, 38889, 21547, 28085, 23506, 20989, 21898, 32597, 32752, 25788, 25421, 26097, 25022, 24717, 28938,
- 27735, 27721, 22831, 26477, 33322, 22741, 22158, 35946, 27627, 37085, 22909, 32791, 21495, 28009, 21621,
- 21917, 33655, 33743, 26680, 31166, 21644, 20309, 21512, 30418, 35977, 38402, 27827, 28088, 36203, 35088,
- 40548, 36154, 22079, 40657, 30165, 24456, 29408, 24680, 21756, 20136, 27178, 34913, 24658, 36720, 21700,
- 28888, 34425, 40511, 27946, 23439, 24344, 32418, 21897, 20399, 29492, 21564, 21402, 20505, 21518, 21628,
- 20046, 24573, 29786, 22774, 33899, 32993, 34676, 29392, 31946, 28246, 31811, 31812, 31813, 31814, 31815,
- 31816, 31817, 31818, 31819, 31820, 31822, 31823, 31824, 31825, 31826, 31827, 31828, 31829, 31830, 31831,
- 31832, 31833, 31834, 31835, 31836, 31837, 31838, 31839, 31840, 31841, 31842, 31843, 31844, 31845, 31846,
- 31847, 31848, 31849, 31850, 31851, 31852, 31853, 31854, 31855, 31856, 31857, 31858, 31861, 31862, 31863,
- 31864, 31865, 31866, 31870, 31871, 31872, 31873, 31874, 31875, 31876, 31877, 31878, 31879, 31880, 31882,
- 31883, 31884, 31885, 31886, 31887, 31888, 31891, 31892, 31894, 31897, 31898, 31899, 31904, 31905, 31907,
- 31910, 31911, 31912, 31913, 31915, 31916, 31917, 31919, 31920, 31924, 31925, 31926, 31927, 31928, 31930,
- 31931, 24359, 34382, 21804, 25252, 20114, 27818, 25143, 33457, 21719, 21326, 29502, 28369, 30011, 21010,
- 21270, 35805, 27088, 24458, 24576, 28142, 22351, 27426, 29615, 26707, 36824, 32531, 25442, 24739, 21796,
- 30186, 35938, 28949, 28067, 23462, 24187, 33618, 24908, 40644, 30970, 34647, 31783, 30343, 20976, 24822,
- 29004, 26179, 24140, 24653, 35854, 28784, 25381, 36745, 24509, 24674, 34516, 22238, 27585, 24724, 24935,
- 21321, 24800, 26214, 36159, 31229, 20250, 28905, 27719, 35763, 35826, 32472, 33636, 26127, 23130, 39746,
- 27985, 28151, 35905, 27963, 20249, 28779, 33719, 25110, 24785, 38669, 36135, 31096, 20987, 22334, 22522,
- 26426, 30072, 31293, 31215, 31637, 31935, 31936, 31938, 31939, 31940, 31942, 31945, 31947, 31950, 31951,
- 31952, 31953, 31954, 31955, 31956, 31960, 31962, 31963, 31965, 31966, 31969, 31970, 31971, 31972, 31973,
- 31974, 31975, 31977, 31978, 31979, 31980, 31981, 31982, 31984, 31985, 31986, 31987, 31988, 31989, 31990,
- 31991, 31993, 31994, 31996, 31997, 31998, 31999, 32000, 32001, 32002, 32003, 32004, 32005, 32006, 32007,
- 32008, 32009, 32011, 32012, 32013, 32014, 32015, 32016, 32017, 32018, 32019, 32020, 32021, 32022, 32023,
- 32024, 32025, 32026, 32027, 32028, 32029, 32030, 32031, 32033, 32035, 32036, 32037, 32038, 32040, 32041,
- 32042, 32044, 32045, 32046, 32048, 32049, 32050, 32051, 32052, 32053, 32054, 32908, 39269, 36857, 28608,
- 35749, 40481, 23020, 32489, 32521, 21513, 26497, 26840, 36753, 31821, 38598, 21450, 24613, 30142, 27762,
- 21363, 23241, 32423, 25380, 20960, 33034, 24049, 34015, 25216, 20864, 23395, 20238, 31085, 21058, 24760,
- 27982, 23492, 23490, 35745, 35760, 26082, 24524, 38469, 22931, 32487, 32426, 22025, 26551, 22841, 20339,
- 23478, 21152, 33626, 39050, 36158, 30002, 38078, 20551, 31292, 20215, 26550, 39550, 23233, 27516, 30417,
- 22362, 23574, 31546, 38388, 29006, 20860, 32937, 33392, 22904, 32516, 33575, 26816, 26604, 30897, 30839,
- 25315, 25441, 31616, 20461, 21098, 20943, 33616, 27099, 37492, 36341, 36145, 35265, 38190, 31661, 20214,
- 32055, 32056, 32057, 32058, 32059, 32060, 32061, 32062, 32063, 32064, 32065, 32066, 32067, 32068, 32069,
- 32070, 32071, 32072, 32073, 32074, 32075, 32076, 32077, 32078, 32079, 32080, 32081, 32082, 32083, 32084,
- 32085, 32086, 32087, 32088, 32089, 32090, 32091, 32092, 32093, 32094, 32095, 32096, 32097, 32098, 32099,
- 32100, 32101, 32102, 32103, 32104, 32105, 32106, 32107, 32108, 32109, 32111, 32112, 32113, 32114, 32115,
- 32116, 32117, 32118, 32120, 32121, 32122, 32123, 32124, 32125, 32126, 32127, 32128, 32129, 32130, 32131,
- 32132, 32133, 32134, 32135, 32136, 32137, 32138, 32139, 32140, 32141, 32142, 32143, 32144, 32145, 32146,
- 32147, 32148, 32149, 32150, 32151, 32152, 20581, 33328, 21073, 39279, 28176, 28293, 28071, 24314, 20725,
- 23004, 23558, 27974, 27743, 30086, 33931, 26728, 22870, 35762, 21280, 37233, 38477, 34121, 26898, 30977,
- 28966, 33014, 20132, 37066, 27975, 39556, 23047, 22204, 25605, 38128, 30699, 20389, 33050, 29409, 35282,
- 39290, 32564, 32478, 21119, 25945, 37237, 36735, 36739, 21483, 31382, 25581, 25509, 30342, 31224, 34903,
- 38454, 25130, 21163, 33410, 26708, 26480, 25463, 30571, 31469, 27905, 32467, 35299, 22992, 25106, 34249,
- 33445, 30028, 20511, 20171, 30117, 35819, 23626, 24062, 31563, 26020, 37329, 20170, 27941, 35167, 32039,
- 38182, 20165, 35880, 36827, 38771, 26187, 31105, 36817, 28908, 28024, 32153, 32154, 32155, 32156, 32157,
- 32158, 32159, 32160, 32161, 32162, 32163, 32164, 32165, 32167, 32168, 32169, 32170, 32171, 32172, 32173,
- 32175, 32176, 32177, 32178, 32179, 32180, 32181, 32182, 32183, 32184, 32185, 32186, 32187, 32188, 32189,
- 32190, 32191, 32192, 32193, 32194, 32195, 32196, 32197, 32198, 32199, 32200, 32201, 32202, 32203, 32204,
- 32205, 32206, 32207, 32208, 32209, 32210, 32211, 32212, 32213, 32214, 32215, 32216, 32217, 32218, 32219,
- 32220, 32221, 32222, 32223, 32224, 32225, 32226, 32227, 32228, 32229, 32230, 32231, 32232, 32233, 32234,
- 32235, 32236, 32237, 32238, 32239, 32240, 32241, 32242, 32243, 32244, 32245, 32246, 32247, 32248, 32249,
- 32250, 23613, 21170, 33606, 20834, 33550, 30555, 26230, 40120, 20140, 24778, 31934, 31923, 32463, 20117,
- 35686, 26223, 39048, 38745, 22659, 25964, 38236, 24452, 30153, 38742, 31455, 31454, 20928, 28847, 31384,
- 25578, 31350, 32416, 29590, 38893, 20037, 28792, 20061, 37202, 21417, 25937, 26087, 33276, 33285, 21646,
- 23601, 30106, 38816, 25304, 29401, 30141, 23621, 39545, 33738, 23616, 21632, 30697, 20030, 27822, 32858,
- 25298, 25454, 24040, 20855, 36317, 36382, 38191, 20465, 21477, 24807, 28844, 21095, 25424, 40515, 23071,
- 20518, 30519, 21367, 32482, 25733, 25899, 25225, 25496, 20500, 29237, 35273, 20915, 35776, 32477, 22343,
- 33740, 38055, 20891, 21531, 23803, 32251, 32252, 32253, 32254, 32255, 32256, 32257, 32258, 32259, 32260,
- 32261, 32262, 32263, 32264, 32265, 32266, 32267, 32268, 32269, 32270, 32271, 32272, 32273, 32274, 32275,
- 32276, 32277, 32278, 32279, 32280, 32281, 32282, 32283, 32284, 32285, 32286, 32287, 32288, 32289, 32290,
- 32291, 32292, 32293, 32294, 32295, 32296, 32297, 32298, 32299, 32300, 32301, 32302, 32303, 32304, 32305,
- 32306, 32307, 32308, 32309, 32310, 32311, 32312, 32313, 32314, 32316, 32317, 32318, 32319, 32320, 32322,
- 32323, 32324, 32325, 32326, 32328, 32329, 32330, 32331, 32332, 32333, 32334, 32335, 32336, 32337, 32338,
- 32339, 32340, 32341, 32342, 32343, 32344, 32345, 32346, 32347, 32348, 32349, 20426, 31459, 27994, 37089,
- 39567, 21888, 21654, 21345, 21679, 24320, 25577, 26999, 20975, 24936, 21002, 22570, 21208, 22350, 30733,
- 30475, 24247, 24951, 31968, 25179, 25239, 20130, 28821, 32771, 25335, 28900, 38752, 22391, 33499, 26607,
- 26869, 30933, 39063, 31185, 22771, 21683, 21487, 28212, 20811, 21051, 23458, 35838, 32943, 21827, 22438,
- 24691, 22353, 21549, 31354, 24656, 23380, 25511, 25248, 21475, 25187, 23495, 26543, 21741, 31391, 33510,
- 37239, 24211, 35044, 22840, 22446, 25358, 36328, 33007, 22359, 31607, 20393, 24555, 23485, 27454, 21281,
- 31568, 29378, 26694, 30719, 30518, 26103, 20917, 20111, 30420, 23743, 31397, 33909, 22862, 39745, 20608,
- 32350, 32351, 32352, 32353, 32354, 32355, 32356, 32357, 32358, 32359, 32360, 32361, 32362, 32363, 32364,
- 32365, 32366, 32367, 32368, 32369, 32370, 32371, 32372, 32373, 32374, 32375, 32376, 32377, 32378, 32379,
- 32380, 32381, 32382, 32383, 32384, 32385, 32387, 32388, 32389, 32390, 32391, 32392, 32393, 32394, 32395,
- 32396, 32397, 32398, 32399, 32400, 32401, 32402, 32403, 32404, 32405, 32406, 32407, 32408, 32409, 32410,
- 32412, 32413, 32414, 32430, 32436, 32443, 32444, 32470, 32484, 32492, 32505, 32522, 32528, 32542, 32567,
- 32569, 32571, 32572, 32573, 32574, 32575, 32576, 32577, 32579, 32582, 32583, 32584, 32585, 32586, 32587,
- 32588, 32589, 32590, 32591, 32594, 32595, 39304, 24871, 28291, 22372, 26118, 25414, 22256, 25324, 25193,
- 24275, 38420, 22403, 25289, 21895, 34593, 33098, 36771, 21862, 33713, 26469, 36182, 34013, 23146, 26639,
- 25318, 31726, 38417, 20848, 28572, 35888, 25597, 35272, 25042, 32518, 28866, 28389, 29701, 27028, 29436,
- 24266, 37070, 26391, 28010, 25438, 21171, 29282, 32769, 20332, 23013, 37226, 28889, 28061, 21202, 20048,
- 38647, 38253, 34174, 30922, 32047, 20769, 22418, 25794, 32907, 31867, 27882, 26865, 26974, 20919, 21400,
- 26792, 29313, 40654, 31729, 29432, 31163, 28435, 29702, 26446, 37324, 40100, 31036, 33673, 33620, 21519,
- 26647, 20029, 21385, 21169, 30782, 21382, 21033, 20616, 20363, 20432, 32598, 32601, 32603, 32604, 32605,
- 32606, 32608, 32611, 32612, 32613, 32614, 32615, 32619, 32620, 32621, 32623, 32624, 32627, 32629, 32630,
- 32631, 32632, 32634, 32635, 32636, 32637, 32639, 32640, 32642, 32643, 32644, 32645, 32646, 32647, 32648,
- 32649, 32651, 32653, 32655, 32656, 32657, 32658, 32659, 32661, 32662, 32663, 32664, 32665, 32667, 32668,
- 32672, 32674, 32675, 32677, 32678, 32680, 32681, 32682, 32683, 32684, 32685, 32686, 32689, 32691, 32692,
- 32693, 32694, 32695, 32698, 32699, 32702, 32704, 32706, 32707, 32708, 32710, 32711, 32712, 32713, 32715,
- 32717, 32719, 32720, 32721, 32722, 32723, 32726, 32727, 32729, 32730, 32731, 32732, 32733, 32734, 32738,
- 32739, 30178, 31435, 31890, 27813, 38582, 21147, 29827, 21737, 20457, 32852, 33714, 36830, 38256, 24265,
- 24604, 28063, 24088, 25947, 33080, 38142, 24651, 28860, 32451, 31918, 20937, 26753, 31921, 33391, 20004,
- 36742, 37327, 26238, 20142, 35845, 25769, 32842, 20698, 30103, 29134, 23525, 36797, 28518, 20102, 25730,
- 38243, 24278, 26009, 21015, 35010, 28872, 21155, 29454, 29747, 26519, 30967, 38678, 20020, 37051, 40158,
- 28107, 20955, 36161, 21533, 25294, 29618, 33777, 38646, 40836, 38083, 20278, 32666, 20940, 28789, 38517,
- 23725, 39046, 21478, 20196, 28316, 29705, 27060, 30827, 39311, 30041, 21016, 30244, 27969, 26611, 20845,
- 40857, 32843, 21657, 31548, 31423, 32740, 32743, 32744, 32746, 32747, 32748, 32749, 32751, 32754, 32756,
- 32757, 32758, 32759, 32760, 32761, 32762, 32765, 32766, 32767, 32770, 32775, 32776, 32777, 32778, 32782,
- 32783, 32785, 32787, 32794, 32795, 32797, 32798, 32799, 32801, 32803, 32804, 32811, 32812, 32813, 32814,
- 32815, 32816, 32818, 32820, 32825, 32826, 32828, 32830, 32832, 32833, 32836, 32837, 32839, 32840, 32841,
- 32846, 32847, 32848, 32849, 32851, 32853, 32854, 32855, 32857, 32859, 32860, 32861, 32862, 32863, 32864,
- 32865, 32866, 32867, 32868, 32869, 32870, 32871, 32872, 32875, 32876, 32877, 32878, 32879, 32880, 32882,
- 32883, 32884, 32885, 32886, 32887, 32888, 32889, 32890, 32891, 32892, 32893, 38534, 22404, 25314, 38471,
- 27004, 23044, 25602, 31699, 28431, 38475, 33446, 21346, 39045, 24208, 28809, 25523, 21348, 34383, 40065,
- 40595, 30860, 38706, 36335, 36162, 40575, 28510, 31108, 24405, 38470, 25134, 39540, 21525, 38109, 20387,
- 26053, 23653, 23649, 32533, 34385, 27695, 24459, 29575, 28388, 32511, 23782, 25371, 23402, 28390, 21365,
- 20081, 25504, 30053, 25249, 36718, 20262, 20177, 27814, 32438, 35770, 33821, 34746, 32599, 36923, 38179,
- 31657, 39585, 35064, 33853, 27931, 39558, 32476, 22920, 40635, 29595, 30721, 34434, 39532, 39554, 22043,
- 21527, 22475, 20080, 40614, 21334, 36808, 33033, 30610, 39314, 34542, 28385, 34067, 26364, 24930, 28459,
- 32894, 32897, 32898, 32901, 32904, 32906, 32909, 32910, 32911, 32912, 32913, 32914, 32916, 32917, 32919,
- 32921, 32926, 32931, 32934, 32935, 32936, 32940, 32944, 32947, 32949, 32950, 32952, 32953, 32955, 32965,
- 32967, 32968, 32969, 32970, 32971, 32975, 32976, 32977, 32978, 32979, 32980, 32981, 32984, 32991, 32992,
- 32994, 32995, 32998, 33006, 33013, 33015, 33017, 33019, 33022, 33023, 33024, 33025, 33027, 33028, 33029,
- 33031, 33032, 33035, 33036, 33045, 33047, 33049, 33051, 33052, 33053, 33055, 33056, 33057, 33058, 33059,
- 33060, 33061, 33062, 33063, 33064, 33065, 33066, 33067, 33069, 33070, 33072, 33075, 33076, 33077, 33079,
- 33081, 33082, 33083, 33084, 33085, 33087, 35881, 33426, 33579, 30450, 27667, 24537, 33725, 29483, 33541,
- 38170, 27611, 30683, 38086, 21359, 33538, 20882, 24125, 35980, 36152, 20040, 29611, 26522, 26757, 37238,
- 38665, 29028, 27809, 30473, 23186, 38209, 27599, 32654, 26151, 23504, 22969, 23194, 38376, 38391, 20204,
- 33804, 33945, 27308, 30431, 38192, 29467, 26790, 23391, 30511, 37274, 38753, 31964, 36855, 35868, 24357,
- 31859, 31192, 35269, 27852, 34588, 23494, 24130, 26825, 30496, 32501, 20885, 20813, 21193, 23081, 32517,
- 38754, 33495, 25551, 30596, 34256, 31186, 28218, 24217, 22937, 34065, 28781, 27665, 25279, 30399, 25935,
- 24751, 38397, 26126, 34719, 40483, 38125, 21517, 21629, 35884, 25720, 33088, 33089, 33090, 33091, 33092,
- 33093, 33095, 33097, 33101, 33102, 33103, 33106, 33110, 33111, 33112, 33115, 33116, 33117, 33118, 33119,
- 33121, 33122, 33123, 33124, 33126, 33128, 33130, 33131, 33132, 33135, 33138, 33139, 33141, 33142, 33143,
- 33144, 33153, 33155, 33156, 33157, 33158, 33159, 33161, 33163, 33164, 33165, 33166, 33168, 33170, 33171,
- 33172, 33173, 33174, 33175, 33177, 33178, 33182, 33183, 33184, 33185, 33186, 33188, 33189, 33191, 33193,
- 33195, 33196, 33197, 33198, 33199, 33200, 33201, 33202, 33204, 33205, 33206, 33207, 33208, 33209, 33212,
- 33213, 33214, 33215, 33220, 33221, 33223, 33224, 33225, 33227, 33229, 33230, 33231, 33232, 33233, 33234,
- 33235, 25721, 34321, 27169, 33180, 30952, 25705, 39764, 25273, 26411, 33707, 22696, 40664, 27819, 28448,
- 23518, 38476, 35851, 29279, 26576, 25287, 29281, 20137, 22982, 27597, 22675, 26286, 24149, 21215, 24917,
- 26408, 30446, 30566, 29287, 31302, 25343, 21738, 21584, 38048, 37027, 23068, 32435, 27670, 20035, 22902,
- 32784, 22856, 21335, 30007, 38590, 22218, 25376, 33041, 24700, 38393, 28118, 21602, 39297, 20869, 23273,
- 33021, 22958, 38675, 20522, 27877, 23612, 25311, 20320, 21311, 33147, 36870, 28346, 34091, 25288, 24180,
- 30910, 25781, 25467, 24565, 23064, 37247, 40479, 23615, 25423, 32834, 23421, 21870, 38218, 38221, 28037,
- 24744, 26592, 29406, 20957, 23425, 33236, 33237, 33238, 33239, 33240, 33241, 33242, 33243, 33244, 33245,
- 33246, 33247, 33248, 33249, 33250, 33252, 33253, 33254, 33256, 33257, 33259, 33262, 33263, 33264, 33265,
- 33266, 33269, 33270, 33271, 33272, 33273, 33274, 33277, 33279, 33283, 33287, 33288, 33289, 33290, 33291,
- 33294, 33295, 33297, 33299, 33301, 33302, 33303, 33304, 33305, 33306, 33309, 33312, 33316, 33317, 33318,
- 33319, 33321, 33326, 33330, 33338, 33340, 33341, 33343, 33344, 33345, 33346, 33347, 33349, 33350, 33352,
- 33354, 33356, 33357, 33358, 33360, 33361, 33362, 33363, 33364, 33365, 33366, 33367, 33369, 33371, 33372,
- 33373, 33374, 33376, 33377, 33378, 33379, 33380, 33381, 33382, 33383, 33385, 25319, 27870, 29275, 25197,
- 38062, 32445, 33043, 27987, 20892, 24324, 22900, 21162, 24594, 22899, 26262, 34384, 30111, 25386, 25062,
- 31983, 35834, 21734, 27431, 40485, 27572, 34261, 21589, 20598, 27812, 21866, 36276, 29228, 24085, 24597,
- 29750, 25293, 25490, 29260, 24472, 28227, 27966, 25856, 28504, 30424, 30928, 30460, 30036, 21028, 21467,
- 20051, 24222, 26049, 32810, 32982, 25243, 21638, 21032, 28846, 34957, 36305, 27873, 21624, 32986, 22521,
- 35060, 36180, 38506, 37197, 20329, 27803, 21943, 30406, 30768, 25256, 28921, 28558, 24429, 34028, 26842,
- 30844, 31735, 33192, 26379, 40527, 25447, 30896, 22383, 30738, 38713, 25209, 25259, 21128, 29749, 27607,
- 33386, 33387, 33388, 33389, 33393, 33397, 33398, 33399, 33400, 33403, 33404, 33408, 33409, 33411, 33413,
- 33414, 33415, 33417, 33420, 33424, 33427, 33428, 33429, 33430, 33434, 33435, 33438, 33440, 33442, 33443,
- 33447, 33458, 33461, 33462, 33466, 33467, 33468, 33471, 33472, 33474, 33475, 33477, 33478, 33481, 33488,
- 33494, 33497, 33498, 33501, 33506, 33511, 33512, 33513, 33514, 33516, 33517, 33518, 33520, 33522, 33523,
- 33525, 33526, 33528, 33530, 33532, 33533, 33534, 33535, 33536, 33546, 33547, 33549, 33552, 33554, 33555,
- 33558, 33560, 33561, 33565, 33566, 33567, 33568, 33569, 33570, 33571, 33572, 33573, 33574, 33577, 33578,
- 33582, 33584, 33586, 33591, 33595, 33597, 21860, 33086, 30130, 30382, 21305, 30174, 20731, 23617, 35692,
- 31687, 20559, 29255, 39575, 39128, 28418, 29922, 31080, 25735, 30629, 25340, 39057, 36139, 21697, 32856,
- 20050, 22378, 33529, 33805, 24179, 20973, 29942, 35780, 23631, 22369, 27900, 39047, 23110, 30772, 39748,
- 36843, 31893, 21078, 25169, 38138, 20166, 33670, 33889, 33769, 33970, 22484, 26420, 22275, 26222, 28006,
- 35889, 26333, 28689, 26399, 27450, 26646, 25114, 22971, 19971, 20932, 28422, 26578, 27791, 20854, 26827,
- 22855, 27495, 30054, 23822, 33040, 40784, 26071, 31048, 31041, 39569, 36215, 23682, 20062, 20225, 21551,
- 22865, 30732, 22120, 27668, 36804, 24323, 27773, 27875, 35755, 25488, 33598, 33599, 33601, 33602, 33604,
- 33605, 33608, 33610, 33611, 33612, 33613, 33614, 33619, 33621, 33622, 33623, 33624, 33625, 33629, 33634,
- 33648, 33649, 33650, 33651, 33652, 33653, 33654, 33657, 33658, 33662, 33663, 33664, 33665, 33666, 33667,
- 33668, 33671, 33672, 33674, 33675, 33676, 33677, 33679, 33680, 33681, 33684, 33685, 33686, 33687, 33689,
- 33690, 33693, 33695, 33697, 33698, 33699, 33700, 33701, 33702, 33703, 33708, 33709, 33710, 33711, 33717,
- 33723, 33726, 33727, 33730, 33731, 33732, 33734, 33736, 33737, 33739, 33741, 33742, 33744, 33745, 33746,
- 33747, 33749, 33751, 33753, 33754, 33755, 33758, 33762, 33763, 33764, 33766, 33767, 33768, 33771, 33772,
- 33773, 24688, 27965, 29301, 25190, 38030, 38085, 21315, 36801, 31614, 20191, 35878, 20094, 40660, 38065,
- 38067, 21069, 28508, 36963, 27973, 35892, 22545, 23884, 27424, 27465, 26538, 21595, 33108, 32652, 22681,
- 34103, 24378, 25250, 27207, 38201, 25970, 24708, 26725, 30631, 20052, 20392, 24039, 38808, 25772, 32728,
- 23789, 20431, 31373, 20999, 33540, 19988, 24623, 31363, 38054, 20405, 20146, 31206, 29748, 21220, 33465,
- 25810, 31165, 23517, 27777, 38738, 36731, 27682, 20542, 21375, 28165, 25806, 26228, 27696, 24773, 39031,
- 35831, 24198, 29756, 31351, 31179, 19992, 37041, 29699, 27714, 22234, 37195, 27845, 36235, 21306, 34502,
- 26354, 36527, 23624, 39537, 28192, 33774, 33775, 33779, 33780, 33781, 33782, 33783, 33786, 33787, 33788,
- 33790, 33791, 33792, 33794, 33797, 33799, 33800, 33801, 33802, 33808, 33810, 33811, 33812, 33813, 33814,
- 33815, 33817, 33818, 33819, 33822, 33823, 33824, 33825, 33826, 33827, 33833, 33834, 33835, 33836, 33837,
- 33838, 33839, 33840, 33842, 33843, 33844, 33845, 33846, 33847, 33849, 33850, 33851, 33854, 33855, 33856,
- 33857, 33858, 33859, 33860, 33861, 33863, 33864, 33865, 33866, 33867, 33868, 33869, 33870, 33871, 33872,
- 33874, 33875, 33876, 33877, 33878, 33880, 33885, 33886, 33887, 33888, 33890, 33892, 33893, 33894, 33895,
- 33896, 33898, 33902, 33903, 33904, 33906, 33908, 33911, 33913, 33915, 33916, 21462, 23094, 40843, 36259,
- 21435, 22280, 39079, 26435, 37275, 27849, 20840, 30154, 25331, 29356, 21048, 21149, 32570, 28820, 30264,
- 21364, 40522, 27063, 30830, 38592, 35033, 32676, 28982, 29123, 20873, 26579, 29924, 22756, 25880, 22199,
- 35753, 39286, 25200, 32469, 24825, 28909, 22764, 20161, 20154, 24525, 38887, 20219, 35748, 20995, 22922,
- 32427, 25172, 20173, 26085, 25102, 33592, 33993, 33635, 34701, 29076, 28342, 23481, 32466, 20887, 25545,
- 26580, 32905, 33593, 34837, 20754, 23418, 22914, 36785, 20083, 27741, 20837, 35109, 36719, 38446, 34122,
- 29790, 38160, 38384, 28070, 33509, 24369, 25746, 27922, 33832, 33134, 40131, 22622, 36187, 19977, 21441,
- 33917, 33918, 33919, 33920, 33921, 33923, 33924, 33925, 33926, 33930, 33933, 33935, 33936, 33937, 33938,
- 33939, 33940, 33941, 33942, 33944, 33946, 33947, 33949, 33950, 33951, 33952, 33954, 33955, 33956, 33957,
- 33958, 33959, 33960, 33961, 33962, 33963, 33964, 33965, 33966, 33968, 33969, 33971, 33973, 33974, 33975,
- 33979, 33980, 33982, 33984, 33986, 33987, 33989, 33990, 33991, 33992, 33995, 33996, 33998, 33999, 34002,
- 34004, 34005, 34007, 34008, 34009, 34010, 34011, 34012, 34014, 34017, 34018, 34020, 34023, 34024, 34025,
- 34026, 34027, 34029, 34030, 34031, 34033, 34034, 34035, 34036, 34037, 34038, 34039, 34040, 34041, 34042,
- 34043, 34045, 34046, 34048, 34049, 34050, 20254, 25955, 26705, 21971, 20007, 25620, 39578, 25195, 23234,
- 29791, 33394, 28073, 26862, 20711, 33678, 30722, 26432, 21049, 27801, 32433, 20667, 21861, 29022, 31579,
- 26194, 29642, 33515, 26441, 23665, 21024, 29053, 34923, 38378, 38485, 25797, 36193, 33203, 21892, 27733,
- 25159, 32558, 22674, 20260, 21830, 36175, 26188, 19978, 23578, 35059, 26786, 25422, 31245, 28903, 33421,
- 21242, 38902, 23569, 21736, 37045, 32461, 22882, 36170, 34503, 33292, 33293, 36198, 25668, 23556, 24913,
- 28041, 31038, 35774, 30775, 30003, 21627, 20280, 36523, 28145, 23072, 32453, 31070, 27784, 23457, 23158,
- 29978, 32958, 24910, 28183, 22768, 29983, 29989, 29298, 21319, 32499, 34051, 34052, 34053, 34054, 34055,
- 34056, 34057, 34058, 34059, 34061, 34062, 34063, 34064, 34066, 34068, 34069, 34070, 34072, 34073, 34075,
- 34076, 34077, 34078, 34080, 34082, 34083, 34084, 34085, 34086, 34087, 34088, 34089, 34090, 34093, 34094,
- 34095, 34096, 34097, 34098, 34099, 34100, 34101, 34102, 34110, 34111, 34112, 34113, 34114, 34116, 34117,
- 34118, 34119, 34123, 34124, 34125, 34126, 34127, 34128, 34129, 34130, 34131, 34132, 34133, 34135, 34136,
- 34138, 34139, 34140, 34141, 34143, 34144, 34145, 34146, 34147, 34149, 34150, 34151, 34153, 34154, 34155,
- 34156, 34157, 34158, 34159, 34160, 34161, 34163, 34165, 34166, 34167, 34168, 34172, 34173, 34175, 34176,
- 34177, 30465, 30427, 21097, 32988, 22307, 24072, 22833, 29422, 26045, 28287, 35799, 23608, 34417, 21313,
- 30707, 25342, 26102, 20160, 39135, 34432, 23454, 35782, 21490, 30690, 20351, 23630, 39542, 22987, 24335,
- 31034, 22763, 19990, 26623, 20107, 25325, 35475, 36893, 21183, 26159, 21980, 22124, 36866, 20181, 20365,
- 37322, 39280, 27663, 24066, 24643, 23460, 35270, 35797, 25910, 25163, 39318, 23432, 23551, 25480, 21806,
- 21463, 30246, 20861, 34092, 26530, 26803, 27530, 25234, 36755, 21460, 33298, 28113, 30095, 20070, 36174,
- 23408, 29087, 34223, 26257, 26329, 32626, 34560, 40653, 40736, 23646, 26415, 36848, 26641, 26463, 25101,
- 31446, 22661, 24246, 25968, 28465, 34178, 34179, 34182, 34184, 34185, 34186, 34187, 34188, 34189, 34190,
- 34192, 34193, 34194, 34195, 34196, 34197, 34198, 34199, 34200, 34201, 34202, 34205, 34206, 34207, 34208,
- 34209, 34210, 34211, 34213, 34214, 34215, 34217, 34219, 34220, 34221, 34225, 34226, 34227, 34228, 34229,
- 34230, 34232, 34234, 34235, 34236, 34237, 34238, 34239, 34240, 34242, 34243, 34244, 34245, 34246, 34247,
- 34248, 34250, 34251, 34252, 34253, 34254, 34257, 34258, 34260, 34262, 34263, 34264, 34265, 34266, 34267,
- 34269, 34270, 34271, 34272, 34273, 34274, 34275, 34277, 34278, 34279, 34280, 34282, 34283, 34284, 34285,
- 34286, 34287, 34288, 34289, 34290, 34291, 34292, 34293, 34294, 34295, 34296, 24661, 21047, 32781, 25684,
- 34928, 29993, 24069, 26643, 25332, 38684, 21452, 29245, 35841, 27700, 30561, 31246, 21550, 30636, 39034,
- 33308, 35828, 30805, 26388, 28865, 26031, 25749, 22070, 24605, 31169, 21496, 19997, 27515, 32902, 23546,
- 21987, 22235, 20282, 20284, 39282, 24051, 26494, 32824, 24578, 39042, 36865, 23435, 35772, 35829, 25628,
- 33368, 25822, 22013, 33487, 37221, 20439, 32032, 36895, 31903, 20723, 22609, 28335, 23487, 35785, 32899,
- 37240, 33948, 31639, 34429, 38539, 38543, 32485, 39635, 30862, 23681, 31319, 36930, 38567, 31071, 23385,
- 25439, 31499, 34001, 26797, 21766, 32553, 29712, 32034, 38145, 25152, 22604, 20182, 23427, 22905, 22612,
- 34297, 34298, 34300, 34301, 34302, 34304, 34305, 34306, 34307, 34308, 34310, 34311, 34312, 34313, 34314,
- 34315, 34316, 34317, 34318, 34319, 34320, 34322, 34323, 34324, 34325, 34327, 34328, 34329, 34330, 34331,
- 34332, 34333, 34334, 34335, 34336, 34337, 34338, 34339, 34340, 34341, 34342, 34344, 34346, 34347, 34348,
- 34349, 34350, 34351, 34352, 34353, 34354, 34355, 34356, 34357, 34358, 34359, 34361, 34362, 34363, 34365,
- 34366, 34367, 34368, 34369, 34370, 34371, 34372, 34373, 34374, 34375, 34376, 34377, 34378, 34379, 34380,
- 34386, 34387, 34389, 34390, 34391, 34392, 34393, 34395, 34396, 34397, 34399, 34400, 34401, 34403, 34404,
- 34405, 34406, 34407, 34408, 34409, 34410, 29549, 25374, 36427, 36367, 32974, 33492, 25260, 21488, 27888,
- 37214, 22826, 24577, 27760, 22349, 25674, 36138, 30251, 28393, 22363, 27264, 30192, 28525, 35885, 35848,
- 22374, 27631, 34962, 30899, 25506, 21497, 28845, 27748, 22616, 25642, 22530, 26848, 33179, 21776, 31958,
- 20504, 36538, 28108, 36255, 28907, 25487, 28059, 28372, 32486, 33796, 26691, 36867, 28120, 38518, 35752,
- 22871, 29305, 34276, 33150, 30140, 35466, 26799, 21076, 36386, 38161, 25552, 39064, 36420, 21884, 20307,
- 26367, 22159, 24789, 28053, 21059, 23625, 22825, 28155, 22635, 30000, 29980, 24684, 33300, 33094, 25361,
- 26465, 36834, 30522, 36339, 36148, 38081, 24086, 21381, 21548, 28867, 34413, 34415, 34416, 34418, 34419,
- 34420, 34421, 34422, 34423, 34424, 34435, 34436, 34437, 34438, 34439, 34440, 34441, 34446, 34447, 34448,
- 34449, 34450, 34452, 34454, 34455, 34456, 34457, 34458, 34459, 34462, 34463, 34464, 34465, 34466, 34469,
- 34470, 34475, 34477, 34478, 34482, 34483, 34487, 34488, 34489, 34491, 34492, 34493, 34494, 34495, 34497,
- 34498, 34499, 34501, 34504, 34508, 34509, 34514, 34515, 34517, 34518, 34519, 34522, 34524, 34525, 34528,
- 34529, 34530, 34531, 34533, 34534, 34535, 34536, 34538, 34539, 34540, 34543, 34549, 34550, 34551, 34554,
- 34555, 34556, 34557, 34559, 34561, 34564, 34565, 34566, 34571, 34572, 34574, 34575, 34576, 34577, 34580,
- 34582, 27712, 24311, 20572, 20141, 24237, 25402, 33351, 36890, 26704, 37230, 30643, 21516, 38108, 24420,
- 31461, 26742, 25413, 31570, 32479, 30171, 20599, 25237, 22836, 36879, 20984, 31171, 31361, 22270, 24466,
- 36884, 28034, 23648, 22303, 21520, 20820, 28237, 22242, 25512, 39059, 33151, 34581, 35114, 36864, 21534,
- 23663, 33216, 25302, 25176, 33073, 40501, 38464, 39534, 39548, 26925, 22949, 25299, 21822, 25366, 21703,
- 34521, 27964, 23043, 29926, 34972, 27498, 22806, 35916, 24367, 28286, 29609, 39037, 20024, 28919, 23436,
- 30871, 25405, 26202, 30358, 24779, 23451, 23113, 19975, 33109, 27754, 29579, 20129, 26505, 32593, 24448,
- 26106, 26395, 24536, 22916, 23041, 34585, 34587, 34589, 34591, 34592, 34596, 34598, 34599, 34600, 34602,
- 34603, 34604, 34605, 34607, 34608, 34610, 34611, 34613, 34614, 34616, 34617, 34618, 34620, 34621, 34624,
- 34625, 34626, 34627, 34628, 34629, 34630, 34634, 34635, 34637, 34639, 34640, 34641, 34642, 34644, 34645,
- 34646, 34648, 34650, 34651, 34652, 34653, 34654, 34655, 34657, 34658, 34662, 34663, 34664, 34665, 34666,
- 34667, 34668, 34669, 34671, 34673, 34674, 34675, 34677, 34679, 34680, 34681, 34682, 34687, 34688, 34689,
- 34692, 34694, 34695, 34697, 34698, 34700, 34702, 34703, 34704, 34705, 34706, 34708, 34709, 34710, 34712,
- 34713, 34714, 34715, 34716, 34717, 34718, 34720, 34721, 34722, 34723, 34724, 24013, 24494, 21361, 38886,
- 36829, 26693, 22260, 21807, 24799, 20026, 28493, 32500, 33479, 33806, 22996, 20255, 20266, 23614, 32428,
- 26410, 34074, 21619, 30031, 32963, 21890, 39759, 20301, 28205, 35859, 23561, 24944, 21355, 30239, 28201,
- 34442, 25991, 38395, 32441, 21563, 31283, 32010, 38382, 21985, 32705, 29934, 25373, 34583, 28065, 31389,
- 25105, 26017, 21351, 25569, 27779, 24043, 21596, 38056, 20044, 27745, 35820, 23627, 26080, 33436, 26791,
- 21566, 21556, 27595, 27494, 20116, 25410, 21320, 33310, 20237, 20398, 22366, 25098, 38654, 26212, 29289,
- 21247, 21153, 24735, 35823, 26132, 29081, 26512, 35199, 30802, 30717, 26224, 22075, 21560, 38177, 29306,
- 34725, 34726, 34727, 34729, 34730, 34734, 34736, 34737, 34738, 34740, 34742, 34743, 34744, 34745, 34747,
- 34748, 34750, 34751, 34753, 34754, 34755, 34756, 34757, 34759, 34760, 34761, 34764, 34765, 34766, 34767,
- 34768, 34772, 34773, 34774, 34775, 34776, 34777, 34778, 34780, 34781, 34782, 34783, 34785, 34786, 34787,
- 34788, 34790, 34791, 34792, 34793, 34795, 34796, 34797, 34799, 34800, 34801, 34802, 34803, 34804, 34805,
- 34806, 34807, 34808, 34810, 34811, 34812, 34813, 34815, 34816, 34817, 34818, 34820, 34821, 34822, 34823,
- 34824, 34825, 34827, 34828, 34829, 34830, 34831, 34832, 34833, 34834, 34836, 34839, 34840, 34841, 34842,
- 34844, 34845, 34846, 34847, 34848, 34851, 31232, 24687, 24076, 24713, 33181, 22805, 24796, 29060, 28911,
- 28330, 27728, 29312, 27268, 34989, 24109, 20064, 23219, 21916, 38115, 27927, 31995, 38553, 25103, 32454,
- 30606, 34430, 21283, 38686, 36758, 26247, 23777, 20384, 29421, 19979, 21414, 22799, 21523, 25472, 38184,
- 20808, 20185, 40092, 32420, 21688, 36132, 34900, 33335, 38386, 28046, 24358, 23244, 26174, 38505, 29616,
- 29486, 21439, 33146, 39301, 32673, 23466, 38519, 38480, 32447, 30456, 21410, 38262, 39321, 31665, 35140,
- 28248, 20065, 32724, 31077, 35814, 24819, 21709, 20139, 39033, 24055, 27233, 20687, 21521, 35937, 33831,
- 30813, 38660, 21066, 21742, 22179, 38144, 28040, 23477, 28102, 26195, 34852, 34853, 34854, 34855, 34856,
- 34857, 34858, 34859, 34860, 34861, 34862, 34863, 34864, 34865, 34867, 34868, 34869, 34870, 34871, 34872,
- 34874, 34875, 34877, 34878, 34879, 34881, 34882, 34883, 34886, 34887, 34888, 34889, 34890, 34891, 34894,
- 34895, 34896, 34897, 34898, 34899, 34901, 34902, 34904, 34906, 34907, 34908, 34909, 34910, 34911, 34912,
- 34918, 34919, 34922, 34925, 34927, 34929, 34931, 34932, 34933, 34934, 34936, 34937, 34938, 34939, 34940,
- 34944, 34947, 34950, 34951, 34953, 34954, 34956, 34958, 34959, 34960, 34961, 34963, 34964, 34965, 34967,
- 34968, 34969, 34970, 34971, 34973, 34974, 34975, 34976, 34977, 34979, 34981, 34982, 34983, 34984, 34985,
- 34986, 23567, 23389, 26657, 32918, 21880, 31505, 25928, 26964, 20123, 27463, 34638, 38795, 21327, 25375,
- 25658, 37034, 26012, 32961, 35856, 20889, 26800, 21368, 34809, 25032, 27844, 27899, 35874, 23633, 34218,
- 33455, 38156, 27427, 36763, 26032, 24571, 24515, 20449, 34885, 26143, 33125, 29481, 24826, 20852, 21009,
- 22411, 24418, 37026, 34892, 37266, 24184, 26447, 24615, 22995, 20804, 20982, 33016, 21256, 27769, 38596,
- 29066, 20241, 20462, 32670, 26429, 21957, 38152, 31168, 34966, 32483, 22687, 25100, 38656, 34394, 22040,
- 39035, 24464, 35768, 33988, 37207, 21465, 26093, 24207, 30044, 24676, 32110, 23167, 32490, 32493, 36713,
- 21927, 23459, 24748, 26059, 29572, 34988, 34990, 34991, 34992, 34994, 34995, 34996, 34997, 34998, 35000,
- 35001, 35002, 35003, 35005, 35006, 35007, 35008, 35011, 35012, 35015, 35016, 35018, 35019, 35020, 35021,
- 35023, 35024, 35025, 35027, 35030, 35031, 35034, 35035, 35036, 35037, 35038, 35040, 35041, 35046, 35047,
- 35049, 35050, 35051, 35052, 35053, 35054, 35055, 35058, 35061, 35062, 35063, 35066, 35067, 35069, 35071,
- 35072, 35073, 35075, 35076, 35077, 35078, 35079, 35080, 35081, 35083, 35084, 35085, 35086, 35087, 35089,
- 35092, 35093, 35094, 35095, 35096, 35100, 35101, 35102, 35103, 35104, 35106, 35107, 35108, 35110, 35111,
- 35112, 35113, 35116, 35117, 35118, 35119, 35121, 35122, 35123, 35125, 35127, 36873, 30307, 30505, 32474,
- 38772, 34203, 23398, 31348, 38634, 34880, 21195, 29071, 24490, 26092, 35810, 23547, 39535, 24033, 27529,
- 27739, 35757, 35759, 36874, 36805, 21387, 25276, 40486, 40493, 21568, 20011, 33469, 29273, 34460, 23830,
- 34905, 28079, 38597, 21713, 20122, 35766, 28937, 21693, 38409, 28895, 28153, 30416, 20005, 30740, 34578,
- 23721, 24310, 35328, 39068, 38414, 28814, 27839, 22852, 25513, 30524, 34893, 28436, 33395, 22576, 29141,
- 21388, 30746, 38593, 21761, 24422, 28976, 23476, 35866, 39564, 27523, 22830, 40495, 31207, 26472, 25196,
- 20335, 30113, 32650, 27915, 38451, 27687, 20208, 30162, 20859, 26679, 28478, 36992, 33136, 22934, 29814,
- 35128, 35129, 35130, 35131, 35132, 35133, 35134, 35135, 35136, 35138, 35139, 35141, 35142, 35143, 35144,
- 35145, 35146, 35147, 35148, 35149, 35150, 35151, 35152, 35153, 35154, 35155, 35156, 35157, 35158, 35159,
- 35160, 35161, 35162, 35163, 35164, 35165, 35168, 35169, 35170, 35171, 35172, 35173, 35175, 35176, 35177,
- 35178, 35179, 35180, 35181, 35182, 35183, 35184, 35185, 35186, 35187, 35188, 35189, 35190, 35191, 35192,
- 35193, 35194, 35196, 35197, 35198, 35200, 35202, 35204, 35205, 35207, 35208, 35209, 35210, 35211, 35212,
- 35213, 35214, 35215, 35216, 35217, 35218, 35219, 35220, 35221, 35222, 35223, 35224, 35225, 35226, 35227,
- 35228, 35229, 35230, 35231, 35232, 35233, 25671, 23591, 36965, 31377, 35875, 23002, 21676, 33280, 33647,
- 35201, 32768, 26928, 22094, 32822, 29239, 37326, 20918, 20063, 39029, 25494, 19994, 21494, 26355, 33099,
- 22812, 28082, 19968, 22777, 21307, 25558, 38129, 20381, 20234, 34915, 39056, 22839, 36951, 31227, 20202,
- 33008, 30097, 27778, 23452, 23016, 24413, 26885, 34433, 20506, 24050, 20057, 30691, 20197, 33402, 25233,
- 26131, 37009, 23673, 20159, 24441, 33222, 36920, 32900, 30123, 20134, 35028, 24847, 27589, 24518, 20041,
- 30410, 28322, 35811, 35758, 35850, 35793, 24322, 32764, 32716, 32462, 33589, 33643, 22240, 27575, 38899,
- 38452, 23035, 21535, 38134, 28139, 23493, 39278, 23609, 24341, 38544, 35234, 35235, 35236, 35237, 35238,
- 35239, 35240, 35241, 35242, 35243, 35244, 35245, 35246, 35247, 35248, 35249, 35250, 35251, 35252, 35253,
- 35254, 35255, 35256, 35257, 35258, 35259, 35260, 35261, 35262, 35263, 35264, 35267, 35277, 35283, 35284,
- 35285, 35287, 35288, 35289, 35291, 35293, 35295, 35296, 35297, 35298, 35300, 35303, 35304, 35305, 35306,
- 35308, 35309, 35310, 35312, 35313, 35314, 35316, 35317, 35318, 35319, 35320, 35321, 35322, 35323, 35324,
- 35325, 35326, 35327, 35329, 35330, 35331, 35332, 35333, 35334, 35336, 35337, 35338, 35339, 35340, 35341,
- 35342, 35343, 35344, 35345, 35346, 35347, 35348, 35349, 35350, 35351, 35352, 35353, 35354, 35355, 35356,
- 35357, 21360, 33521, 27185, 23156, 40560, 24212, 32552, 33721, 33828, 33829, 33639, 34631, 36814, 36194,
- 30408, 24433, 39062, 30828, 26144, 21727, 25317, 20323, 33219, 30152, 24248, 38605, 36362, 34553, 21647,
- 27891, 28044, 27704, 24703, 21191, 29992, 24189, 20248, 24736, 24551, 23588, 30001, 37038, 38080, 29369,
- 27833, 28216, 37193, 26377, 21451, 21491, 20305, 37321, 35825, 21448, 24188, 36802, 28132, 20110, 30402,
- 27014, 34398, 24858, 33286, 20313, 20446, 36926, 40060, 24841, 28189, 28180, 38533, 20104, 23089, 38632,
- 19982, 23679, 31161, 23431, 35821, 32701, 29577, 22495, 33419, 37057, 21505, 36935, 21947, 23786, 24481,
- 24840, 27442, 29425, 32946, 35465, 35358, 35359, 35360, 35361, 35362, 35363, 35364, 35365, 35366, 35367,
- 35368, 35369, 35370, 35371, 35372, 35373, 35374, 35375, 35376, 35377, 35378, 35379, 35380, 35381, 35382,
- 35383, 35384, 35385, 35386, 35387, 35388, 35389, 35391, 35392, 35393, 35394, 35395, 35396, 35397, 35398,
- 35399, 35401, 35402, 35403, 35404, 35405, 35406, 35407, 35408, 35409, 35410, 35411, 35412, 35413, 35414,
- 35415, 35416, 35417, 35418, 35419, 35420, 35421, 35422, 35423, 35424, 35425, 35426, 35427, 35428, 35429,
- 35430, 35431, 35432, 35433, 35434, 35435, 35436, 35437, 35438, 35439, 35440, 35441, 35442, 35443, 35444,
- 35445, 35446, 35447, 35448, 35450, 35451, 35452, 35453, 35454, 35455, 35456, 28020, 23507, 35029, 39044,
- 35947, 39533, 40499, 28170, 20900, 20803, 22435, 34945, 21407, 25588, 36757, 22253, 21592, 22278, 29503,
- 28304, 32536, 36828, 33489, 24895, 24616, 38498, 26352, 32422, 36234, 36291, 38053, 23731, 31908, 26376,
- 24742, 38405, 32792, 20113, 37095, 21248, 38504, 20801, 36816, 34164, 37213, 26197, 38901, 23381, 21277,
- 30776, 26434, 26685, 21705, 28798, 23472, 36733, 20877, 22312, 21681, 25874, 26242, 36190, 36163, 33039,
- 33900, 36973, 31967, 20991, 34299, 26531, 26089, 28577, 34468, 36481, 22122, 36896, 30338, 28790, 29157,
- 36131, 25321, 21017, 27901, 36156, 24590, 22686, 24974, 26366, 36192, 25166, 21939, 28195, 26413, 36711,
- 35457, 35458, 35459, 35460, 35461, 35462, 35463, 35464, 35467, 35468, 35469, 35470, 35471, 35472, 35473,
- 35474, 35476, 35477, 35478, 35479, 35480, 35481, 35482, 35483, 35484, 35485, 35486, 35487, 35488, 35489,
- 35490, 35491, 35492, 35493, 35494, 35495, 35496, 35497, 35498, 35499, 35500, 35501, 35502, 35503, 35504,
- 35505, 35506, 35507, 35508, 35509, 35510, 35511, 35512, 35513, 35514, 35515, 35516, 35517, 35518, 35519,
- 35520, 35521, 35522, 35523, 35524, 35525, 35526, 35527, 35528, 35529, 35530, 35531, 35532, 35533, 35534,
- 35535, 35536, 35537, 35538, 35539, 35540, 35541, 35542, 35543, 35544, 35545, 35546, 35547, 35548, 35549,
- 35550, 35551, 35552, 35553, 35554, 35555, 38113, 38392, 30504, 26629, 27048, 21643, 20045, 28856, 35784,
- 25688, 25995, 23429, 31364, 20538, 23528, 30651, 27617, 35449, 31896, 27838, 30415, 26025, 36759, 23853,
- 23637, 34360, 26632, 21344, 25112, 31449, 28251, 32509, 27167, 31456, 24432, 28467, 24352, 25484, 28072,
- 26454, 19976, 24080, 36134, 20183, 32960, 30260, 38556, 25307, 26157, 25214, 27836, 36213, 29031, 32617,
- 20806, 32903, 21484, 36974, 25240, 21746, 34544, 36761, 32773, 38167, 34071, 36825, 27993, 29645, 26015,
- 30495, 29956, 30759, 33275, 36126, 38024, 20390, 26517, 30137, 35786, 38663, 25391, 38215, 38453, 33976,
- 25379, 30529, 24449, 29424, 20105, 24596, 25972, 25327, 27491, 25919, 35556, 35557, 35558, 35559, 35560,
- 35561, 35562, 35563, 35564, 35565, 35566, 35567, 35568, 35569, 35570, 35571, 35572, 35573, 35574, 35575,
- 35576, 35577, 35578, 35579, 35580, 35581, 35582, 35583, 35584, 35585, 35586, 35587, 35588, 35589, 35590,
- 35592, 35593, 35594, 35595, 35596, 35597, 35598, 35599, 35600, 35601, 35602, 35603, 35604, 35605, 35606,
- 35607, 35608, 35609, 35610, 35611, 35612, 35613, 35614, 35615, 35616, 35617, 35618, 35619, 35620, 35621,
- 35623, 35624, 35625, 35626, 35627, 35628, 35629, 35630, 35631, 35632, 35633, 35634, 35635, 35636, 35637,
- 35638, 35639, 35640, 35641, 35642, 35643, 35644, 35645, 35646, 35647, 35648, 35649, 35650, 35651, 35652,
- 35653, 24103, 30151, 37073, 35777, 33437, 26525, 25903, 21553, 34584, 30693, 32930, 33026, 27713, 20043,
- 32455, 32844, 30452, 26893, 27542, 25191, 20540, 20356, 22336, 25351, 27490, 36286, 21482, 26088, 32440,
- 24535, 25370, 25527, 33267, 33268, 32622, 24092, 23769, 21046, 26234, 31209, 31258, 36136, 28825, 30164,
- 28382, 27835, 31378, 20013, 30405, 24544, 38047, 34935, 32456, 31181, 32959, 37325, 20210, 20247, 33311,
- 21608, 24030, 27954, 35788, 31909, 36724, 32920, 24090, 21650, 30385, 23449, 26172, 39588, 29664, 26666,
- 34523, 26417, 29482, 35832, 35803, 36880, 31481, 28891, 29038, 25284, 30633, 22065, 20027, 33879, 26609,
- 21161, 34496, 36142, 38136, 31569, 35654, 35655, 35656, 35657, 35658, 35659, 35660, 35661, 35662, 35663,
- 35664, 35665, 35666, 35667, 35668, 35669, 35670, 35671, 35672, 35673, 35674, 35675, 35676, 35677, 35678,
- 35679, 35680, 35681, 35682, 35683, 35684, 35685, 35687, 35688, 35689, 35690, 35691, 35693, 35694, 35695,
- 35696, 35697, 35698, 35699, 35700, 35701, 35702, 35703, 35704, 35705, 35706, 35707, 35708, 35709, 35710,
- 35711, 35712, 35713, 35714, 35715, 35716, 35717, 35718, 35719, 35720, 35721, 35722, 35723, 35724, 35725,
- 35726, 35727, 35728, 35729, 35730, 35731, 35732, 35733, 35734, 35735, 35736, 35737, 35738, 35739, 35740,
- 35741, 35742, 35743, 35756, 35761, 35771, 35783, 35792, 35818, 35849, 35870, 20303, 27880, 31069, 39547,
- 25235, 29226, 25341, 19987, 30742, 36716, 25776, 36186, 31686, 26729, 24196, 35013, 22918, 25758, 22766,
- 29366, 26894, 38181, 36861, 36184, 22368, 32512, 35846, 20934, 25417, 25305, 21331, 26700, 29730, 33537,
- 37196, 21828, 30528, 28796, 27978, 20857, 21672, 36164, 23039, 28363, 28100, 23388, 32043, 20180, 31869,
- 28371, 23376, 33258, 28173, 23383, 39683, 26837, 36394, 23447, 32508, 24635, 32437, 37049, 36208, 22863,
- 25549, 31199, 36275, 21330, 26063, 31062, 35781, 38459, 32452, 38075, 32386, 22068, 37257, 26368, 32618,
- 23562, 36981, 26152, 24038, 20304, 26590, 20570, 20316, 22352, 24231, 59408, 59409, 59410, 59411, 59412,
- 35896, 35897, 35898, 35899, 35900, 35901, 35902, 35903, 35904, 35906, 35907, 35908, 35909, 35912, 35914,
- 35915, 35917, 35918, 35919, 35920, 35921, 35922, 35923, 35924, 35926, 35927, 35928, 35929, 35931, 35932,
- 35933, 35934, 35935, 35936, 35939, 35940, 35941, 35942, 35943, 35944, 35945, 35948, 35949, 35950, 35951,
- 35952, 35953, 35954, 35956, 35957, 35958, 35959, 35963, 35964, 35965, 35966, 35967, 35968, 35969, 35971,
- 35972, 35974, 35975, 35976, 35979, 35981, 35982, 35983, 35984, 35985, 35986, 35987, 35989, 35990, 35991,
- 35993, 35994, 35995, 35996, 35997, 35998, 35999, 36000, 36001, 36002, 36003, 36004, 36005, 36006, 36007,
- 36008, 36009, 36010, 36011, 36012, 36013, 20109, 19980, 20800, 19984, 24319, 21317, 19989, 20120, 19998,
- 39730, 23404, 22121, 20008, 31162, 20031, 21269, 20039, 22829, 29243, 21358, 27664, 22239, 32996, 39319,
- 27603, 30590, 40727, 20022, 20127, 40720, 20060, 20073, 20115, 33416, 23387, 21868, 22031, 20164, 21389,
- 21405, 21411, 21413, 21422, 38757, 36189, 21274, 21493, 21286, 21294, 21310, 36188, 21350, 21347, 20994,
- 21000, 21006, 21037, 21043, 21055, 21056, 21068, 21086, 21089, 21084, 33967, 21117, 21122, 21121, 21136,
- 21139, 20866, 32596, 20155, 20163, 20169, 20162, 20200, 20193, 20203, 20190, 20251, 20211, 20258, 20324,
- 20213, 20261, 20263, 20233, 20267, 20318, 20327, 25912, 20314, 20317, 36014, 36015, 36016, 36017, 36018,
- 36019, 36020, 36021, 36022, 36023, 36024, 36025, 36026, 36027, 36028, 36029, 36030, 36031, 36032, 36033,
- 36034, 36035, 36036, 36037, 36038, 36039, 36040, 36041, 36042, 36043, 36044, 36045, 36046, 36047, 36048,
- 36049, 36050, 36051, 36052, 36053, 36054, 36055, 36056, 36057, 36058, 36059, 36060, 36061, 36062, 36063,
- 36064, 36065, 36066, 36067, 36068, 36069, 36070, 36071, 36072, 36073, 36074, 36075, 36076, 36077, 36078,
- 36079, 36080, 36081, 36082, 36083, 36084, 36085, 36086, 36087, 36088, 36089, 36090, 36091, 36092, 36093,
- 36094, 36095, 36096, 36097, 36098, 36099, 36100, 36101, 36102, 36103, 36104, 36105, 36106, 36107, 36108,
- 36109, 20319, 20311, 20274, 20285, 20342, 20340, 20369, 20361, 20355, 20367, 20350, 20347, 20394, 20348,
- 20396, 20372, 20454, 20456, 20458, 20421, 20442, 20451, 20444, 20433, 20447, 20472, 20521, 20556, 20467,
- 20524, 20495, 20526, 20525, 20478, 20508, 20492, 20517, 20520, 20606, 20547, 20565, 20552, 20558, 20588,
- 20603, 20645, 20647, 20649, 20666, 20694, 20742, 20717, 20716, 20710, 20718, 20743, 20747, 20189, 27709,
- 20312, 20325, 20430, 40864, 27718, 31860, 20846, 24061, 40649, 39320, 20865, 22804, 21241, 21261, 35335,
- 21264, 20971, 22809, 20821, 20128, 20822, 20147, 34926, 34980, 20149, 33044, 35026, 31104, 23348, 34819,
- 32696, 20907, 20913, 20925, 20924, 36110, 36111, 36112, 36113, 36114, 36115, 36116, 36117, 36118, 36119,
- 36120, 36121, 36122, 36123, 36124, 36128, 36177, 36178, 36183, 36191, 36197, 36200, 36201, 36202, 36204,
- 36206, 36207, 36209, 36210, 36216, 36217, 36218, 36219, 36220, 36221, 36222, 36223, 36224, 36226, 36227,
- 36230, 36231, 36232, 36233, 36236, 36237, 36238, 36239, 36240, 36242, 36243, 36245, 36246, 36247, 36248,
- 36249, 36250, 36251, 36252, 36253, 36254, 36256, 36257, 36258, 36260, 36261, 36262, 36263, 36264, 36265,
- 36266, 36267, 36268, 36269, 36270, 36271, 36272, 36274, 36278, 36279, 36281, 36283, 36285, 36288, 36289,
- 36290, 36293, 36295, 36296, 36297, 36298, 36301, 36304, 36306, 36307, 36308, 20935, 20886, 20898, 20901,
- 35744, 35750, 35751, 35754, 35764, 35765, 35767, 35778, 35779, 35787, 35791, 35790, 35794, 35795, 35796,
- 35798, 35800, 35801, 35804, 35807, 35808, 35812, 35816, 35817, 35822, 35824, 35827, 35830, 35833, 35836,
- 35839, 35840, 35842, 35844, 35847, 35852, 35855, 35857, 35858, 35860, 35861, 35862, 35865, 35867, 35864,
- 35869, 35871, 35872, 35873, 35877, 35879, 35882, 35883, 35886, 35887, 35890, 35891, 35893, 35894, 21353,
- 21370, 38429, 38434, 38433, 38449, 38442, 38461, 38460, 38466, 38473, 38484, 38495, 38503, 38508, 38514,
- 38516, 38536, 38541, 38551, 38576, 37015, 37019, 37021, 37017, 37036, 37025, 37044, 37043, 37046, 37050,
- 36309, 36312, 36313, 36316, 36320, 36321, 36322, 36325, 36326, 36327, 36329, 36333, 36334, 36336, 36337,
- 36338, 36340, 36342, 36348, 36350, 36351, 36352, 36353, 36354, 36355, 36356, 36358, 36359, 36360, 36363,
- 36365, 36366, 36368, 36369, 36370, 36371, 36373, 36374, 36375, 36376, 36377, 36378, 36379, 36380, 36384,
- 36385, 36388, 36389, 36390, 36391, 36392, 36395, 36397, 36400, 36402, 36403, 36404, 36406, 36407, 36408,
- 36411, 36412, 36414, 36415, 36419, 36421, 36422, 36428, 36429, 36430, 36431, 36432, 36435, 36436, 36437,
- 36438, 36439, 36440, 36442, 36443, 36444, 36445, 36446, 36447, 36448, 36449, 36450, 36451, 36452, 36453,
- 36455, 36456, 36458, 36459, 36462, 36465, 37048, 37040, 37071, 37061, 37054, 37072, 37060, 37063, 37075,
- 37094, 37090, 37084, 37079, 37083, 37099, 37103, 37118, 37124, 37154, 37150, 37155, 37169, 37167, 37177,
- 37187, 37190, 21005, 22850, 21154, 21164, 21165, 21182, 21759, 21200, 21206, 21232, 21471, 29166, 30669,
- 24308, 20981, 20988, 39727, 21430, 24321, 30042, 24047, 22348, 22441, 22433, 22654, 22716, 22725, 22737,
- 22313, 22316, 22314, 22323, 22329, 22318, 22319, 22364, 22331, 22338, 22377, 22405, 22379, 22406, 22396,
- 22395, 22376, 22381, 22390, 22387, 22445, 22436, 22412, 22450, 22479, 22439, 22452, 22419, 22432, 22485,
- 22488, 22490, 22489, 22482, 22456, 22516, 22511, 22520, 22500, 22493, 36467, 36469, 36471, 36472, 36473,
- 36474, 36475, 36477, 36478, 36480, 36482, 36483, 36484, 36486, 36488, 36489, 36490, 36491, 36492, 36493,
- 36494, 36497, 36498, 36499, 36501, 36502, 36503, 36504, 36505, 36506, 36507, 36509, 36511, 36512, 36513,
- 36514, 36515, 36516, 36517, 36518, 36519, 36520, 36521, 36522, 36525, 36526, 36528, 36529, 36531, 36532,
- 36533, 36534, 36535, 36536, 36537, 36539, 36540, 36541, 36542, 36543, 36544, 36545, 36546, 36547, 36548,
- 36549, 36550, 36551, 36552, 36553, 36554, 36555, 36556, 36557, 36559, 36560, 36561, 36562, 36563, 36564,
- 36565, 36566, 36567, 36568, 36569, 36570, 36571, 36572, 36573, 36574, 36575, 36576, 36577, 36578, 36579,
- 36580, 22539, 22541, 22525, 22509, 22528, 22558, 22553, 22596, 22560, 22629, 22636, 22657, 22665, 22682,
- 22656, 39336, 40729, 25087, 33401, 33405, 33407, 33423, 33418, 33448, 33412, 33422, 33425, 33431, 33433,
- 33451, 33464, 33470, 33456, 33480, 33482, 33507, 33432, 33463, 33454, 33483, 33484, 33473, 33449, 33460,
- 33441, 33450, 33439, 33476, 33486, 33444, 33505, 33545, 33527, 33508, 33551, 33543, 33500, 33524, 33490,
- 33496, 33548, 33531, 33491, 33553, 33562, 33542, 33556, 33557, 33504, 33493, 33564, 33617, 33627, 33628,
- 33544, 33682, 33596, 33588, 33585, 33691, 33630, 33583, 33615, 33607, 33603, 33631, 33600, 33559, 33632,
- 33581, 33594, 33587, 33638, 33637, 36581, 36582, 36583, 36584, 36585, 36586, 36587, 36588, 36589, 36590,
- 36591, 36592, 36593, 36594, 36595, 36596, 36597, 36598, 36599, 36600, 36601, 36602, 36603, 36604, 36605,
- 36606, 36607, 36608, 36609, 36610, 36611, 36612, 36613, 36614, 36615, 36616, 36617, 36618, 36619, 36620,
- 36621, 36622, 36623, 36624, 36625, 36626, 36627, 36628, 36629, 36630, 36631, 36632, 36633, 36634, 36635,
- 36636, 36637, 36638, 36639, 36640, 36641, 36642, 36643, 36644, 36645, 36646, 36647, 36648, 36649, 36650,
- 36651, 36652, 36653, 36654, 36655, 36656, 36657, 36658, 36659, 36660, 36661, 36662, 36663, 36664, 36665,
- 36666, 36667, 36668, 36669, 36670, 36671, 36672, 36673, 36674, 36675, 36676, 33640, 33563, 33641, 33644,
- 33642, 33645, 33646, 33712, 33656, 33715, 33716, 33696, 33706, 33683, 33692, 33669, 33660, 33718, 33705,
- 33661, 33720, 33659, 33688, 33694, 33704, 33722, 33724, 33729, 33793, 33765, 33752, 22535, 33816, 33803,
- 33757, 33789, 33750, 33820, 33848, 33809, 33798, 33748, 33759, 33807, 33795, 33784, 33785, 33770, 33733,
- 33728, 33830, 33776, 33761, 33884, 33873, 33882, 33881, 33907, 33927, 33928, 33914, 33929, 33912, 33852,
- 33862, 33897, 33910, 33932, 33934, 33841, 33901, 33985, 33997, 34000, 34022, 33981, 34003, 33994, 33983,
- 33978, 34016, 33953, 33977, 33972, 33943, 34021, 34019, 34060, 29965, 34104, 34032, 34105, 34079, 34106,
- 36677, 36678, 36679, 36680, 36681, 36682, 36683, 36684, 36685, 36686, 36687, 36688, 36689, 36690, 36691,
- 36692, 36693, 36694, 36695, 36696, 36697, 36698, 36699, 36700, 36701, 36702, 36703, 36704, 36705, 36706,
- 36707, 36708, 36709, 36714, 36736, 36748, 36754, 36765, 36768, 36769, 36770, 36772, 36773, 36774, 36775,
- 36778, 36780, 36781, 36782, 36783, 36786, 36787, 36788, 36789, 36791, 36792, 36794, 36795, 36796, 36799,
- 36800, 36803, 36806, 36809, 36810, 36811, 36812, 36813, 36815, 36818, 36822, 36823, 36826, 36832, 36833,
- 36835, 36839, 36844, 36847, 36849, 36850, 36852, 36853, 36854, 36858, 36859, 36860, 36862, 36863, 36871,
- 36872, 36876, 36878, 36883, 36885, 36888, 34134, 34107, 34047, 34044, 34137, 34120, 34152, 34148, 34142,
- 34170, 30626, 34115, 34162, 34171, 34212, 34216, 34183, 34191, 34169, 34222, 34204, 34181, 34233, 34231,
- 34224, 34259, 34241, 34268, 34303, 34343, 34309, 34345, 34326, 34364, 24318, 24328, 22844, 22849, 32823,
- 22869, 22874, 22872, 21263, 23586, 23589, 23596, 23604, 25164, 25194, 25247, 25275, 25290, 25306, 25303,
- 25326, 25378, 25334, 25401, 25419, 25411, 25517, 25590, 25457, 25466, 25486, 25524, 25453, 25516, 25482,
- 25449, 25518, 25532, 25586, 25592, 25568, 25599, 25540, 25566, 25550, 25682, 25542, 25534, 25669, 25665,
- 25611, 25627, 25632, 25612, 25638, 25633, 25694, 25732, 25709, 25750, 36889, 36892, 36899, 36900, 36901,
- 36903, 36904, 36905, 36906, 36907, 36908, 36912, 36913, 36914, 36915, 36916, 36919, 36921, 36922, 36925,
- 36927, 36928, 36931, 36933, 36934, 36936, 36937, 36938, 36939, 36940, 36942, 36948, 36949, 36950, 36953,
- 36954, 36956, 36957, 36958, 36959, 36960, 36961, 36964, 36966, 36967, 36969, 36970, 36971, 36972, 36975,
- 36976, 36977, 36978, 36979, 36982, 36983, 36984, 36985, 36986, 36987, 36988, 36990, 36993, 36996, 36997,
- 36998, 36999, 37001, 37002, 37004, 37005, 37006, 37007, 37008, 37010, 37012, 37014, 37016, 37018, 37020,
- 37022, 37023, 37024, 37028, 37029, 37031, 37032, 37033, 37035, 37037, 37042, 37047, 37052, 37053, 37055,
- 37056, 25722, 25783, 25784, 25753, 25786, 25792, 25808, 25815, 25828, 25826, 25865, 25893, 25902, 24331,
- 24530, 29977, 24337, 21343, 21489, 21501, 21481, 21480, 21499, 21522, 21526, 21510, 21579, 21586, 21587,
- 21588, 21590, 21571, 21537, 21591, 21593, 21539, 21554, 21634, 21652, 21623, 21617, 21604, 21658, 21659,
- 21636, 21622, 21606, 21661, 21712, 21677, 21698, 21684, 21714, 21671, 21670, 21715, 21716, 21618, 21667,
- 21717, 21691, 21695, 21708, 21721, 21722, 21724, 21673, 21674, 21668, 21725, 21711, 21726, 21787, 21735,
- 21792, 21757, 21780, 21747, 21794, 21795, 21775, 21777, 21799, 21802, 21863, 21903, 21941, 21833, 21869,
- 21825, 21845, 21823, 21840, 21820, 37058, 37059, 37062, 37064, 37065, 37067, 37068, 37069, 37074, 37076,
- 37077, 37078, 37080, 37081, 37082, 37086, 37087, 37088, 37091, 37092, 37093, 37097, 37098, 37100, 37102,
- 37104, 37105, 37106, 37107, 37109, 37110, 37111, 37113, 37114, 37115, 37116, 37119, 37120, 37121, 37123,
- 37125, 37126, 37127, 37128, 37129, 37130, 37131, 37132, 37133, 37134, 37135, 37136, 37137, 37138, 37139,
- 37140, 37141, 37142, 37143, 37144, 37146, 37147, 37148, 37149, 37151, 37152, 37153, 37156, 37157, 37158,
- 37159, 37160, 37161, 37162, 37163, 37164, 37165, 37166, 37168, 37170, 37171, 37172, 37173, 37174, 37175,
- 37176, 37178, 37179, 37180, 37181, 37182, 37183, 37184, 37185, 37186, 37188, 21815, 21846, 21877, 21878,
- 21879, 21811, 21808, 21852, 21899, 21970, 21891, 21937, 21945, 21896, 21889, 21919, 21886, 21974, 21905,
- 21883, 21983, 21949, 21950, 21908, 21913, 21994, 22007, 21961, 22047, 21969, 21995, 21996, 21972, 21990,
- 21981, 21956, 21999, 21989, 22002, 22003, 21964, 21965, 21992, 22005, 21988, 36756, 22046, 22024, 22028,
- 22017, 22052, 22051, 22014, 22016, 22055, 22061, 22104, 22073, 22103, 22060, 22093, 22114, 22105, 22108,
- 22092, 22100, 22150, 22116, 22129, 22123, 22139, 22140, 22149, 22163, 22191, 22228, 22231, 22237, 22241,
- 22261, 22251, 22265, 22271, 22276, 22282, 22281, 22300, 24079, 24089, 24084, 24081, 24113, 24123, 24124,
- 37189, 37191, 37192, 37201, 37203, 37204, 37205, 37206, 37208, 37209, 37211, 37212, 37215, 37216, 37222,
- 37223, 37224, 37227, 37229, 37235, 37242, 37243, 37244, 37248, 37249, 37250, 37251, 37252, 37254, 37256,
- 37258, 37262, 37263, 37267, 37268, 37269, 37270, 37271, 37272, 37273, 37276, 37277, 37278, 37279, 37280,
- 37281, 37284, 37285, 37286, 37287, 37288, 37289, 37291, 37292, 37296, 37297, 37298, 37299, 37302, 37303,
- 37304, 37305, 37307, 37308, 37309, 37310, 37311, 37312, 37313, 37314, 37315, 37316, 37317, 37318, 37320,
- 37323, 37328, 37330, 37331, 37332, 37333, 37334, 37335, 37336, 37337, 37338, 37339, 37341, 37342, 37343,
- 37344, 37345, 37346, 37347, 37348, 37349, 24119, 24132, 24148, 24155, 24158, 24161, 23692, 23674, 23693,
- 23696, 23702, 23688, 23704, 23705, 23697, 23706, 23708, 23733, 23714, 23741, 23724, 23723, 23729, 23715,
- 23745, 23735, 23748, 23762, 23780, 23755, 23781, 23810, 23811, 23847, 23846, 23854, 23844, 23838, 23814,
- 23835, 23896, 23870, 23860, 23869, 23916, 23899, 23919, 23901, 23915, 23883, 23882, 23913, 23924, 23938,
- 23961, 23965, 35955, 23991, 24005, 24435, 24439, 24450, 24455, 24457, 24460, 24469, 24473, 24476, 24488,
- 24493, 24501, 24508, 34914, 24417, 29357, 29360, 29364, 29367, 29368, 29379, 29377, 29390, 29389, 29394,
- 29416, 29423, 29417, 29426, 29428, 29431, 29441, 29427, 29443, 29434, 37350, 37351, 37352, 37353, 37354,
- 37355, 37356, 37357, 37358, 37359, 37360, 37361, 37362, 37363, 37364, 37365, 37366, 37367, 37368, 37369,
- 37370, 37371, 37372, 37373, 37374, 37375, 37376, 37377, 37378, 37379, 37380, 37381, 37382, 37383, 37384,
- 37385, 37386, 37387, 37388, 37389, 37390, 37391, 37392, 37393, 37394, 37395, 37396, 37397, 37398, 37399,
- 37400, 37401, 37402, 37403, 37404, 37405, 37406, 37407, 37408, 37409, 37410, 37411, 37412, 37413, 37414,
- 37415, 37416, 37417, 37418, 37419, 37420, 37421, 37422, 37423, 37424, 37425, 37426, 37427, 37428, 37429,
- 37430, 37431, 37432, 37433, 37434, 37435, 37436, 37437, 37438, 37439, 37440, 37441, 37442, 37443, 37444,
- 37445, 29435, 29463, 29459, 29473, 29450, 29470, 29469, 29461, 29474, 29497, 29477, 29484, 29496, 29489,
- 29520, 29517, 29527, 29536, 29548, 29551, 29566, 33307, 22821, 39143, 22820, 22786, 39267, 39271, 39272,
- 39273, 39274, 39275, 39276, 39284, 39287, 39293, 39296, 39300, 39303, 39306, 39309, 39312, 39313, 39315,
- 39316, 39317, 24192, 24209, 24203, 24214, 24229, 24224, 24249, 24245, 24254, 24243, 36179, 24274, 24273,
- 24283, 24296, 24298, 33210, 24516, 24521, 24534, 24527, 24579, 24558, 24580, 24545, 24548, 24574, 24581,
- 24582, 24554, 24557, 24568, 24601, 24629, 24614, 24603, 24591, 24589, 24617, 24619, 24586, 24639, 24609,
- 24696, 24697, 24699, 24698, 24642, 37446, 37447, 37448, 37449, 37450, 37451, 37452, 37453, 37454, 37455,
- 37456, 37457, 37458, 37459, 37460, 37461, 37462, 37463, 37464, 37465, 37466, 37467, 37468, 37469, 37470,
- 37471, 37472, 37473, 37474, 37475, 37476, 37477, 37478, 37479, 37480, 37481, 37482, 37483, 37484, 37485,
- 37486, 37487, 37488, 37489, 37490, 37491, 37493, 37494, 37495, 37496, 37497, 37498, 37499, 37500, 37501,
- 37502, 37503, 37504, 37505, 37506, 37507, 37508, 37509, 37510, 37511, 37512, 37513, 37514, 37515, 37516,
- 37517, 37519, 37520, 37521, 37522, 37523, 37524, 37525, 37526, 37527, 37528, 37529, 37530, 37531, 37532,
- 37533, 37534, 37535, 37536, 37537, 37538, 37539, 37540, 37541, 37542, 37543, 24682, 24701, 24726, 24730,
- 24749, 24733, 24707, 24722, 24716, 24731, 24812, 24763, 24753, 24797, 24792, 24774, 24794, 24756, 24864,
- 24870, 24853, 24867, 24820, 24832, 24846, 24875, 24906, 24949, 25004, 24980, 24999, 25015, 25044, 25077,
- 24541, 38579, 38377, 38379, 38385, 38387, 38389, 38390, 38396, 38398, 38403, 38404, 38406, 38408, 38410,
- 38411, 38412, 38413, 38415, 38418, 38421, 38422, 38423, 38425, 38426, 20012, 29247, 25109, 27701, 27732,
- 27740, 27722, 27811, 27781, 27792, 27796, 27788, 27752, 27753, 27764, 27766, 27782, 27817, 27856, 27860,
- 27821, 27895, 27896, 27889, 27863, 27826, 27872, 27862, 27898, 27883, 27886, 27825, 27859, 27887, 27902,
- 37544, 37545, 37546, 37547, 37548, 37549, 37551, 37552, 37553, 37554, 37555, 37556, 37557, 37558, 37559,
- 37560, 37561, 37562, 37563, 37564, 37565, 37566, 37567, 37568, 37569, 37570, 37571, 37572, 37573, 37574,
- 37575, 37577, 37578, 37579, 37580, 37581, 37582, 37583, 37584, 37585, 37586, 37587, 37588, 37589, 37590,
- 37591, 37592, 37593, 37594, 37595, 37596, 37597, 37598, 37599, 37600, 37601, 37602, 37603, 37604, 37605,
- 37606, 37607, 37608, 37609, 37610, 37611, 37612, 37613, 37614, 37615, 37616, 37617, 37618, 37619, 37620,
- 37621, 37622, 37623, 37624, 37625, 37626, 37627, 37628, 37629, 37630, 37631, 37632, 37633, 37634, 37635,
- 37636, 37637, 37638, 37639, 37640, 37641, 27961, 27943, 27916, 27971, 27976, 27911, 27908, 27929, 27918,
- 27947, 27981, 27950, 27957, 27930, 27983, 27986, 27988, 27955, 28049, 28015, 28062, 28064, 27998, 28051,
- 28052, 27996, 28000, 28028, 28003, 28186, 28103, 28101, 28126, 28174, 28095, 28128, 28177, 28134, 28125,
- 28121, 28182, 28075, 28172, 28078, 28203, 28270, 28238, 28267, 28338, 28255, 28294, 28243, 28244, 28210,
- 28197, 28228, 28383, 28337, 28312, 28384, 28461, 28386, 28325, 28327, 28349, 28347, 28343, 28375, 28340,
- 28367, 28303, 28354, 28319, 28514, 28486, 28487, 28452, 28437, 28409, 28463, 28470, 28491, 28532, 28458,
- 28425, 28457, 28553, 28557, 28556, 28536, 28530, 28540, 28538, 28625, 37642, 37643, 37644, 37645, 37646,
- 37647, 37648, 37649, 37650, 37651, 37652, 37653, 37654, 37655, 37656, 37657, 37658, 37659, 37660, 37661,
- 37662, 37663, 37664, 37665, 37666, 37667, 37668, 37669, 37670, 37671, 37672, 37673, 37674, 37675, 37676,
- 37677, 37678, 37679, 37680, 37681, 37682, 37683, 37684, 37685, 37686, 37687, 37688, 37689, 37690, 37691,
- 37692, 37693, 37695, 37696, 37697, 37698, 37699, 37700, 37701, 37702, 37703, 37704, 37705, 37706, 37707,
- 37708, 37709, 37710, 37711, 37712, 37713, 37714, 37715, 37716, 37717, 37718, 37719, 37720, 37721, 37722,
- 37723, 37724, 37725, 37726, 37727, 37728, 37729, 37730, 37731, 37732, 37733, 37734, 37735, 37736, 37737,
- 37739, 28617, 28583, 28601, 28598, 28610, 28641, 28654, 28638, 28640, 28655, 28698, 28707, 28699, 28729,
- 28725, 28751, 28766, 23424, 23428, 23445, 23443, 23461, 23480, 29999, 39582, 25652, 23524, 23534, 35120,
- 23536, 36423, 35591, 36790, 36819, 36821, 36837, 36846, 36836, 36841, 36838, 36851, 36840, 36869, 36868,
- 36875, 36902, 36881, 36877, 36886, 36897, 36917, 36918, 36909, 36911, 36932, 36945, 36946, 36944, 36968,
- 36952, 36962, 36955, 26297, 36980, 36989, 36994, 37000, 36995, 37003, 24400, 24407, 24406, 24408, 23611,
- 21675, 23632, 23641, 23409, 23651, 23654, 32700, 24362, 24361, 24365, 33396, 24380, 39739, 23662, 22913,
- 22915, 22925, 22953, 22954, 22947, 37740, 37741, 37742, 37743, 37744, 37745, 37746, 37747, 37748, 37749,
- 37750, 37751, 37752, 37753, 37754, 37755, 37756, 37757, 37758, 37759, 37760, 37761, 37762, 37763, 37764,
- 37765, 37766, 37767, 37768, 37769, 37770, 37771, 37772, 37773, 37774, 37776, 37777, 37778, 37779, 37780,
- 37781, 37782, 37783, 37784, 37785, 37786, 37787, 37788, 37789, 37790, 37791, 37792, 37793, 37794, 37795,
- 37796, 37797, 37798, 37799, 37800, 37801, 37802, 37803, 37804, 37805, 37806, 37807, 37808, 37809, 37810,
- 37811, 37812, 37813, 37814, 37815, 37816, 37817, 37818, 37819, 37820, 37821, 37822, 37823, 37824, 37825,
- 37826, 37827, 37828, 37829, 37830, 37831, 37832, 37833, 37835, 37836, 37837, 22935, 22986, 22955, 22942,
- 22948, 22994, 22962, 22959, 22999, 22974, 23045, 23046, 23005, 23048, 23011, 23000, 23033, 23052, 23049,
- 23090, 23092, 23057, 23075, 23059, 23104, 23143, 23114, 23125, 23100, 23138, 23157, 33004, 23210, 23195,
- 23159, 23162, 23230, 23275, 23218, 23250, 23252, 23224, 23264, 23267, 23281, 23254, 23270, 23256, 23260,
- 23305, 23319, 23318, 23346, 23351, 23360, 23573, 23580, 23386, 23397, 23411, 23377, 23379, 23394, 39541,
- 39543, 39544, 39546, 39551, 39549, 39552, 39553, 39557, 39560, 39562, 39568, 39570, 39571, 39574, 39576,
- 39579, 39580, 39581, 39583, 39584, 39586, 39587, 39589, 39591, 32415, 32417, 32419, 32421, 32424, 32425,
- 37838, 37839, 37840, 37841, 37842, 37843, 37844, 37845, 37847, 37848, 37849, 37850, 37851, 37852, 37853,
- 37854, 37855, 37856, 37857, 37858, 37859, 37860, 37861, 37862, 37863, 37864, 37865, 37866, 37867, 37868,
- 37869, 37870, 37871, 37872, 37873, 37874, 37875, 37876, 37877, 37878, 37879, 37880, 37881, 37882, 37883,
- 37884, 37885, 37886, 37887, 37888, 37889, 37890, 37891, 37892, 37893, 37894, 37895, 37896, 37897, 37898,
- 37899, 37900, 37901, 37902, 37903, 37904, 37905, 37906, 37907, 37908, 37909, 37910, 37911, 37912, 37913,
- 37914, 37915, 37916, 37917, 37918, 37919, 37920, 37921, 37922, 37923, 37924, 37925, 37926, 37927, 37928,
- 37929, 37930, 37931, 37932, 37933, 37934, 32429, 32432, 32446, 32448, 32449, 32450, 32457, 32459, 32460,
- 32464, 32468, 32471, 32475, 32480, 32481, 32488, 32491, 32494, 32495, 32497, 32498, 32525, 32502, 32506,
- 32507, 32510, 32513, 32514, 32515, 32519, 32520, 32523, 32524, 32527, 32529, 32530, 32535, 32537, 32540,
- 32539, 32543, 32545, 32546, 32547, 32548, 32549, 32550, 32551, 32554, 32555, 32556, 32557, 32559, 32560,
- 32561, 32562, 32563, 32565, 24186, 30079, 24027, 30014, 37013, 29582, 29585, 29614, 29602, 29599, 29647,
- 29634, 29649, 29623, 29619, 29632, 29641, 29640, 29669, 29657, 39036, 29706, 29673, 29671, 29662, 29626,
- 29682, 29711, 29738, 29787, 29734, 29733, 29736, 29744, 29742, 29740, 37935, 37936, 37937, 37938, 37939,
- 37940, 37941, 37942, 37943, 37944, 37945, 37946, 37947, 37948, 37949, 37951, 37952, 37953, 37954, 37955,
- 37956, 37957, 37958, 37959, 37960, 37961, 37962, 37963, 37964, 37965, 37966, 37967, 37968, 37969, 37970,
- 37971, 37972, 37973, 37974, 37975, 37976, 37977, 37978, 37979, 37980, 37981, 37982, 37983, 37984, 37985,
- 37986, 37987, 37988, 37989, 37990, 37991, 37992, 37993, 37994, 37996, 37997, 37998, 37999, 38000, 38001,
- 38002, 38003, 38004, 38005, 38006, 38007, 38008, 38009, 38010, 38011, 38012, 38013, 38014, 38015, 38016,
- 38017, 38018, 38019, 38020, 38033, 38038, 38040, 38087, 38095, 38099, 38100, 38106, 38118, 38139, 38172,
- 38176, 29723, 29722, 29761, 29788, 29783, 29781, 29785, 29815, 29805, 29822, 29852, 29838, 29824, 29825,
- 29831, 29835, 29854, 29864, 29865, 29840, 29863, 29906, 29882, 38890, 38891, 38892, 26444, 26451, 26462,
- 26440, 26473, 26533, 26503, 26474, 26483, 26520, 26535, 26485, 26536, 26526, 26541, 26507, 26487, 26492,
- 26608, 26633, 26584, 26634, 26601, 26544, 26636, 26585, 26549, 26586, 26547, 26589, 26624, 26563, 26552,
- 26594, 26638, 26561, 26621, 26674, 26675, 26720, 26721, 26702, 26722, 26692, 26724, 26755, 26653, 26709,
- 26726, 26689, 26727, 26688, 26686, 26698, 26697, 26665, 26805, 26767, 26740, 26743, 26771, 26731, 26818,
- 26990, 26876, 26911, 26912, 26873, 38183, 38195, 38205, 38211, 38216, 38219, 38229, 38234, 38240, 38254,
- 38260, 38261, 38263, 38264, 38265, 38266, 38267, 38268, 38269, 38270, 38272, 38273, 38274, 38275, 38276,
- 38277, 38278, 38279, 38280, 38281, 38282, 38283, 38284, 38285, 38286, 38287, 38288, 38289, 38290, 38291,
- 38292, 38293, 38294, 38295, 38296, 38297, 38298, 38299, 38300, 38301, 38302, 38303, 38304, 38305, 38306,
- 38307, 38308, 38309, 38310, 38311, 38312, 38313, 38314, 38315, 38316, 38317, 38318, 38319, 38320, 38321,
- 38322, 38323, 38324, 38325, 38326, 38327, 38328, 38329, 38330, 38331, 38332, 38333, 38334, 38335, 38336,
- 38337, 38338, 38339, 38340, 38341, 38342, 38343, 38344, 38345, 38346, 38347, 26916, 26864, 26891, 26881,
- 26967, 26851, 26896, 26993, 26937, 26976, 26946, 26973, 27012, 26987, 27008, 27032, 27000, 26932, 27084,
- 27015, 27016, 27086, 27017, 26982, 26979, 27001, 27035, 27047, 27067, 27051, 27053, 27092, 27057, 27073,
- 27082, 27103, 27029, 27104, 27021, 27135, 27183, 27117, 27159, 27160, 27237, 27122, 27204, 27198, 27296,
- 27216, 27227, 27189, 27278, 27257, 27197, 27176, 27224, 27260, 27281, 27280, 27305, 27287, 27307, 29495,
- 29522, 27521, 27522, 27527, 27524, 27538, 27539, 27533, 27546, 27547, 27553, 27562, 36715, 36717, 36721,
- 36722, 36723, 36725, 36726, 36728, 36727, 36729, 36730, 36732, 36734, 36737, 36738, 36740, 36743, 36747,
- 38348, 38349, 38350, 38351, 38352, 38353, 38354, 38355, 38356, 38357, 38358, 38359, 38360, 38361, 38362,
- 38363, 38364, 38365, 38366, 38367, 38368, 38369, 38370, 38371, 38372, 38373, 38374, 38375, 38380, 38399,
- 38407, 38419, 38424, 38427, 38430, 38432, 38435, 38436, 38437, 38438, 38439, 38440, 38441, 38443, 38444,
- 38445, 38447, 38448, 38455, 38456, 38457, 38458, 38462, 38465, 38467, 38474, 38478, 38479, 38481, 38482,
- 38483, 38486, 38487, 38488, 38489, 38490, 38492, 38493, 38494, 38496, 38499, 38501, 38502, 38507, 38509,
- 38510, 38511, 38512, 38513, 38515, 38520, 38521, 38522, 38523, 38524, 38525, 38526, 38527, 38528, 38529,
- 38530, 38531, 38532, 38535, 38537, 38538, 36749, 36750, 36751, 36760, 36762, 36558, 25099, 25111, 25115,
- 25119, 25122, 25121, 25125, 25124, 25132, 33255, 29935, 29940, 29951, 29967, 29969, 29971, 25908, 26094,
- 26095, 26096, 26122, 26137, 26482, 26115, 26133, 26112, 28805, 26359, 26141, 26164, 26161, 26166, 26165,
- 32774, 26207, 26196, 26177, 26191, 26198, 26209, 26199, 26231, 26244, 26252, 26279, 26269, 26302, 26331,
- 26332, 26342, 26345, 36146, 36147, 36150, 36155, 36157, 36160, 36165, 36166, 36168, 36169, 36167, 36173,
- 36181, 36185, 35271, 35274, 35275, 35276, 35278, 35279, 35280, 35281, 29294, 29343, 29277, 29286, 29295,
- 29310, 29311, 29316, 29323, 29325, 29327, 29330, 25352, 25394, 25520, 38540, 38542, 38545, 38546, 38547,
- 38549, 38550, 38554, 38555, 38557, 38558, 38559, 38560, 38561, 38562, 38563, 38564, 38565, 38566, 38568,
- 38569, 38570, 38571, 38572, 38573, 38574, 38575, 38577, 38578, 38580, 38581, 38583, 38584, 38586, 38587,
- 38591, 38594, 38595, 38600, 38602, 38603, 38608, 38609, 38611, 38612, 38614, 38615, 38616, 38617, 38618,
- 38619, 38620, 38621, 38622, 38623, 38625, 38626, 38627, 38628, 38629, 38630, 38631, 38635, 38636, 38637,
- 38638, 38640, 38641, 38642, 38644, 38645, 38648, 38650, 38651, 38652, 38653, 38655, 38658, 38659, 38661,
- 38666, 38667, 38668, 38672, 38673, 38674, 38676, 38677, 38679, 38680, 38681, 38682, 38683, 38685, 38687,
- 38688, 25663, 25816, 32772, 27626, 27635, 27645, 27637, 27641, 27653, 27655, 27654, 27661, 27669, 27672,
- 27673, 27674, 27681, 27689, 27684, 27690, 27698, 25909, 25941, 25963, 29261, 29266, 29270, 29232, 34402,
- 21014, 32927, 32924, 32915, 32956, 26378, 32957, 32945, 32939, 32941, 32948, 32951, 32999, 33000, 33001,
- 33002, 32987, 32962, 32964, 32985, 32973, 32983, 26384, 32989, 33003, 33009, 33012, 33005, 33037, 33038,
- 33010, 33020, 26389, 33042, 35930, 33078, 33054, 33068, 33048, 33074, 33096, 33100, 33107, 33140, 33113,
- 33114, 33137, 33120, 33129, 33148, 33149, 33133, 33127, 22605, 23221, 33160, 33154, 33169, 28373, 33187,
- 33194, 33228, 26406, 33226, 33211, 38689, 38690, 38691, 38692, 38693, 38694, 38695, 38696, 38697, 38699,
- 38700, 38702, 38703, 38705, 38707, 38708, 38709, 38710, 38711, 38714, 38715, 38716, 38717, 38719, 38720,
- 38721, 38722, 38723, 38724, 38725, 38726, 38727, 38728, 38729, 38730, 38731, 38732, 38733, 38734, 38735,
- 38736, 38737, 38740, 38741, 38743, 38744, 38746, 38748, 38749, 38751, 38755, 38756, 38758, 38759, 38760,
- 38762, 38763, 38764, 38765, 38766, 38767, 38768, 38769, 38770, 38773, 38775, 38776, 38777, 38778, 38779,
- 38781, 38782, 38783, 38784, 38785, 38786, 38787, 38788, 38790, 38791, 38792, 38793, 38794, 38796, 38798,
- 38799, 38800, 38803, 38805, 38806, 38807, 38809, 38810, 38811, 38812, 38813, 33217, 33190, 27428, 27447,
- 27449, 27459, 27462, 27481, 39121, 39122, 39123, 39125, 39129, 39130, 27571, 24384, 27586, 35315, 26000,
- 40785, 26003, 26044, 26054, 26052, 26051, 26060, 26062, 26066, 26070, 28800, 28828, 28822, 28829, 28859,
- 28864, 28855, 28843, 28849, 28904, 28874, 28944, 28947, 28950, 28975, 28977, 29043, 29020, 29032, 28997,
- 29042, 29002, 29048, 29050, 29080, 29107, 29109, 29096, 29088, 29152, 29140, 29159, 29177, 29213, 29224,
- 28780, 28952, 29030, 29113, 25150, 25149, 25155, 25160, 25161, 31035, 31040, 31046, 31049, 31067, 31068,
- 31059, 31066, 31074, 31063, 31072, 31087, 31079, 31098, 31109, 31114, 31130, 31143, 31155, 24529, 24528,
- 38814, 38815, 38817, 38818, 38820, 38821, 38822, 38823, 38824, 38825, 38826, 38828, 38830, 38832, 38833,
- 38835, 38837, 38838, 38839, 38840, 38841, 38842, 38843, 38844, 38845, 38846, 38847, 38848, 38849, 38850,
- 38851, 38852, 38853, 38854, 38855, 38856, 38857, 38858, 38859, 38860, 38861, 38862, 38863, 38864, 38865,
- 38866, 38867, 38868, 38869, 38870, 38871, 38872, 38873, 38874, 38875, 38876, 38877, 38878, 38879, 38880,
- 38881, 38882, 38883, 38884, 38885, 38888, 38894, 38895, 38896, 38897, 38898, 38900, 38903, 38904, 38905,
- 38906, 38907, 38908, 38909, 38910, 38911, 38912, 38913, 38914, 38915, 38916, 38917, 38918, 38919, 38920,
- 38921, 38922, 38923, 38924, 38925, 38926, 24636, 24669, 24666, 24679, 24641, 24665, 24675, 24747, 24838,
- 24845, 24925, 25001, 24989, 25035, 25041, 25094, 32896, 32895, 27795, 27894, 28156, 30710, 30712, 30720,
- 30729, 30743, 30744, 30737, 26027, 30765, 30748, 30749, 30777, 30778, 30779, 30751, 30780, 30757, 30764,
- 30755, 30761, 30798, 30829, 30806, 30807, 30758, 30800, 30791, 30796, 30826, 30875, 30867, 30874, 30855,
- 30876, 30881, 30883, 30898, 30905, 30885, 30932, 30937, 30921, 30956, 30962, 30981, 30964, 30995, 31012,
- 31006, 31028, 40859, 40697, 40699, 40700, 30449, 30468, 30477, 30457, 30471, 30472, 30490, 30498, 30489,
- 30509, 30502, 30517, 30520, 30544, 30545, 30535, 30531, 30554, 30568, 38927, 38928, 38929, 38930, 38931,
- 38932, 38933, 38934, 38935, 38936, 38937, 38938, 38939, 38940, 38941, 38942, 38943, 38944, 38945, 38946,
- 38947, 38948, 38949, 38950, 38951, 38952, 38953, 38954, 38955, 38956, 38957, 38958, 38959, 38960, 38961,
- 38962, 38963, 38964, 38965, 38966, 38967, 38968, 38969, 38970, 38971, 38972, 38973, 38974, 38975, 38976,
- 38977, 38978, 38979, 38980, 38981, 38982, 38983, 38984, 38985, 38986, 38987, 38988, 38989, 38990, 38991,
- 38992, 38993, 38994, 38995, 38996, 38997, 38998, 38999, 39000, 39001, 39002, 39003, 39004, 39005, 39006,
- 39007, 39008, 39009, 39010, 39011, 39012, 39013, 39014, 39015, 39016, 39017, 39018, 39019, 39020, 39021,
- 39022, 30562, 30565, 30591, 30605, 30589, 30592, 30604, 30609, 30623, 30624, 30640, 30645, 30653, 30010,
- 30016, 30030, 30027, 30024, 30043, 30066, 30073, 30083, 32600, 32609, 32607, 35400, 32616, 32628, 32625,
- 32633, 32641, 32638, 30413, 30437, 34866, 38021, 38022, 38023, 38027, 38026, 38028, 38029, 38031, 38032,
- 38036, 38039, 38037, 38042, 38043, 38044, 38051, 38052, 38059, 38058, 38061, 38060, 38063, 38064, 38066,
- 38068, 38070, 38071, 38072, 38073, 38074, 38076, 38077, 38079, 38084, 38088, 38089, 38090, 38091, 38092,
- 38093, 38094, 38096, 38097, 38098, 38101, 38102, 38103, 38105, 38104, 38107, 38110, 38111, 38112, 38114,
- 38116, 38117, 38119, 38120, 38122, 39023, 39024, 39025, 39026, 39027, 39028, 39051, 39054, 39058, 39061,
- 39065, 39075, 39080, 39081, 39082, 39083, 39084, 39085, 39086, 39087, 39088, 39089, 39090, 39091, 39092,
- 39093, 39094, 39095, 39096, 39097, 39098, 39099, 39100, 39101, 39102, 39103, 39104, 39105, 39106, 39107,
- 39108, 39109, 39110, 39111, 39112, 39113, 39114, 39115, 39116, 39117, 39119, 39120, 39124, 39126, 39127,
- 39131, 39132, 39133, 39136, 39137, 39138, 39139, 39140, 39141, 39142, 39145, 39146, 39147, 39148, 39149,
- 39150, 39151, 39152, 39153, 39154, 39155, 39156, 39157, 39158, 39159, 39160, 39161, 39162, 39163, 39164,
- 39165, 39166, 39167, 39168, 39169, 39170, 39171, 39172, 39173, 39174, 39175, 38121, 38123, 38126, 38127,
- 38131, 38132, 38133, 38135, 38137, 38140, 38141, 38143, 38147, 38146, 38150, 38151, 38153, 38154, 38157,
- 38158, 38159, 38162, 38163, 38164, 38165, 38166, 38168, 38171, 38173, 38174, 38175, 38178, 38186, 38187,
- 38185, 38188, 38193, 38194, 38196, 38198, 38199, 38200, 38204, 38206, 38207, 38210, 38197, 38212, 38213,
- 38214, 38217, 38220, 38222, 38223, 38226, 38227, 38228, 38230, 38231, 38232, 38233, 38235, 38238, 38239,
- 38237, 38241, 38242, 38244, 38245, 38246, 38247, 38248, 38249, 38250, 38251, 38252, 38255, 38257, 38258,
- 38259, 38202, 30695, 30700, 38601, 31189, 31213, 31203, 31211, 31238, 23879, 31235, 31234, 31262, 31252,
- 39176, 39177, 39178, 39179, 39180, 39182, 39183, 39185, 39186, 39187, 39188, 39189, 39190, 39191, 39192,
- 39193, 39194, 39195, 39196, 39197, 39198, 39199, 39200, 39201, 39202, 39203, 39204, 39205, 39206, 39207,
- 39208, 39209, 39210, 39211, 39212, 39213, 39215, 39216, 39217, 39218, 39219, 39220, 39221, 39222, 39223,
- 39224, 39225, 39226, 39227, 39228, 39229, 39230, 39231, 39232, 39233, 39234, 39235, 39236, 39237, 39238,
- 39239, 39240, 39241, 39242, 39243, 39244, 39245, 39246, 39247, 39248, 39249, 39250, 39251, 39254, 39255,
- 39256, 39257, 39258, 39259, 39260, 39261, 39262, 39263, 39264, 39265, 39266, 39268, 39270, 39283, 39288,
- 39289, 39291, 39294, 39298, 39299, 39305, 31289, 31287, 31313, 40655, 39333, 31344, 30344, 30350, 30355,
- 30361, 30372, 29918, 29920, 29996, 40480, 40482, 40488, 40489, 40490, 40491, 40492, 40498, 40497, 40502,
- 40504, 40503, 40505, 40506, 40510, 40513, 40514, 40516, 40518, 40519, 40520, 40521, 40523, 40524, 40526,
- 40529, 40533, 40535, 40538, 40539, 40540, 40542, 40547, 40550, 40551, 40552, 40553, 40554, 40555, 40556,
- 40561, 40557, 40563, 30098, 30100, 30102, 30112, 30109, 30124, 30115, 30131, 30132, 30136, 30148, 30129,
- 30128, 30147, 30146, 30166, 30157, 30179, 30184, 30182, 30180, 30187, 30183, 30211, 30193, 30204, 30207,
- 30224, 30208, 30213, 30220, 30231, 30218, 30245, 30232, 30229, 30233, 39308, 39310, 39322, 39323, 39324,
- 39325, 39326, 39327, 39328, 39329, 39330, 39331, 39332, 39334, 39335, 39337, 39338, 39339, 39340, 39341,
- 39342, 39343, 39344, 39345, 39346, 39347, 39348, 39349, 39350, 39351, 39352, 39353, 39354, 39355, 39356,
- 39357, 39358, 39359, 39360, 39361, 39362, 39363, 39364, 39365, 39366, 39367, 39368, 39369, 39370, 39371,
- 39372, 39373, 39374, 39375, 39376, 39377, 39378, 39379, 39380, 39381, 39382, 39383, 39384, 39385, 39386,
- 39387, 39388, 39389, 39390, 39391, 39392, 39393, 39394, 39395, 39396, 39397, 39398, 39399, 39400, 39401,
- 39402, 39403, 39404, 39405, 39406, 39407, 39408, 39409, 39410, 39411, 39412, 39413, 39414, 39415, 39416,
- 39417, 30235, 30268, 30242, 30240, 30272, 30253, 30256, 30271, 30261, 30275, 30270, 30259, 30285, 30302,
- 30292, 30300, 30294, 30315, 30319, 32714, 31462, 31352, 31353, 31360, 31366, 31368, 31381, 31398, 31392,
- 31404, 31400, 31405, 31411, 34916, 34921, 34930, 34941, 34943, 34946, 34978, 35014, 34999, 35004, 35017,
- 35042, 35022, 35043, 35045, 35057, 35098, 35068, 35048, 35070, 35056, 35105, 35097, 35091, 35099, 35082,
- 35124, 35115, 35126, 35137, 35174, 35195, 30091, 32997, 30386, 30388, 30684, 32786, 32788, 32790, 32796,
- 32800, 32802, 32805, 32806, 32807, 32809, 32808, 32817, 32779, 32821, 32835, 32838, 32845, 32850, 32873,
- 32881, 35203, 39032, 39040, 39043, 39418, 39419, 39420, 39421, 39422, 39423, 39424, 39425, 39426, 39427,
- 39428, 39429, 39430, 39431, 39432, 39433, 39434, 39435, 39436, 39437, 39438, 39439, 39440, 39441, 39442,
- 39443, 39444, 39445, 39446, 39447, 39448, 39449, 39450, 39451, 39452, 39453, 39454, 39455, 39456, 39457,
- 39458, 39459, 39460, 39461, 39462, 39463, 39464, 39465, 39466, 39467, 39468, 39469, 39470, 39471, 39472,
- 39473, 39474, 39475, 39476, 39477, 39478, 39479, 39480, 39481, 39482, 39483, 39484, 39485, 39486, 39487,
- 39488, 39489, 39490, 39491, 39492, 39493, 39494, 39495, 39496, 39497, 39498, 39499, 39500, 39501, 39502,
- 39503, 39504, 39505, 39506, 39507, 39508, 39509, 39510, 39511, 39512, 39513, 39049, 39052, 39053, 39055,
- 39060, 39066, 39067, 39070, 39071, 39073, 39074, 39077, 39078, 34381, 34388, 34412, 34414, 34431, 34426,
- 34428, 34427, 34472, 34445, 34443, 34476, 34461, 34471, 34467, 34474, 34451, 34473, 34486, 34500, 34485,
- 34510, 34480, 34490, 34481, 34479, 34505, 34511, 34484, 34537, 34545, 34546, 34541, 34547, 34512, 34579,
- 34526, 34548, 34527, 34520, 34513, 34563, 34567, 34552, 34568, 34570, 34573, 34569, 34595, 34619, 34590,
- 34597, 34606, 34586, 34622, 34632, 34612, 34609, 34601, 34615, 34623, 34690, 34594, 34685, 34686, 34683,
- 34656, 34672, 34636, 34670, 34699, 34643, 34659, 34684, 34660, 34649, 34661, 34707, 34735, 34728, 34770,
- 39514, 39515, 39516, 39517, 39518, 39519, 39520, 39521, 39522, 39523, 39524, 39525, 39526, 39527, 39528,
- 39529, 39530, 39531, 39538, 39555, 39561, 39565, 39566, 39572, 39573, 39577, 39590, 39593, 39594, 39595,
- 39596, 39597, 39598, 39599, 39602, 39603, 39604, 39605, 39609, 39611, 39613, 39614, 39615, 39619, 39620,
- 39622, 39623, 39624, 39625, 39626, 39629, 39630, 39631, 39632, 39634, 39636, 39637, 39638, 39639, 39641,
- 39642, 39643, 39644, 39645, 39646, 39648, 39650, 39651, 39652, 39653, 39655, 39656, 39657, 39658, 39660,
- 39662, 39664, 39665, 39666, 39667, 39668, 39669, 39670, 39671, 39672, 39674, 39676, 39677, 39678, 39679,
- 39680, 39681, 39682, 39684, 39685, 39686, 34758, 34696, 34693, 34733, 34711, 34691, 34731, 34789, 34732,
- 34741, 34739, 34763, 34771, 34749, 34769, 34752, 34762, 34779, 34794, 34784, 34798, 34838, 34835, 34814,
- 34826, 34843, 34849, 34873, 34876, 32566, 32578, 32580, 32581, 33296, 31482, 31485, 31496, 31491, 31492,
- 31509, 31498, 31531, 31503, 31559, 31544, 31530, 31513, 31534, 31537, 31520, 31525, 31524, 31539, 31550,
- 31518, 31576, 31578, 31557, 31605, 31564, 31581, 31584, 31598, 31611, 31586, 31602, 31601, 31632, 31654,
- 31655, 31672, 31660, 31645, 31656, 31621, 31658, 31644, 31650, 31659, 31668, 31697, 31681, 31692, 31709,
- 31706, 31717, 31718, 31722, 31756, 31742, 31740, 31759, 31766, 31755, 39687, 39689, 39690, 39691, 39692,
- 39693, 39694, 39696, 39697, 39698, 39700, 39701, 39702, 39703, 39704, 39705, 39706, 39707, 39708, 39709,
- 39710, 39712, 39713, 39714, 39716, 39717, 39718, 39719, 39720, 39721, 39722, 39723, 39724, 39725, 39726,
- 39728, 39729, 39731, 39732, 39733, 39734, 39735, 39736, 39737, 39738, 39741, 39742, 39743, 39744, 39750,
- 39754, 39755, 39756, 39758, 39760, 39762, 39763, 39765, 39766, 39767, 39768, 39769, 39770, 39771, 39772,
- 39773, 39774, 39775, 39776, 39777, 39778, 39779, 39780, 39781, 39782, 39783, 39784, 39785, 39786, 39787,
- 39788, 39789, 39790, 39791, 39792, 39793, 39794, 39795, 39796, 39797, 39798, 39799, 39800, 39801, 39802,
- 39803, 31775, 31786, 31782, 31800, 31809, 31808, 33278, 33281, 33282, 33284, 33260, 34884, 33313, 33314,
- 33315, 33325, 33327, 33320, 33323, 33336, 33339, 33331, 33332, 33342, 33348, 33353, 33355, 33359, 33370,
- 33375, 33384, 34942, 34949, 34952, 35032, 35039, 35166, 32669, 32671, 32679, 32687, 32688, 32690, 31868,
- 25929, 31889, 31901, 31900, 31902, 31906, 31922, 31932, 31933, 31937, 31943, 31948, 31949, 31944, 31941,
- 31959, 31976, 33390, 26280, 32703, 32718, 32725, 32741, 32737, 32742, 32745, 32750, 32755, 31992, 32119,
- 32166, 32174, 32327, 32411, 40632, 40628, 36211, 36228, 36244, 36241, 36273, 36199, 36205, 35911, 35913,
- 37194, 37200, 37198, 37199, 37220, 39804, 39805, 39806, 39807, 39808, 39809, 39810, 39811, 39812, 39813,
- 39814, 39815, 39816, 39817, 39818, 39819, 39820, 39821, 39822, 39823, 39824, 39825, 39826, 39827, 39828,
- 39829, 39830, 39831, 39832, 39833, 39834, 39835, 39836, 39837, 39838, 39839, 39840, 39841, 39842, 39843,
- 39844, 39845, 39846, 39847, 39848, 39849, 39850, 39851, 39852, 39853, 39854, 39855, 39856, 39857, 39858,
- 39859, 39860, 39861, 39862, 39863, 39864, 39865, 39866, 39867, 39868, 39869, 39870, 39871, 39872, 39873,
- 39874, 39875, 39876, 39877, 39878, 39879, 39880, 39881, 39882, 39883, 39884, 39885, 39886, 39887, 39888,
- 39889, 39890, 39891, 39892, 39893, 39894, 39895, 39896, 39897, 39898, 39899, 37218, 37217, 37232, 37225,
- 37231, 37245, 37246, 37234, 37236, 37241, 37260, 37253, 37264, 37261, 37265, 37282, 37283, 37290, 37293,
- 37294, 37295, 37301, 37300, 37306, 35925, 40574, 36280, 36331, 36357, 36441, 36457, 36277, 36287, 36284,
- 36282, 36292, 36310, 36311, 36314, 36318, 36302, 36303, 36315, 36294, 36332, 36343, 36344, 36323, 36345,
- 36347, 36324, 36361, 36349, 36372, 36381, 36383, 36396, 36398, 36387, 36399, 36410, 36416, 36409, 36405,
- 36413, 36401, 36425, 36417, 36418, 36433, 36434, 36426, 36464, 36470, 36476, 36463, 36468, 36485, 36495,
- 36500, 36496, 36508, 36510, 35960, 35970, 35978, 35973, 35992, 35988, 26011, 35286, 35294, 35290, 35292,
- 39900, 39901, 39902, 39903, 39904, 39905, 39906, 39907, 39908, 39909, 39910, 39911, 39912, 39913, 39914,
- 39915, 39916, 39917, 39918, 39919, 39920, 39921, 39922, 39923, 39924, 39925, 39926, 39927, 39928, 39929,
- 39930, 39931, 39932, 39933, 39934, 39935, 39936, 39937, 39938, 39939, 39940, 39941, 39942, 39943, 39944,
- 39945, 39946, 39947, 39948, 39949, 39950, 39951, 39952, 39953, 39954, 39955, 39956, 39957, 39958, 39959,
- 39960, 39961, 39962, 39963, 39964, 39965, 39966, 39967, 39968, 39969, 39970, 39971, 39972, 39973, 39974,
- 39975, 39976, 39977, 39978, 39979, 39980, 39981, 39982, 39983, 39984, 39985, 39986, 39987, 39988, 39989,
- 39990, 39991, 39992, 39993, 39994, 39995, 35301, 35307, 35311, 35390, 35622, 38739, 38633, 38643, 38639,
- 38662, 38657, 38664, 38671, 38670, 38698, 38701, 38704, 38718, 40832, 40835, 40837, 40838, 40839, 40840,
- 40841, 40842, 40844, 40702, 40715, 40717, 38585, 38588, 38589, 38606, 38610, 30655, 38624, 37518, 37550,
- 37576, 37694, 37738, 37834, 37775, 37950, 37995, 40063, 40066, 40069, 40070, 40071, 40072, 31267, 40075,
- 40078, 40080, 40081, 40082, 40084, 40085, 40090, 40091, 40094, 40095, 40096, 40097, 40098, 40099, 40101,
- 40102, 40103, 40104, 40105, 40107, 40109, 40110, 40112, 40113, 40114, 40115, 40116, 40117, 40118, 40119,
- 40122, 40123, 40124, 40125, 40132, 40133, 40134, 40135, 40138, 40139, 39996, 39997, 39998, 39999, 40000,
- 40001, 40002, 40003, 40004, 40005, 40006, 40007, 40008, 40009, 40010, 40011, 40012, 40013, 40014, 40015,
- 40016, 40017, 40018, 40019, 40020, 40021, 40022, 40023, 40024, 40025, 40026, 40027, 40028, 40029, 40030,
- 40031, 40032, 40033, 40034, 40035, 40036, 40037, 40038, 40039, 40040, 40041, 40042, 40043, 40044, 40045,
- 40046, 40047, 40048, 40049, 40050, 40051, 40052, 40053, 40054, 40055, 40056, 40057, 40058, 40059, 40061,
- 40062, 40064, 40067, 40068, 40073, 40074, 40076, 40079, 40083, 40086, 40087, 40088, 40089, 40093, 40106,
- 40108, 40111, 40121, 40126, 40127, 40128, 40129, 40130, 40136, 40137, 40145, 40146, 40154, 40155, 40160,
- 40161, 40140, 40141, 40142, 40143, 40144, 40147, 40148, 40149, 40151, 40152, 40153, 40156, 40157, 40159,
- 40162, 38780, 38789, 38801, 38802, 38804, 38831, 38827, 38819, 38834, 38836, 39601, 39600, 39607, 40536,
- 39606, 39610, 39612, 39617, 39616, 39621, 39618, 39627, 39628, 39633, 39749, 39747, 39751, 39753, 39752,
- 39757, 39761, 39144, 39181, 39214, 39253, 39252, 39647, 39649, 39654, 39663, 39659, 39675, 39661, 39673,
- 39688, 39695, 39699, 39711, 39715, 40637, 40638, 32315, 40578, 40583, 40584, 40587, 40594, 37846, 40605,
- 40607, 40667, 40668, 40669, 40672, 40671, 40674, 40681, 40679, 40677, 40682, 40687, 40738, 40748, 40751,
- 40761, 40759, 40765, 40766, 40772, 40163, 40164, 40165, 40166, 40167, 40168, 40169, 40170, 40171, 40172,
- 40173, 40174, 40175, 40176, 40177, 40178, 40179, 40180, 40181, 40182, 40183, 40184, 40185, 40186, 40187,
- 40188, 40189, 40190, 40191, 40192, 40193, 40194, 40195, 40196, 40197, 40198, 40199, 40200, 40201, 40202,
- 40203, 40204, 40205, 40206, 40207, 40208, 40209, 40210, 40211, 40212, 40213, 40214, 40215, 40216, 40217,
- 40218, 40219, 40220, 40221, 40222, 40223, 40224, 40225, 40226, 40227, 40228, 40229, 40230, 40231, 40232,
- 40233, 40234, 40235, 40236, 40237, 40238, 40239, 40240, 40241, 40242, 40243, 40244, 40245, 40246, 40247,
- 40248, 40249, 40250, 40251, 40252, 40253, 40254, 40255, 40256, 40257, 40258, 57908, 57909, 57910, 57911,
- 57912, 57913, 57914, 57915, 57916, 57917, 57918, 57919, 57920, 57921, 57922, 57923, 57924, 57925, 57926,
- 57927, 57928, 57929, 57930, 57931, 57932, 57933, 57934, 57935, 57936, 57937, 57938, 57939, 57940, 57941,
- 57942, 57943, 57944, 57945, 57946, 57947, 57948, 57949, 57950, 57951, 57952, 57953, 57954, 57955, 57956,
- 57957, 57958, 57959, 57960, 57961, 57962, 57963, 57964, 57965, 57966, 57967, 57968, 57969, 57970, 57971,
- 57972, 57973, 57974, 57975, 57976, 57977, 57978, 57979, 57980, 57981, 57982, 57983, 57984, 57985, 57986,
- 57987, 57988, 57989, 57990, 57991, 57992, 57993, 57994, 57995, 57996, 57997, 57998, 57999, 58000, 58001,
- 40259, 40260, 40261, 40262, 40263, 40264, 40265, 40266, 40267, 40268, 40269, 40270, 40271, 40272, 40273,
- 40274, 40275, 40276, 40277, 40278, 40279, 40280, 40281, 40282, 40283, 40284, 40285, 40286, 40287, 40288,
- 40289, 40290, 40291, 40292, 40293, 40294, 40295, 40296, 40297, 40298, 40299, 40300, 40301, 40302, 40303,
- 40304, 40305, 40306, 40307, 40308, 40309, 40310, 40311, 40312, 40313, 40314, 40315, 40316, 40317, 40318,
- 40319, 40320, 40321, 40322, 40323, 40324, 40325, 40326, 40327, 40328, 40329, 40330, 40331, 40332, 40333,
- 40334, 40335, 40336, 40337, 40338, 40339, 40340, 40341, 40342, 40343, 40344, 40345, 40346, 40347, 40348,
- 40349, 40350, 40351, 40352, 40353, 40354, 58002, 58003, 58004, 58005, 58006, 58007, 58008, 58009, 58010,
- 58011, 58012, 58013, 58014, 58015, 58016, 58017, 58018, 58019, 58020, 58021, 58022, 58023, 58024, 58025,
- 58026, 58027, 58028, 58029, 58030, 58031, 58032, 58033, 58034, 58035, 58036, 58037, 58038, 58039, 58040,
- 58041, 58042, 58043, 58044, 58045, 58046, 58047, 58048, 58049, 58050, 58051, 58052, 58053, 58054, 58055,
- 58056, 58057, 58058, 58059, 58060, 58061, 58062, 58063, 58064, 58065, 58066, 58067, 58068, 58069, 58070,
- 58071, 58072, 58073, 58074, 58075, 58076, 58077, 58078, 58079, 58080, 58081, 58082, 58083, 58084, 58085,
- 58086, 58087, 58088, 58089, 58090, 58091, 58092, 58093, 58094, 58095, 40355, 40356, 40357, 40358, 40359,
- 40360, 40361, 40362, 40363, 40364, 40365, 40366, 40367, 40368, 40369, 40370, 40371, 40372, 40373, 40374,
- 40375, 40376, 40377, 40378, 40379, 40380, 40381, 40382, 40383, 40384, 40385, 40386, 40387, 40388, 40389,
- 40390, 40391, 40392, 40393, 40394, 40395, 40396, 40397, 40398, 40399, 40400, 40401, 40402, 40403, 40404,
- 40405, 40406, 40407, 40408, 40409, 40410, 40411, 40412, 40413, 40414, 40415, 40416, 40417, 40418, 40419,
- 40420, 40421, 40422, 40423, 40424, 40425, 40426, 40427, 40428, 40429, 40430, 40431, 40432, 40433, 40434,
- 40435, 40436, 40437, 40438, 40439, 40440, 40441, 40442, 40443, 40444, 40445, 40446, 40447, 40448, 40449,
- 40450, 58096, 58097, 58098, 58099, 58100, 58101, 58102, 58103, 58104, 58105, 58106, 58107, 58108, 58109,
- 58110, 58111, 58112, 58113, 58114, 58115, 58116, 58117, 58118, 58119, 58120, 58121, 58122, 58123, 58124,
- 58125, 58126, 58127, 58128, 58129, 58130, 58131, 58132, 58133, 58134, 58135, 58136, 58137, 58138, 58139,
- 58140, 58141, 58142, 58143, 58144, 58145, 58146, 58147, 58148, 58149, 58150, 58151, 58152, 58153, 58154,
- 58155, 58156, 58157, 58158, 58159, 58160, 58161, 58162, 58163, 58164, 58165, 58166, 58167, 58168, 58169,
- 58170, 58171, 58172, 58173, 58174, 58175, 58176, 58177, 58178, 58179, 58180, 58181, 58182, 58183, 58184,
- 58185, 58186, 58187, 58188, 58189, 40451, 40452, 40453, 40454, 40455, 40456, 40457, 40458, 40459, 40460,
- 40461, 40462, 40463, 40464, 40465, 40466, 40467, 40468, 40469, 40470, 40471, 40472, 40473, 40474, 40475,
- 40476, 40477, 40478, 40484, 40487, 40494, 40496, 40500, 40507, 40508, 40512, 40525, 40528, 40530, 40531,
- 40532, 40534, 40537, 40541, 40543, 40544, 40545, 40546, 40549, 40558, 40559, 40562, 40564, 40565, 40566,
- 40567, 40568, 40569, 40570, 40571, 40572, 40573, 40576, 40577, 40579, 40580, 40581, 40582, 40585, 40586,
- 40588, 40589, 40590, 40591, 40592, 40593, 40596, 40597, 40598, 40599, 40600, 40601, 40602, 40603, 40604,
- 40606, 40608, 40609, 40610, 40611, 40612, 40613, 40615, 40616, 40617, 40618, 58190, 58191, 58192, 58193,
- 58194, 58195, 58196, 58197, 58198, 58199, 58200, 58201, 58202, 58203, 58204, 58205, 58206, 58207, 58208,
- 58209, 58210, 58211, 58212, 58213, 58214, 58215, 58216, 58217, 58218, 58219, 58220, 58221, 58222, 58223,
- 58224, 58225, 58226, 58227, 58228, 58229, 58230, 58231, 58232, 58233, 58234, 58235, 58236, 58237, 58238,
- 58239, 58240, 58241, 58242, 58243, 58244, 58245, 58246, 58247, 58248, 58249, 58250, 58251, 58252, 58253,
- 58254, 58255, 58256, 58257, 58258, 58259, 58260, 58261, 58262, 58263, 58264, 58265, 58266, 58267, 58268,
- 58269, 58270, 58271, 58272, 58273, 58274, 58275, 58276, 58277, 58278, 58279, 58280, 58281, 58282, 58283,
- 40619, 40620, 40621, 40622, 40623, 40624, 40625, 40626, 40627, 40629, 40630, 40631, 40633, 40634, 40636,
- 40639, 40640, 40641, 40642, 40643, 40645, 40646, 40647, 40648, 40650, 40651, 40652, 40656, 40658, 40659,
- 40661, 40662, 40663, 40665, 40666, 40670, 40673, 40675, 40676, 40678, 40680, 40683, 40684, 40685, 40686,
- 40688, 40689, 40690, 40691, 40692, 40693, 40694, 40695, 40696, 40698, 40701, 40703, 40704, 40705, 40706,
- 40707, 40708, 40709, 40710, 40711, 40712, 40713, 40714, 40716, 40719, 40721, 40722, 40724, 40725, 40726,
- 40728, 40730, 40731, 40732, 40733, 40734, 40735, 40737, 40739, 40740, 40741, 40742, 40743, 40744, 40745,
- 40746, 40747, 40749, 40750, 40752, 40753, 58284, 58285, 58286, 58287, 58288, 58289, 58290, 58291, 58292,
- 58293, 58294, 58295, 58296, 58297, 58298, 58299, 58300, 58301, 58302, 58303, 58304, 58305, 58306, 58307,
- 58308, 58309, 58310, 58311, 58312, 58313, 58314, 58315, 58316, 58317, 58318, 58319, 58320, 58321, 58322,
- 58323, 58324, 58325, 58326, 58327, 58328, 58329, 58330, 58331, 58332, 58333, 58334, 58335, 58336, 58337,
- 58338, 58339, 58340, 58341, 58342, 58343, 58344, 58345, 58346, 58347, 58348, 58349, 58350, 58351, 58352,
- 58353, 58354, 58355, 58356, 58357, 58358, 58359, 58360, 58361, 58362, 58363, 58364, 58365, 58366, 58367,
- 58368, 58369, 58370, 58371, 58372, 58373, 58374, 58375, 58376, 58377, 40754, 40755, 40756, 40757, 40758,
- 40760, 40762, 40764, 40767, 40768, 40769, 40770, 40771, 40773, 40774, 40775, 40776, 40777, 40778, 40779,
- 40780, 40781, 40782, 40783, 40786, 40787, 40788, 40789, 40790, 40791, 40792, 40793, 40794, 40795, 40796,
- 40797, 40798, 40799, 40800, 40801, 40802, 40803, 40804, 40805, 40806, 40807, 40808, 40809, 40810, 40811,
- 40812, 40813, 40814, 40815, 40816, 40817, 40818, 40819, 40820, 40821, 40822, 40823, 40824, 40825, 40826,
- 40827, 40828, 40829, 40830, 40833, 40834, 40845, 40846, 40847, 40848, 40849, 40850, 40851, 40852, 40853,
- 40854, 40855, 40856, 40860, 40861, 40862, 40865, 40866, 40867, 40868, 40869, 63788, 63865, 63893, 63975,
- 63985, 58378, 58379, 58380, 58381, 58382, 58383, 58384, 58385, 58386, 58387, 58388, 58389, 58390, 58391,
- 58392, 58393, 58394, 58395, 58396, 58397, 58398, 58399, 58400, 58401, 58402, 58403, 58404, 58405, 58406,
- 58407, 58408, 58409, 58410, 58411, 58412, 58413, 58414, 58415, 58416, 58417, 58418, 58419, 58420, 58421,
- 58422, 58423, 58424, 58425, 58426, 58427, 58428, 58429, 58430, 58431, 58432, 58433, 58434, 58435, 58436,
- 58437, 58438, 58439, 58440, 58441, 58442, 58443, 58444, 58445, 58446, 58447, 58448, 58449, 58450, 58451,
- 58452, 58453, 58454, 58455, 58456, 58457, 58458, 58459, 58460, 58461, 58462, 58463, 58464, 58465, 58466,
- 58467, 58468, 58469, 58470, 58471, 64012, 64013, 64014, 64015, 64017, 64019, 64020, 64024, 64031, 64032,
- 64033, 64035, 64036, 64039, 64040, 64041, 11905, 59414, 59415, 59416, 11908, 13427, 13383, 11912, 11915,
- 59422, 13726, 13850, 13838, 11916, 11927, 14702, 14616, 59430, 14799, 14815, 14963, 14800, 59435, 59436,
- 15182, 15470, 15584, 11943, 59441, 59442, 11946, 16470, 16735, 11950, 17207, 11955, 11958, 11959, 59451,
- 17329, 17324, 11963, 17373, 17622, 18017, 17996, 59459, 18211, 18217, 18300, 18317, 11978, 18759, 18810,
- 18813, 18818, 18819, 18821, 18822, 18847, 18843, 18871, 18870, 59476, 59477, 19619, 19615, 19616, 19617,
- 19575, 19618, 19731, 19732, 19733, 19734, 19735, 19736, 19737, 19886, 59492, 58472, 58473, 58474, 58475,
- 58476, 58477, 58478, 58479, 58480, 58481, 58482, 58483, 58484, 58485, 58486, 58487, 58488, 58489, 58490,
- 58491, 58492, 58493, 58494, 58495, 58496, 58497, 58498, 58499, 58500, 58501, 58502, 58503, 58504, 58505,
- 58506, 58507, 58508, 58509, 58510, 58511, 58512, 58513, 58514, 58515, 58516, 58517, 58518, 58519, 58520,
- 58521, 58522, 58523, 58524, 58525, 58526, 58527, 58528, 58529, 58530, 58531, 58532, 58533, 58534, 58535,
- 58536, 58537, 58538, 58539, 58540, 58541, 58542, 58543, 58544, 58545, 58546, 58547, 58548, 58549, 58550,
- 58551, 58552, 58553, 58554, 58555, 58556, 58557, 58558, 58559, 58560, 58561, 58562, 58563, 58564, 58565,
- ]);
-
- for (const [key, index] of encodingIndexes) {
- if (["gb18030", "big5"].includes(key)) {
- continue;
- }
- decoders.set(key, (options) => {
- return new SingleByteDecoder(index, options);
- });
- }
-
- function codePointsToString(codePoints) {
- let s = "";
- for (const cp of codePoints) {
- s += String.fromCodePoint(cp);
- }
- return s;
- }
-
- class Stream {
- #tokens = [];
- constructor(tokens) {
- this.#tokens = [...tokens];
- this.#tokens.reverse();
- }
-
- endOfStream() {
- return !this.#tokens.length;
- }
-
- read() {
- return !this.#tokens.length ? END_OF_STREAM : this.#tokens.pop();
- }
-
- prepend(token) {
- if (Array.isArray(token)) {
- while (token.length) {
- this.#tokens.push(token.pop());
- }
- } else {
- this.#tokens.push(token);
- }
- }
-
- push(token) {
- if (Array.isArray(token)) {
- while (token.length) {
- this.#tokens.unshift(token.shift());
- }
- } else {
- this.#tokens.unshift(token);
- }
- }
- }
-
- function isEitherArrayBuffer(x) {
- return (
- x instanceof SharedArrayBuffer ||
- x instanceof ArrayBuffer ||
- typeof x === "undefined"
- );
- }
-
- const whitespace = [" ", "\t", "\n", "\f", "\r"];
- function trimAsciiWhitespace(label) {
- let start = 0;
- for (const i in label) {
- if (!whitespace.includes(label[i])) {
- start = i;
- break;
- }
- }
- let end = label.length - 1;
- for (const _i in label) {
- const i = end - _i;
- if (!whitespace.includes(label[i])) {
- end = i;
- break;
- }
- }
- return label.substring(start, end + 1);
- }
-
- class TextDecoder {
- #encoding = "";
-
- get encoding() {
- return this.#encoding;
- }
- fatal = false;
- ignoreBOM = false;
-
- constructor(label = "utf-8", options = { fatal: false }) {
- if (options.ignoreBOM) {
- this.ignoreBOM = true;
- }
- if (options.fatal) {
- this.fatal = true;
- }
- const _label = trimAsciiWhitespace(String(label)).toLowerCase();
- const encoding = encodings.get(_label);
- if (!encoding) {
- throw new RangeError(
- `The encoding label provided ('${label}') is invalid.`,
- );
- }
- if (
- !decoders.has(encoding) &&
- !["utf-16le", "utf-16be", "utf-8", "big5", "gbk", "gb18030"].includes(
- encoding,
- )
- ) {
- throw new RangeError(`Internal decoder ('${encoding}') not found.`);
- }
- this.#encoding = encoding;
- }
-
- decode(input, options = { stream: false }) {
- if (options.stream) {
- throw new TypeError("Stream not supported.");
- }
-
- let bytes;
- if (input instanceof Uint8Array) {
- bytes = input;
- } else if (isEitherArrayBuffer(input)) {
- bytes = new Uint8Array(input);
- } else if (
- typeof input === "object" &&
- input !== null &&
- "buffer" in input &&
- isEitherArrayBuffer(input.buffer)
- ) {
- bytes = new Uint8Array(
- input.buffer,
- input.byteOffset,
- input.byteLength,
- );
- } else {
- throw new TypeError(
- "Provided input is not of type ArrayBuffer or ArrayBufferView",
- );
- }
-
- // For simple utf-8 decoding "Deno.core.decode" can be used for performance
- if (
- this.#encoding === "utf-8" &&
- this.fatal === false &&
- this.ignoreBOM === false
- ) {
- return core.decode(bytes);
- }
-
- // For performance reasons we utilise a highly optimised decoder instead of
- // the general decoder.
- if (this.#encoding === "utf-8") {
- return decodeUtf8(bytes, this.fatal, this.ignoreBOM);
- }
-
- if (this.#encoding === "utf-16le" || this.#encoding === "utf-16be") {
- const result = Utf16ByteDecoder(
- bytes,
- this.#encoding.endsWith("be"),
- this.fatal,
- this.ignoreBOM,
- );
- return String.fromCharCode.apply(null, result);
- }
-
- if (this.#encoding === "big5") {
- const result = Big5Decoder(
- encodingIndexes.get("big5"),
- bytes,
- this.fatal,
- this.ignoreBOM,
- );
- return String.fromCharCode.apply(null, result);
- }
-
- if (this.#encoding === "gbk" || this.#encoding === "gb18030") {
- const result = gb18030Decoder(
- encodingIndexes.get("gb18030"),
- bytes,
- this.fatal,
- this.ignoreBOM,
- );
- return String.fromCodePoint.apply(null, result);
- }
-
- const decoder = decoders.get(this.#encoding)({
- fatal: this.fatal,
- ignoreBOM: this.ignoreBOM,
- });
- const inputStream = new Stream(bytes);
- const output = [];
-
- while (true) {
- const result = decoder.handler(inputStream, inputStream.read());
- if (result === FINISHED) {
- break;
- }
-
- if (result !== CONTINUE) {
- output.push(result);
- }
- }
-
- if (output.length > 0 && output[0] === 0xfeff) {
- output.shift();
- }
-
- return codePointsToString(output);
- }
-
- get [Symbol.toStringTag]() {
- return "TextDecoder";
- }
- }
-
- class TextEncoder {
- encoding = "utf-8";
- encode(input = "") {
- // Deno.core.encode() provides very efficient utf-8 encoding
- return core.encode(String(input));
- }
- encodeInto(input, dest) {
- if (!(dest instanceof Uint8Array)) {
- throw new TypeError(
- "2nd argument to TextEncoder.encodeInto must be Uint8Array",
- );
- }
- if (dest.byteLength === 0) {
- return { read: 0, written: 0 };
- }
- const encoder = new UTF8Encoder();
- const inputStream = new Stream(stringToCodePoints(input));
-
- let written = 0;
- let read = 0;
- while (true) {
- const item = inputStream.read();
- const result = encoder.handler(item);
- if (result === "finished") {
- break;
- }
- if (dest.length - written >= result.length) {
- read++;
- if (item > 0xFFFF) {
- // increment read a second time if greater than U+FFFF
- read++;
- }
- dest.set(result, written);
- written += result.length;
- } else {
- break;
- }
- }
-
- return {
- read,
- written,
- };
- }
- get [Symbol.toStringTag]() {
- return "TextEncoder";
- }
- }
-
- // This function is based on Bjoern Hoehrmann's DFA UTF-8 decoder.
- // See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details.
- //
- // Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>
- //
- // 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.
- function decodeUtf8(input, fatal, ignoreBOM) {
- let outString = "";
-
- // Prepare a buffer so that we don't have to do a lot of string concats, which
- // are very slow.
- const outBufferLength = Math.min(1024, input.length);
- const outBuffer = new Uint16Array(outBufferLength);
- let outIndex = 0;
-
- let state = 0;
- let codepoint = 0;
- let type;
-
- let i =
- !ignoreBOM && input[0] === 0xef && input[1] === 0xbb && input[2] === 0xbf
- ? 3
- : 0;
-
- for (; i < input.length; ++i) {
- // Encoding error handling
- if (state === 12 || (state !== 0 && (input[i] & 0xc0) !== 0x80)) {
- if (fatal) {
- throw new TypeError(
- `Decoder error. Invalid byte in sequence at position ${i} in data.`,
- );
- }
- outBuffer[outIndex++] = 0xfffd; // Replacement character
- if (outIndex === outBufferLength) {
- outString += String.fromCharCode.apply(null, outBuffer);
- outIndex = 0;
- }
- state = 0;
- }
-
- // deno-fmt-ignore
- // deno-fmt-ignore
- type = [
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
- 10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3, 11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8
- ][input[i]];
- codepoint = state !== 0
- ? (input[i] & 0x3f) | (codepoint << 6)
- : (0xff >> type) & input[i];
- // deno-fmt-ignore
- // deno-fmt-ignore
- state = [
- 0,12,24,36,60,96,84,12,12,12,48,72, 12,12,12,12,12,12,12,12,12,12,12,12,
- 12, 0,12,12,12,12,12, 0,12, 0,12,12, 12,24,12,12,12,12,12,24,12,24,12,12,
- 12,12,12,12,12,12,12,24,12,12,12,12, 12,24,12,12,12,12,12,12,12,24,12,12,
- 12,12,12,12,12,12,12,36,12,36,12,12, 12,36,12,12,12,12,12,36,12,36,12,12,
- 12,36,12,12,12,12,12,12,12,12,12,12
- ][state + type];
-
- if (state !== 0) continue;
-
- // Add codepoint to buffer (as charcodes for utf-16), and flush buffer to
- // string if needed.
- if (codepoint > 0xffff) {
- outBuffer[outIndex++] = 0xd7c0 + (codepoint >> 10);
- if (outIndex === outBufferLength) {
- outString += String.fromCharCode.apply(null, outBuffer);
- outIndex = 0;
- }
- outBuffer[outIndex++] = 0xdc00 | (codepoint & 0x3ff);
- if (outIndex === outBufferLength) {
- outString += String.fromCharCode.apply(null, outBuffer);
- outIndex = 0;
- }
- } else {
- outBuffer[outIndex++] = codepoint;
- if (outIndex === outBufferLength) {
- outString += String.fromCharCode.apply(null, outBuffer);
- outIndex = 0;
- }
- }
- }
-
- // Add a replacement character if we ended in the middle of a sequence or
- // encountered an invalid code at the end.
- if (state !== 0) {
- if (fatal) throw new TypeError(`Decoder error. Unexpected end of data.`);
- outBuffer[outIndex++] = 0xfffd; // Replacement character
- }
-
- // Final flush of buffer
- outString += String.fromCharCode.apply(
- null,
- outBuffer.subarray(0, outIndex),
- );
-
- return outString;
- }
-
- // Following code is forked from https://github.com/beatgammit/base64-js
- // Copyright (c) 2014 Jameson Little. MIT License.
- const lookup = [];
- const revLookup = [];
-
- const code =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- for (let i = 0, len = code.length; i < len; ++i) {
- lookup[i] = code[i];
- revLookup[code.charCodeAt(i)] = i;
- }
-
- // Support decoding URL-safe base64 strings, as Node.js does.
- // See: https://en.wikipedia.org/wiki/Base64#URL_applications
- revLookup["-".charCodeAt(0)] = 62;
- revLookup["_".charCodeAt(0)] = 63;
-
- function getLens(b64) {
- const len = b64.length;
-
- if (len % 4 > 0) {
- throw new Error("Invalid string. Length must be a multiple of 4");
- }
-
- // Trim off extra bytes after placeholder bytes are found
- // See: https://github.com/beatgammit/base64-js/issues/42
- let validLen = b64.indexOf("=");
- if (validLen === -1) validLen = len;
-
- const placeHoldersLen = validLen === len ? 0 : 4 - (validLen % 4);
-
- return [validLen, placeHoldersLen];
- }
-
- // base64 is 4/3 + up to two characters of the original data
- function byteLength(b64) {
- const lens = getLens(b64);
- const validLen = lens[0];
- const placeHoldersLen = lens[1];
- return ((validLen + placeHoldersLen) * 3) / 4 - placeHoldersLen;
- }
-
- function _byteLength(b64, validLen, placeHoldersLen) {
- return ((validLen + placeHoldersLen) * 3) / 4 - placeHoldersLen;
- }
-
- function toByteArray(b64) {
- let tmp;
- const lens = getLens(b64);
- const validLen = lens[0];
- const placeHoldersLen = lens[1];
-
- const arr = new Uint8Array(_byteLength(b64, validLen, placeHoldersLen));
-
- let curByte = 0;
-
- // if there are placeholders, only get up to the last complete 4 chars
- const len = placeHoldersLen > 0 ? validLen - 4 : validLen;
-
- let i;
- for (i = 0; i < len; i += 4) {
- tmp = (revLookup[b64.charCodeAt(i)] << 18) |
- (revLookup[b64.charCodeAt(i + 1)] << 12) |
- (revLookup[b64.charCodeAt(i + 2)] << 6) |
- revLookup[b64.charCodeAt(i + 3)];
- arr[curByte++] = (tmp >> 16) & 0xff;
- arr[curByte++] = (tmp >> 8) & 0xff;
- arr[curByte++] = tmp & 0xff;
- }
-
- if (placeHoldersLen === 2) {
- tmp = (revLookup[b64.charCodeAt(i)] << 2) |
- (revLookup[b64.charCodeAt(i + 1)] >> 4);
- arr[curByte++] = tmp & 0xff;
- }
-
- if (placeHoldersLen === 1) {
- tmp = (revLookup[b64.charCodeAt(i)] << 10) |
- (revLookup[b64.charCodeAt(i + 1)] << 4) |
- (revLookup[b64.charCodeAt(i + 2)] >> 2);
- arr[curByte++] = (tmp >> 8) & 0xff;
- arr[curByte++] = tmp & 0xff;
- }
-
- return arr;
- }
-
- function tripletToBase64(num) {
- return (
- lookup[(num >> 18) & 0x3f] +
- lookup[(num >> 12) & 0x3f] +
- lookup[(num >> 6) & 0x3f] +
- lookup[num & 0x3f]
- );
- }
-
- function encodeChunk(uint8, start, end) {
- let tmp;
- const output = [];
- for (let i = start; i < end; i += 3) {
- tmp = ((uint8[i] << 16) & 0xff0000) +
- ((uint8[i + 1] << 8) & 0xff00) +
- (uint8[i + 2] & 0xff);
- output.push(tripletToBase64(tmp));
- }
- return output.join("");
- }
-
- function fromByteArray(uint8) {
- let tmp;
- const len = uint8.length;
- const extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
- const parts = [];
- const maxChunkLength = 16383; // must be multiple of 3
-
- // go through the array every three bytes, we'll deal with trailing stuff later
- for (let i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
- parts.push(
- encodeChunk(
- uint8,
- i,
- i + maxChunkLength > len2 ? len2 : i + maxChunkLength,
- ),
- );
- }
-
- // pad the end with zeros, but make sure to not forget the extra bytes
- if (extraBytes === 1) {
- tmp = uint8[len - 1];
- parts.push(lookup[tmp >> 2] + lookup[(tmp << 4) & 0x3f] + "==");
- } else if (extraBytes === 2) {
- tmp = (uint8[len - 2] << 8) + uint8[len - 1];
- parts.push(
- lookup[tmp >> 10] +
- lookup[(tmp >> 4) & 0x3f] +
- lookup[(tmp << 2) & 0x3f] +
- "=",
- );
- }
-
- return parts.join("");
- }
-
- const base64 = {
- byteLength,
- toByteArray,
- fromByteArray,
- };
-
- /**
- * @param {Uint8Array} bytes
- */
- function decode(bytes, encoding) {
- const BOMEncoding = BOMSniff(bytes);
- let start = 0;
- if (BOMEncoding !== null) {
- encoding = BOMEncoding;
- if (BOMEncoding === "UTF-8") start = 3;
- else start = 2;
- }
- return new TextDecoder(encoding).decode(bytes.slice(start));
- }
-
- /**
- * @param {Uint8Array} bytes
- */
- function BOMSniff(bytes) {
- const BOM = bytes.subarray(0, 3);
- if (BOM[0] === 0xEF && BOM[1] === 0xBB && BOM[2] === 0xBF) {
- return "UTF-8";
- }
- if (BOM[0] === 0xFE && BOM[1] === 0xFF) return "UTF-16BE";
- if (BOM[0] === 0xFF && BOM[1] === 0xFE) return "UTF-16LE";
- return null;
- }
-
- window.TextEncoder = TextEncoder;
- window.TextDecoder = TextDecoder;
- window.atob = atob;
- window.btoa = btoa;
- window.__bootstrap.encoding = { decode };
- window.__bootstrap.base64 = base64;
-})(this);
diff --git a/op_crates/web/12_location.js b/op_crates/web/12_location.js
deleted file mode 100644
index 2b6580f8b..000000000
--- a/op_crates/web/12_location.js
+++ /dev/null
@@ -1,393 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-"use strict";
-
-((window) => {
- const { URL } = window.__bootstrap.url;
- const locationConstructorKey = Symbol("locationConstuctorKey");
-
- // The differences between the definitions of `Location` and `WorkerLocation`
- // are because of the `LegacyUnforgeable` attribute only specified upon
- // `Location`'s properties. See:
- // - https://html.spec.whatwg.org/multipage/history.html#the-location-interface
- // - https://heycam.github.io/webidl/#LegacyUnforgeable
- class Location {
- constructor(href = null, key = null) {
- if (key != locationConstructorKey) {
- throw new TypeError("Illegal constructor.");
- }
- const url = new URL(href);
- url.username = "";
- url.password = "";
- Object.defineProperties(this, {
- hash: {
- get() {
- return url.hash;
- },
- set() {
- throw new DOMException(
- `Cannot set "location.hash".`,
- "NotSupportedError",
- );
- },
- enumerable: true,
- },
- host: {
- get() {
- return url.host;
- },
- set() {
- throw new DOMException(
- `Cannot set "location.host".`,
- "NotSupportedError",
- );
- },
- enumerable: true,
- },
- hostname: {
- get() {
- return url.hostname;
- },
- set() {
- throw new DOMException(
- `Cannot set "location.hostname".`,
- "NotSupportedError",
- );
- },
- enumerable: true,
- },
- href: {
- get() {
- return url.href;
- },
- set() {
- throw new DOMException(
- `Cannot set "location.href".`,
- "NotSupportedError",
- );
- },
- enumerable: true,
- },
- origin: {
- get() {
- return url.origin;
- },
- enumerable: true,
- },
- pathname: {
- get() {
- return url.pathname;
- },
- set() {
- throw new DOMException(
- `Cannot set "location.pathname".`,
- "NotSupportedError",
- );
- },
- enumerable: true,
- },
- port: {
- get() {
- return url.port;
- },
- set() {
- throw new DOMException(
- `Cannot set "location.port".`,
- "NotSupportedError",
- );
- },
- enumerable: true,
- },
- protocol: {
- get() {
- return url.protocol;
- },
- set() {
- throw new DOMException(
- `Cannot set "location.protocol".`,
- "NotSupportedError",
- );
- },
- enumerable: true,
- },
- search: {
- get() {
- return url.search;
- },
- set() {
- throw new DOMException(
- `Cannot set "location.search".`,
- "NotSupportedError",
- );
- },
- enumerable: true,
- },
- ancestorOrigins: {
- get() {
- // TODO(nayeemrmn): Replace with a `DOMStringList` instance.
- return {
- length: 0,
- item: () => null,
- contains: () => false,
- };
- },
- enumerable: true,
- },
- assign: {
- value: function assign() {
- throw new DOMException(
- `Cannot call "location.assign()".`,
- "NotSupportedError",
- );
- },
- enumerable: true,
- },
- reload: {
- value: function reload() {
- throw new DOMException(
- `Cannot call "location.reload()".`,
- "NotSupportedError",
- );
- },
- enumerable: true,
- },
- replace: {
- value: function replace() {
- throw new DOMException(
- `Cannot call "location.replace()".`,
- "NotSupportedError",
- );
- },
- enumerable: true,
- },
- toString: {
- value: function toString() {
- return url.href;
- },
- enumerable: true,
- },
- [Symbol.for("Deno.customInspect")]: {
- value: function (inspect) {
- const object = {
- hash: this.hash,
- host: this.host,
- hostname: this.hostname,
- href: this.href,
- origin: this.origin,
- pathname: this.pathname,
- port: this.port,
- protocol: this.protocol,
- search: this.search,
- };
- return `${this.constructor.name} ${inspect(object)}`;
- },
- },
- });
- }
- }
-
- Object.defineProperties(Location.prototype, {
- [Symbol.toStringTag]: {
- value: "Location",
- configurable: true,
- },
- });
-
- const workerLocationUrls = new WeakMap();
-
- class WorkerLocation {
- constructor(href = null, key = null) {
- if (key != locationConstructorKey) {
- throw new TypeError("Illegal constructor.");
- }
- const url = new URL(href);
- url.username = "";
- url.password = "";
- workerLocationUrls.set(this, url);
- }
- }
-
- Object.defineProperties(WorkerLocation.prototype, {
- hash: {
- get() {
- const url = workerLocationUrls.get(this);
- if (url == null) {
- throw new TypeError("Illegal invocation.");
- }
- return url.hash;
- },
- configurable: true,
- enumerable: true,
- },
- host: {
- get() {
- const url = workerLocationUrls.get(this);
- if (url == null) {
- throw new TypeError("Illegal invocation.");
- }
- return url.host;
- },
- configurable: true,
- enumerable: true,
- },
- hostname: {
- get() {
- const url = workerLocationUrls.get(this);
- if (url == null) {
- throw new TypeError("Illegal invocation.");
- }
- return url.hostname;
- },
- configurable: true,
- enumerable: true,
- },
- href: {
- get() {
- const url = workerLocationUrls.get(this);
- if (url == null) {
- throw new TypeError("Illegal invocation.");
- }
- return url.href;
- },
- configurable: true,
- enumerable: true,
- },
- origin: {
- get() {
- const url = workerLocationUrls.get(this);
- if (url == null) {
- throw new TypeError("Illegal invocation.");
- }
- return url.origin;
- },
- configurable: true,
- enumerable: true,
- },
- pathname: {
- get() {
- const url = workerLocationUrls.get(this);
- if (url == null) {
- throw new TypeError("Illegal invocation.");
- }
- return url.pathname;
- },
- configurable: true,
- enumerable: true,
- },
- port: {
- get() {
- const url = workerLocationUrls.get(this);
- if (url == null) {
- throw new TypeError("Illegal invocation.");
- }
- return url.port;
- },
- configurable: true,
- enumerable: true,
- },
- protocol: {
- get() {
- const url = workerLocationUrls.get(this);
- if (url == null) {
- throw new TypeError("Illegal invocation.");
- }
- return url.protocol;
- },
- configurable: true,
- enumerable: true,
- },
- search: {
- get() {
- const url = workerLocationUrls.get(this);
- if (url == null) {
- throw new TypeError("Illegal invocation.");
- }
- return url.search;
- },
- configurable: true,
- enumerable: true,
- },
- toString: {
- value: function toString() {
- const url = workerLocationUrls.get(this);
- if (url == null) {
- throw new TypeError("Illegal invocation.");
- }
- return url.href;
- },
- configurable: true,
- enumerable: true,
- writable: true,
- },
- [Symbol.toStringTag]: {
- value: "WorkerLocation",
- configurable: true,
- },
- [Symbol.for("Deno.customInspect")]: {
- value: function (inspect) {
- const object = {
- hash: this.hash,
- host: this.host,
- hostname: this.hostname,
- href: this.href,
- origin: this.origin,
- pathname: this.pathname,
- port: this.port,
- protocol: this.protocol,
- search: this.search,
- };
- return `${this.constructor.name} ${inspect(object)}`;
- },
- },
- });
-
- let location = null;
- let workerLocation = null;
-
- function setLocationHref(href) {
- location = new Location(href, locationConstructorKey);
- workerLocation = new WorkerLocation(href, locationConstructorKey);
- }
-
- window.__bootstrap.location = {
- locationConstructorDescriptor: {
- value: Location,
- configurable: true,
- writable: true,
- },
- workerLocationConstructorDescriptor: {
- value: WorkerLocation,
- configurable: true,
- writable: true,
- },
- locationDescriptor: {
- get() {
- if (location == null) {
- throw new ReferenceError(
- `Access to "location", run again with --location <href>.`,
- );
- }
- return location;
- },
- set() {
- throw new DOMException(`Cannot set "location".`, "NotSupportedError");
- },
- enumerable: true,
- },
- workerLocationDescriptor: {
- get() {
- if (workerLocation == null) {
- throw new Error(
- `Assertion: "globalThis.location" must be defined in a worker.`,
- );
- }
- return workerLocation;
- },
- configurable: true,
- enumerable: true,
- },
- setLocationHref,
- getLocationHref() {
- return location?.href;
- },
- };
-})(this);
diff --git a/op_crates/web/Cargo.toml b/op_crates/web/Cargo.toml
deleted file mode 100644
index 5608fadbd..000000000
--- a/op_crates/web/Cargo.toml
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-[package]
-name = "deno_web"
-version = "0.35.0"
-edition = "2018"
-description = "Collection of Web APIs"
-authors = ["the Deno authors"]
-license = "MIT"
-readme = "README.md"
-repository = "https://github.com/denoland/deno"
-
-[lib]
-path = "lib.rs"
-
-[dependencies]
-deno_core = { version = "0.86.0", path = "../../core" }
-
-[dev-dependencies]
-futures = "0.3.13"
diff --git a/op_crates/web/README.md b/op_crates/web/README.md
deleted file mode 100644
index 03c1b7f89..000000000
--- a/op_crates/web/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# deno web
-
-Op crate that implements Event, TextEncoder, TextDecoder.
-
-Testing for text encoding is done via WPT in cli/.
diff --git a/op_crates/web/internal.d.ts b/op_crates/web/internal.d.ts
deleted file mode 100644
index bfce3e1e1..000000000
--- a/op_crates/web/internal.d.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-/// <reference no-default-lib="true" />
-/// <reference lib="esnext" />
-
-declare namespace globalThis {
- declare var TextEncoder: typeof TextEncoder;
- declare var TextDecoder: typeof TextDecoder;
-
- declare namespace __bootstrap {
- declare var infra: {
- collectSequenceOfCodepoints(
- input: string,
- position: number,
- condition: (char: string) => boolean,
- ): {
- result: string;
- position: number;
- };
- ASCII_DIGIT: string[];
- ASCII_UPPER_ALPHA: string[];
- ASCII_LOWER_ALPHA: string[];
- ASCII_ALPHA: string[];
- ASCII_ALPHANUMERIC: string[];
- HTTP_TAB_OR_SPACE: string[];
- HTTP_WHITESPACE: string[];
- HTTP_TOKEN_CODE_POINT: string[];
- HTTP_TOKEN_CODE_POINT_RE: RegExp;
- HTTP_QUOTED_STRING_TOKEN_POINT: string[];
- HTTP_QUOTED_STRING_TOKEN_POINT_RE: RegExp;
- HTTP_TAB_OR_SPACE_PREFIX_RE: RegExp;
- HTTP_TAB_OR_SPACE_SUFFIX_RE: RegExp;
- HTTP_WHITESPACE_PREFIX_RE: RegExp;
- HTTP_WHITESPACE_SUFFIX_RE: RegExp;
- regexMatcher(chars: string[]): string;
- byteUpperCase(s: string): string;
- byteLowerCase(s: string): string;
- collectHttpQuotedString(
- input: string,
- position: number,
- extractValue: boolean,
- ): {
- result: string;
- position: number;
- };
- };
-
- declare namespace mimesniff {
- declare interface MimeType {
- type: string;
- subtype: string;
- parameters: Map<string, string>;
- }
- declare function parseMimeType(input: string): MimeType | null;
- declare function essence(mimeType: MimeType): string;
- declare function serializeMimeType(mimeType: MimeType): string;
- }
-
- declare var eventTarget: {
- EventTarget: typeof EventTarget;
- };
-
- declare var location: {
- getLocationHref(): string | undefined;
- };
-
- declare var base64: {
- byteLength(b64: string): number;
- toByteArray(b64: string): Uint8Array;
- fromByteArray(uint8: Uint8Array): string;
- };
- }
-}
diff --git a/op_crates/web/lib.deno_web.d.ts b/op_crates/web/lib.deno_web.d.ts
deleted file mode 100644
index 0fce6ce6b..000000000
--- a/op_crates/web/lib.deno_web.d.ts
+++ /dev/null
@@ -1,314 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// deno-lint-ignore-file no-explicit-any
-
-/// <reference no-default-lib="true" />
-/// <reference lib="esnext" />
-
-declare class DOMException extends Error {
- constructor(message?: string, name?: string);
- readonly name: string;
- readonly message: string;
- readonly code: number;
-}
-
-interface EventInit {
- bubbles?: boolean;
- cancelable?: boolean;
- composed?: boolean;
-}
-
-/** An event which takes place in the DOM. */
-declare class Event {
- constructor(type: string, eventInitDict?: EventInit);
- /** Returns true or false depending on how event was initialized. True if
- * event goes through its target's ancestors in reverse tree order, and
- * false otherwise. */
- readonly bubbles: boolean;
- cancelBubble: boolean;
- /** Returns true or false depending on how event was initialized. Its return
- * value does not always carry meaning, but true can indicate that part of the
- * operation during which event was dispatched, can be canceled by invoking
- * the preventDefault() method. */
- readonly cancelable: boolean;
- /** Returns true or false depending on how event was initialized. True if
- * event invokes listeners past a ShadowRoot node that is the root of its
- * target, and false otherwise. */
- readonly composed: boolean;
- /** Returns the object whose event listener's callback is currently being
- * invoked. */
- readonly currentTarget: EventTarget | null;
- /** Returns true if preventDefault() was invoked successfully to indicate
- * cancellation, and false otherwise. */
- readonly defaultPrevented: boolean;
- /** Returns the event's phase, which is one of NONE, CAPTURING_PHASE,
- * AT_TARGET, and BUBBLING_PHASE. */
- readonly eventPhase: number;
- /** Returns true if event was dispatched by the user agent, and false
- * otherwise. */
- readonly isTrusted: boolean;
- /** Returns the object to which event is dispatched (its target). */
- readonly target: EventTarget | null;
- /** Returns the event's timestamp as the number of milliseconds measured
- * relative to the time origin. */
- readonly timeStamp: number;
- /** Returns the type of event, e.g. "click", "hashchange", or "submit". */
- readonly type: string;
- /** Returns the invocation target objects of event's path (objects on which
- * listeners will be invoked), except for any nodes in shadow trees of which
- * the shadow root's mode is "closed" that are not reachable from event's
- * currentTarget. */
- composedPath(): EventTarget[];
- /** If invoked when the cancelable attribute value is true, and while
- * executing a listener for the event with passive set to false, signals to
- * the operation that caused event to be dispatched that it needs to be
- * canceled. */
- preventDefault(): void;
- /** Invoking this method prevents event from reaching any registered event
- * listeners after the current one finishes running and, when dispatched in a
- * tree, also prevents event from reaching any other objects. */
- stopImmediatePropagation(): void;
- /** When dispatched in a tree, invoking this method prevents event from
- * reaching any objects other than the current object. */
- stopPropagation(): void;
- readonly AT_TARGET: number;
- readonly BUBBLING_PHASE: number;
- readonly CAPTURING_PHASE: number;
- readonly NONE: number;
- static readonly AT_TARGET: number;
- static readonly BUBBLING_PHASE: number;
- static readonly CAPTURING_PHASE: number;
- static readonly NONE: number;
-}
-
-/**
- * EventTarget is a DOM interface implemented by objects that can receive events
- * and may have listeners for them.
- */
-declare class EventTarget {
- /** Appends an event listener for events whose type attribute value is type.
- * The callback argument sets the callback that will be invoked when the event
- * is dispatched.
- *
- * The options argument sets listener-specific options. For compatibility this
- * can be a boolean, in which case the method behaves exactly as if the value
- * was specified as options's capture.
- *
- * When set to true, options's capture prevents callback from being invoked
- * when the event's eventPhase attribute value is BUBBLING_PHASE. When false
- * (or not present), callback will not be invoked when event's eventPhase
- * attribute value is CAPTURING_PHASE. Either way, callback will be invoked if
- * event's eventPhase attribute value is AT_TARGET.
- *
- * When set to true, options's passive indicates that the callback will not
- * cancel the event by invoking preventDefault(). This is used to enable
- * performance optimizations described in § 2.8 Observing event listeners.
- *
- * When set to true, options's once indicates that the callback will only be
- * invoked once after which the event listener will be removed.
- *
- * The event listener is appended to target's event listener list and is not
- * appended if it has the same type, callback, and capture. */
- addEventListener(
- type: string,
- listener: EventListenerOrEventListenerObject | null,
- options?: boolean | AddEventListenerOptions,
- ): void;
- /** Dispatches a synthetic event event to target and returns true if either
- * event's cancelable attribute value is false or its preventDefault() method
- * was not invoked, and false otherwise. */
- dispatchEvent(event: Event): boolean;
- /** Removes the event listener in target's event listener list with the same
- * type, callback, and options. */
- removeEventListener(
- type: string,
- callback: EventListenerOrEventListenerObject | null,
- options?: EventListenerOptions | boolean,
- ): void;
-}
-
-interface EventListener {
- (evt: Event): void | Promise<void>;
-}
-
-interface EventListenerObject {
- handleEvent(evt: Event): void | Promise<void>;
-}
-
-declare type EventListenerOrEventListenerObject =
- | EventListener
- | EventListenerObject;
-
-interface AddEventListenerOptions extends EventListenerOptions {
- once?: boolean;
- passive?: boolean;
-}
-
-interface EventListenerOptions {
- capture?: boolean;
-}
-
-interface ProgressEventInit extends EventInit {
- lengthComputable?: boolean;
- loaded?: number;
- total?: number;
-}
-
-/** Events measuring progress of an underlying process, like an HTTP request
- * (for an XMLHttpRequest, or the loading of the underlying resource of an
- * <img>, <audio>, <video>, <style> or <link>). */
-declare class ProgressEvent<T extends EventTarget = EventTarget> extends Event {
- constructor(type: string, eventInitDict?: ProgressEventInit);
- readonly lengthComputable: boolean;
- readonly loaded: number;
- readonly target: T | null;
- readonly total: number;
-}
-
-/** Decodes a string of data which has been encoded using base-64 encoding.
- *
- * console.log(atob("aGVsbG8gd29ybGQ=")); // outputs 'hello world'
- */
-declare function atob(s: string): string;
-
-/** Creates a base-64 ASCII encoded string from the input string.
- *
- * console.log(btoa("hello world")); // outputs "aGVsbG8gd29ybGQ="
- */
-declare function btoa(s: string): string;
-
-declare class TextDecoder {
- /** Returns encoding's name, lowercased. */
- readonly encoding: string;
- /** Returns `true` if error mode is "fatal", and `false` otherwise. */
- readonly fatal: boolean;
- /** Returns `true` if ignore BOM flag is set, and `false` otherwise. */
- readonly ignoreBOM = false;
- constructor(
- label?: string,
- options?: { fatal?: boolean; ignoreBOM?: boolean },
- );
- /** Returns the result of running encoding's decoder. */
- decode(input?: BufferSource, options?: { stream?: false }): string;
- readonly [Symbol.toStringTag]: string;
-}
-
-declare class TextEncoder {
- /** Returns "utf-8". */
- readonly encoding = "utf-8";
- /** Returns the result of running UTF-8's encoder. */
- encode(input?: string): Uint8Array;
- encodeInto(
- input: string,
- dest: Uint8Array,
- ): { read: number; written: number };
- readonly [Symbol.toStringTag]: string;
-}
-
-/** A controller object that allows you to abort one or more DOM requests as and
- * when desired. */
-declare class AbortController {
- /** Returns the AbortSignal object associated with this object. */
- readonly signal: AbortSignal;
- /** Invoking this method will set this object's AbortSignal's aborted flag and
- * signal to any observers that the associated activity is to be aborted. */
- abort(): void;
-}
-
-interface AbortSignalEventMap {
- abort: Event;
-}
-
-/** A signal object that allows you to communicate with a DOM request (such as a
- * Fetch) and abort it if required via an AbortController object. */
-interface AbortSignal extends EventTarget {
- /** Returns true if this AbortSignal's AbortController has signaled to abort,
- * and false otherwise. */
- readonly aborted: boolean;
- onabort: ((this: AbortSignal, ev: Event) => any) | null;
- addEventListener<K extends keyof AbortSignalEventMap>(
- type: K,
- listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any,
- options?: boolean | AddEventListenerOptions,
- ): void;
- addEventListener(
- type: string,
- listener: EventListenerOrEventListenerObject,
- options?: boolean | AddEventListenerOptions,
- ): void;
- removeEventListener<K extends keyof AbortSignalEventMap>(
- type: K,
- listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any,
- options?: boolean | EventListenerOptions,
- ): void;
- removeEventListener(
- type: string,
- listener: EventListenerOrEventListenerObject,
- options?: boolean | EventListenerOptions,
- ): void;
-}
-
-declare var AbortSignal: {
- prototype: AbortSignal;
- new (): AbortSignal;
-};
-
-interface FileReaderEventMap {
- "abort": ProgressEvent<FileReader>;
- "error": ProgressEvent<FileReader>;
- "load": ProgressEvent<FileReader>;
- "loadend": ProgressEvent<FileReader>;
- "loadstart": ProgressEvent<FileReader>;
- "progress": ProgressEvent<FileReader>;
-}
-
-/** Lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user's computer, using File or Blob objects to specify the file or data to read. */
-interface FileReader extends EventTarget {
- readonly error: DOMException | null;
- onabort: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
- onerror: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
- onload: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
- onloadend: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
- onloadstart:
- | ((this: FileReader, ev: ProgressEvent<FileReader>) => any)
- | null;
- onprogress: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
- readonly readyState: number;
- readonly result: string | ArrayBuffer | null;
- abort(): void;
- readAsArrayBuffer(blob: Blob): void;
- readAsBinaryString(blob: Blob): void;
- readAsDataURL(blob: Blob): void;
- readAsText(blob: Blob, encoding?: string): void;
- readonly DONE: number;
- readonly EMPTY: number;
- readonly LOADING: number;
- addEventListener<K extends keyof FileReaderEventMap>(
- type: K,
- listener: (this: FileReader, ev: FileReaderEventMap[K]) => any,
- options?: boolean | AddEventListenerOptions,
- ): void;
- addEventListener(
- type: string,
- listener: EventListenerOrEventListenerObject,
- options?: boolean | AddEventListenerOptions,
- ): void;
- removeEventListener<K extends keyof FileReaderEventMap>(
- type: K,
- listener: (this: FileReader, ev: FileReaderEventMap[K]) => any,
- options?: boolean | EventListenerOptions,
- ): void;
- removeEventListener(
- type: string,
- listener: EventListenerOrEventListenerObject,
- options?: boolean | EventListenerOptions,
- ): void;
-}
-
-declare var FileReader: {
- prototype: FileReader;
- new (): FileReader;
- readonly DONE: number;
- readonly EMPTY: number;
- readonly LOADING: number;
-};
diff --git a/op_crates/web/lib.rs b/op_crates/web/lib.rs
deleted file mode 100644
index a2612743e..000000000
--- a/op_crates/web/lib.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::include_js_files;
-use deno_core::Extension;
-use std::path::PathBuf;
-
-/// Load and execute the javascript code.
-pub fn init() -> Extension {
- Extension::builder()
- .js(include_js_files!(
- prefix "deno:op_crates/web",
- "00_infra.js",
- "01_dom_exception.js",
- "01_mimesniff.js",
- "02_event.js",
- "03_abort_signal.js",
- "04_global_interfaces.js",
- "08_text_encoding.js",
- "12_location.js",
- ))
- .build()
-}
-
-pub fn get_declaration() -> PathBuf {
- PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("lib.deno_web.d.ts")
-}
diff --git a/op_crates/webgpu/01_webgpu.js b/op_crates/webgpu/01_webgpu.js
deleted file mode 100644
index a02262ccd..000000000
--- a/op_crates/webgpu/01_webgpu.js
+++ /dev/null
@@ -1,5048 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// @ts-check
-/// <reference path="../../core/lib.deno_core.d.ts" />
-/// <reference path="../web/internal.d.ts" />
-/// <reference path="../web/lib.deno_web.d.ts" />
-/// <reference path="./lib.deno_webgpu.d.ts" />
-
-"use strict";
-
-((window) => {
- const core = window.Deno.core;
- const webidl = window.__bootstrap.webidl;
- const eventTarget = window.__bootstrap.eventTarget;
-
- /**
- * @param {any} self
- * @param {{prefix: string, context: string}} opts
- * @returns {InnerGPUDevice & {rid: number}}
- */
- function assertDevice(self, { prefix, context }) {
- const device = self[_device];
- const deviceRid = device?.rid;
- if (deviceRid === undefined) {
- throw new DOMException(
- `${prefix}: ${context} references an invalid or destroyed device.`,
- "OperationError",
- );
- }
- return device;
- }
-
- /**
- * @param {InnerGPUDevice} self
- * @param {any} resource
- * @param {{prefix: string, resourceContext: string, selfContext: string}} opts
- * @returns {InnerGPUDevice & {rid: number}}
- */
- function assertDeviceMatch(
- self,
- resource,
- { prefix, resourceContext, selfContext },
- ) {
- const resourceDevice = assertDevice(resource, {
- prefix,
- context: resourceContext,
- });
- if (resourceDevice.rid !== self.rid) {
- throw new DOMException(
- `${prefix}: ${resourceContext} belongs to a diffent device than ${selfContext}.`,
- "OperationError",
- );
- }
- return { ...resourceDevice, rid: resourceDevice.rid };
- }
-
- /**
- * @param {any} self
- * @param {{prefix: string, context: string}} opts
- * @returns {number}
- */
- function assertResource(self, { prefix, context }) {
- const rid = self[_rid];
- if (rid === undefined) {
- throw new DOMException(
- `${prefix}: ${context} an invalid or destroyed resource.`,
- "OperationError",
- );
- }
- return rid;
- }
-
- /**
- * @param {number[] | GPUExtent3DDict} data
- * @returns {GPUExtent3DDict}
- */
- function normalizeGPUExtent3D(data) {
- if (Array.isArray(data)) {
- return {
- width: data[0],
- height: data[1],
- depth: data[2],
- };
- } else {
- return data;
- }
- }
-
- /**
- * @param {number[] | GPUOrigin3DDict} data
- * @returns {GPUOrigin3DDict}
- */
- function normalizeGPUOrigin3D(data) {
- if (Array.isArray(data)) {
- return {
- x: data[0],
- y: data[1],
- z: data[2],
- };
- } else {
- return data;
- }
- }
-
- /**
- * @param {number[] | GPUColor} data
- * @returns {GPUColor}
- */
- function normalizeGPUColor(data) {
- if (Array.isArray(data)) {
- return {
- r: data[0],
- g: data[1],
- b: data[2],
- a: data[3],
- };
- } else {
- return data;
- }
- }
-
- class GPUOutOfMemoryError extends Error {
- constructor() {
- super();
- }
- }
-
- class GPUValidationError extends Error {
- /** @param {string} message */
- constructor(message) {
- const prefix = "Failed to construct 'GPUValidationError'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- message = webidl.converters.DOMString(message, {
- prefix,
- context: "Argument 1",
- });
- super(message);
- }
- }
-
- class GPU {
- [webidl.brand] = webidl.brand;
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- /**
- * @param {GPURequestAdapterOptions} options
- */
- async requestAdapter(options = {}) {
- webidl.assertBranded(this, GPU);
- options = webidl.converters.GPURequestAdapterOptions(options, {
- prefix: "Failed to execute 'requestAdapter' on 'GPU'",
- context: "Argument 1",
- });
-
- const { err, ...data } = await core.opAsync(
- "op_webgpu_request_adapter",
- { ...options },
- );
-
- if (err) {
- return null;
- } else {
- return createGPUAdapter(data.name, data);
- }
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${inspect({})}`;
- }
- }
-
- const _name = Symbol("[[name]]");
- const _adapter = Symbol("[[adapter]]");
- const _cleanup = Symbol("[[cleanup]]");
-
- /**
- * @typedef InnerGPUAdapter
- * @property {number} rid
- * @property {GPUAdapterFeatures} features
- * @property {GPUAdapterLimits} limits
- */
-
- /**
- * @param {string} name
- * @param {InnerGPUAdapter} inner
- * @returns {GPUAdapter}
- */
- function createGPUAdapter(name, inner) {
- /** @type {GPUAdapter} */
- const adapter = webidl.createBranded(GPUAdapter);
- adapter[_name] = name;
- adapter[_adapter] = {
- ...inner,
- features: createGPUAdapterFeatures(inner.features),
- limits: createGPUAdapterLimits(inner.limits),
- };
- return adapter;
- }
-
- class GPUAdapter {
- /** @type {string} */
- [_name];
- /** @type {InnerGPUAdapter} */
- [_adapter];
-
- /** @returns {string} */
- get name() {
- webidl.assertBranded(this, GPUAdapter);
- return this[_name];
- }
- /** @returns {GPUAdapterFeatures} */
- get features() {
- webidl.assertBranded(this, GPUAdapter);
- return this[_adapter].features;
- }
- /** @returns {GPUAdapterLimits} */
- get limits() {
- webidl.assertBranded(this, GPUAdapter);
- return this[_adapter].limits;
- }
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- /**
- * @param {GPUDeviceDescriptor} descriptor
- * @returns {Promise<GPUDevice>}
- */
- async requestDevice(descriptor = {}) {
- webidl.assertBranded(this, GPUAdapter);
- const prefix = "Failed to execute 'requestDevice' on 'GPUAdapter'";
- descriptor = webidl.converters.GPUDeviceDescriptor(descriptor, {
- prefix,
- context: "Argument 1",
- });
- const nonGuaranteedFeatures = descriptor.nonGuaranteedFeatures ?? [];
- for (const feature of nonGuaranteedFeatures) {
- if (!this[_adapter].features.has(feature)) {
- throw new TypeError(
- `${prefix}: nonGuaranteedFeatures must be a subset of the adapter features.`,
- );
- }
- }
- const nonGuaranteedLimits = descriptor.nonGuaranteedLimits ?? [];
- // TODO(lucacasonato): validate nonGuaranteedLimits
-
- const { rid, features, limits } = await core.opAsync(
- "op_webgpu_request_device",
- {
- adapterRid: this[_adapter].rid,
- labe: descriptor.label,
- nonGuaranteedFeatures,
- nonGuaranteedLimits,
- },
- );
-
- const inner = new InnerGPUDevice({
- rid,
- adapter: this,
- features: Object.freeze(features),
- limits: Object.freeze(limits),
- });
- return createGPUDevice(
- descriptor.label ?? null,
- inner,
- createGPUQueue(descriptor.label ?? null, inner),
- );
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- name: this.name,
- features: this.features,
- limits: this.limits,
- })
- }`;
- }
- }
-
- const _limits = Symbol("[[limits]]");
-
- function createGPUAdapterLimits(features) {
- /** @type {GPUAdapterLimits} */
- const adapterFeatures = webidl.createBranded(GPUAdapterLimits);
- adapterFeatures[_limits] = features;
- return adapterFeatures;
- }
-
- /**
- * @typedef InnerAdapterLimits
- * @property {number} maxTextureDimension1D
- * @property {number} maxTextureDimension2D
- * @property {number} maxTextureDimension3D
- * @property {number} maxTextureArrayLayers
- * @property {number} maxBindGroups
- * @property {number} maxDynamicUniformBuffersPerPipelineLayout
- * @property {number} maxDynamicStorageBuffersPerPipelineLayout
- * @property {number} maxSampledTexturesPerShaderStage
- * @property {number} maxSamplersPerShaderStage
- * @property {number} maxStorageBuffersPerShaderStage
- * @property {number} maxStorageTexturesPerShaderStage
- * @property {number} maxUniformBuffersPerShaderStage
- * @property {number} maxUniformBufferBindingSize
- * @property {number} maxStorageBufferBindingSize
- * @property {number} maxVertexBuffers
- * @property {number} maxVertexAttributes
- * @property {number} maxVertexBufferArrayStride
- */
-
- class GPUAdapterLimits {
- /** @type {InnerAdapterLimits} */
- [_limits];
- constructor() {
- webidl.illegalConstructor();
- }
-
- get maxTextureDimension1D() {
- throw new TypeError("Not yet implemented");
- }
- get maxTextureDimension2D() {
- throw new TypeError("Not yet implemented");
- }
- get maxTextureDimension3D() {
- throw new TypeError("Not yet implemented");
- }
- get maxTextureArrayLayers() {
- throw new TypeError("Not yet implemented");
- }
- get maxBindGroups() {
- webidl.assertBranded(this, GPUAdapterLimits);
- return this[_limits].maxBindGroups;
- }
- get maxDynamicUniformBuffersPerPipelineLayout() {
- webidl.assertBranded(this, GPUAdapterLimits);
- return this[_limits].maxDynamicUniformBuffersPerPipelineLayout;
- }
- get maxDynamicStorageBuffersPerPipelineLayout() {
- webidl.assertBranded(this, GPUAdapterLimits);
- return this[_limits].maxDynamicStorageBuffersPerPipelineLayout;
- }
- get maxSampledTexturesPerShaderStage() {
- webidl.assertBranded(this, GPUAdapterLimits);
- return this[_limits].maxSampledTexturesPerShaderStage;
- }
- get maxSamplersPerShaderStage() {
- webidl.assertBranded(this, GPUAdapterLimits);
- return this[_limits].maxSamplersPerShaderStage;
- }
- get maxStorageBuffersPerShaderStage() {
- webidl.assertBranded(this, GPUAdapterLimits);
- return this[_limits].maxStorageBuffersPerShaderStage;
- }
- get maxStorageTexturesPerShaderStage() {
- webidl.assertBranded(this, GPUAdapterLimits);
- return this[_limits].maxStorageTexturesPerShaderStage;
- }
- get maxUniformBuffersPerShaderStage() {
- webidl.assertBranded(this, GPUAdapterLimits);
- return this[_limits].maxUniformBuffersPerShaderStage;
- }
- get maxUniformBufferBindingSize() {
- webidl.assertBranded(this, GPUAdapterLimits);
- return this[_limits].maxUniformBufferBindingSize;
- }
- get maxStorageBufferBindingSize() {
- throw new TypeError("Not yet implemented");
- }
- get maxVertexBuffers() {
- throw new TypeError("Not yet implemented");
- }
- get maxVertexAttributes() {
- throw new TypeError("Not yet implemented");
- }
- get maxVertexBufferArrayStride() {
- throw new TypeError("Not yet implemented");
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${inspect(this[_limits])}`;
- }
- }
-
- const _features = Symbol("[[features]]");
-
- function createGPUAdapterFeatures(features) {
- /** @type {GPUAdapterFeatures} */
- const adapterFeatures = webidl.createBranded(GPUAdapterFeatures);
- adapterFeatures[_features] = new Set(features);
- return adapterFeatures;
- }
-
- class GPUAdapterFeatures {
- /** @type {Set<string>} */
- [_features];
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- /** @return {IterableIterator<[string, string]>} */
- entries() {
- webidl.assertBranded(this, GPUAdapterFeatures);
- return this[_features].entries();
- }
-
- /** @return {void} */
- forEach(callbackfn, thisArg) {
- webidl.assertBranded(this, GPUAdapterFeatures);
- this[_features].forEach(callbackfn, thisArg);
- }
-
- /** @return {boolean} */
- has(value) {
- webidl.assertBranded(this, GPUAdapterFeatures);
- return this[_features].has(value);
- }
-
- /** @return {IterableIterator<string>} */
- keys() {
- webidl.assertBranded(this, GPUAdapterFeatures);
- return this[_features].keys();
- }
-
- /** @return {IterableIterator<string>} */
- values() {
- webidl.assertBranded(this, GPUAdapterFeatures);
- return this[_features].values();
- }
-
- /** @return {number} */
- get size() {
- webidl.assertBranded(this, GPUAdapterFeatures);
- return this[_features].size;
- }
-
- [Symbol.iterator]() {
- webidl.assertBranded(this, GPUAdapterFeatures);
- return this[_features][Symbol.iterator]();
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${inspect([...this.values()])}`;
- }
- }
-
- const _reason = Symbol("[[reason]]");
- const _message = Symbol("[[message]]");
-
- /**
- *
- * @param {string | undefined} reason
- * @param {string} message
- * @returns {GPUDeviceLostInfo}
- */
- function createGPUDeviceLostInfo(reason, message) {
- /** @type {GPUDeviceLostInfo} */
- const deviceLostInfo = webidl.createBranded(GPUDeviceLostInfo);
- deviceLostInfo[_reason] = reason;
- deviceLostInfo[_message] = message;
- return deviceLostInfo;
- }
-
- class GPUDeviceLostInfo {
- /** @type {string | undefined} */
- [_reason];
- /** @type {string} */
- [_message];
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- get reason() {
- webidl.assertBranded(this, GPUDeviceLostInfo);
- return this[_reason];
- }
- get message() {
- webidl.assertBranded(this, GPUDeviceLostInfo);
- return this[_message];
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({ reason: this[_reason], message: this[_message] })
- }`;
- }
- }
-
- const _label = Symbol("[[label]]");
-
- /**
- * @param {string} name
- * @param {any} type
- */
- function GPUObjectBaseMixin(name, type) {
- type.prototype[_label] = null;
- Object.defineProperty(type.prototype, "label", {
- /**
- * @return {string | null}
- */
- get() {
- webidl.assertBranded(this, type);
- return this[_label];
- },
- /**
- * @param {string | null} label
- */
- set(label) {
- webidl.assertBranded(this, type);
- label = webidl.converters["UVString?"](label, {
- prefix: `Failed to set 'label' on '${name}'`,
- context: "Argument 1",
- });
- this[_label] = label;
- },
- });
- }
-
- const _device = Symbol("[[device]]");
- const _queue = Symbol("[[queue]]");
-
- /**
- * @typedef ErrorScope
- * @property {string} filter
- * @property {GPUError | undefined} error
- */
-
- /**
- * @typedef InnerGPUDeviceOptions
- * @property {GPUAdapter} adapter
- * @property {number | undefined} rid
- * @property {GPUFeatureName[]} features
- * @property {object} limits
- */
-
- class InnerGPUDevice {
- /** @type {GPUAdapter} */
- adapter;
- /** @type {number | undefined} */
- rid;
- /** @type {GPUFeatureName[]} */
- features;
- /** @type {object} */
- limits;
- /** @type {WeakRef<any>[]} */
- resources;
- /** @type {boolean} */
- isLost;
- /** @type {Promise<GPUDeviceLostInfo>} */
- lost;
- /** @type {(info: GPUDeviceLostInfo) => void} */
- resolveLost;
- /** @type {ErrorScope[]} */
- errorScopeStack;
-
- /**
- * @param {InnerGPUDeviceOptions} options
- */
- constructor(options) {
- this.adapter = options.adapter;
- this.rid = options.rid;
- this.features = options.features;
- this.limits = options.limits;
- this.resources = [];
- this.isLost = false;
- this.resolveLost = () => {};
- this.lost = new Promise((resolve) => {
- this.resolveLost = resolve;
- });
- this.errorScopeStack = [];
- }
-
- /** @param {any} resource */
- trackResource(resource) {
- this.resources.push(new WeakRef(resource));
- }
-
- /** @param {{ type: string, value: string | null } | undefined} err */
- pushError(err) {
- if (err) {
- switch (err.type) {
- case "lost":
- this.isLost = true;
- this.resolveLost(
- createGPUDeviceLostInfo(undefined, "device was lost"),
- );
- break;
- case "validation":
- case "out-of-memory":
- for (
- let i = this.errorScopeStack.length - 1;
- i >= 0;
- i--
- ) {
- const scope = this.errorScopeStack[i];
- if (scope.filter == err.type) {
- if (!scope.error) {
- switch (err.type) {
- case "validation":
- scope.error = new GPUValidationError(
- err.value ?? "validation error",
- );
- break;
- case "out-of-memory":
- scope.error = new GPUOutOfMemoryError();
- break;
- }
- }
- return;
- }
- }
- // TODO(lucacasonato): emit a UncapturedErrorEvent
- break;
- }
- }
- }
- }
-
- /**
- * @param {string | null} label
- * @param {InnerGPUDevice} inner
- * @param {GPUQueue} queue
- * @returns {GPUDevice}
- */
- function createGPUDevice(label, inner, queue) {
- /** @type {GPUDevice} */
- const device = webidl.createBranded(GPUDevice);
- device[_label] = label;
- device[_device] = inner;
- device[_queue] = queue;
- return device;
- }
-
- // TODO(@crowlKats): https://gpuweb.github.io/gpuweb/#errors-and-debugging
- class GPUDevice extends eventTarget.EventTarget {
- /** @type {InnerGPUDevice} */
- [_device];
-
- /** @type {GPUQueue} */
- [_queue];
-
- [_cleanup]() {
- const device = this[_device];
- const resources = device.resources;
- while (resources.length > 0) {
- const resource = resources.pop()?.deref();
- if (resource) {
- resource[_cleanup]();
- }
- }
- const rid = device.rid;
- if (rid !== undefined) {
- core.close(rid);
- /** @type {number | undefined} */
- device.rid = undefined;
- }
- }
-
- get adapter() {
- webidl.assertBranded(this, GPUDevice);
- return this[_device].adapter;
- }
- get features() {
- webidl.assertBranded(this, GPUDevice);
- return this[_device].features;
- }
- get limits() {
- webidl.assertBranded(this, GPUDevice);
- return this[_device].limits;
- }
- get queue() {
- webidl.assertBranded(this, GPUDevice);
- return this[_queue];
- }
-
- constructor() {
- webidl.illegalConstructor();
- super();
- }
-
- destroy() {
- webidl.assertBranded(this, GPUDevice);
- this[_cleanup]();
- }
-
- /**
- * @param {GPUBufferDescriptor} descriptor
- * @returns {GPUBuffer}
- */
- createBuffer(descriptor) {
- webidl.assertBranded(this, GPUDevice);
- const prefix = "Failed to execute 'createBuffer' on 'GPUDevice'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- descriptor = webidl.converters.GPUBufferDescriptor(descriptor, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const { rid, err } = core.opSync("op_webgpu_create_buffer", {
- deviceRid: device.rid,
- ...descriptor,
- });
- device.pushError(err);
- /** @type {CreateGPUBufferOptions} */
- let options;
- if (descriptor.mappedAtCreation) {
- options = {
- mapping: new ArrayBuffer(descriptor.size),
- mappingRange: [0, descriptor.size],
- mappedRanges: [],
- state: "mapped at creation",
- };
- } else {
- options = {
- mapping: null,
- mappedRanges: null,
- mappingRange: null,
- state: "unmapped",
- };
- }
- const buffer = createGPUBuffer(
- descriptor.label ?? null,
- device,
- rid,
- descriptor.size,
- descriptor.usage,
- options,
- );
- device.trackResource((buffer));
- return buffer;
- }
-
- /**
- * @param {GPUTextureDescriptor} descriptor
- * @returns {GPUTexture}
- */
- createTexture(descriptor) {
- webidl.assertBranded(this, GPUDevice);
- const prefix = "Failed to execute 'createTexture' on 'GPUDevice'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- descriptor = webidl.converters.GPUTextureDescriptor(descriptor, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const { rid, err } = core.opSync("op_webgpu_create_texture", {
- deviceRid: device.rid,
- ...descriptor,
- size: normalizeGPUExtent3D(descriptor.size),
- });
- device.pushError(err);
-
- const texture = createGPUTexture(
- descriptor.label ?? null,
- device,
- rid,
- );
- device.trackResource((texture));
- return texture;
- }
-
- /**
- * @param {GPUSamplerDescriptor} descriptor
- * @returns {GPUSampler}
- */
- createSampler(descriptor = {}) {
- webidl.assertBranded(this, GPUDevice);
- const prefix = "Failed to execute 'createSampler' on 'GPUDevice'";
- descriptor = webidl.converters.GPUSamplerDescriptor(descriptor, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const { rid, err } = core.opSync("op_webgpu_create_sampler", {
- deviceRid: device.rid,
- ...descriptor,
- });
- device.pushError(err);
-
- const sampler = createGPUSampler(
- descriptor.label ?? null,
- device,
- rid,
- );
- device.trackResource((sampler));
- return sampler;
- }
-
- /**
- * @param {GPUBindGroupLayoutDescriptor} descriptor
- * @returns {GPUBindGroupLayout}
- */
- createBindGroupLayout(descriptor) {
- webidl.assertBranded(this, GPUDevice);
- const prefix = "Failed to execute 'createBindGroupLayout' on 'GPUDevice'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- descriptor = webidl.converters.GPUBindGroupLayoutDescriptor(descriptor, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- for (const entry of descriptor.entries) {
- let i = 0;
- if (entry.buffer) i++;
- if (entry.sampler) i++;
- if (entry.texture) i++;
- if (entry.storageTexture) i++;
-
- if (i !== 1) {
- throw new Error(); // TODO(@crowlKats): correct error
- }
- }
-
- const { rid, err } = core.opSync(
- "op_webgpu_create_bind_group_layout",
- {
- deviceRid: device.rid,
- ...descriptor,
- },
- );
- device.pushError(err);
-
- const bindGroupLayout = createGPUBindGroupLayout(
- descriptor.label ?? null,
- device,
- rid,
- );
- device.trackResource((bindGroupLayout));
- return bindGroupLayout;
- }
-
- /**
- * @param {GPUPipelineLayoutDescriptor} descriptor
- * @returns {GPUPipelineLayout}
- */
- createPipelineLayout(descriptor) {
- webidl.assertBranded(this, GPUDevice);
- const prefix = "Failed to execute 'createPipelineLayout' on 'GPUDevice'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- descriptor = webidl.converters.GPUPipelineLayoutDescriptor(descriptor, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const bindGroupLayouts = descriptor.bindGroupLayouts.map(
- (layout, i) => {
- const context = `bind group layout ${i + 1}`;
- const rid = assertResource(layout, { prefix, context });
- assertDeviceMatch(device, layout, {
- prefix,
- selfContext: "this",
- resourceContext: context,
- });
- return rid;
- },
- );
- const { rid, err } = core.opSync("op_webgpu_create_pipeline_layout", {
- deviceRid: device.rid,
- label: descriptor.label,
- bindGroupLayouts,
- });
- device.pushError(err);
-
- const pipelineLayout = createGPUPipelineLayout(
- descriptor.label ?? null,
- device,
- rid,
- );
- device.trackResource((pipelineLayout));
- return pipelineLayout;
- }
-
- /**
- * @param {GPUBindGroupDescriptor} descriptor
- * @returns {GPUBindGroup}
- */
- createBindGroup(descriptor) {
- webidl.assertBranded(this, GPUDevice);
- const prefix = "Failed to execute 'createBindGroup' on 'GPUDevice'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- descriptor = webidl.converters.GPUBindGroupDescriptor(descriptor, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const layout = assertResource(descriptor.layout, {
- prefix,
- context: "layout",
- });
- assertDeviceMatch(device, descriptor.layout, {
- prefix,
- resourceContext: "layout",
- selfContext: "this",
- });
- const entries = descriptor.entries.map((entry, i) => {
- const context = `entry ${i + 1}`;
- const resource = entry.resource;
- if (resource instanceof GPUSampler) {
- const rid = assertResource(resource, {
- prefix,
- context,
- });
- assertDeviceMatch(device, resource, {
- prefix,
- resourceContext: context,
- selfContext: "this",
- });
- return {
- binding: entry.binding,
- kind: "GPUSampler",
- resource: rid,
- };
- } else if (resource instanceof GPUTextureView) {
- const rid = assertResource(resource, {
- prefix,
- context,
- });
- assertResource(resource[_texture], {
- prefix,
- context,
- });
- assertDeviceMatch(device, resource[_texture], {
- prefix,
- resourceContext: context,
- selfContext: "this",
- });
- return {
- binding: entry.binding,
- kind: "GPUTextureView",
- resource: rid,
- };
- } else {
- const rid = assertResource(resource.buffer, { prefix, context });
- assertDeviceMatch(device, resource.buffer, {
- prefix,
- resourceContext: context,
- selfContext: "this",
- });
- return {
- binding: entry.binding,
- kind: "GPUBufferBinding",
- resource: rid,
- offset: entry.resource.offset,
- size: entry.resource.size,
- };
- }
- });
-
- const { rid, err } = core.opSync("op_webgpu_create_bind_group", {
- deviceRid: device.rid,
- label: descriptor.label,
- layout,
- entries,
- });
- device.pushError(err);
-
- const bindGroup = createGPUBindGroup(
- descriptor.label ?? null,
- device,
- rid,
- );
- device.trackResource((bindGroup));
- return bindGroup;
- }
-
- /**
- * @param {GPUShaderModuleDescriptor} descriptor
- */
- createShaderModule(descriptor) {
- webidl.assertBranded(this, GPUDevice);
- const prefix = "Failed to execute 'createShaderModule' on 'GPUDevice'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- descriptor = webidl.converters.GPUShaderModuleDescriptor(descriptor, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const { rid, err } = core.opSync(
- "op_webgpu_create_shader_module",
- {
- deviceRid: device.rid,
- label: descriptor.label,
- code: (typeof descriptor.code === "string")
- ? descriptor.code
- : undefined,
- sourceMap: descriptor.sourceMap,
- },
- ...(descriptor.code instanceof Uint32Array
- ? [new Uint8Array(descriptor.code.buffer)]
- : []),
- );
- device.pushError(err);
-
- const shaderModule = createGPUShaderModule(
- descriptor.label ?? null,
- device,
- rid,
- );
- device.trackResource((shaderModule));
- return shaderModule;
- }
-
- /**
- * @param {GPUComputePipelineDescriptor} descriptor
- * @returns {GPUComputePipeline}
- */
- createComputePipeline(descriptor) {
- webidl.assertBranded(this, GPUDevice);
- const prefix = "Failed to execute 'createComputePipeline' on 'GPUDevice'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- descriptor = webidl.converters.GPUComputePipelineDescriptor(descriptor, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- let layout = undefined;
- if (descriptor.layout) {
- const context = "layout";
- layout = assertResource(descriptor.layout, { prefix, context });
- assertDeviceMatch(device, descriptor.layout, {
- prefix,
- resourceContext: context,
- selfContext: "this",
- });
- }
- const module = assertResource(descriptor.compute.module, {
- prefix,
- context: "compute shader module",
- });
- assertDeviceMatch(device, descriptor.compute.module, {
- prefix,
- resourceContext: "compute shader module",
- selfContext: "this",
- });
-
- const { rid, err } = core.opSync(
- "op_webgpu_create_compute_pipeline",
- {
- deviceRid: device.rid,
- label: descriptor.label,
- layout,
- compute: {
- module,
- entryPoint: descriptor.compute.entryPoint,
- },
- },
- );
- device.pushError(err);
-
- const computePipeline = createGPUComputePipeline(
- descriptor.label ?? null,
- device,
- rid,
- );
- device.trackResource((computePipeline));
- return computePipeline;
- }
-
- /**
- * @param {GPURenderPipelineDescriptor} descriptor
- * @returns {GPURenderPipeline}
- */
- createRenderPipeline(descriptor) {
- webidl.assertBranded(this, GPUDevice);
- const prefix = "Failed to execute 'createRenderPipeline' on 'GPUDevice'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- descriptor = webidl.converters.GPURenderPipelineDescriptor(descriptor, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- let layout = undefined;
- if (descriptor.layout) {
- const context = "layout";
- layout = assertResource(descriptor.layout, { prefix, context });
- assertDeviceMatch(device, descriptor.layout, {
- prefix,
- resourceContext: context,
- selfContext: "this",
- });
- }
- const module = assertResource(descriptor.vertex.module, {
- prefix,
- context: "vertex shader module",
- });
- assertDeviceMatch(device, descriptor.vertex.module, {
- prefix,
- resourceContext: "vertex shader module",
- selfContext: "this",
- });
- let fragment = undefined;
- if (descriptor.fragment) {
- const module = assertResource(descriptor.fragment.module, {
- prefix,
- context: "fragment shader module",
- });
- assertDeviceMatch(device, descriptor.fragment.module, {
- prefix,
- resourceContext: "fragment shader module",
- selfContext: "this",
- });
- fragment = {
- module,
- entryPoint: descriptor.fragment.entryPoint,
- targets: descriptor.fragment.targets,
- };
- }
-
- const { rid, err } = core.opSync("op_webgpu_create_render_pipeline", {
- deviceRid: device.rid,
- label: descriptor.label,
- layout,
- vertex: {
- module,
- entryPoint: descriptor.vertex.entryPoint,
- buffers: descriptor.vertex.buffers,
- },
- primitive: descriptor.primitive,
- depthStencil: descriptor.depthStencil,
- multisample: descriptor.multisample,
- fragment,
- });
- device.pushError(err);
-
- const renderPipeline = createGPURenderPipeline(
- descriptor.label ?? null,
- device,
- rid,
- );
- device.trackResource((renderPipeline));
- return renderPipeline;
- }
-
- createComputePipelineAsync(descriptor) {
- // TODO(lucacasonato): this should be real async
- return Promise.resolve(this.createComputePipeline(descriptor));
- }
-
- createRenderPipelineAsync(descriptor) {
- // TODO(lucacasonato): this should be real async
- return Promise.resolve(this.createRenderPipeline(descriptor));
- }
-
- /**
- * @param {GPUCommandEncoderDescriptor} descriptor
- * @returns {GPUCommandEncoder}
- */
- createCommandEncoder(descriptor = {}) {
- webidl.assertBranded(this, GPUDevice);
- const prefix = "Failed to execute 'createCommandEncoder' on 'GPUDevice'";
- descriptor = webidl.converters.GPUCommandEncoderDescriptor(descriptor, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const { rid, err } = core.opSync("op_webgpu_create_command_encoder", {
- deviceRid: device.rid,
- ...descriptor,
- });
- device.pushError(err);
-
- const commandEncoder = createGPUCommandEncoder(
- descriptor.label ?? null,
- device,
- rid,
- );
- device.trackResource((commandEncoder));
- return commandEncoder;
- }
-
- /**
- * @param {GPURenderBundleEncoderDescriptor} descriptor
- * @returns {GPURenderBundleEncoder}
- */
- createRenderBundleEncoder(descriptor) {
- webidl.assertBranded(this, GPUDevice);
- const prefix =
- "Failed to execute 'createRenderBundleEncoder' on 'GPUDevice'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- descriptor = webidl.converters.GPURenderBundleEncoderDescriptor(
- descriptor,
- {
- prefix,
- context: "Argument 1",
- },
- );
- const device = assertDevice(this, { prefix, context: "this" });
- const { rid, err } = core.opSync(
- "op_webgpu_create_render_bundle_encoder",
- {
- deviceRid: device.rid,
- ...descriptor,
- },
- );
- device.pushError(err);
-
- const renderBundleEncoder = createGPURenderBundleEncoder(
- descriptor.label ?? null,
- device,
- rid,
- );
- device.trackResource((renderBundleEncoder));
- return renderBundleEncoder;
- }
-
- /**
- * @param {GPUQuerySetDescriptor} descriptor
- * @returns {GPUQuerySet}
- */
- createQuerySet(descriptor) {
- webidl.assertBranded(this, GPUDevice);
- const prefix = "Failed to execute 'createQuerySet' on 'GPUDevice'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- descriptor = webidl.converters.GPUQuerySetDescriptor(
- descriptor,
- {
- prefix,
- context: "Argument 1",
- },
- );
- const device = assertDevice(this, { prefix, context: "this" });
- const { rid, err } = core.opSync("op_webgpu_create_query_set", {
- deviceRid: device.rid,
- ...descriptor,
- });
- device.pushError(err);
-
- const querySet = createGPUQuerySet(
- descriptor.label ?? null,
- device,
- rid,
- descriptor,
- );
- device.trackResource((querySet));
- return querySet;
- }
-
- get lost() {
- webidl.assertBranded(this, GPUDevice);
- const device = this[_device];
- if (!device) {
- return Promise.resolve(true);
- }
- if (device.rid === undefined) {
- return Promise.resolve(true);
- }
- return device.lost;
- }
-
- /**
- * @param {GPUErrorFilter} filter
- */
- pushErrorScope(filter) {
- webidl.assertBranded(this, GPUDevice);
- const prefix = "Failed to execute 'pushErrorScope' on 'GPUDevice'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- filter = webidl.converters.GPUErrorFilter(filter, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- device.errorScopeStack.push({ filter, error: undefined });
- }
-
- /**
- * @returns {Promise<GPUError | null>}
- */
- // deno-lint-ignore require-await
- async popErrorScope() {
- webidl.assertBranded(this, GPUDevice);
- const prefix = "Failed to execute 'pushErrorScope' on 'GPUDevice'";
- const device = assertDevice(this, { prefix, context: "this" });
- if (device.isLost) {
- throw new DOMException("Device has been lost.", "OperationError");
- }
- const scope = device.errorScopeStack.pop();
- if (!scope) {
- throw new DOMException(
- "There are no error scopes on that stack.",
- "OperationError",
- );
- }
- return scope.error ?? null;
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- adapter: this.adapter,
- features: this.features,
- label: this.label,
- limits: this.limits,
- queue: this.queue,
- })
- }`;
- }
- }
- GPUObjectBaseMixin("GPUDevice", GPUDevice);
-
- /**
- * @param {string | null} label
- * @param {InnerGPUDevice} device
- * @returns {GPUQueue}
- */
- function createGPUQueue(label, device) {
- /** @type {GPUQueue} */
- const queue = webidl.createBranded(GPUQueue);
- queue[_label] = label;
- queue[_device] = device;
- return queue;
- }
-
- class GPUQueue {
- /** @type {InnerGPUDevice} */
- [_device];
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- /**
- * @param {GPUCommandBuffer[]} commandBuffers
- */
- submit(commandBuffers) {
- webidl.assertBranded(this, GPUQueue);
- const prefix = "Failed to execute 'submit' on 'GPUQueue'";
- webidl.requiredArguments(arguments.length, 1, {
- prefix,
- });
- commandBuffers = webidl.converters["sequence<GPUCommandBuffer>"](
- commandBuffers,
- { prefix, context: "Argument 1" },
- );
- const device = assertDevice(this, { prefix, context: "this" });
- const commandBufferRids = commandBuffers.map((buffer, i) => {
- const context = `command buffer ${i + 1}`;
- const rid = assertResource(buffer, { prefix, context });
- assertDeviceMatch(device, buffer, {
- prefix,
- selfContext: "this",
- resourceContext: context,
- });
- return rid;
- });
- const { err } = core.opSync("op_webgpu_queue_submit", {
- queueRid: device.rid,
- commandBuffers: commandBufferRids,
- });
- device.pushError(err);
- }
-
- onSubmittedWorkDone() {
- webidl.assertBranded(this, GPUQueue);
- return Promise.resolve();
- }
-
- /**
- * @param {GPUBuffer} buffer
- * @param {number} bufferOffset
- * @param {BufferSource} data
- * @param {number} [dataOffset]
- * @param {number} [size]
- */
- writeBuffer(buffer, bufferOffset, data, dataOffset = 0, size) {
- webidl.assertBranded(this, GPUQueue);
- const prefix = "Failed to execute 'writeBuffer' on 'GPUQueue'";
- webidl.requiredArguments(arguments.length, 3, { prefix });
- buffer = webidl.converters["GPUBuffer"](buffer, {
- prefix,
- context: "Argument 1",
- });
- bufferOffset = webidl.converters["GPUSize64"](bufferOffset, {
- prefix,
- context: "Argument 2",
- });
- data = webidl.converters.BufferSource(data, {
- prefix,
- context: "Argument 3",
- });
- dataOffset = webidl.converters["GPUSize64"](dataOffset, {
- prefix,
- context: "Argument 4",
- });
- size = size === undefined
- ? undefined
- : webidl.converters["GPUSize64"](size, {
- prefix,
- context: "Argument 5",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const bufferRid = assertResource(buffer, {
- prefix,
- context: "Argument 1",
- });
- assertDeviceMatch(device, buffer, {
- prefix,
- selfContext: "this",
- resourceContext: "Argument 1",
- });
- const { err } = core.opSync(
- "op_webgpu_write_buffer",
- {
- queueRid: device.rid,
- buffer: bufferRid,
- bufferOffset,
- dataOffset,
- size,
- },
- new Uint8Array(ArrayBuffer.isView(data) ? data.buffer : data),
- );
- device.pushError(err);
- }
-
- /**
- * @param {GPUImageCopyTexture} destination
- * @param {BufferSource} data
- * @param {GPUImageDataLayout} dataLayout
- * @param {GPUExtent3D} size
- */
- writeTexture(destination, data, dataLayout, size) {
- webidl.assertBranded(this, GPUQueue);
- const prefix = "Failed to execute 'writeTexture' on 'GPUQueue'";
- webidl.requiredArguments(arguments.length, 4, { prefix });
- destination = webidl.converters.GPUImageCopyTexture(destination, {
- prefix,
- context: "Argument 1",
- });
- data = webidl.converters.BufferSource(data, {
- prefix,
- context: "Argument 2",
- });
- dataLayout = webidl.converters.GPUImageDataLayout(dataLayout, {
- prefix,
- context: "Argument 3",
- });
- size = webidl.converters.GPUExtent3D(size, {
- prefix,
- context: "Argument 4",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const textureRid = assertResource(destination.texture, {
- prefix,
- context: "texture",
- });
- assertDeviceMatch(device, destination.texture, {
- prefix,
- selfContext: "this",
- resourceContext: "texture",
- });
- const { err } = core.opSync(
- "op_webgpu_write_texture",
- {
- queueRid: device.rid,
- destination: {
- texture: textureRid,
- mipLevel: destination.mipLevel,
- origin: destination.origin
- ? normalizeGPUOrigin3D(destination.origin)
- : undefined,
- },
- dataLayout,
- size: normalizeGPUExtent3D(size),
- },
- new Uint8Array(ArrayBuffer.isView(data) ? data.buffer : data),
- );
- device.pushError(err);
- }
-
- copyImageBitmapToTexture(_source, _destination, _copySize) {
- throw new Error("Not yet implemented");
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- label: this.label,
- })
- }`;
- }
- }
- GPUObjectBaseMixin("GPUQueue", GPUQueue);
-
- const _rid = Symbol("[[rid]]");
-
- const _size = Symbol("[[size]]");
- const _usage = Symbol("[[usage]]");
- const _state = Symbol("[[state]]");
- const _mappingRange = Symbol("[[mapping_range]]");
- const _mappedRanges = Symbol("[[mapped_ranges]]");
- const _mapMode = Symbol("[[map_mode]]");
-
- /**
- * @typedef CreateGPUBufferOptions
- * @property {ArrayBuffer | null} mapping
- * @property {number[] | null} mappingRange
- * @property {[ArrayBuffer, number, number][] | null} mappedRanges
- * @property {"mapped" | "mapped at creation" | "mapped pending" | "unmapped" | "destroy" } state
- */
-
- /**
- * @param {string | null} label
- * @param {InnerGPUDevice} device
- * @param {number} rid
- * @param {number} size
- * @param {number} usage
- * @param {CreateGPUBufferOptions} options
- * @returns {GPUBuffer}
- */
- function createGPUBuffer(label, device, rid, size, usage, options) {
- /** @type {GPUBuffer} */
- const buffer = webidl.createBranded(GPUBuffer);
- buffer[_label] = label;
- buffer[_device] = device;
- buffer[_rid] = rid;
- buffer[_size] = size;
- buffer[_usage] = usage;
- buffer[_mappingRange] = options.mappingRange;
- buffer[_mappedRanges] = options.mappedRanges;
- buffer[_state] = options.state;
- return buffer;
- }
-
- class GPUBuffer {
- /** @type {InnerGPUDevice} */
- [_device];
-
- /** @type {number} */
- [_rid];
-
- /** @type {number} */
- [_size];
-
- /** @type {number} */
- [_usage];
-
- /** @type {"mapped" | "mapped at creation" | "mapped pending" | "unmapped" | "destroy"} */
- [_state];
-
- /** @type {[number, number] | null} */
- [_mappingRange];
-
- /** @type {[ArrayBuffer, number, number][] | null} */
- [_mappedRanges];
-
- /** @type {number} */
- [_mapMode];
-
- [_cleanup]() {
- const mappedRanges = this[_mappedRanges];
- if (mappedRanges) {
- while (mappedRanges.length > 0) {
- const mappedRange = mappedRanges.pop();
- if (mappedRange !== undefined) {
- core.close(mappedRange[1]);
- }
- }
- }
- const rid = this[_rid];
- if (rid !== undefined) {
- core.close(rid);
- /** @type {number | undefined} */
- this[_rid] = undefined;
- }
- this[_state] = "destroy";
- }
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- /**
- * @param {number} mode
- * @param {number} offset
- * @param {number} [size]
- */
- async mapAsync(mode, offset = 0, size) {
- webidl.assertBranded(this, GPUBuffer);
- const prefix = "Failed to execute 'mapAsync' on 'GPUBuffer'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- mode = webidl.converters.GPUMapModeFlags(mode, {
- prefix,
- context: "Argument 1",
- });
- offset = webidl.converters.GPUSize64(offset, {
- prefix,
- context: "Argument 2",
- });
- size = size === undefined
- ? undefined
- : webidl.converters.GPUSize64(size, {
- prefix,
- context: "Argument 3",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const bufferRid = assertResource(this, { prefix, context: "this" });
- /** @type {number} */
- let rangeSize;
- if (size === undefined) {
- rangeSize = Math.max(0, this[_size] - offset);
- } else {
- rangeSize = this[_size];
- }
- if ((offset % 8) !== 0) {
- throw new DOMException(
- `${prefix}: offset must be a multiple of 8.`,
- "OperationError",
- );
- }
- if ((rangeSize % 4) !== 0) {
- throw new DOMException(
- `${prefix}: rangeSize must be a multiple of 4.`,
- "OperationError",
- );
- }
- if ((offset + rangeSize) > this[_size]) {
- throw new DOMException(
- `${prefix}: offset + rangeSize must be less than or equal to buffer size.`,
- "OperationError",
- );
- }
- if (this[_state] !== "unmapped") {
- throw new DOMException(
- `${prefix}: GPUBuffer is not currently unmapped.`,
- "OperationError",
- );
- }
- const readMode = (mode & 0x0001) === 0x0001;
- const writeMode = (mode & 0x0002) === 0x0002;
- if ((readMode && writeMode) || (!readMode && !writeMode)) {
- throw new DOMException(
- `${prefix}: exactly one of READ or WRITE map mode must be set.`,
- "OperationError",
- );
- }
- if (readMode && !((this[_usage] && 0x0001) === 0x0001)) {
- throw new DOMException(
- `${prefix}: READ map mode not valid because buffer does not have MAP_READ usage.`,
- "OperationError",
- );
- }
- if (writeMode && !((this[_usage] && 0x0002) === 0x0002)) {
- throw new DOMException(
- `${prefix}: WRITE map mode not valid because buffer does not have MAP_WRITE usage.`,
- "OperationError",
- );
- }
-
- this[_mapMode] = mode;
- this[_state] = "mapping pending";
- const { err } = await core.opAsync(
- "op_webgpu_buffer_get_map_async",
- {
- bufferRid,
- deviceRid: device.rid,
- mode,
- offset,
- size: rangeSize,
- },
- );
- device.pushError(err);
- this[_state] = "mapped";
- this[_mappingRange] = [offset, offset + rangeSize];
- /** @type {[ArrayBuffer, number, number][] | null} */
- this[_mappedRanges] = [];
- }
-
- /**
- * @param {number} offset
- * @param {number} size
- */
- getMappedRange(offset = 0, size) {
- webidl.assertBranded(this, GPUBuffer);
- const prefix = "Failed to execute 'getMappedRange' on 'GPUBuffer'";
- offset = webidl.converters.GPUSize64(offset, {
- prefix,
- context: "Argument 1",
- });
- size = size === undefined
- ? undefined
- : webidl.converters.GPUSize64(size, {
- prefix,
- context: "Argument 2",
- });
- assertDevice(this, { prefix, context: "this" });
- const bufferRid = assertResource(this, { prefix, context: "this" });
- /** @type {number} */
- let rangeSize;
- if (size === undefined) {
- rangeSize = Math.max(0, this[_size] - offset);
- } else {
- rangeSize = this[_size];
- }
- if (this[_state] !== "mapped" && this[_state] !== "mapped at creation") {
- throw new DOMException(
- `${prefix}: buffer is not mapped.`,
- "OperationError",
- );
- }
- if ((offset % 8) !== 0) {
- throw new DOMException(
- `${prefix}: offset must be a multiple of 8.`,
- "OperationError",
- );
- }
- if ((rangeSize % 4) !== 0) {
- throw new DOMException(
- `${prefix}: rangeSize must be a multiple of 4.`,
- "OperationError",
- );
- }
- const mappingRange = this[_mappingRange];
- if (!mappingRange) {
- throw new DOMException(`${prefix}: invalid state.`, "OperationError");
- }
- if (offset < mappingRange[0]) {
- throw new DOMException(
- `${prefix}: offset is out of bounds.`,
- "OperationError",
- );
- }
- if ((offset + rangeSize) > mappingRange[1]) {
- throw new DOMException(
- `${prefix}: offset is out of bounds.`,
- "OperationError",
- );
- }
- const mappedRanges = this[_mappedRanges];
- if (!mappedRanges) {
- throw new DOMException(`${prefix}: invalid state.`, "OperationError");
- }
- for (const [buffer, _rid, start] of mappedRanges) {
- // TODO(lucacasonato): is this logic correct?
- const end = start + buffer.byteLength;
- if (
- (start >= offset && start < (offset + rangeSize)) ||
- (end >= offset && end < (offset + rangeSize))
- ) {
- throw new DOMException(
- `${prefix}: requested buffer overlaps with another mapped range.`,
- "OperationError",
- );
- }
- }
-
- const buffer = new ArrayBuffer(rangeSize);
- const { rid } = core.opSync(
- "op_webgpu_buffer_get_mapped_range",
- {
- bufferRid,
- offset: offset - mappingRange[0],
- size: rangeSize,
- },
- new Uint8Array(buffer),
- );
-
- mappedRanges.push([buffer, rid, offset]);
-
- return buffer;
- }
-
- unmap() {
- webidl.assertBranded(this, GPUBuffer);
- const prefix = "Failed to execute 'unmap' on 'GPUBuffer'";
- const device = assertDevice(this, { prefix, context: "this" });
- const bufferRid = assertResource(this, { prefix, context: "this" });
- if (this[_state] === "unmapped" || this[_state] === "destroyed") {
- throw new DOMException(
- `${prefix}: buffer is not ready to be unmapped.`,
- "OperationError",
- );
- }
- if (this[_state] === "mapping pending") {
- // TODO(lucacasonato): this is not spec compliant.
- throw new DOMException(
- `${prefix}: can not unmap while mapping. This is a Deno limitation.`,
- "OperationError",
- );
- } else if (
- this[_state] === "mapped" || this[_state] === "mapped at creation"
- ) {
- /** @type {boolean} */
- let write = false;
- if (this[_state] === "mapped at creation") {
- write = true;
- } else if (this[_state] === "mapped") {
- const mapMode = this[_mapMode];
- if (mapMode === undefined) {
- throw new DOMException(
- `${prefix}: invalid state.`,
- "OperationError",
- );
- }
- if ((mapMode & 0x0002) === 0x0002) {
- write = true;
- }
- }
-
- const mappedRanges = this[_mappedRanges];
- if (!mappedRanges) {
- throw new DOMException(`${prefix}: invalid state.`, "OperationError");
- }
- for (const [buffer, mappedRid] of mappedRanges) {
- const { err } = core.opSync("op_webgpu_buffer_unmap", {
- bufferRid,
- mappedRid,
- }, ...(write ? [new Uint8Array(buffer)] : []));
- device.pushError(err);
- if (err) return;
- }
- this[_mappingRange] = null;
- this[_mappedRanges] = null;
- }
-
- this[_state] = "unmapped";
- }
-
- destroy() {
- webidl.assertBranded(this, GPUBuffer);
- this[_cleanup]();
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- label: this.label,
- })
- }`;
- }
- }
- GPUObjectBaseMixin("GPUBuffer", GPUBuffer);
-
- class GPUBufferUsage {
- constructor() {
- webidl.illegalConstructor();
- }
-
- static get MAP_READ() {
- return 0x0001;
- }
- static get MAP_WRITE() {
- return 0x0002;
- }
- static get COPY_SRC() {
- return 0x0004;
- }
- static get COPY_DST() {
- return 0x0008;
- }
- static get INDEX() {
- return 0x0010;
- }
- static get VERTEX() {
- return 0x0020;
- }
- static get UNIFORM() {
- return 0x0040;
- }
- static get STORAGE() {
- return 0x0080;
- }
- static get INDIRECT() {
- return 0x0100;
- }
- static get QUERY_RESOLVE() {
- return 0x0200;
- }
- }
-
- class GPUMapMode {
- constructor() {
- webidl.illegalConstructor();
- }
-
- static get READ() {
- return 0x0001;
- }
- static get WRITE() {
- return 0x0002;
- }
- }
-
- const _views = Symbol("[[views]]");
-
- /**
- * @param {string | null} label
- * @param {InnerGPUDevice} device
- * @param {number} rid
- * @returns {GPUTexture}
- */
- function createGPUTexture(label, device, rid) {
- /** @type {GPUTexture} */
- const texture = webidl.createBranded(GPUTexture);
- texture[_label] = label;
- texture[_device] = device;
- texture[_rid] = rid;
- texture[_views] = [];
- return texture;
- }
-
- class GPUTexture {
- /** @type {InnerGPUDevice} */
- [_device];
- /** @type {number | undefined} */
- [_rid];
- /** @type {WeakRef<GPUTextureView>[]} */
- [_views];
-
- [_cleanup]() {
- const views = this[_views];
- while (views.length > 0) {
- const view = views.pop()?.deref();
- if (view) {
- view[_cleanup]();
- }
- }
- const rid = this[_rid];
- if (rid !== undefined) {
- core.close(rid);
- /** @type {number | undefined} */
- this[_rid] = undefined;
- }
- }
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- /**
- * @param {GPUTextureViewDescriptor} descriptor
- */
- createView(descriptor = {}) {
- webidl.assertBranded(this, GPUTexture);
- const prefix = "Failed to execute 'createView' on 'GPUTexture'";
- webidl.requiredArguments(arguments.length, 0, { prefix });
- descriptor = webidl.converters.GPUTextureViewDescriptor(descriptor, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const textureRid = assertResource(this, { prefix, context: "this" });
- const { rid, err } = core.opSync("op_webgpu_create_texture_view", {
- textureRid,
- ...descriptor,
- });
- device.pushError(err);
-
- const textureView = createGPUTextureView(
- descriptor.label ?? null,
- this,
- rid,
- );
- this[_views].push(new WeakRef(textureView));
- return textureView;
- }
-
- destroy() {
- webidl.assertBranded(this, GPUTexture);
- this[_cleanup]();
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- label: this.label,
- })
- }`;
- }
- }
- GPUObjectBaseMixin("GPUTexture", GPUTexture);
-
- class GPUTextureUsage {
- constructor() {
- webidl.illegalConstructor();
- }
-
- static get COPY_SRC() {
- return 0x01;
- }
- static get COPY_DST() {
- return 0x02;
- }
- static get SAMPLED() {
- return 0x04;
- }
- static get STORAGE() {
- return 0x08;
- }
- static get RENDER_ATTACHMENT() {
- return 0x10;
- }
- }
-
- const _texture = Symbol("[[texture]]");
-
- /**
- * @param {string | null} label
- * @param {GPUTexture} texture
- * @param {number} rid
- * @returns {GPUTextureView}
- */
- function createGPUTextureView(label, texture, rid) {
- /** @type {GPUTextureView} */
- const textureView = webidl.createBranded(GPUTextureView);
- textureView[_label] = label;
- textureView[_texture] = texture;
- textureView[_rid] = rid;
- return textureView;
- }
- class GPUTextureView {
- /** @type {GPUTexture} */
- [_texture];
- /** @type {number | undefined} */
- [_rid];
-
- [_cleanup]() {
- const rid = this[_rid];
- if (rid !== undefined) {
- core.close(rid);
- /** @type {number | undefined} */
- this[_rid] = undefined;
- }
- }
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- label: this.label,
- })
- }`;
- }
- }
- GPUObjectBaseMixin("GPUTextureView", GPUTextureView);
-
- /**
- * @param {string | null} label
- * @param {InnerGPUDevice} device
- * @param {number} rid
- * @returns {GPUSampler}
- */
- function createGPUSampler(label, device, rid) {
- /** @type {GPUSampler} */
- const sampler = webidl.createBranded(GPUSampler);
- sampler[_label] = label;
- sampler[_device] = device;
- sampler[_rid] = rid;
- return sampler;
- }
- class GPUSampler {
- /** @type {InnerGPUDevice} */
- [_device];
- /** @type {number | undefined} */
- [_rid];
-
- [_cleanup]() {
- const rid = this[_rid];
- if (rid !== undefined) {
- core.close(rid);
- /** @type {number | undefined} */
- this[_rid] = undefined;
- }
- }
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- label: this.label,
- })
- }`;
- }
- }
- GPUObjectBaseMixin("GPUSampler", GPUSampler);
-
- /**
- * @param {string | null} label
- * @param {InnerGPUDevice} device
- * @param {number} rid
- * @returns {GPUBindGroupLayout}
- */
- function createGPUBindGroupLayout(label, device, rid) {
- /** @type {GPUBindGroupLayout} */
- const bindGroupLayout = webidl.createBranded(GPUBindGroupLayout);
- bindGroupLayout[_label] = label;
- bindGroupLayout[_device] = device;
- bindGroupLayout[_rid] = rid;
- return bindGroupLayout;
- }
- class GPUBindGroupLayout {
- /** @type {InnerGPUDevice} */
- [_device];
- /** @type {number | undefined} */
- [_rid];
-
- [_cleanup]() {
- const rid = this[_rid];
- if (rid !== undefined) {
- core.close(rid);
- /** @type {number | undefined} */
- this[_rid] = undefined;
- }
- }
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- label: this.label,
- })
- }`;
- }
- }
- GPUObjectBaseMixin("GPUBindGroupLayout", GPUBindGroupLayout);
-
- /**
- * @param {string | null} label
- * @param {InnerGPUDevice} device
- * @param {number} rid
- * @returns {GPUPipelineLayout}
- */
- function createGPUPipelineLayout(label, device, rid) {
- /** @type {GPUPipelineLayout} */
- const pipelineLayout = webidl.createBranded(GPUPipelineLayout);
- pipelineLayout[_label] = label;
- pipelineLayout[_device] = device;
- pipelineLayout[_rid] = rid;
- return pipelineLayout;
- }
- class GPUPipelineLayout {
- /** @type {InnerGPUDevice} */
- [_device];
- /** @type {number | undefined} */
- [_rid];
-
- [_cleanup]() {
- const rid = this[_rid];
- if (rid !== undefined) {
- core.close(rid);
- /** @type {number | undefined} */
- this[_rid] = undefined;
- }
- }
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- label: this.label,
- })
- }`;
- }
- }
- GPUObjectBaseMixin("GPUPipelineLayout", GPUPipelineLayout);
-
- /**
- * @param {string | null} label
- * @param {InnerGPUDevice} device
- * @param {number} rid
- * @returns {GPUBindGroup}
- */
- function createGPUBindGroup(label, device, rid) {
- /** @type {GPUBindGroup} */
- const bindGroup = webidl.createBranded(GPUBindGroup);
- bindGroup[_label] = label;
- bindGroup[_device] = device;
- bindGroup[_rid] = rid;
- return bindGroup;
- }
- class GPUBindGroup {
- /** @type {InnerGPUDevice} */
- [_device];
- /** @type {number | undefined} */
- [_rid];
-
- [_cleanup]() {
- const rid = this[_rid];
- if (rid !== undefined) {
- core.close(rid);
- /** @type {number | undefined} */
- this[_rid] = undefined;
- }
- }
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- label: this.label,
- })
- }`;
- }
- }
- GPUObjectBaseMixin("GPUBindGroup", GPUBindGroup);
-
- /**
- * @param {string | null} label
- * @param {InnerGPUDevice} device
- * @param {number} rid
- * @returns {GPUShaderModule}
- */
- function createGPUShaderModule(label, device, rid) {
- /** @type {GPUShaderModule} */
- const bindGroup = webidl.createBranded(GPUShaderModule);
- bindGroup[_label] = label;
- bindGroup[_device] = device;
- bindGroup[_rid] = rid;
- return bindGroup;
- }
- class GPUShaderModule {
- /** @type {InnerGPUDevice} */
- [_device];
- /** @type {number | undefined} */
- [_rid];
-
- [_cleanup]() {
- const rid = this[_rid];
- if (rid !== undefined) {
- core.close(rid);
- /** @type {number | undefined} */
- this[_rid] = undefined;
- }
- }
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- compilationInfo() {
- throw new Error("Not yet implemented");
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- label: this.label,
- })
- }`;
- }
- }
- GPUObjectBaseMixin("GPUShaderModule", GPUShaderModule);
-
- class GPUShaderStage {
- constructor() {
- webidl.illegalConstructor();
- }
-
- static get VERTEX() {
- return 0x1;
- }
-
- static get FRAGMENT() {
- return 0x2;
- }
-
- static get COMPUTE() {
- return 0x4;
- }
- }
-
- /**
- * @param {string | null} label
- * @param {InnerGPUDevice} device
- * @param {number} rid
- * @returns {GPUComputePipeline}
- */
- function createGPUComputePipeline(label, device, rid) {
- /** @type {GPUComputePipeline} */
- const pipeline = webidl.createBranded(GPUComputePipeline);
- pipeline[_label] = label;
- pipeline[_device] = device;
- pipeline[_rid] = rid;
- return pipeline;
- }
- class GPUComputePipeline {
- /** @type {InnerGPUDevice} */
- [_device];
- /** @type {number | undefined} */
- [_rid];
-
- [_cleanup]() {
- const rid = this[_rid];
- if (rid !== undefined) {
- core.close(rid);
- /** @type {number | undefined} */
- this[_rid] = undefined;
- }
- }
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- /**
- * @param {number} index
- * @returns {GPUBindGroupLayout}
- */
- getBindGroupLayout(index) {
- webidl.assertBranded(this, GPUComputePipeline);
- const prefix =
- "Failed to execute 'getBindGroupLayout' on 'GPUComputePipeline'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- index = webidl.converters["unsigned long"](index, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const computePipelineRid = assertResource(this, {
- prefix,
- context: "this",
- });
- const { rid, label, err } = core.opSync(
- "op_webgpu_compute_pipeline_get_bind_group_layout",
- { computePipelineRid, index },
- );
- device.pushError(err);
-
- const bindGroupLayout = createGPUBindGroupLayout(
- label,
- device,
- rid,
- );
- device.trackResource((bindGroupLayout));
- return bindGroupLayout;
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- label: this.label,
- })
- }`;
- }
- }
- GPUObjectBaseMixin("GPUComputePipeline", GPUComputePipeline);
-
- /**
- * @param {string | null} label
- * @param {InnerGPUDevice} device
- * @param {number} rid
- * @returns {GPURenderPipeline}
- */
- function createGPURenderPipeline(label, device, rid) {
- /** @type {GPURenderPipeline} */
- const pipeline = webidl.createBranded(GPURenderPipeline);
- pipeline[_label] = label;
- pipeline[_device] = device;
- pipeline[_rid] = rid;
- return pipeline;
- }
- class GPURenderPipeline {
- /** @type {InnerGPUDevice} */
- [_device];
- /** @type {number | undefined} */
- [_rid];
-
- [_cleanup]() {
- const rid = this[_rid];
- if (rid !== undefined) {
- core.close(rid);
- /** @type {number | undefined} */
- this[_rid] = undefined;
- }
- }
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- /**
- * @param {number} index
- */
- getBindGroupLayout(index) {
- webidl.assertBranded(this, GPURenderPipeline);
- const prefix =
- "Failed to execute 'getBindGroupLayout' on 'GPURenderPipeline'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- index = webidl.converters["unsigned long"](index, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const renderPipelineRid = assertResource(this, {
- prefix,
- context: "this",
- });
- const { rid, label, err } = core.opSync(
- "op_webgpu_render_pipeline_get_bind_group_layout",
- { renderPipelineRid, index },
- );
- device.pushError(err);
-
- const bindGroupLayout = createGPUBindGroupLayout(
- label,
- device,
- rid,
- );
- device.trackResource((bindGroupLayout));
- return bindGroupLayout;
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- label: this.label,
- })
- }`;
- }
- }
- GPUObjectBaseMixin("GPURenderPipeline", GPURenderPipeline);
-
- class GPUColorWrite {
- constructor() {
- webidl.illegalConstructor();
- }
-
- static get RED() {
- return 0x1;
- }
- static get GREEN() {
- return 0x2;
- }
- static get BLUE() {
- return 0x4;
- }
- static get ALPHA() {
- return 0x8;
- }
- static get ALL() {
- return 0xF;
- }
- }
-
- const _encoders = Symbol("[[encoders]]");
-
- /**
- * @param {string | null} label
- * @param {InnerGPUDevice} device
- * @param {number} rid
- * @returns {GPUCommandEncoder}
- */
- function createGPUCommandEncoder(label, device, rid) {
- /** @type {GPUCommandEncoder} */
- const encoder = webidl.createBranded(GPUCommandEncoder);
- encoder[_label] = label;
- encoder[_device] = device;
- encoder[_rid] = rid;
- encoder[_encoders] = [];
- return encoder;
- }
- class GPUCommandEncoder {
- /** @type {InnerGPUDevice} */
- [_device];
- /** @type {number | undefined} */
- [_rid];
- /** @type {WeakRef<GPURenderPassEncoder | GPUComputePassEncoder>[]} */
- [_encoders];
-
- [_cleanup]() {
- const encoders = this[_encoders];
- while (encoders.length > 0) {
- const encoder = encoders.pop()?.deref();
- if (encoder) {
- encoder[_cleanup]();
- }
- }
- const rid = this[_rid];
- if (rid !== undefined) {
- core.close(rid);
- /** @type {number | undefined} */
- this[_rid] = undefined;
- }
- }
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- /**
- * @param {GPURenderPassDescriptor} descriptor
- * @return {GPURenderPassEncoder}
- */
- beginRenderPass(descriptor) {
- webidl.assertBranded(this, GPUCommandEncoder);
- const prefix =
- "Failed to execute 'beginRenderPass' on 'GPUCommandEncoder'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- descriptor = webidl.converters.GPURenderPassDescriptor(descriptor, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const commandEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
-
- if (this[_rid] === undefined) {
- throw new DOMException(
- "Failed to execute 'beginRenderPass' on 'GPUCommandEncoder': already consumed",
- "OperationError",
- );
- }
-
- let depthStencilAttachment;
- if (descriptor.depthStencilAttachment) {
- const view = assertResource(descriptor.depthStencilAttachment.view, {
- prefix,
- context: "texture view for depth stencil attachment",
- });
- assertDeviceMatch(
- device,
- descriptor.depthStencilAttachment.view[_texture],
- {
- prefix,
- resourceContext: "texture view for depth stencil attachment",
- selfContext: "this",
- },
- );
-
- depthStencilAttachment = {
- ...descriptor.depthStencilAttachment,
- view,
- };
-
- if (
- typeof descriptor.depthStencilAttachment.depthLoadValue === "string"
- ) {
- depthStencilAttachment.depthLoadOp =
- descriptor.depthStencilAttachment.depthLoadValue;
- } else {
- depthStencilAttachment.depthLoadOp = "clear";
- depthStencilAttachment.depthLoadValue =
- descriptor.depthStencilAttachment.depthLoadValue;
- }
-
- if (
- typeof descriptor.depthStencilAttachment.stencilLoadValue === "string"
- ) {
- depthStencilAttachment.stencilLoadOp =
- descriptor.depthStencilAttachment.stencilLoadValue;
- depthStencilAttachment.stencilLoadValue = undefined;
- } else {
- depthStencilAttachment.stencilLoadOp = "clear";
- depthStencilAttachment.stencilLoadValue =
- descriptor.depthStencilAttachment.stencilLoadValue;
- }
- }
- const colorAttachments = descriptor.colorAttachments.map(
- (colorAttachment, i) => {
- const context = `color attachment ${i + 1}`;
- const view = assertResource(colorAttachment.view, {
- prefix,
- context: `texture view for ${context}`,
- });
- assertResource(colorAttachment.view[_texture], {
- prefix,
- context: `texture backing texture view for ${context}`,
- });
- assertDeviceMatch(
- device,
- colorAttachment.view[_texture],
- {
- prefix,
- resourceContext: `texture view for ${context}`,
- selfContext: "this",
- },
- );
- let resolveTarget;
- if (colorAttachment.resolveTarget) {
- resolveTarget = assertResource(
- colorAttachment.resolveTarget,
- {
- prefix,
- context: `resolve target texture view for ${context}`,
- },
- );
- assertResource(colorAttachment.resolveTarget[_texture], {
- prefix,
- context:
- `texture backing resolve target texture view for ${context}`,
- });
- assertDeviceMatch(
- device,
- colorAttachment.resolveTarget[_texture],
- {
- prefix,
- resourceContext: `resolve target texture view for ${context}`,
- selfContext: "this",
- },
- );
- }
- const attachment = {
- view: view,
- resolveTarget,
- storeOp: colorAttachment.storeOp,
- };
-
- if (typeof colorAttachment.loadValue === "string") {
- attachment.loadOp = colorAttachment.loadValue;
- } else {
- attachment.loadOp = "clear";
- attachment.loadValue = normalizeGPUColor(
- colorAttachment.loadValue,
- );
- }
-
- return attachment;
- },
- );
-
- const { rid } = core.opSync(
- "op_webgpu_command_encoder_begin_render_pass",
- {
- commandEncoderRid,
- ...descriptor,
- colorAttachments,
- depthStencilAttachment,
- },
- );
-
- const renderPassEncoder = createGPURenderPassEncoder(
- descriptor.label ?? null,
- this,
- rid,
- );
- this[_encoders].push(new WeakRef(renderPassEncoder));
- return renderPassEncoder;
- }
-
- /**
- * @param {GPUComputePassDescriptor} descriptor
- */
- beginComputePass(descriptor = {}) {
- webidl.assertBranded(this, GPUCommandEncoder);
- const prefix =
- "Failed to execute 'beginComputePass' on 'GPUCommandEncoder'";
- descriptor = webidl.converters.GPUComputePassDescriptor(descriptor, {
- prefix,
- context: "Argument 1",
- });
-
- assertDevice(this, { prefix, context: "this" });
- const commandEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
-
- const { rid } = core.opSync(
- "op_webgpu_command_encoder_begin_compute_pass",
- {
- commandEncoderRid,
- ...descriptor,
- },
- );
-
- const computePassEncoder = createGPUComputePassEncoder(
- descriptor.label ?? null,
- this,
- rid,
- );
- this[_encoders].push(new WeakRef(computePassEncoder));
- return computePassEncoder;
- }
-
- /**
- * @param {GPUBuffer} source
- * @param {number} sourceOffset
- * @param {GPUBuffer} destination
- * @param {number} destinationOffset
- * @param {number} size
- */
- copyBufferToBuffer(
- source,
- sourceOffset,
- destination,
- destinationOffset,
- size,
- ) {
- webidl.assertBranded(this, GPUCommandEncoder);
- const prefix =
- "Failed to execute 'copyBufferToBuffer' on 'GPUCommandEncoder'";
- webidl.requiredArguments(arguments.length, 5, { prefix });
- source = webidl.converters.GPUBuffer(source, {
- prefix,
- context: "Argument 1",
- });
- sourceOffset = webidl.converters.GPUSize64(sourceOffset, {
- prefix,
- context: "Argument 2",
- });
- destination = webidl.converters.GPUBuffer(destination, {
- prefix,
- context: "Argument 3",
- });
- destinationOffset = webidl.converters.GPUSize64(destinationOffset, {
- prefix,
- context: "Argument 4",
- });
- size = webidl.converters.GPUSize64(size, {
- prefix,
- context: "Argument 5",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const commandEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- const sourceRid = assertResource(source, {
- prefix,
- context: "Argument 1",
- });
- assertDeviceMatch(device, source, {
- prefix,
- resourceContext: "Argument 1",
- selfContext: "this",
- });
- const destinationRid = assertResource(destination, {
- prefix,
- context: "Argument 3",
- });
- assertDeviceMatch(device, destination, {
- prefix,
- resourceContext: "Argument 3",
- selfContext: "this",
- });
-
- const { err } = core.opSync(
- "op_webgpu_command_encoder_copy_buffer_to_buffer",
- {
- commandEncoderRid,
- source: sourceRid,
- sourceOffset,
- destination: destinationRid,
- destinationOffset,
- size,
- },
- );
- device.pushError(err);
- }
-
- /**
- * @param {GPUImageCopyBuffer} source
- * @param {GPUImageCopyTexture} destination
- * @param {GPUExtent3D} copySize
- */
- copyBufferToTexture(source, destination, copySize) {
- webidl.assertBranded(this, GPUCommandEncoder);
- const prefix =
- "Failed to execute 'copyBufferToTexture' on 'GPUCommandEncoder'";
- webidl.requiredArguments(arguments.length, 3, { prefix });
- source = webidl.converters.GPUImageCopyBuffer(source, {
- prefix,
- context: "Argument 1",
- });
- destination = webidl.converters.GPUImageCopyTexture(destination, {
- prefix,
- context: "Argument 2",
- });
- copySize = webidl.converters.GPUExtent3D(copySize, {
- prefix,
- context: "Argument 3",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const commandEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- const sourceBufferRid = assertResource(source.buffer, {
- prefix,
- context: "source in Argument 1",
- });
- assertDeviceMatch(device, source.buffer, {
- prefix,
- resourceContext: "source in Argument 1",
- selfContext: "this",
- });
- const destinationTextureRid = assertResource(destination.texture, {
- prefix,
- context: "texture in Argument 2",
- });
- assertDeviceMatch(device, destination.texture, {
- prefix,
- resourceContext: "texture in Argument 2",
- selfContext: "this",
- });
-
- const { err } = core.opSync(
- "op_webgpu_command_encoder_copy_buffer_to_texture",
- {
- commandEncoderRid,
- source: {
- ...source,
- buffer: sourceBufferRid,
- },
- destination: {
- texture: destinationTextureRid,
- mipLevel: destination.mipLevel,
- origin: destination.origin
- ? normalizeGPUOrigin3D(destination.origin)
- : undefined,
- },
- copySize: normalizeGPUExtent3D(copySize),
- },
- );
- device.pushError(err);
- }
-
- /**
- * @param {GPUImageCopyTexture} source
- * @param {GPUImageCopyBuffer} destination
- * @param {GPUExtent3D} copySize
- */
- copyTextureToBuffer(source, destination, copySize) {
- webidl.assertBranded(this, GPUCommandEncoder);
- const prefix =
- "Failed to execute 'copyTextureToBuffer' on 'GPUCommandEncoder'";
- webidl.requiredArguments(arguments.length, 3, { prefix });
- source = webidl.converters.GPUImageCopyTexture(source, {
- prefix,
- context: "Argument 1",
- });
- destination = webidl.converters.GPUImageCopyBuffer(destination, {
- prefix,
- context: "Argument 2",
- });
- copySize = webidl.converters.GPUExtent3D(copySize, {
- prefix,
- context: "Argument 3",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const commandEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- const sourceTextureRid = assertResource(source.texture, {
- prefix,
- context: "texture in Argument 1",
- });
- assertDeviceMatch(device, source.texture, {
- prefix,
- resourceContext: "texture in Argument 1",
- selfContext: "this",
- });
- const destinationBufferRid = assertResource(destination.buffer, {
- prefix,
- context: "buffer in Argument 2",
- });
- assertDeviceMatch(device, destination.buffer, {
- prefix,
- resourceContext: "buffer in Argument 2",
- selfContext: "this",
- });
- const { err } = core.opSync(
- "op_webgpu_command_encoder_copy_texture_to_buffer",
- {
- commandEncoderRid,
- source: {
- texture: sourceTextureRid,
- mipLevel: source.mipLevel,
- origin: source.origin
- ? normalizeGPUOrigin3D(source.origin)
- : undefined,
- },
- destination: {
- ...destination,
- buffer: destinationBufferRid,
- },
- copySize: normalizeGPUExtent3D(copySize),
- },
- );
- device.pushError(err);
- }
-
- /**
- * @param {GPUImageCopyTexture} source
- * @param {GPUImageCopyTexture} destination
- * @param {GPUExtent3D} copySize
- */
- copyTextureToTexture(source, destination, copySize) {
- webidl.assertBranded(this, GPUCommandEncoder);
- const prefix =
- "Failed to execute 'copyTextureToTexture' on 'GPUCommandEncoder'";
- webidl.requiredArguments(arguments.length, 3, { prefix });
- source = webidl.converters.GPUImageCopyTexture(source, {
- prefix,
- context: "Argument 1",
- });
- destination = webidl.converters.GPUImageCopyTexture(destination, {
- prefix,
- context: "Argument 2",
- });
- copySize = webidl.converters.GPUExtent3D(copySize, {
- prefix,
- context: "Argument 3",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const commandEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- const sourceTextureRid = assertResource(source.texture, {
- prefix,
- context: "texture in Argument 1",
- });
- assertDeviceMatch(device, source.texture, {
- prefix,
- resourceContext: "texture in Argument 1",
- selfContext: "this",
- });
- const destinationTextureRid = assertResource(destination.texture, {
- prefix,
- context: "texture in Argument 2",
- });
- assertDeviceMatch(device, destination.texture, {
- prefix,
- resourceContext: "texture in Argument 2",
- selfContext: "this",
- });
- const { err } = core.opSync(
- "op_webgpu_command_encoder_copy_texture_to_texture",
- {
- commandEncoderRid,
- source: {
- texture: sourceTextureRid,
- mipLevel: source.mipLevel,
- origin: source.origin
- ? normalizeGPUOrigin3D(source.origin)
- : undefined,
- },
- destination: {
- texture: destinationTextureRid,
- mipLevel: destination.mipLevel,
- origin: destination.origin
- ? normalizeGPUOrigin3D(destination.origin)
- : undefined,
- },
- copySize: normalizeGPUExtent3D(copySize),
- },
- );
- device.pushError(err);
- }
-
- /**
- * @param {string} groupLabel
- */
- pushDebugGroup(groupLabel) {
- webidl.assertBranded(this, GPUCommandEncoder);
- const prefix =
- "Failed to execute 'pushDebugGroup' on 'GPUCommandEncoder'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- groupLabel = webidl.converters.USVString(groupLabel, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const commandEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- const { err } = core.opSync(
- "op_webgpu_command_encoder_push_debug_group",
- {
- commandEncoderRid,
- groupLabel,
- },
- );
- device.pushError(err);
- }
-
- popDebugGroup() {
- webidl.assertBranded(this, GPUCommandEncoder);
- const prefix = "Failed to execute 'popDebugGroup' on 'GPUCommandEncoder'";
- const device = assertDevice(this, { prefix, context: "this" });
- const commandEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- const { err } = core.opSync(
- "op_webgpu_command_encoder_pop_debug_group",
- {
- commandEncoderRid,
- },
- );
- device.pushError(err);
- }
-
- /**
- * @param {string} markerLabel
- */
- insertDebugMarker(markerLabel) {
- webidl.assertBranded(this, GPUCommandEncoder);
- const prefix =
- "Failed to execute 'insertDebugMarker' on 'GPUCommandEncoder'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- markerLabel = webidl.converters.USVString(markerLabel, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const commandEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- const { err } = core.opSync(
- "op_webgpu_command_encoder_insert_debug_marker",
- {
- commandEncoderRid,
- markerLabel,
- },
- );
- device.pushError(err);
- }
-
- /**
- * @param {GPUQuerySet} querySet
- * @param {number} queryIndex
- */
- writeTimestamp(querySet, queryIndex) {
- webidl.assertBranded(this, GPUCommandEncoder);
- const prefix =
- "Failed to execute 'writeTimestamp' on 'GPUCommandEncoder'";
- webidl.requiredArguments(arguments.length, 2, { prefix });
- querySet = webidl.converters.GPUQuerySet(querySet, {
- prefix,
- context: "Argument 1",
- });
- queryIndex = webidl.converters.GPUSize32(queryIndex, {
- prefix,
- context: "Argument 2",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const commandEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- const querySetRid = assertResource(querySet, {
- prefix,
- context: "Argument 1",
- });
- assertDeviceMatch(device, querySet, {
- prefix,
- resourceContext: "Argument 1",
- selfContext: "this",
- });
- const { err } = core.opSync(
- "op_webgpu_command_encoder_write_timestamp",
- {
- commandEncoderRid,
- querySet: querySetRid,
- queryIndex,
- },
- );
- device.pushError(err);
- }
-
- /**
- * @param {GPUQuerySet} querySet
- * @param {number} firstQuery
- * @param {number} queryCount
- * @param {GPUBuffer} destination
- * @param {number} destinationOffset
- */
- resolveQuerySet(
- querySet,
- firstQuery,
- queryCount,
- destination,
- destinationOffset,
- ) {
- webidl.assertBranded(this, GPUCommandEncoder);
- const prefix =
- "Failed to execute 'resolveQuerySet' on 'GPUCommandEncoder'";
- webidl.requiredArguments(arguments.length, 5, { prefix });
- querySet = webidl.converters.GPUQuerySet(querySet, {
- prefix,
- context: "Argument 1",
- });
- firstQuery = webidl.converters.GPUSize32(firstQuery, {
- prefix,
- context: "Argument 2",
- });
- queryCount = webidl.converters.GPUSize32(queryCount, {
- prefix,
- context: "Argument 3",
- });
- destination = webidl.converters.GPUQuerySet(destination, {
- prefix,
- context: "Argument 4",
- });
- destinationOffset = webidl.converters.GPUSize64(destinationOffset, {
- prefix,
- context: "Argument 5",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const commandEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- const querySetRid = assertResource(querySet, {
- prefix,
- context: "Argument 1",
- });
- assertDeviceMatch(device, querySet, {
- prefix,
- resourceContext: "Argument 1",
- selfContext: "this",
- });
- const destinationRid = assertResource(destination, {
- prefix,
- context: "Argument 3",
- });
- assertDeviceMatch(device, destination, {
- prefix,
- resourceContext: "Argument 3",
- selfContext: "this",
- });
- const { err } = core.opSync(
- "op_webgpu_command_encoder_resolve_query_set",
- {
- commandEncoderRid,
- querySet: querySetRid,
- firstQuery,
- queryCount,
- destination: destinationRid,
- destinationOffset,
- },
- );
- device.pushError(err);
- }
-
- /**
- * @param {GPUCommandBufferDescriptor} descriptor
- * @returns {GPUCommandBuffer}
- */
- finish(descriptor = {}) {
- webidl.assertBranded(this, GPUCommandEncoder);
- const prefix = "Failed to execute 'finish' on 'GPUCommandEncoder'";
- descriptor = webidl.converters.GPUCommandBufferDescriptor(descriptor, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const commandEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- const { rid, err } = core.opSync("op_webgpu_command_encoder_finish", {
- commandEncoderRid,
- ...descriptor,
- });
- device.pushError(err);
- /** @type {number | undefined} */
- this[_rid] = undefined;
-
- const commandBuffer = createGPUCommandBuffer(
- descriptor.label ?? null,
- device,
- rid,
- );
- device.trackResource((commandBuffer));
- return commandBuffer;
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- label: this.label,
- })
- }`;
- }
- }
- GPUObjectBaseMixin("GPUCommandEncoder", GPUCommandEncoder);
-
- const _encoder = Symbol("[[encoder]]");
-
- /**
- * @param {string | null} label
- * @param {GPUCommandEncoder} encoder
- * @param {number} rid
- * @returns {GPURenderPassEncoder}
- */
- function createGPURenderPassEncoder(label, encoder, rid) {
- /** @type {GPURenderPassEncoder} */
- const passEncoder = webidl.createBranded(GPURenderPassEncoder);
- passEncoder[_label] = label;
- passEncoder[_encoder] = encoder;
- passEncoder[_rid] = rid;
- return passEncoder;
- }
-
- class GPURenderPassEncoder {
- /** @type {GPUCommandEncoder} */
- [_encoder];
- /** @type {number | undefined} */
- [_rid];
-
- [_cleanup]() {
- const rid = this[_rid];
- if (rid !== undefined) {
- core.close(rid);
- /** @type {number | undefined} */
- this[_rid] = undefined;
- }
- }
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- /**
- * @param {number} x
- * @param {number} y
- * @param {number} width
- * @param {number} height
- * @param {number} minDepth
- * @param {number} maxDepth
- */
- setViewport(x, y, width, height, minDepth, maxDepth) {
- webidl.assertBranded(this, GPURenderPassEncoder);
- const prefix =
- "Failed to execute 'setViewport' on 'GPUComputePassEncoder'";
- webidl.requiredArguments(arguments.length, 6, { prefix });
- x = webidl.converters.float(x, { prefix, context: "Argument 1" });
- y = webidl.converters.float(y, { prefix, context: "Argument 2" });
- width = webidl.converters.float(width, { prefix, context: "Argument 3" });
- height = webidl.converters.float(height, {
- prefix,
- context: "Argument 4",
- });
- minDepth = webidl.converters.float(minDepth, {
- prefix,
- context: "Argument 5",
- });
- maxDepth = webidl.converters.float(maxDepth, {
- prefix,
- context: "Argument 6",
- });
- assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const renderPassRid = assertResource(this, { prefix, context: "this" });
- core.opSync("op_webgpu_render_pass_set_viewport", {
- renderPassRid,
- x,
- y,
- width,
- height,
- minDepth,
- maxDepth,
- });
- }
-
- /**
- *
- * @param {number} x
- * @param {number} y
- * @param {number} width
- * @param {number} height
- */
- setScissorRect(x, y, width, height) {
- webidl.assertBranded(this, GPURenderPassEncoder);
- const prefix =
- "Failed to execute 'setScissorRect' on 'GPUComputePassEncoder'";
- webidl.requiredArguments(arguments.length, 4, { prefix });
- x = webidl.converters.GPUIntegerCoordinate(x, {
- prefix,
- context: "Argument 1",
- });
- y = webidl.converters.GPUIntegerCoordinate(y, {
- prefix,
- context: "Argument 2",
- });
- width = webidl.converters.GPUIntegerCoordinate(width, {
- prefix,
- context: "Argument 3",
- });
- height = webidl.converters.GPUIntegerCoordinate(height, {
- prefix,
- context: "Argument 4",
- });
- assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const renderPassRid = assertResource(this, { prefix, context: "this" });
- core.opSync("op_webgpu_render_pass_set_scissor_rect", {
- renderPassRid,
- x,
- y,
- width,
- height,
- });
- }
-
- /**
- * @param {GPUColor} color
- */
- setBlendColor(color) {
- webidl.assertBranded(this, GPURenderPassEncoder);
- const prefix =
- "Failed to execute 'setBlendColor' on 'GPUComputePassEncoder'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- color = webidl.converters.GPUColor(color, {
- prefix,
- context: "Argument 1",
- });
- assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const renderPassRid = assertResource(this, { prefix, context: "this" });
- core.opSync("op_webgpu_render_pass_set_blend_color", {
- renderPassRid,
- color: normalizeGPUColor(color),
- });
- }
-
- /**
- * @param {number} reference
- */
- setStencilReference(reference) {
- webidl.assertBranded(this, GPURenderPassEncoder);
- const prefix =
- "Failed to execute 'setStencilReference' on 'GPUComputePassEncoder'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- reference = webidl.converters.GPUStencilValue(reference, {
- prefix,
- context: "Argument 1",
- });
- assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const renderPassRid = assertResource(this, { prefix, context: "this" });
- core.opSync("op_webgpu_render_pass_set_stencil_reference", {
- renderPassRid,
- reference,
- });
- }
-
- beginOcclusionQuery(_queryIndex) {
- throw new Error("Not yet implemented");
- }
-
- endOcclusionQuery() {
- throw new Error("Not yet implemented");
- }
-
- /**
- * @param {GPUQuerySet} querySet
- * @param {number} queryIndex
- */
- beginPipelineStatisticsQuery(querySet, queryIndex) {
- webidl.assertBranded(this, GPURenderPassEncoder);
- const prefix =
- "Failed to execute 'beginPipelineStatisticsQuery' on 'GPURenderPassEncoder'";
- webidl.requiredArguments(arguments.length, 2, { prefix });
- querySet = webidl.converters.GPUQuerySet(querySet, {
- prefix,
- context: "Argument 1",
- });
- queryIndex = webidl.converters.GPUSize32(queryIndex, {
- prefix,
- context: "Argument 2",
- });
- const device = assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const renderPassRid = assertResource(this, { prefix, context: "this" });
- const querySetRid = assertResource(querySet, {
- prefix,
- context: "Argument 1",
- });
- assertDeviceMatch(device, querySet, {
- prefix,
- resourceContext: "Argument 1",
- selfContext: "this",
- });
- core.opSync("op_webgpu_render_pass_begin_pipeline_statistics_query", {
- renderPassRid,
- querySet: querySetRid,
- queryIndex,
- });
- }
-
- endPipelineStatisticsQuery() {
- webidl.assertBranded(this, GPURenderPassEncoder);
- const prefix =
- "Failed to execute 'endPipelineStatisticsQuery' on 'GPURenderPassEncoder'";
- assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const renderPassRid = assertResource(this, { prefix, context: "this" });
- core.opSync("op_webgpu_render_pass_end_pipeline_statistics_query", {
- renderPassRid,
- });
- }
-
- /**
- * @param {GPUQuerySet} querySet
- * @param {number} queryIndex
- */
- writeTimestamp(querySet, queryIndex) {
- webidl.assertBranded(this, GPURenderPassEncoder);
- const prefix =
- "Failed to execute 'writeTimestamp' on 'GPURenderPassEncoder'";
- webidl.requiredArguments(arguments.length, 2, { prefix });
- querySet = webidl.converters.GPUQuerySet(querySet, {
- prefix,
- context: "Argument 1",
- });
- queryIndex = webidl.converters.GPUSize32(queryIndex, {
- prefix,
- context: "Argument 2",
- });
- const device = assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const renderPassRid = assertResource(this, { prefix, context: "this" });
- const querySetRid = assertResource(querySet, {
- prefix,
- context: "Argument 1",
- });
- assertDeviceMatch(device, querySet, {
- prefix,
- resourceContext: "Argument 1",
- selfContext: "this",
- });
- core.opSync("op_webgpu_render_pass_write_timestamp", {
- renderPassRid,
- querySet: querySetRid,
- queryIndex,
- });
- }
-
- /**
- * @param {GPURenderBundle[]} bundles
- */
- executeBundles(bundles) {
- webidl.assertBranded(this, GPURenderPassEncoder);
- const prefix =
- "Failed to execute 'executeBundles' on 'GPURenderPassEncoder'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- bundles = webidl.converters["sequence<GPURenderBundle>"](bundles, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const renderPassRid = assertResource(this, { prefix, context: "this" });
- const bundleRids = bundles.map((bundle, i) => {
- const context = `bundle ${i + 1}`;
- const rid = assertResource(bundle, { prefix, context });
- assertDeviceMatch(device, bundle, {
- prefix,
- resourceContext: context,
- selfContext: "this",
- });
- return rid;
- });
- core.opSync("op_webgpu_render_pass_execute_bundles", {
- renderPassRid,
- bundles: bundleRids,
- });
- }
-
- endPass() {
- webidl.assertBranded(this, GPURenderPassEncoder);
- const prefix = "Failed to execute 'endPass' on 'GPURenderPassEncoder'";
- const device = assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const commandEncoderRid = assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const renderPassRid = assertResource(this, { prefix, context: "this" });
- const { err } = core.opSync("op_webgpu_render_pass_end_pass", {
- commandEncoderRid,
- renderPassRid,
- });
- device.pushError(err);
- this[_rid] = undefined;
- }
-
- // TODO(lucacasonato): has an overload
- setBindGroup(
- index,
- bindGroup,
- dynamicOffsetsData,
- dynamicOffsetsDataStart,
- dynamicOffsetsDataLength,
- ) {
- webidl.assertBranded(this, GPURenderPassEncoder);
- const prefix =
- "Failed to execute 'setBindGroup' on 'GPURenderPassEncoder'";
- const device = assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const renderPassRid = assertResource(this, { prefix, context: "this" });
- const bindGroupRid = assertResource(bindGroup, {
- prefix,
- context: "Argument 2",
- });
- assertDeviceMatch(device, bindGroup, {
- prefix,
- resourceContext: "Argument 2",
- selfContext: "this",
- });
- if (dynamicOffsetsData instanceof Uint32Array) {
- core.opSync(
- "op_webgpu_render_pass_set_bind_group",
- {
- renderPassRid,
- index,
- bindGroup: bindGroupRid,
- dynamicOffsetsDataStart,
- dynamicOffsetsDataLength,
- },
- dynamicOffsetsData,
- );
- } else {
- dynamicOffsetsData ??= [];
- core.opSync("op_webgpu_render_pass_set_bind_group", {
- renderPassRid,
- index,
- bindGroup: bindGroupRid,
- dynamicOffsetsData,
- dynamicOffsetsDataStart: 0,
- dynamicOffsetsDataLength: dynamicOffsetsData.length,
- });
- }
- }
-
- /**
- * @param {string} groupLabel
- */
- pushDebugGroup(groupLabel) {
- webidl.assertBranded(this, GPURenderPassEncoder);
- const prefix =
- "Failed to execute 'pushDebugGroup' on 'GPURenderPassEncoder'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- groupLabel = webidl.converters.USVString(groupLabel, {
- prefix,
- context: "Argument 1",
- });
- assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const renderPassRid = assertResource(this, { prefix, context: "this" });
- core.opSync("op_webgpu_render_pass_push_debug_group", {
- renderPassRid,
- groupLabel,
- });
- }
-
- popDebugGroup() {
- webidl.assertBranded(this, GPURenderPassEncoder);
- const prefix =
- "Failed to execute 'popDebugGroup' on 'GPURenderPassEncoder'";
- assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const renderPassRid = assertResource(this, { prefix, context: "this" });
- core.opSync("op_webgpu_render_pass_pop_debug_group", {
- renderPassRid,
- });
- }
-
- /**
- * @param {string} markerLabel
- */
- insertDebugMarker(markerLabel) {
- webidl.assertBranded(this, GPURenderPassEncoder);
- const prefix =
- "Failed to execute 'insertDebugMarker' on 'GPURenderPassEncoder'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- markerLabel = webidl.converters.USVString(markerLabel, {
- prefix,
- context: "Argument 1",
- });
- assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const renderPassRid = assertResource(this, { prefix, context: "this" });
- core.opSync("op_webgpu_render_pass_insert_debug_marker", {
- renderPassRid,
- markerLabel,
- });
- }
-
- /**
- * @param {GPURenderPipeline} pipeline
- */
- setPipeline(pipeline) {
- webidl.assertBranded(this, GPURenderPassEncoder);
- const prefix =
- "Failed to execute 'setPipeline' on 'GPURenderPassEncoder'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- pipeline = webidl.converters.GPURenderPipeline(pipeline, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const renderPassRid = assertResource(this, { prefix, context: "this" });
- const pipelineRid = assertResource(pipeline, {
- prefix,
- context: "Argument 1",
- });
- assertDeviceMatch(device, pipeline, {
- prefix,
- resourceContext: "Argument 1",
- selfContext: "this",
- });
- core.opSync("op_webgpu_render_pass_set_pipeline", {
- renderPassRid,
- pipeline: pipelineRid,
- });
- }
-
- /**
- * @param {GPUBuffer} buffer
- * @param {GPUIndexFormat} indexFormat
- * @param {number} offset
- * @param {number} size
- */
- setIndexBuffer(buffer, indexFormat, offset = 0, size = 0) {
- webidl.assertBranded(this, GPURenderPassEncoder);
- const prefix =
- "Failed to execute 'setIndexBuffer' on 'GPURenderPassEncoder'";
- webidl.requiredArguments(arguments.length, 2, { prefix });
- buffer = webidl.converters.GPUBuffer(buffer, {
- prefix,
- context: "Argument 1",
- });
- indexFormat = webidl.converters.GPUIndexFormat(indexFormat, {
- prefix,
- context: "Argument 2",
- });
- offset = webidl.converters.GPUSize64(offset, {
- prefix,
- context: "Argument 3",
- });
- size = webidl.converters.GPUSize64(size, {
- prefix,
- context: "Argument 4",
- });
- const device = assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const renderPassRid = assertResource(this, { prefix, context: "this" });
- const bufferRid = assertResource(buffer, {
- prefix,
- context: "Argument 1",
- });
- assertDeviceMatch(device, buffer, {
- prefix,
- resourceContext: "Argument 1",
- selfContext: "this",
- });
- core.opSync("op_webgpu_render_pass_set_index_buffer", {
- renderPassRid,
- buffer: bufferRid,
- indexFormat,
- offset,
- size,
- });
- }
-
- /**
- * @param {number} slot
- * @param {GPUBuffer} buffer
- * @param {number} offset
- * @param {number} size
- */
- setVertexBuffer(slot, buffer, offset = 0, size = 0) {
- webidl.assertBranded(this, GPURenderPassEncoder);
- const prefix =
- "Failed to execute 'setVertexBuffer' on 'GPURenderPassEncoder'";
- webidl.requiredArguments(arguments.length, 2, { prefix });
- slot = webidl.converters.GPUSize32(slot, {
- prefix,
- context: "Argument 2",
- });
- buffer = webidl.converters.GPUBuffer(buffer, {
- prefix,
- context: "Argument 2",
- });
- offset = webidl.converters.GPUSize64(offset, {
- prefix,
- context: "Argument 3",
- });
- size = webidl.converters.GPUSize64(size, {
- prefix,
- context: "Argument 4",
- });
- const device = assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const renderPassRid = assertResource(this, { prefix, context: "this" });
- const bufferRid = assertResource(buffer, {
- prefix,
- context: "Argument 2",
- });
- assertDeviceMatch(device, buffer, {
- prefix,
- resourceContext: "Argument 2",
- selfContext: "this",
- });
- core.opSync("op_webgpu_render_pass_set_vertex_buffer", {
- renderPassRid,
- slot,
- buffer: bufferRid,
- offset,
- size,
- });
- }
-
- /**
- * @param {number} vertexCount
- * @param {number} instanceCount
- * @param {number} firstVertex
- * @param {number} firstInstance
- */
- draw(vertexCount, instanceCount = 1, firstVertex = 0, firstInstance = 0) {
- webidl.assertBranded(this, GPURenderPassEncoder);
- const prefix = "Failed to execute 'draw' on 'GPURenderPassEncoder'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- vertexCount = webidl.converters.GPUSize32(vertexCount, {
- prefix,
- context: "Argument 1",
- });
- instanceCount = webidl.converters.GPUSize32(instanceCount, {
- prefix,
- context: "Argument 2",
- });
- firstVertex = webidl.converters.GPUSize32(firstVertex, {
- prefix,
- context: "Argument 3",
- });
- firstInstance = webidl.converters.GPUSize32(firstInstance, {
- prefix,
- context: "Argument 4",
- });
- assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const renderPassRid = assertResource(this, { prefix, context: "this" });
- core.opSync("op_webgpu_render_pass_draw", {
- renderPassRid,
- vertexCount,
- instanceCount,
- firstVertex,
- firstInstance,
- });
- }
-
- /**
- * @param {number} indexCount
- * @param {number} instanceCount
- * @param {number} firstIndex
- * @param {number} baseVertex
- * @param {number} firstInstance
- */
- drawIndexed(
- indexCount,
- instanceCount = 1,
- firstIndex = 0,
- baseVertex = 0,
- firstInstance = 0,
- ) {
- webidl.assertBranded(this, GPURenderPassEncoder);
- const prefix =
- "Failed to execute 'drawIndexed' on 'GPURenderPassEncoder'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- indexCount = webidl.converters.GPUSize32(indexCount, {
- prefix,
- context: "Argument 1",
- });
- instanceCount = webidl.converters.GPUSize32(instanceCount, {
- prefix,
- context: "Argument 2",
- });
- firstIndex = webidl.converters.GPUSize32(firstIndex, {
- prefix,
- context: "Argument 3",
- });
- baseVertex = webidl.converters.GPUSignedOffset32(baseVertex, {
- prefix,
- context: "Argument 4",
- });
- firstInstance = webidl.converters.GPUSize32(firstInstance, {
- prefix,
- context: "Argument 5",
- });
- assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const renderPassRid = assertResource(this, { prefix, context: "this" });
- core.opSync("op_webgpu_render_pass_draw_indexed", {
- renderPassRid,
- indexCount,
- instanceCount,
- firstIndex,
- baseVertex,
- firstInstance,
- });
- }
-
- /**
- * @param {GPUBuffer} indirectBuffer
- * @param {number} indirectOffset
- */
- drawIndirect(indirectBuffer, indirectOffset) {
- webidl.assertBranded(this, GPURenderPassEncoder);
- const prefix =
- "Failed to execute 'drawIndirect' on 'GPURenderPassEncoder'";
- webidl.requiredArguments(arguments.length, 2, { prefix });
- indirectBuffer = webidl.converters.GPUBuffer(indirectBuffer, {
- prefix,
- context: "Argument 1",
- });
- indirectOffset = webidl.converters.GPUSize64(indirectOffset, {
- prefix,
- context: "Argument 2",
- });
- const device = assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const renderPassRid = assertResource(this, { prefix, context: "this" });
- const indirectBufferRid = assertResource(indirectBuffer, {
- prefix,
- context: "Argument 1",
- });
- assertDeviceMatch(device, indirectBuffer, {
- prefix,
- resourceContext: "Argument 1",
- selfContext: "this",
- });
- core.opSync("op_webgpu_render_pass_draw_indirect", {
- renderPassRid,
- indirectBuffer: indirectBufferRid,
- indirectOffset,
- });
- }
-
- /**
- * @param {GPUBuffer} indirectBuffer
- * @param {number} indirectOffset
- */
- drawIndexedIndirect(indirectBuffer, indirectOffset) {
- webidl.assertBranded(this, GPURenderPassEncoder);
- const prefix =
- "Failed to execute 'drawIndirect' on 'GPURenderPassEncoder'";
- webidl.requiredArguments(arguments.length, 2, { prefix });
- indirectBuffer = webidl.converters.GPUBuffer(indirectBuffer, {
- prefix,
- context: "Argument 1",
- });
- indirectOffset = webidl.converters.GPUSize64(indirectOffset, {
- prefix,
- context: "Argument 2",
- });
- const device = assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const renderPassRid = assertResource(this, { prefix, context: "this" });
- const indirectBufferRid = assertResource(indirectBuffer, {
- prefix,
- context: "Argument 1",
- });
- assertDeviceMatch(device, indirectBuffer, {
- prefix,
- resourceContext: "Argument 1",
- selfContext: "this",
- });
- core.opSync("op_webgpu_render_pass_draw_indexed_indirect", {
- renderPassRid,
- indirectBuffer: indirectBufferRid,
- indirectOffset,
- });
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- label: this.label,
- })
- }`;
- }
- }
- GPUObjectBaseMixin("GPURenderPassEncoder", GPURenderPassEncoder);
-
- /**
- * @param {string | null} label
- * @param {GPUCommandEncoder} encoder
- * @param {number} rid
- * @returns {GPUComputePassEncoder}
- */
- function createGPUComputePassEncoder(label, encoder, rid) {
- /** @type {GPUComputePassEncoder} */
- const computePassEncoder = webidl.createBranded(GPUComputePassEncoder);
- computePassEncoder[_label] = label;
- computePassEncoder[_encoder] = encoder;
- computePassEncoder[_rid] = rid;
- return computePassEncoder;
- }
-
- class GPUComputePassEncoder {
- /** @type {GPUCommandEncoder} */
- [_encoder];
-
- /** @type {number | undefined} */
- [_rid];
-
- [_cleanup]() {
- const rid = this[_rid];
- if (rid !== undefined) {
- core.close(rid);
- /** @type {number | undefined} */
- this[_rid] = undefined;
- }
- }
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- /**
- * @param {GPUComputePipeline} pipeline
- */
- setPipeline(pipeline) {
- webidl.assertBranded(this, GPUComputePassEncoder);
- const prefix =
- "Failed to execute 'setPipeline' on 'GPUComputePassEncoder'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- pipeline = webidl.converters.GPUComputePipeline(pipeline, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const computePassRid = assertResource(this, { prefix, context: "this" });
- const pipelineRid = assertResource(pipeline, {
- prefix,
- context: "Argument 1",
- });
- assertDeviceMatch(device, pipeline, {
- prefix,
- resourceContext: "Argument 1",
- selfContext: "this",
- });
- core.opSync("op_webgpu_compute_pass_set_pipeline", {
- computePassRid,
- pipeline: pipelineRid,
- });
- }
-
- /**
- * @param {number} x
- * @param {number} y
- * @param {number} z
- */
- dispatch(x, y = 1, z = 1) {
- webidl.assertBranded(this, GPUComputePassEncoder);
- const prefix = "Failed to execute 'dispatch' on 'GPUComputePassEncoder'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- x = webidl.converters.GPUSize32(x, { prefix, context: "Argument 1" });
- y = webidl.converters.GPUSize32(y, { prefix, context: "Argument 2" });
- z = webidl.converters.GPUSize32(z, { prefix, context: "Argument 3" });
- assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const computePassRid = assertResource(this, { prefix, context: "this" });
- core.opSync("op_webgpu_compute_pass_dispatch", {
- computePassRid,
- x,
- y,
- z,
- });
- }
-
- /**
- * @param {GPUBuffer} indirectBuffer
- * @param {number} indirectOffset
- */
- dispatchIndirect(indirectBuffer, indirectOffset) {
- webidl.assertBranded(this, GPUComputePassEncoder);
- const prefix =
- "Failed to execute 'dispatchIndirect' on 'GPUComputePassEncoder'";
- webidl.requiredArguments(arguments.length, 2, { prefix });
- indirectBuffer = webidl.converters.GPUBuffer(indirectBuffer, {
- prefix,
- context: "Argument 1",
- });
- indirectOffset = webidl.converters.GPUSize64(indirectOffset, {
- prefix,
- context: "Argument 2",
- });
- const device = assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const computePassRid = assertResource(this, { prefix, context: "this" });
- const indirectBufferRid = assertResource(indirectBuffer, {
- prefix,
- context: "Argument 1",
- });
- assertDeviceMatch(device, indirectBuffer, {
- prefix,
- resourceContext: "Argument 1",
- selfContext: "this",
- });
- core.opSync("op_webgpu_compute_pass_dispatch_indirect", {
- computePassRid: computePassRid,
- indirectBuffer: indirectBufferRid,
- indirectOffset,
- });
- }
-
- /**
- * @param {GPUQuerySet} querySet
- * @param {number} queryIndex
- */
- beginPipelineStatisticsQuery(querySet, queryIndex) {
- webidl.assertBranded(this, GPUComputePassEncoder);
- const prefix =
- "Failed to execute 'beginPipelineStatisticsQuery' on 'GPUComputePassEncoder'";
- webidl.requiredArguments(arguments.length, 2, { prefix });
- querySet = webidl.converters.GPUQuerySet(querySet, {
- prefix,
- context: "Argument 1",
- });
- queryIndex = webidl.converters.GPUSize32(queryIndex, {
- prefix,
- context: "Argument 2",
- });
- const device = assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const computePassRid = assertResource(this, { prefix, context: "this" });
- const querySetRid = assertResource(querySet, {
- prefix,
- context: "Argument 1",
- });
- assertDeviceMatch(device, querySet, {
- prefix,
- resourceContext: "Argument 1",
- selfContext: "this",
- });
- core.opSync(
- "op_webgpu_compute_pass_begin_pipeline_statistics_query",
- {
- computePassRid,
- querySet: querySetRid,
- queryIndex,
- },
- );
- }
-
- endPipelineStatisticsQuery() {
- webidl.assertBranded(this, GPUComputePassEncoder);
- const prefix =
- "Failed to execute 'endPipelineStatisticsQuery' on 'GPUComputePassEncoder'";
- assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const computePassRid = assertResource(this, { prefix, context: "this" });
- core.opSync("op_webgpu_compute_pass_end_pipeline_statistics_query", {
- computePassRid,
- });
- }
-
- /**
- * @param {GPUQuerySet} querySet
- * @param {number} queryIndex
- */
- writeTimestamp(querySet, queryIndex) {
- webidl.assertBranded(this, GPUComputePassEncoder);
- const prefix =
- "Failed to execute 'writeTimestamp' on 'GPUComputePassEncoder'";
- webidl.requiredArguments(arguments.length, 2, { prefix });
- querySet = webidl.converters.GPUQuerySet(querySet, {
- prefix,
- context: "Argument 1",
- });
- queryIndex = webidl.converters.GPUSize32(queryIndex, {
- prefix,
- context: "Argument 2",
- });
- const device = assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const computePassRid = assertResource(this, { prefix, context: "this" });
- const querySetRid = assertResource(querySet, {
- prefix,
- context: "Argument 1",
- });
- assertDeviceMatch(device, querySet, {
- prefix,
- resourceContext: "Argument 1",
- selfContext: "this",
- });
- core.opSync("op_webgpu_compute_pass_write_timestamp", {
- computePassRid,
- querySet: querySetRid,
- queryIndex,
- });
- }
-
- endPass() {
- webidl.assertBranded(this, GPUComputePassEncoder);
- const prefix = "Failed to execute 'endPass' on 'GPUComputePassEncoder'";
- const device = assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const commandEncoderRid = assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const computePassRid = assertResource(this, { prefix, context: "this" });
- const { err } = core.opSync("op_webgpu_compute_pass_end_pass", {
- commandEncoderRid,
- computePassRid,
- });
- device.pushError(err);
- this[_rid] = undefined;
- }
-
- // TODO(lucacasonato): has an overload
- setBindGroup(
- index,
- bindGroup,
- dynamicOffsetsData,
- dynamicOffsetsDataStart,
- dynamicOffsetsDataLength,
- ) {
- webidl.assertBranded(this, GPUComputePassEncoder);
- const prefix =
- "Failed to execute 'setBindGroup' on 'GPUComputePassEncoder'";
- const device = assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const computePassRid = assertResource(this, { prefix, context: "this" });
- const bindGroupRid = assertResource(bindGroup, {
- prefix,
- context: "Argument 2",
- });
- assertDeviceMatch(device, bindGroup, {
- prefix,
- resourceContext: "Argument 2",
- selfContext: "this",
- });
- if (dynamicOffsetsData instanceof Uint32Array) {
- core.opSync(
- "op_webgpu_compute_pass_set_bind_group",
- {
- computePassRid,
- index,
- bindGroup: bindGroupRid,
- dynamicOffsetsDataStart,
- dynamicOffsetsDataLength,
- },
- dynamicOffsetsData,
- );
- } else {
- dynamicOffsetsData ??= [];
- core.opSync("op_webgpu_compute_pass_set_bind_group", {
- computePassRid,
- index,
- bindGroup: bindGroupRid,
- dynamicOffsetsData,
- dynamicOffsetsDataStart: 0,
- dynamicOffsetsDataLength: dynamicOffsetsData.length,
- });
- }
- }
-
- /**
- * @param {string} groupLabel
- */
- pushDebugGroup(groupLabel) {
- webidl.assertBranded(this, GPUComputePassEncoder);
- const prefix =
- "Failed to execute 'pushDebugGroup' on 'GPUComputePassEncoder'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- groupLabel = webidl.converters.USVString(groupLabel, {
- prefix,
- context: "Argument 1",
- });
- assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const computePassRid = assertResource(this, { prefix, context: "this" });
- core.opSync("op_webgpu_compute_pass_push_debug_group", {
- computePassRid,
- groupLabel,
- });
- }
-
- popDebugGroup() {
- webidl.assertBranded(this, GPUComputePassEncoder);
- const prefix =
- "Failed to execute 'popDebugGroup' on 'GPUComputePassEncoder'";
- assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const computePassRid = assertResource(this, { prefix, context: "this" });
- core.opSync("op_webgpu_compute_pass_pop_debug_group", {
- computePassRid,
- });
- }
-
- /**
- * @param {string} markerLabel
- */
- insertDebugMarker(markerLabel) {
- webidl.assertBranded(this, GPUComputePassEncoder);
- const prefix =
- "Failed to execute 'insertDebugMarker' on 'GPUComputePassEncoder'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- markerLabel = webidl.converters.USVString(markerLabel, {
- prefix,
- context: "Argument 1",
- });
- assertDevice(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- assertResource(this[_encoder], {
- prefix,
- context: "encoder referenced by this",
- });
- const computePassRid = assertResource(this, { prefix, context: "this" });
- core.opSync("op_webgpu_compute_pass_insert_debug_marker", {
- computePassRid,
- markerLabel,
- });
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- label: this.label,
- })
- }`;
- }
- }
- GPUObjectBaseMixin("GPUComputePassEncoder", GPUComputePassEncoder);
-
- /**
- * @param {string | null} label
- * @param {InnerGPUDevice} device
- * @param {number} rid
- * @returns {GPUCommandBuffer}
- */
- function createGPUCommandBuffer(label, device, rid) {
- /** @type {GPUCommandBuffer} */
- const commandBuffer = webidl.createBranded(GPUCommandBuffer);
- commandBuffer[_label] = label;
- commandBuffer[_device] = device;
- commandBuffer[_rid] = rid;
- return commandBuffer;
- }
-
- class GPUCommandBuffer {
- /** @type {InnerGPUDevice} */
- [_device];
- /** @type {number | undefined} */
- [_rid];
-
- [_cleanup]() {
- const rid = this[_rid];
- if (rid !== undefined) {
- core.close(rid);
- /** @type {number | undefined} */
- this[_rid] = undefined;
- }
- }
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- get executionTime() {
- throw new Error("Not yet implemented");
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- label: this.label,
- // TODO(crowlKats): executionTime
- })
- }`;
- }
- }
- GPUObjectBaseMixin("GPUCommandBuffer", GPUCommandBuffer);
-
- /**
- * @param {string | null} label
- * @param {InnerGPUDevice} device
- * @param {number} rid
- * @returns {GPURenderBundleEncoder}
- */
- function createGPURenderBundleEncoder(label, device, rid) {
- /** @type {GPURenderBundleEncoder} */
- const bundleEncoder = webidl.createBranded(GPURenderBundleEncoder);
- bundleEncoder[_label] = label;
- bundleEncoder[_device] = device;
- bundleEncoder[_rid] = rid;
- return bundleEncoder;
- }
-
- class GPURenderBundleEncoder {
- /** @type {InnerGPUDevice} */
- [_device];
- /** @type {number | undefined} */
- [_rid];
-
- [_cleanup]() {
- const rid = this[_rid];
- if (rid !== undefined) {
- core.close(rid);
- /** @type {number | undefined} */
- this[_rid] = undefined;
- }
- }
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- /**
- * @param {GPURenderBundleDescriptor} descriptor
- */
- finish(descriptor = {}) {
- webidl.assertBranded(this, GPURenderBundleEncoder);
- const prefix = "Failed to execute 'finish' on 'GPURenderBundleEncoder'";
- descriptor = webidl.converters.GPURenderBundleDescriptor(descriptor, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const renderBundleEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- const { rid, err } = core.opSync(
- "op_webgpu_render_bundle_encoder_finish",
- {
- renderBundleEncoderRid,
- ...descriptor,
- },
- );
- device.pushError(err);
- this[_rid] = undefined;
-
- const renderBundle = createGPURenderBundle(
- descriptor.label ?? null,
- device,
- rid,
- );
- device.trackResource((renderBundle));
- return renderBundle;
- }
-
- // TODO(lucacasonato): has an overload
- setBindGroup(
- index,
- bindGroup,
- dynamicOffsetsData,
- dynamicOffsetsDataStart,
- dynamicOffsetsDataLength,
- ) {
- webidl.assertBranded(this, GPURenderBundleEncoder);
- const prefix =
- "Failed to execute 'setBindGroup' on 'GPURenderBundleEncoder'";
- const device = assertDevice(this, { prefix, context: "this" });
- const renderBundleEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- const bindGroupRid = assertResource(bindGroup, {
- prefix,
- context: "Argument 2",
- });
- assertDeviceMatch(device, bindGroup, {
- prefix,
- resourceContext: "Argument 2",
- selfContext: "this",
- });
- if (dynamicOffsetsData instanceof Uint32Array) {
- core.opSync(
- "op_webgpu_render_bundle_encoder_set_bind_group",
- {
- renderBundleEncoderRid,
- index,
- bindGroup: bindGroupRid,
- dynamicOffsetsDataStart,
- dynamicOffsetsDataLength,
- },
- dynamicOffsetsData,
- );
- } else {
- dynamicOffsetsData ??= [];
- core.opSync("op_webgpu_render_bundle_encoder_set_bind_group", {
- renderBundleEncoderRid,
- index,
- bindGroup: bindGroupRid,
- dynamicOffsetsData,
- dynamicOffsetsDataStart: 0,
- dynamicOffsetsDataLength: dynamicOffsetsData.length,
- });
- }
- }
-
- /**
- * @param {string} groupLabel
- */
- pushDebugGroup(groupLabel) {
- webidl.assertBranded(this, GPURenderBundleEncoder);
- const prefix =
- "Failed to execute 'pushDebugGroup' on 'GPURenderBundleEncoder'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- groupLabel = webidl.converters.USVString(groupLabel, {
- prefix,
- context: "Argument 1",
- });
- assertDevice(this, { prefix, context: "this" });
- const renderBundleEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- core.opSync("op_webgpu_render_bundle_encoder_push_debug_group", {
- renderBundleEncoderRid,
- groupLabel,
- });
- }
-
- popDebugGroup() {
- webidl.assertBranded(this, GPURenderBundleEncoder);
- const prefix =
- "Failed to execute 'popDebugGroup' on 'GPURenderBundleEncoder'";
- assertDevice(this, { prefix, context: "this" });
- const renderBundleEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- core.opSync("op_webgpu_render_bundle_encoder_pop_debug_group", {
- renderBundleEncoderRid,
- });
- }
-
- /**
- * @param {string} markerLabel
- */
- insertDebugMarker(markerLabel) {
- webidl.assertBranded(this, GPURenderBundleEncoder);
- const prefix =
- "Failed to execute 'insertDebugMarker' on 'GPURenderBundleEncoder'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- markerLabel = webidl.converters.USVString(markerLabel, {
- prefix,
- context: "Argument 1",
- });
- assertDevice(this, { prefix, context: "this" });
- const renderBundleEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- core.opSync("op_webgpu_render_bundle_encoder_push_debug_group", {
- renderBundleEncoderRid,
- markerLabel,
- });
- }
-
- /**
- * @param {GPURenderPipeline} pipeline
- */
- setPipeline(pipeline) {
- webidl.assertBranded(this, GPURenderBundleEncoder);
- const prefix =
- "Failed to execute 'setPipeline' on 'GPURenderBundleEncoder'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- pipeline = webidl.converters.GPURenderPipeline(pipeline, {
- prefix,
- context: "Argument 1",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const renderBundleEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- const pipelineRid = assertResource(pipeline, {
- prefix,
- context: "Argument 1",
- });
- assertDeviceMatch(device, pipeline, {
- prefix,
- resourceContext: "Argument 1",
- selfContext: "this",
- });
- core.opSync("op_webgpu_render_bundle_encoder_set_pipeline", {
- renderBundleEncoderRid,
- pipeline: pipelineRid,
- });
- }
-
- /**
- * @param {GPUBuffer} buffer
- * @param {GPUIndexFormat} indexFormat
- * @param {number} offset
- * @param {number} size
- */
- setIndexBuffer(buffer, indexFormat, offset = 0, size = 0) {
- webidl.assertBranded(this, GPURenderBundleEncoder);
- const prefix =
- "Failed to execute 'setIndexBuffer' on 'GPURenderBundleEncoder'";
- webidl.requiredArguments(arguments.length, 2, { prefix });
- buffer = webidl.converters.GPUBuffer(buffer, {
- prefix,
- context: "Argument 1",
- });
- indexFormat = webidl.converters.GPUIndexFormat(indexFormat, {
- prefix,
- context: "Argument 2",
- });
- offset = webidl.converters.GPUSize64(offset, {
- prefix,
- context: "Argument 3",
- });
- size = webidl.converters.GPUSize64(size, {
- prefix,
- context: "Argument 4",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const renderBundleEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- const bufferRid = assertResource(buffer, {
- prefix,
- context: "Argument 1",
- });
- assertDeviceMatch(device, buffer, {
- prefix,
- resourceContext: "Argument 1",
- selfContext: "this",
- });
- core.opSync("op_webgpu_render_bundle_encoder_set_index_buffer", {
- renderBundleEncoderRid,
- buffer: bufferRid,
- indexFormat,
- offset,
- size,
- });
- }
-
- /**
- * @param {number} slot
- * @param {GPUBuffer} buffer
- * @param {number} offset
- * @param {number} size
- */
- setVertexBuffer(slot, buffer, offset = 0, size = 0) {
- webidl.assertBranded(this, GPURenderBundleEncoder);
- const prefix =
- "Failed to execute 'setVertexBuffer' on 'GPURenderBundleEncoder'";
- webidl.requiredArguments(arguments.length, 2, { prefix });
- slot = webidl.converters.GPUSize32(slot, {
- prefix,
- context: "Argument 2",
- });
- buffer = webidl.converters.GPUBuffer(buffer, {
- prefix,
- context: "Argument 2",
- });
- offset = webidl.converters.GPUSize64(offset, {
- prefix,
- context: "Argument 3",
- });
- size = webidl.converters.GPUSize64(size, {
- prefix,
- context: "Argument 4",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const renderBundleEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- const bufferRid = assertResource(buffer, {
- prefix,
- context: "Argument 2",
- });
- assertDeviceMatch(device, buffer, {
- prefix,
- resourceContext: "Argument 2",
- selfContext: "this",
- });
- core.opSync("op_webgpu_render_bundle_encoder_set_vertex_buffer", {
- renderBundleEncoderRid,
- slot,
- buffer: bufferRid,
- offset,
- size,
- });
- }
-
- /**
- * @param {number} vertexCount
- * @param {number} instanceCount
- * @param {number} firstVertex
- * @param {number} firstInstance
- */
- draw(vertexCount, instanceCount = 1, firstVertex = 0, firstInstance = 0) {
- webidl.assertBranded(this, GPURenderBundleEncoder);
- const prefix = "Failed to execute 'draw' on 'GPURenderBundleEncoder'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- vertexCount = webidl.converters.GPUSize32(vertexCount, {
- prefix,
- context: "Argument 1",
- });
- instanceCount = webidl.converters.GPUSize32(instanceCount, {
- prefix,
- context: "Argument 2",
- });
- firstVertex = webidl.converters.GPUSize32(firstVertex, {
- prefix,
- context: "Argument 3",
- });
- firstInstance = webidl.converters.GPUSize32(firstInstance, {
- prefix,
- context: "Argument 4",
- });
- assertDevice(this, { prefix, context: "this" });
- const renderBundleEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- core.opSync("op_webgpu_render_bundle_encoder_draw", {
- renderBundleEncoderRid,
- vertexCount,
- instanceCount,
- firstVertex,
- firstInstance,
- });
- }
-
- /**
- * @param {number} indexCount
- * @param {number} instanceCount
- * @param {number} firstIndex
- * @param {number} baseVertex
- * @param {number} firstInstance
- */
- drawIndexed(
- indexCount,
- instanceCount = 1,
- firstIndex = 0,
- baseVertex = 0,
- firstInstance = 0,
- ) {
- webidl.assertBranded(this, GPURenderBundleEncoder);
- const prefix =
- "Failed to execute 'drawIndexed' on 'GPURenderBundleEncoder'";
- webidl.requiredArguments(arguments.length, 1, { prefix });
- indexCount = webidl.converters.GPUSize32(indexCount, {
- prefix,
- context: "Argument 1",
- });
- instanceCount = webidl.converters.GPUSize32(instanceCount, {
- prefix,
- context: "Argument 2",
- });
- firstIndex = webidl.converters.GPUSize32(firstIndex, {
- prefix,
- context: "Argument 3",
- });
- baseVertex = webidl.converters.GPUSignedOffset32(baseVertex, {
- prefix,
- context: "Argument 4",
- });
- firstInstance = webidl.converters.GPUSize32(firstInstance, {
- prefix,
- context: "Argument 5",
- });
- assertDevice(this, { prefix, context: "this" });
- const renderBundleEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- core.opSync("op_webgpu_render_bundle_encoder_draw_indexed", {
- renderBundleEncoderRid,
- indexCount,
- instanceCount,
- firstIndex,
- baseVertex,
- firstInstance,
- });
- }
-
- /**
- * @param {GPUBuffer} indirectBuffer
- * @param {number} indirectOffset
- */
- drawIndirect(indirectBuffer, indirectOffset) {
- webidl.assertBranded(this, GPURenderBundleEncoder);
- const prefix =
- "Failed to execute 'drawIndirect' on 'GPURenderBundleEncoder'";
- webidl.requiredArguments(arguments.length, 2, { prefix });
- indirectBuffer = webidl.converters.GPUBuffer(indirectBuffer, {
- prefix,
- context: "Argument 1",
- });
- indirectOffset = webidl.converters.GPUSize64(indirectOffset, {
- prefix,
- context: "Argument 2",
- });
- const device = assertDevice(this, { prefix, context: "this" });
- const renderBundleEncoderRid = assertResource(this, {
- prefix,
- context: "this",
- });
- const indirectBufferRid = assertResource(indirectBuffer, {
- prefix,
- context: "Argument 1",
- });
- assertDeviceMatch(device, indirectBuffer, {
- prefix,
- resourceContext: "Argument 1",
- selfContext: "this",
- });
- core.opSync("op_webgpu_render_bundle_encoder_draw_indirect", {
- renderBundleEncoderRid,
- indirectBuffer: indirectBufferRid,
- indirectOffset,
- });
- }
-
- drawIndexedIndirect(_indirectBuffer, _indirectOffset) {
- throw new Error("Not yet implemented");
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- label: this.label,
- })
- }`;
- }
- }
- GPUObjectBaseMixin("GPURenderBundleEncoder", GPURenderBundleEncoder);
-
- /**
- * @param {string | null} label
- * @param {InnerGPUDevice} device
- * @param {number} rid
- * @returns {GPURenderBundle}
- */
- function createGPURenderBundle(label, device, rid) {
- /** @type {GPURenderBundle} */
- const bundle = webidl.createBranded(GPURenderBundle);
- bundle[_label] = label;
- bundle[_device] = device;
- bundle[_rid] = rid;
- return bundle;
- }
-
- class GPURenderBundle {
- /** @type {InnerGPUDevice} */
- [_device];
- /** @type {number | undefined} */
- [_rid];
-
- [_cleanup]() {
- const rid = this[_rid];
- if (rid !== undefined) {
- core.close(rid);
- /** @type {number | undefined} */
- this[_rid] = undefined;
- }
- }
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- label: this.label,
- })
- }`;
- }
- }
- GPUObjectBaseMixin("GPURenderBundle", GPURenderBundle);
-
- const _descriptor = Symbol("[[descriptor]]");
-
- /**
- * @param {string | null} label
- * @param {InnerGPUDevice} device
- * @param {number} rid
- * @returns {GPUQuerySet}
- */
- function createGPUQuerySet(label, device, rid, descriptor) {
- /** @type {GPUQuerySet} */
- const queue = webidl.createBranded(GPUQuerySet);
- queue[_label] = label;
- queue[_device] = device;
- queue[_rid] = rid;
- queue[_descriptor] = descriptor;
- return queue;
- }
-
- class GPUQuerySet {
- /** @type {InnerGPUDevice} */
- [_device];
- /** @type {number | undefined} */
- [_rid];
- /** @type {GPUQuerySetDescriptor} */
- [_descriptor];
-
- [_cleanup]() {
- const rid = this[_rid];
- if (rid !== undefined) {
- core.close(rid);
- /** @type {number | undefined} */
- this[_rid] = undefined;
- }
- }
-
- constructor() {
- webidl.illegalConstructor();
- }
-
- destroy() {
- webidl.assertBranded(this, GPUQuerySet);
- this[_cleanup]();
- }
-
- [Symbol.for("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- label: this.label,
- })
- }`;
- }
- }
- GPUObjectBaseMixin("GPUQuerySet", GPUQuerySet);
-
- window.__bootstrap.webgpu = {
- gpu: webidl.createBranded(GPU),
- GPU,
- GPUAdapter,
- GPUAdapterLimits,
- GPUAdapterFeatures,
- GPUDevice,
- GPUQueue,
- GPUBuffer,
- GPUBufferUsage,
- GPUMapMode,
- GPUTextureUsage,
- GPUTexture,
- GPUTextureView,
- GPUSampler,
- GPUBindGroupLayout,
- GPUPipelineLayout,
- GPUBindGroup,
- GPUShaderModule,
- GPUShaderStage,
- GPUComputePipeline,
- GPURenderPipeline,
- GPUColorWrite,
- GPUCommandEncoder,
- GPURenderPassEncoder,
- GPUComputePassEncoder,
- GPUCommandBuffer,
- GPURenderBundleEncoder,
- GPURenderBundle,
- GPUQuerySet,
- GPUOutOfMemoryError,
- GPUValidationError,
- };
-})(this);
diff --git a/op_crates/webgpu/02_idl_types.js b/op_crates/webgpu/02_idl_types.js
deleted file mode 100644
index f990a40e8..000000000
--- a/op_crates/webgpu/02_idl_types.js
+++ /dev/null
@@ -1,1926 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// @ts-check
-/// <reference path="../web/internal.d.ts" />
-
-"use strict";
-
-((window) => {
- const webidl = window.__bootstrap.webidl;
- const {
- GPU,
- GPUAdapter,
- GPUAdapterLimits,
- GPUAdapterFeatures,
- GPUDevice,
- GPUQueue,
- GPUBuffer,
- GPUBufferUsage,
- GPUMapMode,
- GPUTextureUsage,
- GPUTexture,
- GPUTextureView,
- GPUSampler,
- GPUBindGroupLayout,
- GPUPipelineLayout,
- GPUBindGroup,
- GPUShaderModule,
- GPUShaderStage,
- GPUComputePipeline,
- GPURenderPipeline,
- GPUColorWrite,
- GPUCommandEncoder,
- GPURenderPassEncoder,
- GPUComputePassEncoder,
- GPUCommandBuffer,
- GPURenderBundleEncoder,
- GPURenderBundle,
- GPUQuerySet,
- GPUOutOfMemoryError,
- GPUValidationError,
- } = window.__bootstrap.webgpu;
-
- // This needs to be initalized after all of the base classes are implmented,
- // otherwise their converters might not be available yet.
- // DICTIONARY: GPUObjectDescriptorBase
- const dictMembersGPUObjectDescriptorBase = [
- { key: "label", converter: webidl.converters["USVString"] },
- ];
- webidl.converters["GPUObjectDescriptorBase"] = webidl
- .createDictionaryConverter(
- "GPUObjectDescriptorBase",
- dictMembersGPUObjectDescriptorBase,
- );
-
- // INTERFACE: GPUAdapterLimits
- webidl.converters.GPUAdapterLimits = webidl.createInterfaceConverter(
- "GPUAdapterLimits",
- GPUAdapterLimits,
- );
-
- // INTERFACE: GPUAdapterFeatures
- webidl.converters.GPUAdapterFeatures = webidl.createInterfaceConverter(
- "GPUAdapterFeatures",
- GPUAdapterFeatures,
- );
-
- // INTERFACE: GPU
- webidl.converters.GPU = webidl.createInterfaceConverter("GPU", GPU);
-
- // ENUM: GPUPowerPreference
- webidl.converters["GPUPowerPreference"] = webidl.createEnumConverter(
- "GPUPowerPreference",
- [
- "low-power",
- "high-performance",
- ],
- );
-
- // DICTIONARY: GPURequestAdapterOptions
- const dictMembersGPURequestAdapterOptions = [
- {
- key: "powerPreference",
- converter: webidl.converters["GPUPowerPreference"],
- },
- ];
- webidl.converters["GPURequestAdapterOptions"] = webidl
- .createDictionaryConverter(
- "GPURequestAdapterOptions",
- dictMembersGPURequestAdapterOptions,
- );
-
- // INTERFACE: GPUAdapter
- webidl.converters.GPUAdapter = webidl.createInterfaceConverter(
- "GPUAdapter",
- GPUAdapter,
- );
-
- // ENUM: GPUFeatureName
- webidl.converters["GPUFeatureName"] = webidl.createEnumConverter(
- "GPUFeatureName",
- [
- "depth-clamping",
- "depth24unorm-stencil8",
- "depth32float-stencil8",
- "pipeline-statistics-query",
- "texture-compression-bc",
- "timestamp-query",
- // extended from spec
- "mappable-primary-buffers",
- "sampled-texture-binding-array",
- "sampled-texture-array-dynamic-indexing",
- "sampled-texture-array-non-uniform-indexing",
- "unsized-binding-array",
- "multi-draw-indirect",
- "multi-draw-indirect-count",
- "push-constants",
- "address-mode-clamp-to-border",
- "non-fill-polygon-mode",
- "texture-compression-etc2",
- "texture-compression-astc-ldr",
- "texture-adapter-specific-format-features",
- "shader-float64",
- "vertex-attribute-64bit",
- ],
- );
-
- // TYPEDEF: GPUSize32
- webidl.converters["GPUSize32"] = (V, opts) =>
- webidl.converters["unsigned long"](V, { ...opts, enforceRange: true });
-
- // DICTIONARY: GPUDeviceDescriptor
- const dictMembersGPUDeviceDescriptor = [
- {
- key: "nonGuaranteedFeatures",
- converter: webidl.createSequenceConverter(
- webidl.converters["GPUFeatureName"],
- ),
- get defaultValue() {
- return [];
- },
- },
- {
- key: "nonGuaranteedLimits",
- converter: webidl.createRecordConverter(
- webidl.converters["DOMString"],
- webidl.converters["GPUSize32"],
- ),
- get defaultValue() {
- return {};
- },
- },
- ];
- webidl.converters["GPUDeviceDescriptor"] = webidl.createDictionaryConverter(
- "GPUDeviceDescriptor",
- dictMembersGPUObjectDescriptorBase,
- dictMembersGPUDeviceDescriptor,
- );
-
- // INTERFACE: GPUDevice
- webidl.converters.GPUDevice = webidl.createInterfaceConverter(
- "GPUDevice",
- GPUDevice,
- );
-
- // INTERFACE: GPUBuffer
- webidl.converters.GPUBuffer = webidl.createInterfaceConverter(
- "GPUBuffer",
- GPUBuffer,
- );
-
- // TYPEDEF: GPUSize64
- webidl.converters["GPUSize64"] = (V, opts) =>
- webidl.converters["unsigned long long"](V, { ...opts, enforceRange: true });
-
- // TYPEDEF: GPUBufferUsageFlags
- webidl.converters["GPUBufferUsageFlags"] = (V, opts) =>
- webidl.converters["unsigned long"](V, { ...opts, enforceRange: true });
-
- // DICTIONARY: GPUBufferDescriptor
- const dictMembersGPUBufferDescriptor = [
- { key: "size", converter: webidl.converters["GPUSize64"], required: true },
- {
- key: "usage",
- converter: webidl.converters["GPUBufferUsageFlags"],
- required: true,
- },
- {
- key: "mappedAtCreation",
- converter: webidl.converters["boolean"],
- defaultValue: false,
- },
- ];
- webidl.converters["GPUBufferDescriptor"] = webidl.createDictionaryConverter(
- "GPUBufferDescriptor",
- dictMembersGPUObjectDescriptorBase,
- dictMembersGPUBufferDescriptor,
- );
-
- // INTERFACE: GPUBufferUsage
- webidl.converters.GPUBufferUsage = webidl.createInterfaceConverter(
- "GPUBufferUsage",
- GPUBufferUsage,
- );
-
- // TYPEDEF: GPUMapModeFlags
- webidl.converters["GPUMapModeFlags"] = (V, opts) =>
- webidl.converters["unsigned long"](V, { ...opts, enforceRange: true });
-
- // INTERFACE: GPUMapMode
- webidl.converters.GPUMapMode = webidl.createInterfaceConverter(
- "GPUMapMode",
- GPUMapMode,
- );
-
- // INTERFACE: GPUTexture
- webidl.converters.GPUTexture = webidl.createInterfaceConverter(
- "GPUTexture",
- GPUTexture,
- );
-
- // TYPEDEF: GPUIntegerCoordinate
- webidl.converters["GPUIntegerCoordinate"] = (V, opts) =>
- webidl.converters["unsigned long"](V, { ...opts, enforceRange: true });
- webidl.converters["sequence<GPUIntegerCoordinate>"] = webidl
- .createSequenceConverter(webidl.converters["GPUIntegerCoordinate"]);
-
- // DICTIONARY: GPUExtent3DDict
- const dictMembersGPUExtent3DDict = [
- {
- key: "width",
- converter: webidl.converters["GPUIntegerCoordinate"],
- defaultValue: 1,
- },
- {
- key: "height",
- converter: webidl.converters["GPUIntegerCoordinate"],
- defaultValue: 1,
- },
- {
- key: "depthOrArrayLayers",
- converter: webidl.converters["GPUIntegerCoordinate"],
- defaultValue: 1,
- },
- ];
- webidl.converters["GPUExtent3DDict"] = webidl.createDictionaryConverter(
- "GPUExtent3DDict",
- dictMembersGPUExtent3DDict,
- );
-
- // TYPEDEF: GPUExtent3D
- webidl.converters["GPUExtent3D"] = (V, opts) => {
- // Union for (sequence<GPUIntegerCoordinate> or GPUExtent3DDict)
- if (V === null || V === undefined) {
- return webidl.converters["GPUExtent3DDict"](V, opts);
- }
- if (typeof V === "object") {
- const method = V[Symbol.iterator];
- if (method !== undefined) {
- return webidl.converters["sequence<GPUIntegerCoordinate>"](V, opts);
- }
- return webidl.converters["GPUExtent3DDict"](V, opts);
- }
- throw webidl.makeException(
- TypeError,
- "can not be converted to sequence<GPUIntegerCoordinate> or GPUExtent3DDict.",
- opts,
- );
- };
-
- // ENUM: GPUTextureDimension
- webidl.converters["GPUTextureDimension"] = webidl.createEnumConverter(
- "GPUTextureDimension",
- [
- "1d",
- "2d",
- "3d",
- ],
- );
-
- // ENUM: GPUTextureFormat
- webidl.converters["GPUTextureFormat"] = webidl.createEnumConverter(
- "GPUTextureFormat",
- [
- "r8unorm",
- "r8snorm",
- "r8uint",
- "r8sint",
- "r16uint",
- "r16sint",
- "r16float",
- "rg8unorm",
- "rg8snorm",
- "rg8uint",
- "rg8sint",
- "r32uint",
- "r32sint",
- "r32float",
- "rg16uint",
- "rg16sint",
- "rg16float",
- "rgba8unorm",
- "rgba8unorm-srgb",
- "rgba8snorm",
- "rgba8uint",
- "rgba8sint",
- "bgra8unorm",
- "bgra8unorm-srgb",
- "rgb9e5ufloat",
- "rgb10a2unorm",
- "rg11b10ufloat",
- "rg32uint",
- "rg32sint",
- "rg32float",
- "rgba16uint",
- "rgba16sint",
- "rgba16float",
- "rgba32uint",
- "rgba32sint",
- "rgba32float",
- "stencil8",
- "depth16unorm",
- "depth24plus",
- "depth24plus-stencil8",
- "depth32float",
- "bc1-rgba-unorm",
- "bc1-rgba-unorm-srgb",
- "bc2-rgba-unorm",
- "bc2-rgba-unorm-srgb",
- "bc3-rgba-unorm",
- "bc3-rgba-unorm-srgb",
- "bc4-r-unorm",
- "bc4-r-snorm",
- "bc5-rg-unorm",
- "bc5-rg-snorm",
- "bc6h-rgb-ufloat",
- "bc6h-rgb-float",
- "bc7-rgba-unorm",
- "bc7-rgba-unorm-srgb",
- "depth24unorm-stencil8",
- "depth32float-stencil8",
- ],
- );
-
- // TYPEDEF: GPUTextureUsageFlags
- webidl.converters["GPUTextureUsageFlags"] = (V, opts) =>
- webidl.converters["unsigned long"](V, { ...opts, enforceRange: true });
-
- // DICTIONARY: GPUTextureDescriptor
- const dictMembersGPUTextureDescriptor = [
- {
- key: "size",
- converter: webidl.converters["GPUExtent3D"],
- required: true,
- },
- {
- key: "mipLevelCount",
- converter: webidl.converters["GPUIntegerCoordinate"],
- defaultValue: 1,
- },
- {
- key: "sampleCount",
- converter: webidl.converters["GPUSize32"],
- defaultValue: 1,
- },
- {
- key: "dimension",
- converter: webidl.converters["GPUTextureDimension"],
- defaultValue: "2d",
- },
- {
- key: "format",
- converter: webidl.converters["GPUTextureFormat"],
- required: true,
- },
- {
- key: "usage",
- converter: webidl.converters["GPUTextureUsageFlags"],
- required: true,
- },
- ];
- webidl.converters["GPUTextureDescriptor"] = webidl.createDictionaryConverter(
- "GPUTextureDescriptor",
- dictMembersGPUObjectDescriptorBase,
- dictMembersGPUTextureDescriptor,
- );
-
- // INTERFACE: GPUTextureUsage
- webidl.converters.GPUTextureUsage = webidl.createInterfaceConverter(
- "GPUTextureUsage",
- GPUTextureUsage,
- );
-
- // INTERFACE: GPUTextureView
- webidl.converters.GPUTextureView = webidl.createInterfaceConverter(
- "GPUTextureView",
- GPUTextureView,
- );
-
- // ENUM: GPUTextureViewDimension
- webidl.converters["GPUTextureViewDimension"] = webidl.createEnumConverter(
- "GPUTextureViewDimension",
- [
- "1d",
- "2d",
- "2d-array",
- "cube",
- "cube-array",
- "3d",
- ],
- );
-
- // ENUM: GPUTextureAspect
- webidl.converters["GPUTextureAspect"] = webidl.createEnumConverter(
- "GPUTextureAspect",
- [
- "all",
- "stencil-only",
- "depth-only",
- ],
- );
-
- // DICTIONARY: GPUTextureViewDescriptor
- const dictMembersGPUTextureViewDescriptor = [
- { key: "format", converter: webidl.converters["GPUTextureFormat"] },
- {
- key: "dimension",
- converter: webidl.converters["GPUTextureViewDimension"],
- },
- {
- key: "aspect",
- converter: webidl.converters["GPUTextureAspect"],
- defaultValue: "all",
- },
- {
- key: "baseMipLevel",
- converter: webidl.converters["GPUIntegerCoordinate"],
- defaultValue: 0,
- },
- {
- key: "mipLevelCount",
- converter: webidl.converters["GPUIntegerCoordinate"],
- },
- {
- key: "baseArrayLayer",
- converter: webidl.converters["GPUIntegerCoordinate"],
- defaultValue: 0,
- },
- {
- key: "arrayLayerCount",
- converter: webidl.converters["GPUIntegerCoordinate"],
- },
- ];
- webidl.converters["GPUTextureViewDescriptor"] = webidl
- .createDictionaryConverter(
- "GPUTextureViewDescriptor",
- dictMembersGPUObjectDescriptorBase,
- dictMembersGPUTextureViewDescriptor,
- );
-
- // INTERFACE: GPUSampler
- webidl.converters.GPUSampler = webidl.createInterfaceConverter(
- "GPUSampler",
- GPUSampler,
- );
-
- // ENUM: GPUAddressMode
- webidl.converters["GPUAddressMode"] = webidl.createEnumConverter(
- "GPUAddressMode",
- [
- "clamp-to-edge",
- "repeat",
- "mirror-repeat",
- ],
- );
-
- // ENUM: GPUFilterMode
- webidl.converters["GPUFilterMode"] = webidl.createEnumConverter(
- "GPUFilterMode",
- [
- "nearest",
- "linear",
- ],
- );
-
- // ENUM: GPUCompareFunction
- webidl.converters["GPUCompareFunction"] = webidl.createEnumConverter(
- "GPUCompareFunction",
- [
- "never",
- "less",
- "equal",
- "less-equal",
- "greater",
- "not-equal",
- "greater-equal",
- "always",
- ],
- );
-
- // DICTIONARY: GPUSamplerDescriptor
- const dictMembersGPUSamplerDescriptor = [
- {
- key: "addressModeU",
- converter: webidl.converters["GPUAddressMode"],
- defaultValue: "clamp-to-edge",
- },
- {
- key: "addressModeV",
- converter: webidl.converters["GPUAddressMode"],
- defaultValue: "clamp-to-edge",
- },
- {
- key: "addressModeW",
- converter: webidl.converters["GPUAddressMode"],
- defaultValue: "clamp-to-edge",
- },
- {
- key: "magFilter",
- converter: webidl.converters["GPUFilterMode"],
- defaultValue: "nearest",
- },
- {
- key: "minFilter",
- converter: webidl.converters["GPUFilterMode"],
- defaultValue: "nearest",
- },
- {
- key: "mipmapFilter",
- converter: webidl.converters["GPUFilterMode"],
- defaultValue: "nearest",
- },
- {
- key: "lodMinClamp",
- converter: webidl.converters["float"],
- defaultValue: 0,
- },
- {
- key: "lodMaxClamp",
- converter: webidl.converters["float"],
- defaultValue: 0xffffffff,
- },
- { key: "compare", converter: webidl.converters["GPUCompareFunction"] },
- {
- key: "maxAnisotropy",
- converter: (V, opts) =>
- webidl.converters["unsigned short"](V, { ...opts, clamp: true }),
- defaultValue: 1,
- },
- ];
- webidl.converters["GPUSamplerDescriptor"] = webidl.createDictionaryConverter(
- "GPUSamplerDescriptor",
- dictMembersGPUObjectDescriptorBase,
- dictMembersGPUSamplerDescriptor,
- );
-
- // INTERFACE: GPUBindGroupLayout
- webidl.converters.GPUBindGroupLayout = webidl.createInterfaceConverter(
- "GPUBindGroupLayout",
- GPUBindGroupLayout,
- );
-
- // TYPEDEF: GPUIndex32
- webidl.converters["GPUIndex32"] = (V, opts) =>
- webidl.converters["unsigned long"](V, { ...opts, enforceRange: true });
-
- // TYPEDEF: GPUShaderStageFlags
- webidl.converters["GPUShaderStageFlags"] = (V, opts) =>
- webidl.converters["unsigned long"](V, { ...opts, enforceRange: true });
-
- // ENUM: GPUBufferBindingType
- webidl.converters["GPUBufferBindingType"] = webidl.createEnumConverter(
- "GPUBufferBindingType",
- [
- "uniform",
- "storage",
- "read-only-storage",
- ],
- );
-
- // DICTIONARY: GPUBufferBindingLayout
- const dictMembersGPUBufferBindingLayout = [
- {
- key: "type",
- converter: webidl.converters["GPUBufferBindingType"],
- defaultValue: "uniform",
- },
- {
- key: "hasDynamicOffset",
- converter: webidl.converters["boolean"],
- defaultValue: false,
- },
- {
- key: "minBindingSize",
- converter: webidl.converters["GPUSize64"],
- defaultValue: 0,
- },
- ];
- webidl.converters["GPUBufferBindingLayout"] = webidl
- .createDictionaryConverter(
- "GPUBufferBindingLayout",
- dictMembersGPUBufferBindingLayout,
- );
-
- // ENUM: GPUSamplerBindingType
- webidl.converters["GPUSamplerBindingType"] = webidl.createEnumConverter(
- "GPUSamplerBindingType",
- [
- "filtering",
- "non-filtering",
- "comparison",
- ],
- );
-
- // DICTIONARY: GPUSamplerBindingLayout
- const dictMembersGPUSamplerBindingLayout = [
- {
- key: "type",
- converter: webidl.converters["GPUSamplerBindingType"],
- defaultValue: "filtering",
- },
- ];
- webidl.converters["GPUSamplerBindingLayout"] = webidl
- .createDictionaryConverter(
- "GPUSamplerBindingLayout",
- dictMembersGPUSamplerBindingLayout,
- );
-
- // ENUM: GPUTextureSampleType
- webidl.converters["GPUTextureSampleType"] = webidl.createEnumConverter(
- "GPUTextureSampleType",
- [
- "float",
- "unfilterable-float",
- "depth",
- "sint",
- "uint",
- ],
- );
-
- // DICTIONARY: GPUTextureBindingLayout
- const dictMembersGPUTextureBindingLayout = [
- {
- key: "sampleType",
- converter: webidl.converters["GPUTextureSampleType"],
- defaultValue: "float",
- },
- {
- key: "viewDimension",
- converter: webidl.converters["GPUTextureViewDimension"],
- defaultValue: "2d",
- },
- {
- key: "multisampled",
- converter: webidl.converters["boolean"],
- defaultValue: false,
- },
- ];
- webidl.converters["GPUTextureBindingLayout"] = webidl
- .createDictionaryConverter(
- "GPUTextureBindingLayout",
- dictMembersGPUTextureBindingLayout,
- );
-
- // ENUM: GPUStorageTextureAccess
- webidl.converters["GPUStorageTextureAccess"] = webidl.createEnumConverter(
- "GPUStorageTextureAccess",
- [
- "read-only",
- "write-only",
- ],
- );
-
- // DICTIONARY: GPUStorageTextureBindingLayout
- const dictMembersGPUStorageTextureBindingLayout = [
- {
- key: "access",
- converter: webidl.converters["GPUStorageTextureAccess"],
- required: true,
- },
- {
- key: "format",
- converter: webidl.converters["GPUTextureFormat"],
- required: true,
- },
- {
- key: "viewDimension",
- converter: webidl.converters["GPUTextureViewDimension"],
- defaultValue: "2d",
- },
- ];
- webidl.converters["GPUStorageTextureBindingLayout"] = webidl
- .createDictionaryConverter(
- "GPUStorageTextureBindingLayout",
- dictMembersGPUStorageTextureBindingLayout,
- );
-
- // DICTIONARY: GPUBindGroupLayoutEntry
- const dictMembersGPUBindGroupLayoutEntry = [
- {
- key: "binding",
- converter: webidl.converters["GPUIndex32"],
- required: true,
- },
- {
- key: "visibility",
- converter: webidl.converters["GPUShaderStageFlags"],
- required: true,
- },
- { key: "buffer", converter: webidl.converters["GPUBufferBindingLayout"] },
- { key: "sampler", converter: webidl.converters["GPUSamplerBindingLayout"] },
- { key: "texture", converter: webidl.converters["GPUTextureBindingLayout"] },
- {
- key: "storageTexture",
- converter: webidl.converters["GPUStorageTextureBindingLayout"],
- },
- ];
- webidl.converters["GPUBindGroupLayoutEntry"] = webidl
- .createDictionaryConverter(
- "GPUBindGroupLayoutEntry",
- dictMembersGPUBindGroupLayoutEntry,
- );
-
- // DICTIONARY: GPUBindGroupLayoutDescriptor
- const dictMembersGPUBindGroupLayoutDescriptor = [
- {
- key: "entries",
- converter: webidl.createSequenceConverter(
- webidl.converters["GPUBindGroupLayoutEntry"],
- ),
- required: true,
- },
- ];
- webidl.converters["GPUBindGroupLayoutDescriptor"] = webidl
- .createDictionaryConverter(
- "GPUBindGroupLayoutDescriptor",
- dictMembersGPUObjectDescriptorBase,
- dictMembersGPUBindGroupLayoutDescriptor,
- );
-
- // INTERFACE: GPUShaderStage
- webidl.converters.GPUShaderStage = webidl.createInterfaceConverter(
- "GPUShaderStage",
- GPUShaderStage,
- );
-
- // INTERFACE: GPUBindGroup
- webidl.converters.GPUBindGroup = webidl.createInterfaceConverter(
- "GPUBindGroup",
- GPUBindGroup,
- );
-
- // DICTIONARY: GPUBufferBinding
- const dictMembersGPUBufferBinding = [
- {
- key: "buffer",
- converter: webidl.converters["GPUBuffer"],
- required: true,
- },
- {
- key: "offset",
- converter: webidl.converters["GPUSize64"],
- defaultValue: 0,
- },
- { key: "size", converter: webidl.converters["GPUSize64"] },
- ];
- webidl.converters["GPUBufferBinding"] = webidl.createDictionaryConverter(
- "GPUBufferBinding",
- dictMembersGPUBufferBinding,
- );
-
- // TYPEDEF: GPUBindingResource
- webidl.converters["GPUBindingResource"] =
- webidl.converters.any /** put union here! **/;
-
- // DICTIONARY: GPUBindGroupEntry
- const dictMembersGPUBindGroupEntry = [
- {
- key: "binding",
- converter: webidl.converters["GPUIndex32"],
- required: true,
- },
- {
- key: "resource",
- converter: webidl.converters["GPUBindingResource"],
- required: true,
- },
- ];
- webidl.converters["GPUBindGroupEntry"] = webidl.createDictionaryConverter(
- "GPUBindGroupEntry",
- dictMembersGPUBindGroupEntry,
- );
-
- // DICTIONARY: GPUBindGroupDescriptor
- const dictMembersGPUBindGroupDescriptor = [
- {
- key: "layout",
- converter: webidl.converters["GPUBindGroupLayout"],
- required: true,
- },
- {
- key: "entries",
- converter: webidl.createSequenceConverter(
- webidl.converters["GPUBindGroupEntry"],
- ),
- required: true,
- },
- ];
- webidl.converters["GPUBindGroupDescriptor"] = webidl
- .createDictionaryConverter(
- "GPUBindGroupDescriptor",
- dictMembersGPUObjectDescriptorBase,
- dictMembersGPUBindGroupDescriptor,
- );
-
- // INTERFACE: GPUPipelineLayout
- webidl.converters.GPUPipelineLayout = webidl.createInterfaceConverter(
- "GPUPipelineLayout",
- GPUPipelineLayout,
- );
-
- // DICTIONARY: GPUPipelineLayoutDescriptor
- const dictMembersGPUPipelineLayoutDescriptor = [
- {
- key: "bindGroupLayouts",
- converter: webidl.createSequenceConverter(
- webidl.converters["GPUBindGroupLayout"],
- ),
- required: true,
- },
- ];
- webidl.converters["GPUPipelineLayoutDescriptor"] = webidl
- .createDictionaryConverter(
- "GPUPipelineLayoutDescriptor",
- dictMembersGPUObjectDescriptorBase,
- dictMembersGPUPipelineLayoutDescriptor,
- );
-
- // ENUM: GPUCompilationMessageType
- webidl.converters["GPUCompilationMessageType"] = webidl.createEnumConverter(
- "GPUCompilationMessageType",
- [
- "error",
- "warning",
- "info",
- ],
- );
-
- // // INTERFACE: GPUCompilationMessage
- // webidl.converters.GPUCompilationMessage = webidl.createInterfaceConverter(
- // "GPUCompilationMessage",
- // GPUCompilationMessage,
- // );
-
- // // INTERFACE: GPUCompilationInfo
- // webidl.converters.GPUCompilationInfo = webidl.createInterfaceConverter(
- // "GPUCompilationInfo",
- // GPUCompilationInfo,
- // );
-
- // INTERFACE: GPUShaderModule
- webidl.converters.GPUShaderModule = webidl.createInterfaceConverter(
- "GPUShaderModule",
- GPUShaderModule,
- );
-
- // DICTIONARY: GPUShaderModuleDescriptor
- const dictMembersGPUShaderModuleDescriptor = [
- {
- key: "code",
- converter: (V, opts) => {
- if (V instanceof Uint32Array) {
- return webidl.converters["Uint32Array"](V, opts);
- }
- if (typeof V === "string") {
- return webidl.converters["DOMString"](V, opts);
- }
- throw webidl.makeException(
- TypeError,
- "can not be converted to Uint32Array or DOMString.",
- opts,
- );
- },
- required: true,
- },
- { key: "sourceMap", converter: webidl.converters["object"] },
- ];
- webidl.converters["GPUShaderModuleDescriptor"] = webidl
- .createDictionaryConverter(
- "GPUShaderModuleDescriptor",
- dictMembersGPUObjectDescriptorBase,
- dictMembersGPUShaderModuleDescriptor,
- );
-
- // DICTIONARY: GPUPipelineDescriptorBase
- const dictMembersGPUPipelineDescriptorBase = [
- { key: "layout", converter: webidl.converters["GPUPipelineLayout"] },
- ];
- webidl.converters["GPUPipelineDescriptorBase"] = webidl
- .createDictionaryConverter(
- "GPUPipelineDescriptorBase",
- dictMembersGPUObjectDescriptorBase,
- dictMembersGPUPipelineDescriptorBase,
- );
-
- // DICTIONARY: GPUProgrammableStage
- const dictMembersGPUProgrammableStage = [
- {
- key: "module",
- converter: webidl.converters["GPUShaderModule"],
- required: true,
- },
- {
- key: "entryPoint",
- converter: webidl.converters["USVString"],
- required: true,
- },
- ];
- webidl.converters["GPUProgrammableStage"] = webidl.createDictionaryConverter(
- "GPUProgrammableStage",
- dictMembersGPUProgrammableStage,
- );
-
- // INTERFACE: GPUComputePipeline
- webidl.converters.GPUComputePipeline = webidl.createInterfaceConverter(
- "GPUComputePipeline",
- GPUComputePipeline,
- );
-
- // DICTIONARY: GPUComputePipelineDescriptor
- const dictMembersGPUComputePipelineDescriptor = [
- {
- key: "compute",
- converter: webidl.converters["GPUProgrammableStage"],
- required: true,
- },
- ];
- webidl.converters["GPUComputePipelineDescriptor"] = webidl
- .createDictionaryConverter(
- "GPUComputePipelineDescriptor",
- dictMembersGPUPipelineDescriptorBase,
- dictMembersGPUComputePipelineDescriptor,
- );
-
- // INTERFACE: GPURenderPipeline
- webidl.converters.GPURenderPipeline = webidl.createInterfaceConverter(
- "GPURenderPipeline",
- GPURenderPipeline,
- );
-
- // ENUM: GPUInputStepMode
- webidl.converters["GPUInputStepMode"] = webidl.createEnumConverter(
- "GPUInputStepMode",
- [
- "vertex",
- "instance",
- ],
- );
-
- // ENUM: GPUVertexFormat
- webidl.converters["GPUVertexFormat"] = webidl.createEnumConverter(
- "GPUVertexFormat",
- [
- "uchar2",
- "uchar4",
- "char2",
- "char4",
- "uchar2norm",
- "uchar4norm",
- "char2norm",
- "char4norm",
- "ushort2",
- "ushort4",
- "short2",
- "short4",
- "ushort2norm",
- "ushort4norm",
- "short2norm",
- "short4norm",
- "half2",
- "half4",
- "float",
- "float2",
- "float3",
- "float4",
- "uint",
- "uint2",
- "uint3",
- "uint4",
- "int",
- "int2",
- "int3",
- "int4",
- ],
- );
-
- // DICTIONARY: GPUVertexAttribute
- const dictMembersGPUVertexAttribute = [
- {
- key: "format",
- converter: webidl.converters["GPUVertexFormat"],
- required: true,
- },
- {
- key: "offset",
- converter: webidl.converters["GPUSize64"],
- required: true,
- },
- {
- key: "shaderLocation",
- converter: webidl.converters["GPUIndex32"],
- required: true,
- },
- ];
- webidl.converters["GPUVertexAttribute"] = webidl.createDictionaryConverter(
- "GPUVertexAttribute",
- dictMembersGPUVertexAttribute,
- );
-
- // DICTIONARY: GPUVertexBufferLayout
- const dictMembersGPUVertexBufferLayout = [
- {
- key: "arrayStride",
- converter: webidl.converters["GPUSize64"],
- required: true,
- },
- {
- key: "stepMode",
- converter: webidl.converters["GPUInputStepMode"],
- defaultValue: "vertex",
- },
- {
- key: "attributes",
- converter: webidl.createSequenceConverter(
- webidl.converters["GPUVertexAttribute"],
- ),
- required: true,
- },
- ];
- webidl.converters["GPUVertexBufferLayout"] = webidl.createDictionaryConverter(
- "GPUVertexBufferLayout",
- dictMembersGPUVertexBufferLayout,
- );
-
- // DICTIONARY: GPUVertexState
- const dictMembersGPUVertexState = [
- {
- key: "buffers",
- converter: webidl.createSequenceConverter(
- webidl.createNullableConverter(
- webidl.converters["GPUVertexBufferLayout"],
- ),
- ),
- get defaultValue() {
- return [];
- },
- },
- ];
- webidl.converters["GPUVertexState"] = webidl.createDictionaryConverter(
- "GPUVertexState",
- dictMembersGPUProgrammableStage,
- dictMembersGPUVertexState,
- );
-
- // ENUM: GPUPrimitiveTopology
- webidl.converters["GPUPrimitiveTopology"] = webidl.createEnumConverter(
- "GPUPrimitiveTopology",
- [
- "point-list",
- "line-list",
- "line-strip",
- "triangle-list",
- "triangle-strip",
- ],
- );
-
- // ENUM: GPUIndexFormat
- webidl.converters["GPUIndexFormat"] = webidl.createEnumConverter(
- "GPUIndexFormat",
- [
- "uint16",
- "uint32",
- ],
- );
-
- // ENUM: GPUFrontFace
- webidl.converters["GPUFrontFace"] = webidl.createEnumConverter(
- "GPUFrontFace",
- [
- "ccw",
- "cw",
- ],
- );
-
- // ENUM: GPUCullMode
- webidl.converters["GPUCullMode"] = webidl.createEnumConverter("GPUCullMode", [
- "none",
- "front",
- "back",
- ]);
-
- // DICTIONARY: GPUPrimitiveState
- const dictMembersGPUPrimitiveState = [
- {
- key: "topology",
- converter: webidl.converters["GPUPrimitiveTopology"],
- defaultValue: "triangle-list",
- },
- { key: "stripIndexFormat", converter: webidl.converters["GPUIndexFormat"] },
- {
- key: "frontFace",
- converter: webidl.converters["GPUFrontFace"],
- defaultValue: "ccw",
- },
- {
- key: "cullMode",
- converter: webidl.converters["GPUCullMode"],
- defaultValue: "none",
- },
- ];
- webidl.converters["GPUPrimitiveState"] = webidl.createDictionaryConverter(
- "GPUPrimitiveState",
- dictMembersGPUPrimitiveState,
- );
-
- // ENUM: GPUStencilOperation
- webidl.converters["GPUStencilOperation"] = webidl.createEnumConverter(
- "GPUStencilOperation",
- [
- "keep",
- "zero",
- "replace",
- "invert",
- "increment-clamp",
- "decrement-clamp",
- "increment-wrap",
- "decrement-wrap",
- ],
- );
-
- // DICTIONARY: GPUStencilFaceState
- const dictMembersGPUStencilFaceState = [
- {
- key: "compare",
- converter: webidl.converters["GPUCompareFunction"],
- defaultValue: "always",
- },
- {
- key: "failOp",
- converter: webidl.converters["GPUStencilOperation"],
- defaultValue: "keep",
- },
- {
- key: "depthFailOp",
- converter: webidl.converters["GPUStencilOperation"],
- defaultValue: "keep",
- },
- {
- key: "passOp",
- converter: webidl.converters["GPUStencilOperation"],
- defaultValue: "keep",
- },
- ];
- webidl.converters["GPUStencilFaceState"] = webidl.createDictionaryConverter(
- "GPUStencilFaceState",
- dictMembersGPUStencilFaceState,
- );
-
- // TYPEDEF: GPUStencilValue
- webidl.converters["GPUStencilValue"] = (V, opts) =>
- webidl.converters["unsigned long"](V, { ...opts, enforceRange: true });
-
- // TYPEDEF: GPUDepthBias
- webidl.converters["GPUDepthBias"] = (V, opts) =>
- webidl.converters["long"](V, { ...opts, enforceRange: true });
-
- // DICTIONARY: GPUDepthStencilState
- const dictMembersGPUDepthStencilState = [
- {
- key: "format",
- converter: webidl.converters["GPUTextureFormat"],
- required: true,
- },
- {
- key: "depthWriteEnabled",
- converter: webidl.converters["boolean"],
- defaultValue: false,
- },
- {
- key: "depthCompare",
- converter: webidl.converters["GPUCompareFunction"],
- defaultValue: "always",
- },
- {
- key: "stencilFront",
- converter: webidl.converters["GPUStencilFaceState"],
- get defaultValue() {
- return {};
- },
- },
- {
- key: "stencilBack",
- converter: webidl.converters["GPUStencilFaceState"],
- get defaultValue() {
- return {};
- },
- },
- {
- key: "stencilReadMask",
- converter: webidl.converters["GPUStencilValue"],
- defaultValue: 0xFFFFFFFF,
- },
- {
- key: "stencilWriteMask",
- converter: webidl.converters["GPUStencilValue"],
- defaultValue: 0xFFFFFFFF,
- },
- {
- key: "depthBias",
- converter: webidl.converters["GPUDepthBias"],
- defaultValue: 0,
- },
- {
- key: "depthBiasSlopeScale",
- converter: webidl.converters["float"],
- defaultValue: 0,
- },
- {
- key: "depthBiasClamp",
- converter: webidl.converters["float"],
- defaultValue: 0,
- },
- {
- key: "clampDepth",
- converter: webidl.converters["boolean"],
- defaultValue: false,
- },
- ];
- webidl.converters["GPUDepthStencilState"] = webidl.createDictionaryConverter(
- "GPUDepthStencilState",
- dictMembersGPUDepthStencilState,
- );
-
- // TYPEDEF: GPUSampleMask
- webidl.converters["GPUSampleMask"] = (V, opts) =>
- webidl.converters["unsigned long"](V, { ...opts, enforceRange: true });
-
- // DICTIONARY: GPUMultisampleState
- const dictMembersGPUMultisampleState = [
- {
- key: "count",
- converter: webidl.converters["GPUSize32"],
- defaultValue: 1,
- },
- {
- key: "mask",
- converter: webidl.converters["GPUSampleMask"],
- defaultValue: 0xFFFFFFFF,
- },
- {
- key: "alphaToCoverageEnabled",
- converter: webidl.converters["boolean"],
- defaultValue: false,
- },
- ];
- webidl.converters["GPUMultisampleState"] = webidl.createDictionaryConverter(
- "GPUMultisampleState",
- dictMembersGPUMultisampleState,
- );
-
- // ENUM: GPUBlendFactor
- webidl.converters["GPUBlendFactor"] = webidl.createEnumConverter(
- "GPUBlendFactor",
- [
- "zero",
- "one",
- "src-color",
- "one-minus-src-color",
- "src-alpha",
- "one-minus-src-alpha",
- "dst-color",
- "one-minus-dst-color",
- "dst-alpha",
- "one-minus-dst-alpha",
- "src-alpha-saturated",
- "blend-color",
- "one-minus-blend-color",
- ],
- );
-
- // ENUM: GPUBlendOperation
- webidl.converters["GPUBlendOperation"] = webidl.createEnumConverter(
- "GPUBlendOperation",
- [
- "add",
- "subtract",
- "reverse-subtract",
- "min",
- "max",
- ],
- );
-
- // DICTIONARY: GPUBlendComponent
- const dictMembersGPUBlendComponent = [
- {
- key: "srcFactor",
- converter: webidl.converters["GPUBlendFactor"],
- defaultValue: "one",
- },
- {
- key: "dstFactor",
- converter: webidl.converters["GPUBlendFactor"],
- defaultValue: "zero",
- },
- {
- key: "operation",
- converter: webidl.converters["GPUBlendOperation"],
- defaultValue: "add",
- },
- ];
- webidl.converters["GPUBlendComponent"] = webidl.createDictionaryConverter(
- "GPUBlendComponent",
- dictMembersGPUBlendComponent,
- );
-
- // DICTIONARY: GPUBlendState
- const dictMembersGPUBlendState = [
- {
- key: "color",
- converter: webidl.converters["GPUBlendComponent"],
- required: true,
- },
- {
- key: "alpha",
- converter: webidl.converters["GPUBlendComponent"],
- required: true,
- },
- ];
- webidl.converters["GPUBlendState"] = webidl.createDictionaryConverter(
- "GPUBlendState",
- dictMembersGPUBlendState,
- );
-
- // TYPEDEF: GPUColorWriteFlags
- webidl.converters["GPUColorWriteFlags"] = (V, opts) =>
- webidl.converters["unsigned long"](V, { ...opts, enforceRange: true });
-
- // DICTIONARY: GPUColorTargetState
- const dictMembersGPUColorTargetState = [
- {
- key: "format",
- converter: webidl.converters["GPUTextureFormat"],
- required: true,
- },
- { key: "blend", converter: webidl.converters["GPUBlendState"] },
- {
- key: "writeMask",
- converter: webidl.converters["GPUColorWriteFlags"],
- defaultValue: 0xF,
- },
- ];
- webidl.converters["GPUColorTargetState"] = webidl.createDictionaryConverter(
- "GPUColorTargetState",
- dictMembersGPUColorTargetState,
- );
-
- // DICTIONARY: GPUFragmentState
- const dictMembersGPUFragmentState = [
- {
- key: "targets",
- converter: webidl.createSequenceConverter(
- webidl.converters["GPUColorTargetState"],
- ),
- required: true,
- },
- ];
- webidl.converters["GPUFragmentState"] = webidl.createDictionaryConverter(
- "GPUFragmentState",
- dictMembersGPUProgrammableStage,
- dictMembersGPUFragmentState,
- );
-
- // DICTIONARY: GPURenderPipelineDescriptor
- const dictMembersGPURenderPipelineDescriptor = [
- {
- key: "vertex",
- converter: webidl.converters["GPUVertexState"],
- required: true,
- },
- {
- key: "primitive",
- converter: webidl.converters["GPUPrimitiveState"],
- get defaultValue() {
- return {};
- },
- },
- {
- key: "depthStencil",
- converter: webidl.converters["GPUDepthStencilState"],
- },
- {
- key: "multisample",
- converter: webidl.converters["GPUMultisampleState"],
- get defaultValue() {
- return {};
- },
- },
- { key: "fragment", converter: webidl.converters["GPUFragmentState"] },
- ];
- webidl.converters["GPURenderPipelineDescriptor"] = webidl
- .createDictionaryConverter(
- "GPURenderPipelineDescriptor",
- dictMembersGPUPipelineDescriptorBase,
- dictMembersGPURenderPipelineDescriptor,
- );
-
- // INTERFACE: GPUColorWrite
- webidl.converters.GPUColorWrite = webidl.createInterfaceConverter(
- "GPUColorWrite",
- GPUColorWrite,
- );
-
- // INTERFACE: GPUCommandBuffer
- webidl.converters.GPUCommandBuffer = webidl.createInterfaceConverter(
- "GPUCommandBuffer",
- GPUCommandBuffer,
- );
- webidl.converters["sequence<GPUCommandBuffer>"] = webidl
- .createSequenceConverter(webidl.converters["GPUCommandBuffer"]);
-
- // DICTIONARY: GPUCommandBufferDescriptor
- const dictMembersGPUCommandBufferDescriptor = [];
- webidl.converters["GPUCommandBufferDescriptor"] = webidl
- .createDictionaryConverter(
- "GPUCommandBufferDescriptor",
- dictMembersGPUObjectDescriptorBase,
- dictMembersGPUCommandBufferDescriptor,
- );
-
- // INTERFACE: GPUCommandEncoder
- webidl.converters.GPUCommandEncoder = webidl.createInterfaceConverter(
- "GPUCommandEncoder",
- GPUCommandEncoder,
- );
-
- // DICTIONARY: GPUCommandEncoderDescriptor
- const dictMembersGPUCommandEncoderDescriptor = [
- {
- key: "measureExecutionTime",
- converter: webidl.converters["boolean"],
- defaultValue: false,
- },
- ];
- webidl.converters["GPUCommandEncoderDescriptor"] = webidl
- .createDictionaryConverter(
- "GPUCommandEncoderDescriptor",
- dictMembersGPUObjectDescriptorBase,
- dictMembersGPUCommandEncoderDescriptor,
- );
-
- // DICTIONARY: GPUImageDataLayout
- const dictMembersGPUImageDataLayout = [
- {
- key: "offset",
- converter: webidl.converters["GPUSize64"],
- defaultValue: 0,
- },
- { key: "bytesPerRow", converter: webidl.converters["GPUSize32"] },
- { key: "rowsPerImage", converter: webidl.converters["GPUSize32"] },
- ];
- webidl.converters["GPUImageDataLayout"] = webidl.createDictionaryConverter(
- "GPUImageDataLayout",
- dictMembersGPUImageDataLayout,
- );
-
- // DICTIONARY: GPUImageCopyBuffer
- const dictMembersGPUImageCopyBuffer = [
- {
- key: "buffer",
- converter: webidl.converters["GPUBuffer"],
- required: true,
- },
- ];
- webidl.converters["GPUImageCopyBuffer"] = webidl.createDictionaryConverter(
- "GPUImageCopyBuffer",
- dictMembersGPUImageDataLayout,
- dictMembersGPUImageCopyBuffer,
- );
-
- // DICTIONARY: GPUOrigin3DDict
- const dictMembersGPUOrigin3DDict = [
- {
- key: "x",
- converter: webidl.converters["GPUIntegerCoordinate"],
- defaultValue: 0,
- },
- {
- key: "y",
- converter: webidl.converters["GPUIntegerCoordinate"],
- defaultValue: 0,
- },
- {
- key: "z",
- converter: webidl.converters["GPUIntegerCoordinate"],
- defaultValue: 0,
- },
- ];
- webidl.converters["GPUOrigin3DDict"] = webidl.createDictionaryConverter(
- "GPUOrigin3DDict",
- dictMembersGPUOrigin3DDict,
- );
-
- // TYPEDEF: GPUOrigin3D
- webidl.converters["GPUOrigin3D"] = (V, opts) => {
- // Union for (sequence<GPUIntegerCoordinate> or GPUOrigin3DDict)
- if (V === null || V === undefined) {
- return webidl.converters["GPUOrigin3DDict"](V, opts);
- }
- if (typeof V === "object") {
- const method = V[Symbol.iterator];
- if (method !== undefined) {
- return webidl.converters["sequence<GPUIntegerCoordinate>"](V, opts);
- }
- return webidl.converters["GPUOrigin3DDict"](V, opts);
- }
- throw webidl.makeException(
- TypeError,
- "can not be converted to sequence<GPUIntegerCoordinate> or GPUOrigin3DDict.",
- opts,
- );
- };
-
- // DICTIONARY: GPUImageCopyTexture
- const dictMembersGPUImageCopyTexture = [
- {
- key: "texture",
- converter: webidl.converters["GPUTexture"],
- required: true,
- },
- {
- key: "mipLevel",
- converter: webidl.converters["GPUIntegerCoordinate"],
- defaultValue: 0,
- },
- {
- key: "origin",
- converter: webidl.converters["GPUOrigin3D"],
- get defaultValue() {
- return {};
- },
- },
- {
- key: "aspect",
- converter: webidl.converters["GPUTextureAspect"],
- defaultValue: "all",
- },
- ];
- webidl.converters["GPUImageCopyTexture"] = webidl.createDictionaryConverter(
- "GPUImageCopyTexture",
- dictMembersGPUImageCopyTexture,
- );
-
- // INTERFACE: GPUComputePassEncoder
- webidl.converters.GPUComputePassEncoder = webidl.createInterfaceConverter(
- "GPUComputePassEncoder",
- GPUComputePassEncoder,
- );
-
- // DICTIONARY: GPUComputePassDescriptor
- const dictMembersGPUComputePassDescriptor = [];
- webidl.converters["GPUComputePassDescriptor"] = webidl
- .createDictionaryConverter(
- "GPUComputePassDescriptor",
- dictMembersGPUObjectDescriptorBase,
- dictMembersGPUComputePassDescriptor,
- );
-
- // INTERFACE: GPURenderPassEncoder
- webidl.converters.GPURenderPassEncoder = webidl.createInterfaceConverter(
- "GPURenderPassEncoder",
- GPURenderPassEncoder,
- );
-
- // ENUM: GPULoadOp
- webidl.converters["GPULoadOp"] = webidl.createEnumConverter("GPULoadOp", [
- "load",
- ]);
-
- // DICTIONARY: GPUColorDict
- const dictMembersGPUColorDict = [
- { key: "r", converter: webidl.converters["double"], required: true },
- { key: "g", converter: webidl.converters["double"], required: true },
- { key: "b", converter: webidl.converters["double"], required: true },
- { key: "a", converter: webidl.converters["double"], required: true },
- ];
- webidl.converters["GPUColorDict"] = webidl.createDictionaryConverter(
- "GPUColorDict",
- dictMembersGPUColorDict,
- );
-
- // TYPEDEF: GPUColor
- webidl.converters["GPUColor"] = (V, opts) => {
- // Union for (sequence<double> or GPUColorDict)
- if (V === null || V === undefined) {
- return webidl.converters["GPUColorDict"](V, opts);
- }
- if (typeof V === "object") {
- const method = V[Symbol.iterator];
- if (method !== undefined) {
- return webidl.converters["sequence<double>"](V, opts);
- }
- return webidl.converters["GPUColorDict"](V, opts);
- }
- throw webidl.makeException(
- TypeError,
- "can not be converted to sequence<double> or GPUColorDict.",
- opts,
- );
- }; // ENUM: GPUStoreOp
-
- webidl.converters["GPUStoreOp"] = webidl.createEnumConverter("GPUStoreOp", [
- "store",
- "clear",
- ]);
-
- // DICTIONARY: GPURenderPassColorAttachment
- const dictMembersGPURenderPassColorAttachment = [
- {
- key: "view",
- converter: webidl.converters["GPUTextureView"],
- required: true,
- },
- { key: "resolveTarget", converter: webidl.converters["GPUTextureView"] },
- {
- key: "loadValue",
- converter: webidl.converters.any, /** put union here! **/
- required: true,
- },
- {
- key: "storeOp",
- converter: webidl.converters["GPUStoreOp"],
- defaultValue: "store",
- },
- ];
- webidl.converters["GPURenderPassColorAttachment"] = webidl
- .createDictionaryConverter(
- "GPURenderPassColorAttachment",
- dictMembersGPURenderPassColorAttachment,
- );
-
- // DICTIONARY: GPURenderPassDepthStencilAttachment
- const dictMembersGPURenderPassDepthStencilAttachment = [
- {
- key: "view",
- converter: webidl.converters["GPUTextureView"],
- required: true,
- },
- {
- key: "depthLoadValue",
- converter: webidl.converters.any, /** put union here! **/
- required: true,
- },
- {
- key: "depthStoreOp",
- converter: webidl.converters["GPUStoreOp"],
- required: true,
- },
- {
- key: "depthReadOnly",
- converter: webidl.converters["boolean"],
- defaultValue: false,
- },
- {
- key: "stencilLoadValue",
- converter: webidl.converters.any, /** put union here! **/
- required: true,
- },
- {
- key: "stencilStoreOp",
- converter: webidl.converters["GPUStoreOp"],
- required: true,
- },
- {
- key: "stencilReadOnly",
- converter: webidl.converters["boolean"],
- defaultValue: false,
- },
- ];
- webidl.converters["GPURenderPassDepthStencilAttachment"] = webidl
- .createDictionaryConverter(
- "GPURenderPassDepthStencilAttachment",
- dictMembersGPURenderPassDepthStencilAttachment,
- );
-
- // INTERFACE: GPUQuerySet
- webidl.converters.GPUQuerySet = webidl.createInterfaceConverter(
- "GPUQuerySet",
- GPUQuerySet,
- );
-
- // DICTIONARY: GPURenderPassDescriptor
- const dictMembersGPURenderPassDescriptor = [
- {
- key: "colorAttachments",
- converter: webidl.createSequenceConverter(
- webidl.converters["GPURenderPassColorAttachment"],
- ),
- required: true,
- },
- {
- key: "depthStencilAttachment",
- converter: webidl.converters["GPURenderPassDepthStencilAttachment"],
- },
- { key: "occlusionQuerySet", converter: webidl.converters["GPUQuerySet"] },
- ];
- webidl.converters["GPURenderPassDescriptor"] = webidl
- .createDictionaryConverter(
- "GPURenderPassDescriptor",
- dictMembersGPUObjectDescriptorBase,
- dictMembersGPURenderPassDescriptor,
- );
-
- // INTERFACE: GPURenderBundle
- webidl.converters.GPURenderBundle = webidl.createInterfaceConverter(
- "GPURenderBundle",
- GPURenderBundle,
- );
- webidl.converters["sequence<GPURenderBundle>"] = webidl
- .createSequenceConverter(webidl.converters["GPURenderBundle"]);
-
- // DICTIONARY: GPURenderBundleDescriptor
- const dictMembersGPURenderBundleDescriptor = [];
- webidl.converters["GPURenderBundleDescriptor"] = webidl
- .createDictionaryConverter(
- "GPURenderBundleDescriptor",
- dictMembersGPUObjectDescriptorBase,
- dictMembersGPURenderBundleDescriptor,
- );
-
- // INTERFACE: GPURenderBundleEncoder
- webidl.converters.GPURenderBundleEncoder = webidl.createInterfaceConverter(
- "GPURenderBundleEncoder",
- GPURenderBundleEncoder,
- );
-
- // DICTIONARY: GPURenderBundleEncoderDescriptor
- const dictMembersGPURenderBundleEncoderDescriptor = [
- {
- key: "colorFormats",
- converter: webidl.createSequenceConverter(
- webidl.converters["GPUTextureFormat"],
- ),
- required: true,
- },
- {
- key: "depthStencilFormat",
- converter: webidl.converters["GPUTextureFormat"],
- },
- {
- key: "sampleCount",
- converter: webidl.converters["GPUSize32"],
- defaultValue: 1,
- },
- ];
- webidl.converters["GPURenderBundleEncoderDescriptor"] = webidl
- .createDictionaryConverter(
- "GPURenderBundleEncoderDescriptor",
- dictMembersGPUObjectDescriptorBase,
- dictMembersGPURenderBundleEncoderDescriptor,
- );
-
- // INTERFACE: GPUQueue
- webidl.converters.GPUQueue = webidl.createInterfaceConverter(
- "GPUQueue",
- GPUQueue,
- );
-
- // ENUM: GPUQueryType
- webidl.converters["GPUQueryType"] = webidl.createEnumConverter(
- "GPUQueryType",
- [
- "occlusion",
- "pipeline-statistics",
- "timestamp",
- ],
- );
-
- // ENUM: GPUPipelineStatisticName
- webidl.converters["GPUPipelineStatisticName"] = webidl.createEnumConverter(
- "GPUPipelineStatisticName",
- [
- "vertex-shader-invocations",
- "clipper-invocations",
- "clipper-primitives-out",
- "fragment-shader-invocations",
- "compute-shader-invocations",
- ],
- );
-
- // DICTIONARY: GPUQuerySetDescriptor
- const dictMembersGPUQuerySetDescriptor = [
- {
- key: "type",
- converter: webidl.converters["GPUQueryType"],
- required: true,
- },
- { key: "count", converter: webidl.converters["GPUSize32"], required: true },
- {
- key: "pipelineStatistics",
- converter: webidl.createSequenceConverter(
- webidl.converters["GPUPipelineStatisticName"],
- ),
- get defaultValue() {
- return [];
- },
- },
- ];
- webidl.converters["GPUQuerySetDescriptor"] = webidl.createDictionaryConverter(
- "GPUQuerySetDescriptor",
- dictMembersGPUObjectDescriptorBase,
- dictMembersGPUQuerySetDescriptor,
- );
-
- // ENUM: GPUDeviceLostReason
- webidl.converters["GPUDeviceLostReason"] = webidl.createEnumConverter(
- "GPUDeviceLostReason",
- [
- "destroyed",
- ],
- );
-
- // // INTERFACE: GPUDeviceLostInfo
- // webidl.converters.GPUDeviceLostInfo = webidl.createInterfaceConverter(
- // "GPUDeviceLostInfo",
- // GPUDeviceLostInfo,
- // );
-
- // ENUM: GPUErrorFilter
- webidl.converters["GPUErrorFilter"] = webidl.createEnumConverter(
- "GPUErrorFilter",
- [
- "out-of-memory",
- "validation",
- ],
- );
-
- // INTERFACE: GPUOutOfMemoryError
- webidl.converters.GPUOutOfMemoryError = webidl.createInterfaceConverter(
- "GPUOutOfMemoryError",
- GPUOutOfMemoryError,
- );
-
- // INTERFACE: GPUValidationError
- webidl.converters.GPUValidationError = webidl.createInterfaceConverter(
- "GPUValidationError",
- GPUValidationError,
- );
-
- // TYPEDEF: GPUError
- webidl.converters["GPUError"] = webidl.converters.any /** put union here! **/;
-
- // // INTERFACE: GPUUncapturedErrorEvent
- // webidl.converters.GPUUncapturedErrorEvent = webidl.createInterfaceConverter(
- // "GPUUncapturedErrorEvent",
- // GPUUncapturedErrorEvent,
- // );
-
- // DICTIONARY: GPUUncapturedErrorEventInit
- const dictMembersGPUUncapturedErrorEventInit = [
- { key: "error", converter: webidl.converters["GPUError"], required: true },
- ];
- webidl.converters["GPUUncapturedErrorEventInit"] = webidl
- .createDictionaryConverter(
- "GPUUncapturedErrorEventInit",
- // dictMembersEventInit,
- dictMembersGPUUncapturedErrorEventInit,
- );
-
- // TYPEDEF: GPUBufferDynamicOffset
- webidl.converters["GPUBufferDynamicOffset"] = (V, opts) =>
- webidl.converters["unsigned long"](V, { ...opts, enforceRange: true });
-
- // TYPEDEF: GPUSignedOffset32
- webidl.converters["GPUSignedOffset32"] = (V, opts) =>
- webidl.converters["long"](V, { ...opts, enforceRange: true });
-
- // TYPEDEF: GPUFlagsConstant
- webidl.converters["GPUFlagsConstant"] = webidl.converters["unsigned long"];
-
- // DICTIONARY: GPUOrigin2DDict
- const dictMembersGPUOrigin2DDict = [
- {
- key: "x",
- converter: webidl.converters["GPUIntegerCoordinate"],
- defaultValue: 0,
- },
- {
- key: "y",
- converter: webidl.converters["GPUIntegerCoordinate"],
- defaultValue: 0,
- },
- ];
- webidl.converters["GPUOrigin2DDict"] = webidl.createDictionaryConverter(
- "GPUOrigin2DDict",
- dictMembersGPUOrigin2DDict,
- );
-
- // TYPEDEF: GPUOrigin2D
- webidl.converters["GPUOrigin2D"] = (V, opts) => {
- // Union for (sequence<GPUIntegerCoordinate> or GPUOrigin2DDict)
- if (V === null || V === undefined) {
- return webidl.converters["GPUOrigin2DDict"](V, opts);
- }
- if (typeof V === "object") {
- const method = V[Symbol.iterator];
- if (method !== undefined) {
- return webidl.converters["sequence<GPUIntegerCoordinate>"](V, opts);
- }
- return webidl.converters["GPUOrigin2DDict"](V, opts);
- }
- throw webidl.makeException(
- TypeError,
- "can not be converted to sequence<GPUIntegerCoordinate> or GPUOrigin2DDict.",
- opts,
- );
- };
-})(this);
diff --git a/op_crates/webgpu/Cargo.toml b/op_crates/webgpu/Cargo.toml
deleted file mode 100644
index 148ddea6a..000000000
--- a/op_crates/webgpu/Cargo.toml
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-[package]
-name = "deno_webgpu"
-version = "0.6.0"
-edition = "2018"
-description = "WebGPU implementation for Deno"
-authors = ["the Deno authors"]
-license = "MIT"
-readme = "README.md"
-repository = "https://github.com/denoland/deno"
-
-[lib]
-path = "lib.rs"
-
-[dependencies]
-deno_core = { version = "0.86.0", path = "../../core" }
-tokio = { version = "1.4.0", features = ["full"] }
-serde = { version = "1.0.125", features = ["derive"] }
-wgpu-core = { version = "0.7.0", features = ["trace"] }
-wgpu-types = "0.7.0"
diff --git a/op_crates/webgpu/README.md b/op_crates/webgpu/README.md
deleted file mode 100644
index 2f915dcbb..000000000
--- a/op_crates/webgpu/README.md
+++ /dev/null
@@ -1,35 +0,0 @@
-# deno_webgpu
-
-This op crate implements the WebGPU API as defined in
-https://gpuweb.github.io/gpuweb/ in Deno. The implementation targets the spec
-draft as of February 22, 2021. The spec is still very much in flux. This op
-crate tries to stay up to date with the spec, but is constrained by the features
-implemented in our GPU backend library [wgpu](https://github.com/gfx-rs/wgpu).
-
-The spec is still very bare bones, and is still missing many details. As the
-spec becomes more concrete, we will implement to follow the spec more closely.
-
-In addition, setting the `DENO_WEBGPU_TRACE` environmental variable will output
-a
-[wgpu trace](https://github.com/gfx-rs/wgpu/wiki/Debugging-wgpu-Applications#tracing-infrastructure)
-to the specified directory.
-
-For testing this op crate will make use of the WebGPU conformance tests suite,
-running through our WPT runner. This will be used to validate implementation
-conformance.
-
-GitHub CI doesn't run with GPUs, so testing relies on software like DX WARP &
-Vulkan lavapipe. Currently only using DX WARP works, so tests are only run on
-Windows.
-
-## Links
-
-Specification: https://gpuweb.github.io/gpuweb/
-
-Design documents: https://github.com/gpuweb/gpuweb/tree/main/design
-
-Conformance tests suite: https://github.com/gpuweb/cts
-
-WebGPU examples for Deno: https://github.com/crowlKats/webgpu-examples
-
-wgpu-users matrix channel: https://matrix.to/#/#wgpu-users:matrix.org
diff --git a/op_crates/webgpu/binding.rs b/op_crates/webgpu/binding.rs
deleted file mode 100644
index fd4e75784..000000000
--- a/op_crates/webgpu/binding.rs
+++ /dev/null
@@ -1,352 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::error::bad_resource_id;
-use deno_core::error::AnyError;
-use deno_core::ResourceId;
-use deno_core::ZeroCopyBuf;
-use deno_core::{OpState, Resource};
-use serde::Deserialize;
-use std::borrow::Cow;
-
-use super::error::WebGpuResult;
-
-pub(crate) struct WebGpuBindGroupLayout(
- pub(crate) wgpu_core::id::BindGroupLayoutId,
-);
-impl Resource for WebGpuBindGroupLayout {
- fn name(&self) -> Cow<str> {
- "webGPUBindGroupLayout".into()
- }
-}
-
-pub(crate) struct WebGpuBindGroup(pub(crate) wgpu_core::id::BindGroupId);
-impl Resource for WebGpuBindGroup {
- fn name(&self) -> Cow<str> {
- "webGPUBindGroup".into()
- }
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct GpuBufferBindingLayout {
- #[serde(rename = "type")]
- kind: Option<String>,
- has_dynamic_offset: Option<bool>,
- min_binding_size: Option<u64>,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct GpuSamplerBindingLayout {
- #[serde(rename = "type")]
- kind: Option<String>,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct GpuTextureBindingLayout {
- sample_type: Option<String>,
- view_dimension: Option<String>,
- multisampled: Option<bool>,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct GpuStorageTextureBindingLayout {
- access: String,
- format: String,
- view_dimension: Option<String>,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct GpuBindGroupLayoutEntry {
- binding: u32,
- visibility: u32,
- buffer: Option<GpuBufferBindingLayout>,
- sampler: Option<GpuSamplerBindingLayout>,
- texture: Option<GpuTextureBindingLayout>,
- storage_texture: Option<GpuStorageTextureBindingLayout>,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CreateBindGroupLayoutArgs {
- device_rid: ResourceId,
- label: Option<String>,
- entries: Vec<GpuBindGroupLayoutEntry>,
-}
-
-pub fn op_webgpu_create_bind_group_layout(
- state: &mut OpState,
- args: CreateBindGroupLayoutArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let device_resource = state
- .resource_table
- .get::<super::WebGpuDevice>(args.device_rid)
- .ok_or_else(bad_resource_id)?;
- let device = device_resource.0;
-
- let mut entries = vec![];
-
- for entry in &args.entries {
- entries.push(wgpu_types::BindGroupLayoutEntry {
- binding: entry.binding,
- visibility: wgpu_types::ShaderStage::from_bits(entry.visibility).unwrap(),
- ty: if let Some(buffer) = &entry.buffer {
- wgpu_types::BindingType::Buffer {
- ty: match &buffer.kind {
- Some(kind) => match kind.as_str() {
- "uniform" => wgpu_types::BufferBindingType::Uniform,
- "storage" => {
- wgpu_types::BufferBindingType::Storage { read_only: false }
- }
- "read-only-storage" => {
- wgpu_types::BufferBindingType::Storage { read_only: true }
- }
- _ => unreachable!(),
- },
- None => wgpu_types::BufferBindingType::Uniform,
- },
- has_dynamic_offset: buffer.has_dynamic_offset.unwrap_or(false),
- min_binding_size: if let Some(min_binding_size) =
- buffer.min_binding_size
- {
- std::num::NonZeroU64::new(min_binding_size)
- } else {
- None
- },
- }
- } else if let Some(sampler) = &entry.sampler {
- match &sampler.kind {
- Some(kind) => match kind.as_str() {
- "filtering" => wgpu_types::BindingType::Sampler {
- filtering: true,
- comparison: false,
- },
- "non-filtering" => wgpu_types::BindingType::Sampler {
- filtering: false,
- comparison: false,
- },
- "comparison" => wgpu_types::BindingType::Sampler {
- filtering: false,
- comparison: true,
- },
- _ => unreachable!(),
- },
- None => wgpu_types::BindingType::Sampler {
- filtering: true,
- comparison: false,
- },
- }
- } else if let Some(texture) = &entry.texture {
- wgpu_types::BindingType::Texture {
- sample_type: match &texture.sample_type {
- Some(sample_type) => match sample_type.as_str() {
- "float" => {
- wgpu_types::TextureSampleType::Float { filterable: true }
- }
- "unfilterable-float" => {
- wgpu_types::TextureSampleType::Float { filterable: false }
- }
- "depth" => wgpu_types::TextureSampleType::Depth,
- "sint" => wgpu_types::TextureSampleType::Sint,
- "uint" => wgpu_types::TextureSampleType::Uint,
- _ => unreachable!(),
- },
- None => wgpu_types::TextureSampleType::Float { filterable: true },
- },
- view_dimension: match &texture.view_dimension {
- Some(view_dimension) => {
- super::texture::serialize_dimension(view_dimension)
- }
- None => wgpu_types::TextureViewDimension::D2,
- },
- multisampled: texture.multisampled.unwrap_or(false),
- }
- } else if let Some(storage_texture) = &entry.storage_texture {
- wgpu_types::BindingType::StorageTexture {
- access: match storage_texture.access.as_str() {
- "read-only" => wgpu_types::StorageTextureAccess::ReadOnly,
- "write-only" => wgpu_types::StorageTextureAccess::WriteOnly,
- _ => unreachable!(),
- },
- format: super::texture::serialize_texture_format(
- &storage_texture.format,
- )?,
- view_dimension: match &storage_texture.view_dimension {
- Some(view_dimension) => {
- super::texture::serialize_dimension(view_dimension)
- }
- None => wgpu_types::TextureViewDimension::D2,
- },
- }
- } else {
- unreachable!()
- },
- count: None, // native-only
- });
- }
-
- let descriptor = wgpu_core::binding_model::BindGroupLayoutDescriptor {
- label: args.label.map(Cow::from),
- entries: Cow::from(entries),
- };
-
- let (bind_group_layout, maybe_err) = gfx_select!(device => instance.device_create_bind_group_layout(
- device,
- &descriptor,
- std::marker::PhantomData
- ));
-
- let rid = state
- .resource_table
- .add(WebGpuBindGroupLayout(bind_group_layout));
-
- Ok(WebGpuResult::rid_err(rid, maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CreatePipelineLayoutArgs {
- device_rid: ResourceId,
- label: Option<String>,
- bind_group_layouts: Vec<u32>,
-}
-
-pub fn op_webgpu_create_pipeline_layout(
- state: &mut OpState,
- args: CreatePipelineLayoutArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let device_resource = state
- .resource_table
- .get::<super::WebGpuDevice>(args.device_rid)
- .ok_or_else(bad_resource_id)?;
- let device = device_resource.0;
-
- let mut bind_group_layouts = vec![];
-
- for rid in &args.bind_group_layouts {
- let bind_group_layout = state
- .resource_table
- .get::<WebGpuBindGroupLayout>(*rid)
- .ok_or_else(bad_resource_id)?;
- bind_group_layouts.push(bind_group_layout.0);
- }
-
- let descriptor = wgpu_core::binding_model::PipelineLayoutDescriptor {
- label: args.label.map(Cow::from),
- bind_group_layouts: Cow::from(bind_group_layouts),
- push_constant_ranges: Default::default(),
- };
-
- let (pipeline_layout, maybe_err) = gfx_select!(device => instance.device_create_pipeline_layout(
- device,
- &descriptor,
- std::marker::PhantomData
- ));
-
- let rid = state
- .resource_table
- .add(super::pipeline::WebGpuPipelineLayout(pipeline_layout));
-
- Ok(WebGpuResult::rid_err(rid, maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct GpuBindGroupEntry {
- binding: u32,
- kind: String,
- resource: u32,
- offset: Option<u64>,
- size: Option<u64>,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CreateBindGroupArgs {
- device_rid: ResourceId,
- label: Option<String>,
- layout: u32,
- entries: Vec<GpuBindGroupEntry>,
-}
-
-pub fn op_webgpu_create_bind_group(
- state: &mut OpState,
- args: CreateBindGroupArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let device_resource = state
- .resource_table
- .get::<super::WebGpuDevice>(args.device_rid)
- .ok_or_else(bad_resource_id)?;
- let device = device_resource.0;
-
- let mut entries = vec![];
-
- for entry in &args.entries {
- let e = wgpu_core::binding_model::BindGroupEntry {
- binding: entry.binding,
- resource: match entry.kind.as_str() {
- "GPUSampler" => {
- let sampler_resource = state
- .resource_table
- .get::<super::sampler::WebGpuSampler>(entry.resource)
- .ok_or_else(bad_resource_id)?;
- wgpu_core::binding_model::BindingResource::Sampler(sampler_resource.0)
- }
- "GPUTextureView" => {
- let texture_view_resource = state
- .resource_table
- .get::<super::texture::WebGpuTextureView>(entry.resource)
- .ok_or_else(bad_resource_id)?;
- wgpu_core::binding_model::BindingResource::TextureView(
- texture_view_resource.0,
- )
- }
- "GPUBufferBinding" => {
- let buffer_resource = state
- .resource_table
- .get::<super::buffer::WebGpuBuffer>(entry.resource)
- .ok_or_else(bad_resource_id)?;
- wgpu_core::binding_model::BindingResource::Buffer(
- wgpu_core::binding_model::BufferBinding {
- buffer_id: buffer_resource.0,
- offset: entry.offset.unwrap_or(0),
- size: std::num::NonZeroU64::new(entry.size.unwrap_or(0)),
- },
- )
- }
- _ => unreachable!(),
- },
- };
- entries.push(e);
- }
-
- let bind_group_layout = state
- .resource_table
- .get::<WebGpuBindGroupLayout>(args.layout)
- .ok_or_else(bad_resource_id)?;
-
- let descriptor = wgpu_core::binding_model::BindGroupDescriptor {
- label: args.label.map(Cow::from),
- layout: bind_group_layout.0,
- entries: Cow::from(entries),
- };
-
- let (bind_group, maybe_err) = gfx_select!(device => instance.device_create_bind_group(
- device,
- &descriptor,
- std::marker::PhantomData
- ));
-
- let rid = state.resource_table.add(WebGpuBindGroup(bind_group));
-
- Ok(WebGpuResult::rid_err(rid, maybe_err))
-}
diff --git a/op_crates/webgpu/buffer.rs b/op_crates/webgpu/buffer.rs
deleted file mode 100644
index 19fc428cb..000000000
--- a/op_crates/webgpu/buffer.rs
+++ /dev/null
@@ -1,239 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::error::bad_resource_id;
-use deno_core::error::null_opbuf;
-use deno_core::error::AnyError;
-use deno_core::futures::channel::oneshot;
-use deno_core::OpState;
-use deno_core::Resource;
-use deno_core::ResourceId;
-use deno_core::ZeroCopyBuf;
-use serde::Deserialize;
-use std::borrow::Cow;
-use std::cell::RefCell;
-use std::rc::Rc;
-use std::time::Duration;
-
-use super::error::DomExceptionOperationError;
-use super::error::WebGpuResult;
-
-pub(crate) struct WebGpuBuffer(pub(crate) wgpu_core::id::BufferId);
-impl Resource for WebGpuBuffer {
- fn name(&self) -> Cow<str> {
- "webGPUBuffer".into()
- }
-}
-
-struct WebGpuBufferMapped(*mut u8, usize);
-impl Resource for WebGpuBufferMapped {
- fn name(&self) -> Cow<str> {
- "webGPUBufferMapped".into()
- }
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CreateBufferArgs {
- device_rid: ResourceId,
- label: Option<String>,
- size: u64,
- usage: u32,
- mapped_at_creation: Option<bool>,
-}
-
-pub fn op_webgpu_create_buffer(
- state: &mut OpState,
- args: CreateBufferArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let device_resource = state
- .resource_table
- .get::<super::WebGpuDevice>(args.device_rid)
- .ok_or_else(bad_resource_id)?;
- let device = device_resource.0;
-
- let descriptor = wgpu_core::resource::BufferDescriptor {
- label: args.label.map(Cow::from),
- size: args.size,
- usage: wgpu_types::BufferUsage::from_bits(args.usage).unwrap(),
- mapped_at_creation: args.mapped_at_creation.unwrap_or(false),
- };
-
- let (buffer, maybe_err) = gfx_select!(device => instance.device_create_buffer(
- device,
- &descriptor,
- std::marker::PhantomData
- ));
-
- let rid = state.resource_table.add(WebGpuBuffer(buffer));
-
- Ok(WebGpuResult::rid_err(rid, maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct BufferGetMapAsyncArgs {
- buffer_rid: ResourceId,
- device_rid: ResourceId,
- mode: u32,
- offset: u64,
- size: u64,
-}
-
-pub async fn op_webgpu_buffer_get_map_async(
- state: Rc<RefCell<OpState>>,
- args: BufferGetMapAsyncArgs,
- _bufs: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let (sender, receiver) = oneshot::channel::<Result<(), AnyError>>();
-
- let device;
- {
- let state_ = state.borrow();
- let instance = state_.borrow::<super::Instance>();
- let buffer_resource = state_
- .resource_table
- .get::<WebGpuBuffer>(args.buffer_rid)
- .ok_or_else(bad_resource_id)?;
- let buffer = buffer_resource.0;
- let device_resource = state_
- .resource_table
- .get::<super::WebGpuDevice>(args.device_rid)
- .ok_or_else(bad_resource_id)?;
- device = device_resource.0;
-
- let boxed_sender = Box::new(sender);
- let sender_ptr = Box::into_raw(boxed_sender) as *mut u8;
-
- extern "C" fn buffer_map_future_wrapper(
- status: wgpu_core::resource::BufferMapAsyncStatus,
- user_data: *mut u8,
- ) {
- let sender_ptr = user_data as *mut oneshot::Sender<Result<(), AnyError>>;
- let boxed_sender = unsafe { Box::from_raw(sender_ptr) };
- boxed_sender
- .send(match status {
- wgpu_core::resource::BufferMapAsyncStatus::Success => Ok(()),
- _ => unreachable!(), // TODO
- })
- .unwrap();
- }
-
- // TODO(lucacasonato): error handling
- gfx_select!(buffer => instance.buffer_map_async(
- buffer,
- args.offset..(args.offset + args.size),
- wgpu_core::resource::BufferMapOperation {
- host: match args.mode {
- 1 => wgpu_core::device::HostMap::Read,
- 2 => wgpu_core::device::HostMap::Write,
- _ => unreachable!(),
- },
- callback: buffer_map_future_wrapper,
- user_data: sender_ptr,
- }
- ))?;
- }
-
- let done = Rc::new(RefCell::new(false));
- let done_ = done.clone();
- let device_poll_fut = async move {
- while !*done.borrow() {
- {
- let state = state.borrow();
- let instance = state.borrow::<super::Instance>();
- gfx_select!(device => instance.device_poll(device, false)).unwrap()
- }
- tokio::time::sleep(Duration::from_millis(10)).await;
- }
- Ok::<(), AnyError>(())
- };
-
- let receiver_fut = async move {
- receiver.await??;
- let mut done = done_.borrow_mut();
- *done = true;
- Ok::<(), AnyError>(())
- };
-
- tokio::try_join!(device_poll_fut, receiver_fut)?;
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct BufferGetMappedRangeArgs {
- buffer_rid: ResourceId,
- offset: u64,
- size: u64,
-}
-
-pub fn op_webgpu_buffer_get_mapped_range(
- state: &mut OpState,
- args: BufferGetMappedRangeArgs,
- zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let mut zero_copy = zero_copy.ok_or_else(null_opbuf)?;
- let instance = state.borrow::<super::Instance>();
- let buffer_resource = state
- .resource_table
- .get::<WebGpuBuffer>(args.buffer_rid)
- .ok_or_else(bad_resource_id)?;
- let buffer = buffer_resource.0;
-
- let slice_pointer = gfx_select!(buffer => instance.buffer_get_mapped_range(
- buffer,
- args.offset,
- std::num::NonZeroU64::new(args.size)
- ))
- .map_err(|e| DomExceptionOperationError::new(&e.to_string()))?;
-
- let slice = unsafe {
- std::slice::from_raw_parts_mut(slice_pointer, args.size as usize)
- };
- zero_copy.copy_from_slice(slice);
-
- let rid = state
- .resource_table
- .add(WebGpuBufferMapped(slice_pointer, args.size as usize));
-
- Ok(WebGpuResult::rid(rid))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct BufferUnmapArgs {
- buffer_rid: ResourceId,
- mapped_rid: ResourceId,
-}
-
-pub fn op_webgpu_buffer_unmap(
- state: &mut OpState,
- args: BufferUnmapArgs,
- zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let mapped_resource = state
- .resource_table
- .take::<WebGpuBufferMapped>(args.mapped_rid)
- .ok_or_else(bad_resource_id)?;
- let instance = state.borrow::<super::Instance>();
- let buffer_resource = state
- .resource_table
- .get::<WebGpuBuffer>(args.buffer_rid)
- .ok_or_else(bad_resource_id)?;
- let buffer = buffer_resource.0;
-
- let slice_pointer = mapped_resource.0;
- let size = mapped_resource.1;
-
- if let Some(buffer) = zero_copy {
- let slice = unsafe { std::slice::from_raw_parts_mut(slice_pointer, size) };
- slice.copy_from_slice(&buffer);
- }
-
- let maybe_err = gfx_select!(buffer => instance.buffer_unmap(buffer)).err();
-
- Ok(WebGpuResult::maybe_err(maybe_err))
-}
diff --git a/op_crates/webgpu/bundle.rs b/op_crates/webgpu/bundle.rs
deleted file mode 100644
index d33563118..000000000
--- a/op_crates/webgpu/bundle.rs
+++ /dev/null
@@ -1,460 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::error::bad_resource_id;
-use deno_core::error::null_opbuf;
-use deno_core::error::AnyError;
-use deno_core::ResourceId;
-use deno_core::ZeroCopyBuf;
-use deno_core::{OpState, Resource};
-use serde::Deserialize;
-use std::borrow::Cow;
-use std::cell::RefCell;
-use std::rc::Rc;
-
-use super::error::WebGpuResult;
-use super::texture::serialize_texture_format;
-
-struct WebGpuRenderBundleEncoder(
- RefCell<wgpu_core::command::RenderBundleEncoder>,
-);
-impl Resource for WebGpuRenderBundleEncoder {
- fn name(&self) -> Cow<str> {
- "webGPURenderBundleEncoder".into()
- }
-}
-
-pub(crate) struct WebGpuRenderBundle(pub(crate) wgpu_core::id::RenderBundleId);
-impl Resource for WebGpuRenderBundle {
- fn name(&self) -> Cow<str> {
- "webGPURenderBundle".into()
- }
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CreateRenderBundleEncoderArgs {
- device_rid: ResourceId,
- label: Option<String>,
- color_formats: Vec<String>,
- depth_stencil_format: Option<String>,
- sample_count: Option<u32>,
-}
-
-pub fn op_webgpu_create_render_bundle_encoder(
- state: &mut OpState,
- args: CreateRenderBundleEncoderArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let device_resource = state
- .resource_table
- .get::<super::WebGpuDevice>(args.device_rid)
- .ok_or_else(bad_resource_id)?;
- let device = device_resource.0;
-
- let mut color_formats = vec![];
-
- for format in &args.color_formats {
- color_formats.push(serialize_texture_format(format)?);
- }
-
- let descriptor = wgpu_core::command::RenderBundleEncoderDescriptor {
- label: args.label.map(Cow::from),
- color_formats: Cow::from(color_formats),
- depth_stencil_format: args
- .depth_stencil_format
- .map(|s| serialize_texture_format(&s))
- .transpose()?,
- sample_count: args.sample_count.unwrap_or(1),
- };
-
- let res =
- wgpu_core::command::RenderBundleEncoder::new(&descriptor, device, None);
- let (render_bundle_encoder, maybe_err) = match res {
- Ok(encoder) => (encoder, None),
- Err(e) => (
- wgpu_core::command::RenderBundleEncoder::dummy(device),
- Some(e),
- ),
- };
-
- let rid = state
- .resource_table
- .add(WebGpuRenderBundleEncoder(RefCell::new(
- render_bundle_encoder,
- )));
-
- Ok(WebGpuResult::rid_err(rid, maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderBundleEncoderFinishArgs {
- render_bundle_encoder_rid: ResourceId,
- label: Option<String>,
-}
-
-pub fn op_webgpu_render_bundle_encoder_finish(
- state: &mut OpState,
- args: RenderBundleEncoderFinishArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let render_bundle_encoder_resource = state
- .resource_table
- .take::<WebGpuRenderBundleEncoder>(args.render_bundle_encoder_rid)
- .ok_or_else(bad_resource_id)?;
- let render_bundle_encoder = Rc::try_unwrap(render_bundle_encoder_resource)
- .ok()
- .expect("unwrapping render_bundle_encoder_resource should succeed")
- .0
- .into_inner();
- let instance = state.borrow::<super::Instance>();
-
- let (render_bundle, maybe_err) = gfx_select!(render_bundle_encoder.parent() => instance.render_bundle_encoder_finish(
- render_bundle_encoder,
- &wgpu_core::command::RenderBundleDescriptor {
- label: args.label.map(Cow::from),
- },
- std::marker::PhantomData
- ));
-
- let rid = state.resource_table.add(WebGpuRenderBundle(render_bundle));
-
- Ok(WebGpuResult::rid_err(rid, maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderBundleEncoderSetBindGroupArgs {
- render_bundle_encoder_rid: ResourceId,
- index: u32,
- bind_group: u32,
- dynamic_offsets_data: Option<Vec<u32>>,
- dynamic_offsets_data_start: usize,
- dynamic_offsets_data_length: usize,
-}
-
-pub fn op_webgpu_render_bundle_encoder_set_bind_group(
- state: &mut OpState,
- args: RenderBundleEncoderSetBindGroupArgs,
- zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let bind_group_resource = state
- .resource_table
- .get::<super::binding::WebGpuBindGroup>(args.bind_group)
- .ok_or_else(bad_resource_id)?;
- let render_bundle_encoder_resource = state
- .resource_table
- .get::<WebGpuRenderBundleEncoder>(args.render_bundle_encoder_rid)
- .ok_or_else(bad_resource_id)?;
-
- // I know this might look like it can be easily deduplicated, but it can not
- // be due to the lifetime of the args.dynamic_offsets_data slice. Because we
- // need to use a raw pointer here the slice can be freed before the pointer
- // is used in wgpu_render_pass_set_bind_group. See
- // https://matrix.to/#/!XFRnMvAfptAHthwBCx:matrix.org/$HgrlhD-Me1DwsGb8UdMu2Hqubgks8s7ILwWRwigOUAg
- match args.dynamic_offsets_data {
- Some(data) => unsafe {
- wgpu_core::command::bundle_ffi::wgpu_render_bundle_set_bind_group(
- &mut render_bundle_encoder_resource.0.borrow_mut(),
- args.index,
- bind_group_resource.0,
- data.as_slice().as_ptr(),
- args.dynamic_offsets_data_length,
- );
- },
- None => {
- let zero_copy = zero_copy.ok_or_else(null_opbuf)?;
- let (prefix, data, suffix) = unsafe { zero_copy.align_to::<u32>() };
- assert!(prefix.is_empty());
- assert!(suffix.is_empty());
- unsafe {
- wgpu_core::command::bundle_ffi::wgpu_render_bundle_set_bind_group(
- &mut render_bundle_encoder_resource.0.borrow_mut(),
- args.index,
- bind_group_resource.0,
- data[args.dynamic_offsets_data_start..].as_ptr(),
- args.dynamic_offsets_data_length,
- );
- }
- }
- };
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderBundleEncoderPushDebugGroupArgs {
- render_bundle_encoder_rid: ResourceId,
- group_label: String,
-}
-
-pub fn op_webgpu_render_bundle_encoder_push_debug_group(
- state: &mut OpState,
- args: RenderBundleEncoderPushDebugGroupArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let render_bundle_encoder_resource = state
- .resource_table
- .get::<WebGpuRenderBundleEncoder>(args.render_bundle_encoder_rid)
- .ok_or_else(bad_resource_id)?;
-
- unsafe {
- let label = std::ffi::CString::new(args.group_label).unwrap();
- wgpu_core::command::bundle_ffi::wgpu_render_bundle_push_debug_group(
- &mut render_bundle_encoder_resource.0.borrow_mut(),
- label.as_ptr(),
- );
- }
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderBundleEncoderPopDebugGroupArgs {
- render_bundle_encoder_rid: ResourceId,
-}
-
-pub fn op_webgpu_render_bundle_encoder_pop_debug_group(
- state: &mut OpState,
- args: RenderBundleEncoderPopDebugGroupArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let render_bundle_encoder_resource = state
- .resource_table
- .get::<WebGpuRenderBundleEncoder>(args.render_bundle_encoder_rid)
- .ok_or_else(bad_resource_id)?;
-
- unsafe {
- wgpu_core::command::bundle_ffi::wgpu_render_bundle_pop_debug_group(
- &mut render_bundle_encoder_resource.0.borrow_mut(),
- );
- }
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderBundleEncoderInsertDebugMarkerArgs {
- render_bundle_encoder_rid: ResourceId,
- marker_label: String,
-}
-
-pub fn op_webgpu_render_bundle_encoder_insert_debug_marker(
- state: &mut OpState,
- args: RenderBundleEncoderInsertDebugMarkerArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let render_bundle_encoder_resource = state
- .resource_table
- .get::<WebGpuRenderBundleEncoder>(args.render_bundle_encoder_rid)
- .ok_or_else(bad_resource_id)?;
-
- unsafe {
- let label = std::ffi::CString::new(args.marker_label).unwrap();
- wgpu_core::command::bundle_ffi::wgpu_render_bundle_insert_debug_marker(
- &mut render_bundle_encoder_resource.0.borrow_mut(),
- label.as_ptr(),
- );
- }
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderBundleEncoderSetPipelineArgs {
- render_bundle_encoder_rid: ResourceId,
- pipeline: u32,
-}
-
-pub fn op_webgpu_render_bundle_encoder_set_pipeline(
- state: &mut OpState,
- args: RenderBundleEncoderSetPipelineArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let render_pipeline_resource = state
- .resource_table
- .get::<super::pipeline::WebGpuRenderPipeline>(args.pipeline)
- .ok_or_else(bad_resource_id)?;
- let render_bundle_encoder_resource = state
- .resource_table
- .get::<WebGpuRenderBundleEncoder>(args.render_bundle_encoder_rid)
- .ok_or_else(bad_resource_id)?;
-
- wgpu_core::command::bundle_ffi::wgpu_render_bundle_set_pipeline(
- &mut render_bundle_encoder_resource.0.borrow_mut(),
- render_pipeline_resource.0,
- );
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderBundleEncoderSetIndexBufferArgs {
- render_bundle_encoder_rid: ResourceId,
- buffer: u32,
- index_format: String,
- offset: u64,
- size: u64,
-}
-
-pub fn op_webgpu_render_bundle_encoder_set_index_buffer(
- state: &mut OpState,
- args: RenderBundleEncoderSetIndexBufferArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let buffer_resource = state
- .resource_table
- .get::<super::buffer::WebGpuBuffer>(args.buffer)
- .ok_or_else(bad_resource_id)?;
- let render_bundle_encoder_resource = state
- .resource_table
- .get::<WebGpuRenderBundleEncoder>(args.render_bundle_encoder_rid)
- .ok_or_else(bad_resource_id)?;
-
- render_bundle_encoder_resource
- .0
- .borrow_mut()
- .set_index_buffer(
- buffer_resource.0,
- super::pipeline::serialize_index_format(args.index_format),
- args.offset,
- std::num::NonZeroU64::new(args.size),
- );
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderBundleEncoderSetVertexBufferArgs {
- render_bundle_encoder_rid: ResourceId,
- slot: u32,
- buffer: u32,
- offset: u64,
- size: u64,
-}
-
-pub fn op_webgpu_render_bundle_encoder_set_vertex_buffer(
- state: &mut OpState,
- args: RenderBundleEncoderSetVertexBufferArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let buffer_resource = state
- .resource_table
- .get::<super::buffer::WebGpuBuffer>(args.buffer)
- .ok_or_else(bad_resource_id)?;
- let render_bundle_encoder_resource = state
- .resource_table
- .get::<WebGpuRenderBundleEncoder>(args.render_bundle_encoder_rid)
- .ok_or_else(bad_resource_id)?;
-
- wgpu_core::command::bundle_ffi::wgpu_render_bundle_set_vertex_buffer(
- &mut render_bundle_encoder_resource.0.borrow_mut(),
- args.slot,
- buffer_resource.0,
- args.offset,
- std::num::NonZeroU64::new(args.size),
- );
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderBundleEncoderDrawArgs {
- render_bundle_encoder_rid: ResourceId,
- vertex_count: u32,
- instance_count: u32,
- first_vertex: u32,
- first_instance: u32,
-}
-
-pub fn op_webgpu_render_bundle_encoder_draw(
- state: &mut OpState,
- args: RenderBundleEncoderDrawArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let render_bundle_encoder_resource = state
- .resource_table
- .get::<WebGpuRenderBundleEncoder>(args.render_bundle_encoder_rid)
- .ok_or_else(bad_resource_id)?;
-
- wgpu_core::command::bundle_ffi::wgpu_render_bundle_draw(
- &mut render_bundle_encoder_resource.0.borrow_mut(),
- args.vertex_count,
- args.instance_count,
- args.first_vertex,
- args.first_instance,
- );
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderBundleEncoderDrawIndexedArgs {
- render_bundle_encoder_rid: ResourceId,
- index_count: u32,
- instance_count: u32,
- first_index: u32,
- base_vertex: i32,
- first_instance: u32,
-}
-
-pub fn op_webgpu_render_bundle_encoder_draw_indexed(
- state: &mut OpState,
- args: RenderBundleEncoderDrawIndexedArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let render_bundle_encoder_resource = state
- .resource_table
- .get::<WebGpuRenderBundleEncoder>(args.render_bundle_encoder_rid)
- .ok_or_else(bad_resource_id)?;
-
- wgpu_core::command::bundle_ffi::wgpu_render_bundle_draw_indexed(
- &mut render_bundle_encoder_resource.0.borrow_mut(),
- args.index_count,
- args.instance_count,
- args.first_index,
- args.base_vertex,
- args.first_instance,
- );
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderBundleEncoderDrawIndirectArgs {
- render_bundle_encoder_rid: ResourceId,
- indirect_buffer: u32,
- indirect_offset: u64,
-}
-
-pub fn op_webgpu_render_bundle_encoder_draw_indirect(
- state: &mut OpState,
- args: RenderBundleEncoderDrawIndirectArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let buffer_resource = state
- .resource_table
- .get::<super::buffer::WebGpuBuffer>(args.indirect_buffer)
- .ok_or_else(bad_resource_id)?;
- let render_bundle_encoder_resource = state
- .resource_table
- .get::<WebGpuRenderBundleEncoder>(args.render_bundle_encoder_rid)
- .ok_or_else(bad_resource_id)?;
-
- wgpu_core::command::bundle_ffi::wgpu_render_bundle_draw_indirect(
- &mut render_bundle_encoder_resource.0.borrow_mut(),
- buffer_resource.0,
- args.indirect_offset,
- );
-
- Ok(WebGpuResult::empty())
-}
diff --git a/op_crates/webgpu/command_encoder.rs b/op_crates/webgpu/command_encoder.rs
deleted file mode 100644
index 724ce72c4..000000000
--- a/op_crates/webgpu/command_encoder.rs
+++ /dev/null
@@ -1,723 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::error::bad_resource_id;
-use deno_core::error::AnyError;
-use deno_core::ResourceId;
-use deno_core::ZeroCopyBuf;
-use deno_core::{OpState, Resource};
-use serde::Deserialize;
-use std::borrow::Cow;
-use std::cell::RefCell;
-
-use super::error::WebGpuResult;
-
-pub(crate) struct WebGpuCommandEncoder(
- pub(crate) wgpu_core::id::CommandEncoderId,
-);
-impl Resource for WebGpuCommandEncoder {
- fn name(&self) -> Cow<str> {
- "webGPUCommandEncoder".into()
- }
-}
-
-pub(crate) struct WebGpuCommandBuffer(
- pub(crate) wgpu_core::id::CommandBufferId,
-);
-impl Resource for WebGpuCommandBuffer {
- fn name(&self) -> Cow<str> {
- "webGPUCommandBuffer".into()
- }
-}
-
-fn serialize_store_op(store_op: String) -> wgpu_core::command::StoreOp {
- match store_op.as_str() {
- "store" => wgpu_core::command::StoreOp::Store,
- "clear" => wgpu_core::command::StoreOp::Clear,
- _ => unreachable!(),
- }
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CreateCommandEncoderArgs {
- device_rid: ResourceId,
- label: Option<String>,
- _measure_execution_time: Option<bool>, // not yet implemented
-}
-
-pub fn op_webgpu_create_command_encoder(
- state: &mut OpState,
- args: CreateCommandEncoderArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let device_resource = state
- .resource_table
- .get::<super::WebGpuDevice>(args.device_rid)
- .ok_or_else(bad_resource_id)?;
- let device = device_resource.0;
-
- let descriptor = wgpu_types::CommandEncoderDescriptor {
- label: args.label.map(Cow::from),
- };
-
- let (command_encoder, maybe_err) = gfx_select!(device => instance.device_create_command_encoder(
- device,
- &descriptor,
- std::marker::PhantomData
- ));
-
- let rid = state
- .resource_table
- .add(WebGpuCommandEncoder(command_encoder));
-
- Ok(WebGpuResult::rid_err(rid, maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct GpuRenderPassColorAttachment {
- view: u32,
- resolve_target: Option<u32>,
- load_op: String,
- load_value: Option<super::render_pass::GpuColor>,
- store_op: Option<String>,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct GpuRenderPassDepthStencilAttachment {
- view: u32,
- depth_load_op: String,
- depth_load_value: Option<f32>,
- depth_store_op: String,
- depth_read_only: Option<bool>,
- stencil_load_op: String,
- stencil_load_value: Option<u32>,
- stencil_store_op: String,
- stencil_read_only: Option<bool>,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CommandEncoderBeginRenderPassArgs {
- command_encoder_rid: ResourceId,
- label: Option<String>,
- color_attachments: Vec<GpuRenderPassColorAttachment>,
- depth_stencil_attachment: Option<GpuRenderPassDepthStencilAttachment>,
- _occlusion_query_set: Option<u32>, // not yet implemented
-}
-
-pub fn op_webgpu_command_encoder_begin_render_pass(
- state: &mut OpState,
- args: CommandEncoderBeginRenderPassArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let command_encoder_resource = state
- .resource_table
- .get::<WebGpuCommandEncoder>(args.command_encoder_rid)
- .ok_or_else(bad_resource_id)?;
-
- let mut color_attachments = vec![];
-
- for color_attachment in args.color_attachments {
- let texture_view_resource = state
- .resource_table
- .get::<super::texture::WebGpuTextureView>(color_attachment.view)
- .ok_or_else(bad_resource_id)?;
-
- let attachment = wgpu_core::command::ColorAttachmentDescriptor {
- attachment: texture_view_resource.0,
- resolve_target: color_attachment
- .resolve_target
- .map(|rid| {
- state
- .resource_table
- .get::<super::texture::WebGpuTextureView>(rid)
- .ok_or_else(bad_resource_id)
- })
- .transpose()?
- .map(|texture| texture.0),
- channel: match color_attachment.load_op.as_str() {
- "load" => wgpu_core::command::PassChannel {
- load_op: wgpu_core::command::LoadOp::Load,
- store_op: color_attachment
- .store_op
- .map_or(wgpu_core::command::StoreOp::Store, serialize_store_op),
- clear_value: Default::default(),
- read_only: false,
- },
- "clear" => {
- let color = color_attachment.load_value.unwrap();
- wgpu_core::command::PassChannel {
- load_op: wgpu_core::command::LoadOp::Clear,
- store_op: color_attachment
- .store_op
- .map_or(wgpu_core::command::StoreOp::Store, serialize_store_op),
- clear_value: wgpu_types::Color {
- r: color.r,
- g: color.g,
- b: color.b,
- a: color.a,
- },
- read_only: false,
- }
- }
- _ => unreachable!(),
- },
- };
-
- color_attachments.push(attachment)
- }
-
- let mut depth_stencil_attachment = None;
-
- if let Some(attachment) = args.depth_stencil_attachment {
- let texture_view_resource = state
- .resource_table
- .get::<super::texture::WebGpuTextureView>(attachment.view)
- .ok_or_else(bad_resource_id)?;
-
- depth_stencil_attachment =
- Some(wgpu_core::command::DepthStencilAttachmentDescriptor {
- attachment: texture_view_resource.0,
- depth: match attachment.depth_load_op.as_str() {
- "load" => wgpu_core::command::PassChannel {
- load_op: wgpu_core::command::LoadOp::Load,
- store_op: serialize_store_op(attachment.depth_store_op),
- clear_value: 0.0,
- read_only: attachment.depth_read_only.unwrap_or(false),
- },
- "clear" => wgpu_core::command::PassChannel {
- load_op: wgpu_core::command::LoadOp::Clear,
- store_op: serialize_store_op(attachment.depth_store_op),
- clear_value: attachment.depth_load_value.unwrap(),
- read_only: attachment.depth_read_only.unwrap_or(false),
- },
- _ => unreachable!(),
- },
- stencil: match attachment.stencil_load_op.as_str() {
- "load" => wgpu_core::command::PassChannel {
- load_op: wgpu_core::command::LoadOp::Load,
- store_op: serialize_store_op(attachment.stencil_store_op),
- clear_value: 0,
- read_only: attachment.stencil_read_only.unwrap_or(false),
- },
- "clear" => wgpu_core::command::PassChannel {
- load_op: wgpu_core::command::LoadOp::Clear,
- store_op: serialize_store_op(attachment.stencil_store_op),
- clear_value: attachment.stencil_load_value.unwrap(),
- read_only: attachment.stencil_read_only.unwrap_or(false),
- },
- _ => unreachable!(),
- },
- });
- }
-
- let descriptor = wgpu_core::command::RenderPassDescriptor {
- label: args.label.map(Cow::from),
- color_attachments: Cow::from(color_attachments),
- depth_stencil_attachment: depth_stencil_attachment.as_ref(),
- };
-
- let render_pass = wgpu_core::command::RenderPass::new(
- command_encoder_resource.0,
- &descriptor,
- );
-
- let rid = state
- .resource_table
- .add(super::render_pass::WebGpuRenderPass(RefCell::new(
- render_pass,
- )));
-
- Ok(WebGpuResult::rid(rid))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CommandEncoderBeginComputePassArgs {
- command_encoder_rid: ResourceId,
- label: Option<String>,
-}
-
-pub fn op_webgpu_command_encoder_begin_compute_pass(
- state: &mut OpState,
- args: CommandEncoderBeginComputePassArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let command_encoder_resource = state
- .resource_table
- .get::<WebGpuCommandEncoder>(args.command_encoder_rid)
- .ok_or_else(bad_resource_id)?;
-
- let descriptor = wgpu_core::command::ComputePassDescriptor {
- label: args.label.map(Cow::from),
- };
-
- let compute_pass = wgpu_core::command::ComputePass::new(
- command_encoder_resource.0,
- &descriptor,
- );
-
- let rid = state
- .resource_table
- .add(super::compute_pass::WebGpuComputePass(RefCell::new(
- compute_pass,
- )));
-
- Ok(WebGpuResult::rid(rid))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CommandEncoderCopyBufferToBufferArgs {
- command_encoder_rid: ResourceId,
- source: u32,
- source_offset: u64,
- destination: u32,
- destination_offset: u64,
- size: u64,
-}
-
-pub fn op_webgpu_command_encoder_copy_buffer_to_buffer(
- state: &mut OpState,
- args: CommandEncoderCopyBufferToBufferArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let command_encoder_resource = state
- .resource_table
- .get::<WebGpuCommandEncoder>(args.command_encoder_rid)
- .ok_or_else(bad_resource_id)?;
- let command_encoder = command_encoder_resource.0;
- let source_buffer_resource = state
- .resource_table
- .get::<super::buffer::WebGpuBuffer>(args.source)
- .ok_or_else(bad_resource_id)?;
- let source_buffer = source_buffer_resource.0;
- let destination_buffer_resource = state
- .resource_table
- .get::<super::buffer::WebGpuBuffer>(args.destination)
- .ok_or_else(bad_resource_id)?;
- let destination_buffer = destination_buffer_resource.0;
-
- let maybe_err = gfx_select!(command_encoder => instance.command_encoder_copy_buffer_to_buffer(
- command_encoder,
- source_buffer,
- args.source_offset,
- destination_buffer,
- args.destination_offset,
- args.size
- )).err();
-
- Ok(WebGpuResult::maybe_err(maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct GpuImageCopyBuffer {
- buffer: u32,
- offset: Option<u64>,
- bytes_per_row: Option<u32>,
- rows_per_image: Option<u32>,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct GpuOrigin3D {
- pub x: Option<u32>,
- pub y: Option<u32>,
- pub z: Option<u32>,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct GpuImageCopyTexture {
- pub texture: u32,
- pub mip_level: Option<u32>,
- pub origin: Option<GpuOrigin3D>,
- pub _aspect: Option<String>, // not yet implemented
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CommandEncoderCopyBufferToTextureArgs {
- command_encoder_rid: ResourceId,
- source: GpuImageCopyBuffer,
- destination: GpuImageCopyTexture,
- copy_size: super::texture::GpuExtent3D,
-}
-
-pub fn op_webgpu_command_encoder_copy_buffer_to_texture(
- state: &mut OpState,
- args: CommandEncoderCopyBufferToTextureArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let command_encoder_resource = state
- .resource_table
- .get::<WebGpuCommandEncoder>(args.command_encoder_rid)
- .ok_or_else(bad_resource_id)?;
- let command_encoder = command_encoder_resource.0;
- let source_buffer_resource = state
- .resource_table
- .get::<super::buffer::WebGpuBuffer>(args.source.buffer)
- .ok_or_else(bad_resource_id)?;
- let destination_texture_resource = state
- .resource_table
- .get::<super::texture::WebGpuTexture>(args.destination.texture)
- .ok_or_else(bad_resource_id)?;
-
- let source = wgpu_core::command::BufferCopyView {
- buffer: source_buffer_resource.0,
- layout: wgpu_types::TextureDataLayout {
- offset: args.source.offset.unwrap_or(0),
- bytes_per_row: args.source.bytes_per_row.unwrap_or(0),
- rows_per_image: args.source.rows_per_image.unwrap_or(0),
- },
- };
- let destination = wgpu_core::command::TextureCopyView {
- texture: destination_texture_resource.0,
- mip_level: args.destination.mip_level.unwrap_or(0),
- origin: args
- .destination
- .origin
- .map_or(Default::default(), |origin| wgpu_types::Origin3d {
- x: origin.x.unwrap_or(0),
- y: origin.y.unwrap_or(0),
- z: origin.z.unwrap_or(0),
- }),
- };
- let maybe_err = gfx_select!(command_encoder => instance.command_encoder_copy_buffer_to_texture(
- command_encoder,
- &source,
- &destination,
- &wgpu_types::Extent3d {
- width: args.copy_size.width.unwrap_or(1),
- height: args.copy_size.height.unwrap_or(1),
- depth: args.copy_size.depth.unwrap_or(1),
- }
- )).err();
-
- Ok(WebGpuResult::maybe_err(maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CommandEncoderCopyTextureToBufferArgs {
- command_encoder_rid: ResourceId,
- source: GpuImageCopyTexture,
- destination: GpuImageCopyBuffer,
- copy_size: super::texture::GpuExtent3D,
-}
-
-pub fn op_webgpu_command_encoder_copy_texture_to_buffer(
- state: &mut OpState,
- args: CommandEncoderCopyTextureToBufferArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let command_encoder_resource = state
- .resource_table
- .get::<WebGpuCommandEncoder>(args.command_encoder_rid)
- .ok_or_else(bad_resource_id)?;
- let command_encoder = command_encoder_resource.0;
- let source_texture_resource = state
- .resource_table
- .get::<super::texture::WebGpuTexture>(args.source.texture)
- .ok_or_else(bad_resource_id)?;
- let destination_buffer_resource = state
- .resource_table
- .get::<super::buffer::WebGpuBuffer>(args.destination.buffer)
- .ok_or_else(bad_resource_id)?;
-
- let source = wgpu_core::command::TextureCopyView {
- texture: source_texture_resource.0,
- mip_level: args.source.mip_level.unwrap_or(0),
- origin: args.source.origin.map_or(Default::default(), |origin| {
- wgpu_types::Origin3d {
- x: origin.x.unwrap_or(0),
- y: origin.y.unwrap_or(0),
- z: origin.z.unwrap_or(0),
- }
- }),
- };
- let destination = wgpu_core::command::BufferCopyView {
- buffer: destination_buffer_resource.0,
- layout: wgpu_types::TextureDataLayout {
- offset: args.destination.offset.unwrap_or(0),
- bytes_per_row: args.destination.bytes_per_row.unwrap_or(0),
- rows_per_image: args.destination.rows_per_image.unwrap_or(0),
- },
- };
- let maybe_err = gfx_select!(command_encoder => instance.command_encoder_copy_texture_to_buffer(
- command_encoder,
- &source,
- &destination,
- &wgpu_types::Extent3d {
- width: args.copy_size.width.unwrap_or(1),
- height: args.copy_size.height.unwrap_or(1),
- depth: args.copy_size.depth.unwrap_or(1),
- }
- )).err();
-
- Ok(WebGpuResult::maybe_err(maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CommandEncoderCopyTextureToTextureArgs {
- command_encoder_rid: ResourceId,
- source: GpuImageCopyTexture,
- destination: GpuImageCopyTexture,
- copy_size: super::texture::GpuExtent3D,
-}
-
-pub fn op_webgpu_command_encoder_copy_texture_to_texture(
- state: &mut OpState,
- args: CommandEncoderCopyTextureToTextureArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let command_encoder_resource = state
- .resource_table
- .get::<WebGpuCommandEncoder>(args.command_encoder_rid)
- .ok_or_else(bad_resource_id)?;
- let command_encoder = command_encoder_resource.0;
- let source_texture_resource = state
- .resource_table
- .get::<super::texture::WebGpuTexture>(args.source.texture)
- .ok_or_else(bad_resource_id)?;
- let destination_texture_resource = state
- .resource_table
- .get::<super::texture::WebGpuTexture>(args.destination.texture)
- .ok_or_else(bad_resource_id)?;
-
- let source = wgpu_core::command::TextureCopyView {
- texture: source_texture_resource.0,
- mip_level: args.source.mip_level.unwrap_or(0),
- origin: args.source.origin.map_or(Default::default(), |origin| {
- wgpu_types::Origin3d {
- x: origin.x.unwrap_or(0),
- y: origin.y.unwrap_or(0),
- z: origin.z.unwrap_or(0),
- }
- }),
- };
- let destination = wgpu_core::command::TextureCopyView {
- texture: destination_texture_resource.0,
- mip_level: args.destination.mip_level.unwrap_or(0),
- origin: args
- .destination
- .origin
- .map_or(Default::default(), |origin| wgpu_types::Origin3d {
- x: origin.x.unwrap_or(0),
- y: origin.y.unwrap_or(0),
- z: origin.z.unwrap_or(0),
- }),
- };
- let maybe_err = gfx_select!(command_encoder => instance.command_encoder_copy_texture_to_texture(
- command_encoder,
- &source,
- &destination,
- &wgpu_types::Extent3d {
- width: args.copy_size.width.unwrap_or(1),
- height: args.copy_size.height.unwrap_or(1),
- depth: args.copy_size.depth.unwrap_or(1),
- }
- )).err();
-
- Ok(WebGpuResult::maybe_err(maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CommandEncoderPushDebugGroupArgs {
- command_encoder_rid: ResourceId,
- group_label: String,
-}
-
-pub fn op_webgpu_command_encoder_push_debug_group(
- state: &mut OpState,
- args: CommandEncoderPushDebugGroupArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let command_encoder_resource = state
- .resource_table
- .get::<WebGpuCommandEncoder>(args.command_encoder_rid)
- .ok_or_else(bad_resource_id)?;
- let command_encoder = command_encoder_resource.0;
-
- let maybe_err = gfx_select!(command_encoder => instance
- .command_encoder_push_debug_group(command_encoder, &args.group_label))
- .err();
-
- Ok(WebGpuResult::maybe_err(maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CommandEncoderPopDebugGroupArgs {
- command_encoder_rid: ResourceId,
-}
-
-pub fn op_webgpu_command_encoder_pop_debug_group(
- state: &mut OpState,
- args: CommandEncoderPopDebugGroupArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let command_encoder_resource = state
- .resource_table
- .get::<WebGpuCommandEncoder>(args.command_encoder_rid)
- .ok_or_else(bad_resource_id)?;
- let command_encoder = command_encoder_resource.0;
-
- let maybe_err = gfx_select!(command_encoder => instance.command_encoder_pop_debug_group(command_encoder)).err();
-
- Ok(WebGpuResult::maybe_err(maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CommandEncoderInsertDebugMarkerArgs {
- command_encoder_rid: ResourceId,
- marker_label: String,
-}
-
-pub fn op_webgpu_command_encoder_insert_debug_marker(
- state: &mut OpState,
- args: CommandEncoderInsertDebugMarkerArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let command_encoder_resource = state
- .resource_table
- .get::<WebGpuCommandEncoder>(args.command_encoder_rid)
- .ok_or_else(bad_resource_id)?;
- let command_encoder = command_encoder_resource.0;
-
- let maybe_err = gfx_select!(command_encoder => instance.command_encoder_insert_debug_marker(
- command_encoder,
- &args.marker_label
- )).err();
-
- Ok(WebGpuResult::maybe_err(maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CommandEncoderWriteTimestampArgs {
- command_encoder_rid: ResourceId,
- query_set: u32,
- query_index: u32,
-}
-
-pub fn op_webgpu_command_encoder_write_timestamp(
- state: &mut OpState,
- args: CommandEncoderWriteTimestampArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let command_encoder_resource = state
- .resource_table
- .get::<WebGpuCommandEncoder>(args.command_encoder_rid)
- .ok_or_else(bad_resource_id)?;
- let command_encoder = command_encoder_resource.0;
- let query_set_resource = state
- .resource_table
- .get::<super::WebGpuQuerySet>(args.query_set)
- .ok_or_else(bad_resource_id)?;
-
- let maybe_err =
- gfx_select!(command_encoder => instance.command_encoder_write_timestamp(
- command_encoder,
- query_set_resource.0,
- args.query_index
- ))
- .err();
-
- Ok(WebGpuResult::maybe_err(maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CommandEncoderResolveQuerySetArgs {
- command_encoder_rid: ResourceId,
- query_set: u32,
- first_query: u32,
- query_count: u32,
- destination: u32,
- destination_offset: u64,
-}
-
-pub fn op_webgpu_command_encoder_resolve_query_set(
- state: &mut OpState,
- args: CommandEncoderResolveQuerySetArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let command_encoder_resource = state
- .resource_table
- .get::<WebGpuCommandEncoder>(args.command_encoder_rid)
- .ok_or_else(bad_resource_id)?;
- let command_encoder = command_encoder_resource.0;
- let query_set_resource = state
- .resource_table
- .get::<super::WebGpuQuerySet>(args.query_set)
- .ok_or_else(bad_resource_id)?;
- let destination_resource = state
- .resource_table
- .get::<super::buffer::WebGpuBuffer>(args.destination)
- .ok_or_else(bad_resource_id)?;
-
- let maybe_err =
- gfx_select!(command_encoder => instance.command_encoder_resolve_query_set(
- command_encoder,
- query_set_resource.0,
- args.first_query,
- args.query_count,
- destination_resource.0,
- args.destination_offset
- ))
- .err();
-
- Ok(WebGpuResult::maybe_err(maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CommandEncoderFinishArgs {
- command_encoder_rid: ResourceId,
- label: Option<String>,
-}
-
-pub fn op_webgpu_command_encoder_finish(
- state: &mut OpState,
- args: CommandEncoderFinishArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let command_encoder_resource = state
- .resource_table
- .take::<WebGpuCommandEncoder>(args.command_encoder_rid)
- .ok_or_else(bad_resource_id)?;
- let command_encoder = command_encoder_resource.0;
- let instance = state.borrow::<super::Instance>();
-
- let descriptor = wgpu_types::CommandBufferDescriptor {
- label: args.label.map(Cow::from),
- };
-
- let (command_buffer, maybe_err) = gfx_select!(command_encoder => instance.command_encoder_finish(
- command_encoder,
- &descriptor
- ));
-
- let rid = state
- .resource_table
- .add(WebGpuCommandBuffer(command_buffer));
-
- Ok(WebGpuResult::rid_err(rid, maybe_err))
-}
diff --git a/op_crates/webgpu/compute_pass.rs b/op_crates/webgpu/compute_pass.rs
deleted file mode 100644
index e8ec642e9..000000000
--- a/op_crates/webgpu/compute_pass.rs
+++ /dev/null
@@ -1,366 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::error::bad_resource_id;
-use deno_core::error::null_opbuf;
-use deno_core::error::AnyError;
-use deno_core::ResourceId;
-use deno_core::ZeroCopyBuf;
-use deno_core::{OpState, Resource};
-use serde::Deserialize;
-use std::borrow::Cow;
-use std::cell::RefCell;
-
-use super::error::WebGpuResult;
-
-pub(crate) struct WebGpuComputePass(
- pub(crate) RefCell<wgpu_core::command::ComputePass>,
-);
-impl Resource for WebGpuComputePass {
- fn name(&self) -> Cow<str> {
- "webGPUComputePass".into()
- }
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ComputePassSetPipelineArgs {
- compute_pass_rid: ResourceId,
- pipeline: u32,
-}
-
-pub fn op_webgpu_compute_pass_set_pipeline(
- state: &mut OpState,
- args: ComputePassSetPipelineArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let compute_pipeline_resource = state
- .resource_table
- .get::<super::pipeline::WebGpuComputePipeline>(args.pipeline)
- .ok_or_else(bad_resource_id)?;
- let compute_pass_resource = state
- .resource_table
- .get::<WebGpuComputePass>(args.compute_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- wgpu_core::command::compute_ffi::wgpu_compute_pass_set_pipeline(
- &mut compute_pass_resource.0.borrow_mut(),
- compute_pipeline_resource.0,
- );
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ComputePassDispatchArgs {
- compute_pass_rid: ResourceId,
- x: u32,
- y: u32,
- z: u32,
-}
-
-pub fn op_webgpu_compute_pass_dispatch(
- state: &mut OpState,
- args: ComputePassDispatchArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let compute_pass_resource = state
- .resource_table
- .get::<WebGpuComputePass>(args.compute_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- wgpu_core::command::compute_ffi::wgpu_compute_pass_dispatch(
- &mut compute_pass_resource.0.borrow_mut(),
- args.x,
- args.y,
- args.z,
- );
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ComputePassDispatchIndirectArgs {
- compute_pass_rid: ResourceId,
- indirect_buffer: u32,
- indirect_offset: u64,
-}
-
-pub fn op_webgpu_compute_pass_dispatch_indirect(
- state: &mut OpState,
- args: ComputePassDispatchIndirectArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let buffer_resource = state
- .resource_table
- .get::<super::buffer::WebGpuBuffer>(args.indirect_buffer)
- .ok_or_else(bad_resource_id)?;
- let compute_pass_resource = state
- .resource_table
- .get::<WebGpuComputePass>(args.compute_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- wgpu_core::command::compute_ffi::wgpu_compute_pass_dispatch_indirect(
- &mut compute_pass_resource.0.borrow_mut(),
- buffer_resource.0,
- args.indirect_offset,
- );
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ComputePassBeginPipelineStatisticsQueryArgs {
- compute_pass_rid: ResourceId,
- query_set: u32,
- query_index: u32,
-}
-
-pub fn op_webgpu_compute_pass_begin_pipeline_statistics_query(
- state: &mut OpState,
- args: ComputePassBeginPipelineStatisticsQueryArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let compute_pass_resource = state
- .resource_table
- .get::<WebGpuComputePass>(args.compute_pass_rid)
- .ok_or_else(bad_resource_id)?;
- let query_set_resource = state
- .resource_table
- .get::<super::WebGpuQuerySet>(args.query_set)
- .ok_or_else(bad_resource_id)?;
-
- unsafe {
- wgpu_core::command::compute_ffi::wgpu_compute_pass_begin_pipeline_statistics_query(
- &mut compute_pass_resource.0.borrow_mut(),
- query_set_resource.0,
- args.query_index,
- );
- }
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ComputePassEndPipelineStatisticsQueryArgs {
- compute_pass_rid: ResourceId,
-}
-
-pub fn op_webgpu_compute_pass_end_pipeline_statistics_query(
- state: &mut OpState,
- args: ComputePassEndPipelineStatisticsQueryArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let compute_pass_resource = state
- .resource_table
- .get::<WebGpuComputePass>(args.compute_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- unsafe {
- wgpu_core::command::compute_ffi::wgpu_compute_pass_end_pipeline_statistics_query(
- &mut compute_pass_resource.0.borrow_mut(),
- );
- }
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ComputePassWriteTimestampArgs {
- compute_pass_rid: ResourceId,
- query_set: u32,
- query_index: u32,
-}
-
-pub fn op_webgpu_compute_pass_write_timestamp(
- state: &mut OpState,
- args: ComputePassWriteTimestampArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let compute_pass_resource = state
- .resource_table
- .get::<WebGpuComputePass>(args.compute_pass_rid)
- .ok_or_else(bad_resource_id)?;
- let query_set_resource = state
- .resource_table
- .get::<super::WebGpuQuerySet>(args.query_set)
- .ok_or_else(bad_resource_id)?;
-
- unsafe {
- wgpu_core::command::compute_ffi::wgpu_compute_pass_write_timestamp(
- &mut compute_pass_resource.0.borrow_mut(),
- query_set_resource.0,
- args.query_index,
- );
- }
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ComputePassEndPassArgs {
- command_encoder_rid: ResourceId,
- compute_pass_rid: ResourceId,
-}
-
-pub fn op_webgpu_compute_pass_end_pass(
- state: &mut OpState,
- args: ComputePassEndPassArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let command_encoder_resource = state
- .resource_table
- .get::<super::command_encoder::WebGpuCommandEncoder>(
- args.command_encoder_rid,
- )
- .ok_or_else(bad_resource_id)?;
- let command_encoder = command_encoder_resource.0;
- let compute_pass_resource = state
- .resource_table
- .take::<WebGpuComputePass>(args.compute_pass_rid)
- .ok_or_else(bad_resource_id)?;
- let compute_pass = &compute_pass_resource.0.borrow();
- let instance = state.borrow::<super::Instance>();
-
- let maybe_err =
- gfx_select!(command_encoder => instance.command_encoder_run_compute_pass(
- command_encoder,
- compute_pass
- ))
- .err();
-
- Ok(WebGpuResult::maybe_err(maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ComputePassSetBindGroupArgs {
- compute_pass_rid: ResourceId,
- index: u32,
- bind_group: u32,
- dynamic_offsets_data: Option<Vec<u32>>,
- dynamic_offsets_data_start: usize,
- dynamic_offsets_data_length: usize,
-}
-
-pub fn op_webgpu_compute_pass_set_bind_group(
- state: &mut OpState,
- args: ComputePassSetBindGroupArgs,
- zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let bind_group_resource = state
- .resource_table
- .get::<super::binding::WebGpuBindGroup>(args.bind_group)
- .ok_or_else(bad_resource_id)?;
- let compute_pass_resource = state
- .resource_table
- .get::<WebGpuComputePass>(args.compute_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- unsafe {
- wgpu_core::command::compute_ffi::wgpu_compute_pass_set_bind_group(
- &mut compute_pass_resource.0.borrow_mut(),
- args.index,
- bind_group_resource.0,
- match args.dynamic_offsets_data {
- Some(data) => data.as_ptr(),
- None => {
- let zero_copy = zero_copy.ok_or_else(null_opbuf)?;
- let (prefix, data, suffix) = zero_copy.align_to::<u32>();
- assert!(prefix.is_empty());
- assert!(suffix.is_empty());
- data[args.dynamic_offsets_data_start..].as_ptr()
- }
- },
- args.dynamic_offsets_data_length,
- );
- }
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ComputePassPushDebugGroupArgs {
- compute_pass_rid: ResourceId,
- group_label: String,
-}
-
-pub fn op_webgpu_compute_pass_push_debug_group(
- state: &mut OpState,
- args: ComputePassPushDebugGroupArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let compute_pass_resource = state
- .resource_table
- .get::<WebGpuComputePass>(args.compute_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- unsafe {
- let label = std::ffi::CString::new(args.group_label).unwrap();
- wgpu_core::command::compute_ffi::wgpu_compute_pass_push_debug_group(
- &mut compute_pass_resource.0.borrow_mut(),
- label.as_ptr(),
- 0, // wgpu#975
- );
- }
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ComputePassPopDebugGroupArgs {
- compute_pass_rid: ResourceId,
-}
-
-pub fn op_webgpu_compute_pass_pop_debug_group(
- state: &mut OpState,
- args: ComputePassPopDebugGroupArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let compute_pass_resource = state
- .resource_table
- .get::<WebGpuComputePass>(args.compute_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- wgpu_core::command::compute_ffi::wgpu_compute_pass_pop_debug_group(
- &mut compute_pass_resource.0.borrow_mut(),
- );
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ComputePassInsertDebugMarkerArgs {
- compute_pass_rid: ResourceId,
- marker_label: String,
-}
-
-pub fn op_webgpu_compute_pass_insert_debug_marker(
- state: &mut OpState,
- args: ComputePassInsertDebugMarkerArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let compute_pass_resource = state
- .resource_table
- .get::<WebGpuComputePass>(args.compute_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- unsafe {
- let label = std::ffi::CString::new(args.marker_label).unwrap();
- wgpu_core::command::compute_ffi::wgpu_compute_pass_insert_debug_marker(
- &mut compute_pass_resource.0.borrow_mut(),
- label.as_ptr(),
- 0, // wgpu#975
- );
- }
-
- Ok(WebGpuResult::empty())
-}
diff --git a/op_crates/webgpu/error.rs b/op_crates/webgpu/error.rs
deleted file mode 100644
index 57e2e675f..000000000
--- a/op_crates/webgpu/error.rs
+++ /dev/null
@@ -1,294 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-use deno_core::error::AnyError;
-use deno_core::ResourceId;
-use serde::Serialize;
-use std::convert::From;
-use std::fmt;
-use wgpu_core::binding_model::CreateBindGroupError;
-use wgpu_core::binding_model::CreateBindGroupLayoutError;
-use wgpu_core::binding_model::CreatePipelineLayoutError;
-use wgpu_core::binding_model::GetBindGroupLayoutError;
-use wgpu_core::command::CommandAllocatorError;
-use wgpu_core::command::CommandEncoderError;
-use wgpu_core::command::ComputePassError;
-use wgpu_core::command::CopyError;
-use wgpu_core::command::CreateRenderBundleError;
-use wgpu_core::command::QueryError;
-use wgpu_core::command::RenderBundleError;
-use wgpu_core::command::RenderPassError;
-use wgpu_core::device::queue::QueueSubmitError;
-use wgpu_core::device::queue::QueueWriteError;
-use wgpu_core::device::DeviceError;
-use wgpu_core::pipeline::CreateComputePipelineError;
-use wgpu_core::pipeline::CreateRenderPipelineError;
-use wgpu_core::pipeline::CreateShaderModuleError;
-use wgpu_core::resource::BufferAccessError;
-use wgpu_core::resource::CreateBufferError;
-use wgpu_core::resource::CreateQuerySetError;
-use wgpu_core::resource::CreateSamplerError;
-use wgpu_core::resource::CreateTextureError;
-use wgpu_core::resource::CreateTextureViewError;
-
-#[derive(Serialize)]
-pub struct WebGpuResult {
- pub rid: Option<ResourceId>,
- pub err: Option<WebGpuError>,
-}
-
-impl WebGpuResult {
- pub fn rid(rid: ResourceId) -> Self {
- Self {
- rid: Some(rid),
- err: None,
- }
- }
-
- pub fn rid_err<T: Into<WebGpuError>>(
- rid: ResourceId,
- err: Option<T>,
- ) -> Self {
- Self {
- rid: Some(rid),
- err: err.map(|e| e.into()),
- }
- }
-
- pub fn maybe_err<T: Into<WebGpuError>>(err: Option<T>) -> Self {
- Self {
- rid: None,
- err: err.map(|e| e.into()),
- }
- }
-
- pub fn empty() -> Self {
- Self {
- rid: None,
- err: None,
- }
- }
-}
-
-#[derive(Serialize)]
-#[serde(tag = "type", content = "value")]
-#[serde(rename_all = "kebab-case")]
-pub enum WebGpuError {
- Lost,
- OutOfMemory,
- Validation(String),
-}
-
-impl From<CreateBufferError> for WebGpuError {
- fn from(err: CreateBufferError) -> Self {
- match err {
- CreateBufferError::Device(err) => err.into(),
- CreateBufferError::AccessError(err) => err.into(),
- err => WebGpuError::Validation(err.to_string()),
- }
- }
-}
-
-impl From<DeviceError> for WebGpuError {
- fn from(err: DeviceError) -> Self {
- match err {
- DeviceError::Lost => WebGpuError::Lost,
- DeviceError::OutOfMemory => WebGpuError::OutOfMemory,
- DeviceError::Invalid => WebGpuError::Validation(err.to_string()),
- }
- }
-}
-
-impl From<BufferAccessError> for WebGpuError {
- fn from(err: BufferAccessError) -> Self {
- match err {
- BufferAccessError::Device(err) => err.into(),
- err => WebGpuError::Validation(err.to_string()),
- }
- }
-}
-
-impl From<CreateBindGroupLayoutError> for WebGpuError {
- fn from(err: CreateBindGroupLayoutError) -> Self {
- match err {
- CreateBindGroupLayoutError::Device(err) => err.into(),
- err => WebGpuError::Validation(err.to_string()),
- }
- }
-}
-
-impl From<CreatePipelineLayoutError> for WebGpuError {
- fn from(err: CreatePipelineLayoutError) -> Self {
- match err {
- CreatePipelineLayoutError::Device(err) => err.into(),
- err => WebGpuError::Validation(err.to_string()),
- }
- }
-}
-
-impl From<CreateBindGroupError> for WebGpuError {
- fn from(err: CreateBindGroupError) -> Self {
- match err {
- CreateBindGroupError::Device(err) => err.into(),
- err => WebGpuError::Validation(err.to_string()),
- }
- }
-}
-
-impl From<RenderBundleError> for WebGpuError {
- fn from(err: RenderBundleError) -> Self {
- WebGpuError::Validation(err.to_string())
- }
-}
-
-impl From<CreateRenderBundleError> for WebGpuError {
- fn from(err: CreateRenderBundleError) -> Self {
- WebGpuError::Validation(err.to_string())
- }
-}
-
-impl From<CommandAllocatorError> for WebGpuError {
- fn from(err: CommandAllocatorError) -> Self {
- match err {
- CommandAllocatorError::Device(err) => err.into(),
- }
- }
-}
-
-impl From<CopyError> for WebGpuError {
- fn from(err: CopyError) -> Self {
- WebGpuError::Validation(err.to_string())
- }
-}
-
-impl From<CommandEncoderError> for WebGpuError {
- fn from(err: CommandEncoderError) -> Self {
- WebGpuError::Validation(err.to_string())
- }
-}
-
-impl From<QueryError> for WebGpuError {
- fn from(err: QueryError) -> Self {
- WebGpuError::Validation(err.to_string())
- }
-}
-
-impl From<ComputePassError> for WebGpuError {
- fn from(err: ComputePassError) -> Self {
- WebGpuError::Validation(err.to_string())
- }
-}
-
-impl From<CreateComputePipelineError> for WebGpuError {
- fn from(err: CreateComputePipelineError) -> Self {
- match err {
- CreateComputePipelineError::Device(err) => err.into(),
- err => WebGpuError::Validation(err.to_string()),
- }
- }
-}
-
-impl From<GetBindGroupLayoutError> for WebGpuError {
- fn from(err: GetBindGroupLayoutError) -> Self {
- WebGpuError::Validation(err.to_string())
- }
-}
-
-impl From<CreateRenderPipelineError> for WebGpuError {
- fn from(err: CreateRenderPipelineError) -> Self {
- match err {
- CreateRenderPipelineError::Device(err) => err.into(),
- err => WebGpuError::Validation(err.to_string()),
- }
- }
-}
-
-impl From<RenderPassError> for WebGpuError {
- fn from(err: RenderPassError) -> Self {
- WebGpuError::Validation(err.to_string())
- }
-}
-
-impl From<CreateSamplerError> for WebGpuError {
- fn from(err: CreateSamplerError) -> Self {
- match err {
- CreateSamplerError::Device(err) => err.into(),
- err => WebGpuError::Validation(err.to_string()),
- }
- }
-}
-
-impl From<CreateShaderModuleError> for WebGpuError {
- fn from(err: CreateShaderModuleError) -> Self {
- match err {
- CreateShaderModuleError::Device(err) => err.into(),
- err => WebGpuError::Validation(err.to_string()),
- }
- }
-}
-
-impl From<CreateTextureError> for WebGpuError {
- fn from(err: CreateTextureError) -> Self {
- match err {
- CreateTextureError::Device(err) => err.into(),
- err => WebGpuError::Validation(err.to_string()),
- }
- }
-}
-
-impl From<CreateTextureViewError> for WebGpuError {
- fn from(err: CreateTextureViewError) -> Self {
- WebGpuError::Validation(err.to_string())
- }
-}
-
-impl From<CreateQuerySetError> for WebGpuError {
- fn from(err: CreateQuerySetError) -> Self {
- match err {
- CreateQuerySetError::Device(err) => err.into(),
- err => WebGpuError::Validation(err.to_string()),
- }
- }
-}
-
-impl From<QueueSubmitError> for WebGpuError {
- fn from(err: QueueSubmitError) -> Self {
- match err {
- QueueSubmitError::Queue(err) => err.into(),
- err => WebGpuError::Validation(err.to_string()),
- }
- }
-}
-
-impl From<QueueWriteError> for WebGpuError {
- fn from(err: QueueWriteError) -> Self {
- match err {
- QueueWriteError::Queue(err) => err.into(),
- err => WebGpuError::Validation(err.to_string()),
- }
- }
-}
-
-#[derive(Debug)]
-pub struct DomExceptionOperationError {
- pub msg: String,
-}
-
-impl DomExceptionOperationError {
- pub fn new(msg: &str) -> Self {
- DomExceptionOperationError {
- msg: msg.to_string(),
- }
- }
-}
-
-impl fmt::Display for DomExceptionOperationError {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- f.pad(&self.msg)
- }
-}
-
-impl std::error::Error for DomExceptionOperationError {}
-
-pub fn get_error_class_name(e: &AnyError) -> Option<&'static str> {
- e.downcast_ref::<DomExceptionOperationError>()
- .map(|_| "DOMExceptionOperationError")
-}
diff --git a/op_crates/webgpu/lib.deno_webgpu.d.ts b/op_crates/webgpu/lib.deno_webgpu.d.ts
deleted file mode 100644
index bb5da20d6..000000000
--- a/op_crates/webgpu/lib.deno_webgpu.d.ts
+++ /dev/null
@@ -1,1126 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// deno-lint-ignore-file no-explicit-any no-empty-interface
-
-/// <reference no-default-lib="true" />
-/// <reference lib="esnext" />
-
-// 8cc98b6f10b7f354473a08c3773bb1de839845b9
-
-interface GPUObjectBase {
- label: string | null;
-}
-
-declare interface GPUObjectDescriptorBase {
- label?: string;
-}
-
-declare class GPUAdapterLimits {
- maxTextureDimension1D?: number;
- maxTextureDimension2D?: number;
- maxTextureDimension3D?: number;
- maxTextureArrayLayers?: number;
- maxBindGroups?: number;
- maxDynamicUniformBuffersPerPipelineLayout?: number;
- maxDynamicStorageBuffersPerPipelineLayout?: number;
- maxSampledTexturesPerShaderStage?: number;
- maxSamplersPerShaderStage?: number;
- maxStorageBuffersPerShaderStage?: number;
- maxStorageTexturesPerShaderStage?: number;
- maxUniformBuffersPerShaderStage?: number;
- maxUniformBufferBindingSize?: number;
- maxStorageBufferBindingSize?: number;
- maxVertexBuffers?: number;
- maxVertexAttributes?: number;
- maxVertexBufferArrayStride?: number;
-}
-
-declare class GPUAdapterFeatures {
- forEach(
- callbackfn: (
- value: GPUFeatureName,
- value2: GPUFeatureName,
- set: Set<GPUFeatureName>,
- ) => void,
- thisArg?: any,
- ): void;
- has(value: GPUFeatureName): boolean;
- size: number;
- [
- Symbol
- .iterator
- ](): IterableIterator<GPUFeatureName>;
- entries(): IterableIterator<[GPUFeatureName, GPUFeatureName]>;
- keys(): IterableIterator<GPUFeatureName>;
- values(): IterableIterator<GPUFeatureName>;
-}
-
-declare class GPU {
- requestAdapter(
- options?: GPURequestAdapterOptions,
- ): Promise<GPUAdapter | null>;
-}
-
-declare interface GPURequestAdapterOptions {
- powerPreference?: GPUPowerPreference;
-}
-
-declare type GPUPowerPreference = "low-power" | "high-performance";
-
-declare class GPUAdapter {
- readonly name: string;
- readonly features: GPUAdapterFeatures;
- readonly limits: GPUAdapterLimits;
-
- requestDevice(descriptor?: GPUDeviceDescriptor): Promise<GPUDevice | null>;
-}
-
-declare interface GPUDeviceDescriptor extends GPUObjectDescriptorBase {
- nonGuaranteedFeatures?: GPUFeatureName[];
- nonGuaranteedLimits?: Record<string, number>;
-}
-
-declare type GPUFeatureName =
- | "depth-clamping"
- | "depth24unorm-stencil8"
- | "depth32float-stencil8"
- | "pipeline-statistics-query"
- | "texture-compression-bc"
- | "timestamp-query"
- // extended from spec
- | "mappable-primary-buffers"
- | "sampled-texture-binding-array"
- | "sampled-texture-array-dynamic-indexing"
- | "sampled-texture-array-non-uniform-indexing"
- | "unsized-binding-array"
- | "multi-draw-indirect"
- | "multi-draw-indirect-count"
- | "push-constants"
- | "address-mode-clamp-to-border"
- | "non-fill-polygon-mode"
- | "texture-compression-etc2"
- | "texture-compression-astc-ldr"
- | "texture-adapter-specific-format-features"
- | "shader-float64"
- | "vertex-attribute-64bit";
-
-declare class GPUDevice extends EventTarget implements GPUObjectBase {
- label: string | null;
-
- readonly lost: Promise<GPUDeviceLostInfo>;
- pushErrorScope(filter: GPUErrorFilter): undefined;
- popErrorScope(): Promise<GPUError | null>;
- onuncapturederror:
- | ((this: GPUDevice, ev: GPUUncapturedErrorEvent) => any)
- | null;
-
- readonly adapter: GPUAdapter;
- readonly features: ReadonlyArray<GPUFeatureName>;
- readonly limits: Record<string, number>;
- readonly queue: GPUQueue;
-
- destroy(): undefined;
-
- createBuffer(descriptor: GPUBufferDescriptor): GPUBuffer;
- createTexture(descriptor: GPUTextureDescriptor): GPUTexture;
- createSampler(descriptor?: GPUSamplerDescriptor): GPUSampler;
-
- createBindGroupLayout(
- descriptor: GPUBindGroupLayoutDescriptor,
- ): GPUBindGroupLayout;
- createPipelineLayout(
- descriptor: GPUPipelineLayoutDescriptor,
- ): GPUPipelineLayout;
- createBindGroup(descriptor: GPUBindGroupDescriptor): GPUBindGroup;
-
- createShaderModule(descriptor: GPUShaderModuleDescriptor): GPUShaderModule;
- createComputePipeline(
- descriptor: GPUComputePipelineDescriptor,
- ): GPUComputePipeline;
- createRenderPipeline(
- descriptor: GPURenderPipelineDescriptor,
- ): GPURenderPipeline;
- createComputePipelineAsync(
- descriptor: GPUComputePipelineDescriptor,
- ): Promise<GPUComputePipeline>;
- createRenderPipelineAsync(
- descriptor: GPURenderPipelineDescriptor,
- ): Promise<GPURenderPipeline>;
-
- createCommandEncoder(
- descriptor?: GPUCommandEncoderDescriptor,
- ): GPUCommandEncoder;
- createRenderBundleEncoder(
- descriptor: GPURenderBundleEncoderDescriptor,
- ): GPURenderBundleEncoder;
-
- createQuerySet(descriptor: GPUQuerySetDescriptor): GPUQuerySet;
-}
-
-declare class GPUBuffer implements GPUObjectBase {
- label: string | null;
-
- mapAsync(
- mode: GPUMapModeFlags,
- offset?: number,
- size?: number,
- ): Promise<undefined>;
- getMappedRange(offset?: number, size?: number): ArrayBuffer;
- unmap(): undefined;
-
- destroy(): undefined;
-}
-
-declare interface GPUBufferDescriptor extends GPUObjectDescriptorBase {
- size: number;
- usage: GPUBufferUsageFlags;
- mappedAtCreation?: boolean;
-}
-
-declare type GPUBufferUsageFlags = number;
-declare class GPUBufferUsage {
- static MAP_READ: 0x0001;
- static MAP_WRITE: 0x0002;
- static COPY_SRC: 0x0004;
- static COPY_DST: 0x0008;
- static INDEX: 0x0010;
- static VERTEX: 0x0020;
- static UNIFORM: 0x0040;
- static STORAGE: 0x0080;
- static INDIRECT: 0x0100;
- static QUERY_RESOLVE: 0x0200;
-}
-
-declare type GPUMapModeFlags = number;
-declare class GPUMapMode {
- static READ: 0x0001;
- static WRITE: 0x0002;
-}
-
-declare class GPUTexture implements GPUObjectBase {
- label: string | null;
-
- createView(descriptor?: GPUTextureViewDescriptor): GPUTextureView;
- destroy(): undefined;
-}
-
-declare interface GPUTextureDescriptor extends GPUObjectDescriptorBase {
- size: GPUExtent3D;
- mipLevelCount?: number;
- sampleCount?: number;
- dimension?: GPUTextureDimension;
- format: GPUTextureFormat;
- usage: GPUTextureUsageFlags;
-}
-
-declare type GPUTextureDimension = "1d" | "2d" | "3d";
-
-declare type GPUTextureUsageFlags = number;
-declare class GPUTextureUsage {
- static COPY_SRC: 0x01;
- static COPY_DST: 0x02;
- static SAMPLED: 0x04;
- static STORAGE: 0x08;
- static RENDER_ATTACHMENT: 0x10;
-}
-
-declare class GPUTextureView implements GPUObjectBase {
- label: string | null;
-}
-
-declare interface GPUTextureViewDescriptor extends GPUObjectDescriptorBase {
- format?: GPUTextureFormat;
- dimension?: GPUTextureViewDimension;
- aspect?: GPUTextureAspect;
- baseMipLevel?: number;
- mipLevelCount?: number;
- baseArrayLayer?: number;
- arrayLayerCount?: number;
-}
-
-declare type GPUTextureViewDimension =
- | "1d"
- | "2d"
- | "2d-array"
- | "cube"
- | "cube-array"
- | "3d";
-
-declare type GPUTextureAspect = "all" | "stencil-only" | "depth-only";
-
-declare type GPUTextureFormat =
- | "r8unorm"
- | "r8snorm"
- | "r8uint"
- | "r8sint"
- | "r16uint"
- | "r16sint"
- | "r16float"
- | "rg8unorm"
- | "rg8snorm"
- | "rg8uint"
- | "rg8sint"
- | "r32uint"
- | "r32sint"
- | "r32float"
- | "rg16uint"
- | "rg16sint"
- | "rg16float"
- | "rgba8unorm"
- | "rgba8unorm-srgb"
- | "rgba8snorm"
- | "rgba8uint"
- | "rgba8sint"
- | "bgra8unorm"
- | "bgra8unorm-srgb"
- | "rgb9e5ufloat"
- | "rgb10a2unorm"
- | "rg11b10ufloat"
- | "rg32uint"
- | "rg32sint"
- | "rg32float"
- | "rgba16uint"
- | "rgba16sint"
- | "rgba16float"
- | "rgba32uint"
- | "rgba32sint"
- | "rgba32float"
- | "stencil8"
- | "depth16unorm"
- | "depth24plus"
- | "depth24plus-stencil8"
- | "depth32float"
- | "bc1-rgba-unorm"
- | "bc1-rgba-unorm-srgb"
- | "bc2-rgba-unorm"
- | "bc2-rgba-unorm-srgb"
- | "bc3-rgba-unorm"
- | "bc3-rgba-unorm-srgb"
- | "bc4-r-unorm"
- | "bc4-r-snorm"
- | "bc5-rg-unorm"
- | "bc5-rg-snorm"
- | "bc6h-rgb-ufloat"
- | "bc6h-rgb-float"
- | "bc7-rgba-unorm"
- | "bc7-rgba-unorm-srgb"
- | "depth24unorm-stencil8"
- | "depth32float-stencil8";
-
-declare class GPUSampler implements GPUObjectBase {
- label: string | null;
-}
-
-declare interface GPUSamplerDescriptor extends GPUObjectDescriptorBase {
- addressModeU?: GPUAddressMode;
- addressModeV?: GPUAddressMode;
- addressModeW?: GPUAddressMode;
- magFilter?: GPUFilterMode;
- minFilter?: GPUFilterMode;
- mipmapFilter?: GPUFilterMode;
- lodMinClamp?: number;
- lodMaxClamp?: number;
- compare?: GPUCompareFunction;
- maxAnisotropy?: number;
-}
-
-declare type GPUAddressMode = "clamp-to-edge" | "repeat" | "mirror-repeat";
-
-declare type GPUFilterMode = "nearest" | "linear";
-
-declare type GPUCompareFunction =
- | "never"
- | "less"
- | "equal"
- | "less-equal"
- | "greater"
- | "not-equal"
- | "greater-equal"
- | "always";
-
-declare class GPUBindGroupLayout implements GPUObjectBase {
- label: string | null;
-}
-
-declare interface GPUBindGroupLayoutDescriptor extends GPUObjectDescriptorBase {
- entries: GPUBindGroupLayoutEntry[];
-}
-
-declare interface GPUBindGroupLayoutEntry {
- binding: number;
- visibility: GPUShaderStageFlags;
-
- buffer?: GPUBufferBindingLayout;
- sampler?: GPUSamplerBindingLayout;
- texture?: GPUTextureBindingLayout;
- storageTexture?: GPUStorageTextureBindingLayout;
-}
-
-declare type GPUShaderStageFlags = number;
-declare class GPUShaderStage {
- static VERTEX: 0x1;
- static FRAGMENT: 0x2;
- static COMPUTE: 0x4;
-}
-
-declare interface GPUBufferBindingLayout {
- type?: GPUBufferBindingType;
- hasDynamicOffset?: boolean;
- minBindingSize?: number;
-}
-
-declare type GPUBufferBindingType = "uniform" | "storage" | "read-only-storage";
-
-declare interface GPUSamplerBindingLayout {
- type?: GPUSamplerBindingType;
-}
-
-declare type GPUSamplerBindingType =
- | "filtering"
- | "non-filtering"
- | "comparison";
-
-declare interface GPUTextureBindingLayout {
- sampleType?: GPUTextureSampleType;
- viewDimension?: GPUTextureViewDimension;
- multisampled?: boolean;
-}
-
-declare type GPUTextureSampleType =
- | "float"
- | "unfilterable-float"
- | "depth"
- | "sint"
- | "uint";
-
-declare interface GPUTextureBindingLayout {
- sampleType?: GPUTextureSampleType;
- viewDimension?: GPUTextureViewDimension;
- multisampled?: boolean;
-}
-
-declare type GPUStorageTextureAccess = "read-only" | "write-only";
-
-declare interface GPUStorageTextureBindingLayout {
- access: GPUStorageTextureAccess;
- format: GPUTextureFormat;
- viewDimension?: GPUTextureViewDimension;
-}
-
-declare class GPUBindGroup implements GPUObjectBase {
- label: string | null;
-}
-
-declare interface GPUBindGroupDescriptor extends GPUObjectDescriptorBase {
- layout: GPUBindGroupLayout;
- entries: GPUBindGroupEntry[];
-}
-
-declare type GPUBindingResource =
- | GPUSampler
- | GPUTextureView
- | GPUBufferBinding;
-
-declare interface GPUBindGroupEntry {
- binding: number;
- resource: GPUBindingResource;
-}
-
-declare interface GPUBufferBinding {
- buffer: GPUBuffer;
- offset?: number;
- size?: number;
-}
-
-declare class GPUPipelineLayout implements GPUObjectBase {
- label: string | null;
-}
-
-declare interface GPUPipelineLayoutDescriptor extends GPUObjectDescriptorBase {
- bindGroupLayouts: GPUBindGroupLayout[];
-}
-
-declare type GPUCompilationMessageType = "error" | "warning" | "info";
-
-declare interface GPUCompilationMessage {
- readonly message: string;
- readonly type: GPUCompilationMessageType;
- readonly lineNum: number;
- readonly linePos: number;
-}
-
-declare interface GPUCompilationInfo {
- readonly messages: ReadonlyArray<GPUCompilationMessage>;
-}
-
-declare class GPUShaderModule implements GPUObjectBase {
- label: string | null;
-
- compilationInfo(): Promise<GPUCompilationInfo>;
-}
-
-declare interface GPUShaderModuleDescriptor extends GPUObjectDescriptorBase {
- code: string | Uint32Array;
- sourceMap?: any;
-}
-
-declare interface GPUPipelineDescriptorBase extends GPUObjectDescriptorBase {
- layout?: GPUPipelineLayout;
-}
-
-declare interface GPUPipelineBase {
- getBindGroupLayout(index: number): GPUBindGroupLayout;
-}
-
-declare interface GPUProgrammableStage {
- module: GPUShaderModule;
- entryPoint: string;
-}
-
-declare class GPUComputePipeline implements GPUObjectBase, GPUPipelineBase {
- label: string | null;
-
- getBindGroupLayout(index: number): GPUBindGroupLayout;
-}
-
-declare interface GPUComputePipelineDescriptor
- extends GPUPipelineDescriptorBase {
- compute: GPUProgrammableStage;
-}
-
-declare class GPURenderPipeline implements GPUObjectBase, GPUPipelineBase {
- label: string | null;
-
- getBindGroupLayout(index: number): GPUBindGroupLayout;
-}
-
-declare interface GPURenderPipelineDescriptor
- extends GPUPipelineDescriptorBase {
- vertex: GPUVertexState;
- primitive?: GPUPrimitiveState;
- depthStencil?: GPUDepthStencilState;
- multisample?: GPUMultisampleState;
- fragment?: GPUFragmentState;
-}
-
-declare type GPUPrimitiveTopology =
- | "point-list"
- | "line-list"
- | "line-strip"
- | "triangle-list"
- | "triangle-strip";
-
-declare interface GPUPrimitiveState {
- topology?: GPUPrimitiveTopology;
- stripIndexFormat?: GPUIndexFormat;
- frontFace?: GPUFrontFace;
- cullMode?: GPUCullMode;
-}
-
-declare type GPUFrontFace = "ccw" | "cw";
-
-declare type GPUCullMode = "none" | "front" | "back";
-
-declare interface GPUMultisampleState {
- count?: number;
- mask?: number;
- alphaToCoverageEnabled?: boolean;
-}
-
-declare interface GPUFragmentState extends GPUProgrammableStage {
- targets: GPUColorTargetState[];
-}
-
-declare interface GPUColorTargetState {
- format: GPUTextureFormat;
-
- blend?: GPUBlendState;
- writeMask?: GPUColorWriteFlags;
-}
-
-declare interface GPUBlendState {
- color: GPUBlendComponent;
- alpha: GPUBlendComponent;
-}
-
-declare type GPUColorWriteFlags = number;
-declare class GPUColorWrite {
- static RED: 0x1;
- static GREEN: 0x2;
- static BLUE: 0x4;
- static ALPHA: 0x8;
- static ALL: 0xF;
-}
-
-declare interface GPUBlendComponent {
- srcFactor: GPUBlendFactor;
- dstFactor: GPUBlendFactor;
- operation: GPUBlendOperation;
-}
-
-declare type GPUBlendFactor =
- | "zero"
- | "one"
- | "src-color"
- | "one-minus-src-color"
- | "src-alpha"
- | "one-minus-src-alpha"
- | "dst-color"
- | "one-minus-dst-color"
- | "dst-alpha"
- | "one-minus-dst-alpha"
- | "src-alpha-saturated"
- | "blend-color"
- | "one-minus-blend-color";
-
-declare type GPUBlendOperation =
- | "add"
- | "subtract"
- | "reverse-subtract"
- | "min"
- | "max";
-
-declare interface GPUDepthStencilState {
- format: GPUTextureFormat;
-
- depthWriteEnabled?: boolean;
- depthCompare?: GPUCompareFunction;
-
- stencilFront?: GPUStencilFaceState;
- stencilBack?: GPUStencilFaceState;
-
- stencilReadMask?: number;
- stencilWriteMask?: number;
-
- depthBias?: number;
- depthBiasSlopeScale?: number;
- depthBiasClamp?: number;
-
- clampDepth?: boolean;
-}
-
-declare interface GPUStencilFaceState {
- compare?: GPUCompareFunction;
- failOp?: GPUStencilOperation;
- depthFailOp?: GPUStencilOperation;
- passOp?: GPUStencilOperation;
-}
-
-declare type GPUStencilOperation =
- | "keep"
- | "zero"
- | "replace"
- | "invert"
- | "increment-clamp"
- | "decrement-clamp"
- | "increment-wrap"
- | "decrement-wrap";
-
-declare type GPUIndexFormat = "uint16" | "uint32";
-
-declare type GPUVertexFormat =
- | "uchar2"
- | "uchar4"
- | "char2"
- | "char4"
- | "uchar2norm"
- | "uchar4norm"
- | "char2norm"
- | "char4norm"
- | "ushort2"
- | "ushort4"
- | "short2"
- | "short4"
- | "ushort2norm"
- | "ushort4norm"
- | "short2norm"
- | "short4norm"
- | "half2"
- | "half4"
- | "float"
- | "float2"
- | "float3"
- | "float4"
- | "uint"
- | "uint2"
- | "uint3"
- | "uint4"
- | "int"
- | "int2"
- | "int3"
- | "int4";
-
-declare type GPUInputStepMode = "vertex" | "instance";
-
-declare interface GPUVertexState extends GPUProgrammableStage {
- buffers?: (GPUVertexBufferLayout | null)[];
-}
-
-declare interface GPUVertexBufferLayout {
- arrayStride: number;
- stepMode?: GPUInputStepMode;
- attributes: GPUVertexAttribute[];
-}
-
-declare interface GPUVertexAttribute {
- format: GPUVertexFormat;
- offset: number;
-
- shaderLocation: number;
-}
-
-declare class GPUCommandBuffer implements GPUObjectBase {
- label: string | null;
-
- readonly executionTime: Promise<number>;
-}
-
-declare interface GPUCommandBufferDescriptor extends GPUObjectDescriptorBase {}
-
-declare class GPUCommandEncoder implements GPUObjectBase {
- label: string | null;
-
- beginRenderPass(descriptor: GPURenderPassDescriptor): GPURenderPassEncoder;
- beginComputePass(
- descriptor?: GPUComputePassDescriptor,
- ): GPUComputePassEncoder;
-
- copyBufferToBuffer(
- source: GPUBuffer,
- sourceOffset: number,
- destination: GPUBuffer,
- destinationOffset: number,
- size: number,
- ): undefined;
-
- copyBufferToTexture(
- source: GPUImageCopyBuffer,
- destination: GPUImageCopyTexture,
- copySize: GPUExtent3D,
- ): undefined;
-
- copyTextureToBuffer(
- source: GPUImageCopyTexture,
- destination: GPUImageCopyBuffer,
- copySize: GPUExtent3D,
- ): undefined;
-
- copyTextureToTexture(
- source: GPUImageCopyTexture,
- destination: GPUImageCopyTexture,
- copySize: GPUExtent3D,
- ): undefined;
-
- pushDebugGroup(groupLabel: string): undefined;
- popDebugGroup(): undefined;
- insertDebugMarker(markerLabel: string): undefined;
-
- writeTimestamp(querySet: GPUQuerySet, queryIndex: number): undefined;
-
- resolveQuerySet(
- querySet: GPUQuerySet,
- firstQuery: number,
- queryCount: number,
- destination: GPUBuffer,
- destinationOffset: number,
- ): undefined;
-
- finish(descriptor?: GPUCommandBufferDescriptor): GPUCommandBuffer;
-}
-
-declare interface GPUCommandEncoderDescriptor extends GPUObjectDescriptorBase {
- measureExecutionTime?: boolean;
-}
-
-declare interface GPUImageDataLayout {
- offset?: number;
- bytesPerRow?: number;
- rowsPerImage?: number;
-}
-
-declare interface GPUImageCopyBuffer extends GPUImageDataLayout {
- buffer: GPUBuffer;
-}
-
-declare interface GPUImageCopyTexture {
- texture: GPUTexture;
- mipLevel?: number;
- origin?: GPUOrigin3D;
- aspect?: GPUTextureAspect;
-}
-
-interface GPUProgrammablePassEncoder {
- setBindGroup(
- index: number,
- bindGroup: GPUBindGroup,
- dynamicOffsets?: number[],
- ): undefined;
-
- setBindGroup(
- index: number,
- bindGroup: GPUBindGroup,
- dynamicOffsetsData: Uint32Array,
- dynamicOffsetsDataStart: number,
- dynamicOffsetsDataLength: number,
- ): undefined;
-
- pushDebugGroup(groupLabel: string): undefined;
- popDebugGroup(): undefined;
- insertDebugMarker(markerLabel: string): undefined;
-}
-
-declare class GPUComputePassEncoder
- implements GPUObjectBase, GPUProgrammablePassEncoder {
- label: string | null;
- setBindGroup(
- index: number,
- bindGroup: GPUBindGroup,
- dynamicOffsets?: number[],
- ): undefined;
- setBindGroup(
- index: number,
- bindGroup: GPUBindGroup,
- dynamicOffsetsData: Uint32Array,
- dynamicOffsetsDataStart: number,
- dynamicOffsetsDataLength: number,
- ): undefined;
- pushDebugGroup(groupLabel: string): undefined;
- popDebugGroup(): undefined;
- insertDebugMarker(markerLabel: string): undefined;
- setPipeline(pipeline: GPUComputePipeline): undefined;
- dispatch(x: number, y?: number, z?: number): undefined;
- dispatchIndirect(
- indirectBuffer: GPUBuffer,
- indirectOffset: number,
- ): undefined;
-
- beginPipelineStatisticsQuery(
- querySet: GPUQuerySet,
- queryIndex: number,
- ): undefined;
- endPipelineStatisticsQuery(): undefined;
-
- writeTimestamp(querySet: GPUQuerySet, queryIndex: number): undefined;
-
- endPass(): undefined;
-}
-
-declare interface GPUComputePassDescriptor extends GPUObjectDescriptorBase {}
-
-interface GPURenderEncoderBase {
- setPipeline(pipeline: GPURenderPipeline): undefined;
-
- setIndexBuffer(
- buffer: GPUBuffer,
- indexFormat: GPUIndexFormat,
- offset?: number,
- size?: number,
- ): undefined;
- setVertexBuffer(
- slot: number,
- buffer: GPUBuffer,
- offset?: number,
- size?: number,
- ): undefined;
-
- draw(
- vertexCount: number,
- instanceCount?: number,
- firstVertex?: number,
- firstInstance?: number,
- ): undefined;
- drawIndexed(
- indexCount: number,
- instanceCount?: number,
- firstIndex?: number,
- baseVertex?: number,
- firstInstance?: number,
- ): undefined;
-
- drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): undefined;
- drawIndexedIndirect(
- indirectBuffer: GPUBuffer,
- indirectOffset: number,
- ): undefined;
-}
-
-declare class GPURenderPassEncoder
- implements GPUObjectBase, GPUProgrammablePassEncoder, GPURenderEncoderBase {
- label: string | null;
- setBindGroup(
- index: number,
- bindGroup: GPUBindGroup,
- dynamicOffsets?: number[],
- ): undefined;
- setBindGroup(
- index: number,
- bindGroup: GPUBindGroup,
- dynamicOffsetsData: Uint32Array,
- dynamicOffsetsDataStart: number,
- dynamicOffsetsDataLength: number,
- ): undefined;
- pushDebugGroup(groupLabel: string): undefined;
- popDebugGroup(): undefined;
- insertDebugMarker(markerLabel: string): undefined;
- setPipeline(pipeline: GPURenderPipeline): undefined;
- setIndexBuffer(
- buffer: GPUBuffer,
- indexFormat: GPUIndexFormat,
- offset?: number,
- size?: number,
- ): undefined;
- setVertexBuffer(
- slot: number,
- buffer: GPUBuffer,
- offset?: number,
- size?: number,
- ): undefined;
- draw(
- vertexCount: number,
- instanceCount?: number,
- firstVertex?: number,
- firstInstance?: number,
- ): undefined;
- drawIndexed(
- indexCount: number,
- instanceCount?: number,
- firstIndex?: number,
- baseVertex?: number,
- firstInstance?: number,
- ): undefined;
- drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): undefined;
- drawIndexedIndirect(
- indirectBuffer: GPUBuffer,
- indirectOffset: number,
- ): undefined;
-
- setViewport(
- x: number,
- y: number,
- width: number,
- height: number,
- minDepth: number,
- maxDepth: number,
- ): undefined;
-
- setScissorRect(
- x: number,
- y: number,
- width: number,
- height: number,
- ): undefined;
-
- setBlendColor(color: GPUColor): undefined;
- setStencilReference(reference: number): undefined;
-
- beginOcclusionQuery(queryIndex: number): undefined;
- endOcclusionQuery(): undefined;
-
- beginPipelineStatisticsQuery(
- querySet: GPUQuerySet,
- queryIndex: number,
- ): undefined;
- endPipelineStatisticsQuery(): undefined;
-
- writeTimestamp(querySet: GPUQuerySet, queryIndex: number): undefined;
-
- executeBundles(bundles: GPURenderBundle[]): undefined;
- endPass(): undefined;
-}
-
-declare interface GPURenderPassDescriptor extends GPUObjectDescriptorBase {
- colorAttachments: GPURenderPassColorAttachment[];
- depthStencilAttachment?: GPURenderPassDepthStencilAttachment;
- occlusionQuerySet?: GPUQuerySet;
-}
-
-declare interface GPURenderPassColorAttachment {
- view: GPUTextureView;
- resolveTarget?: GPUTextureView;
-
- loadValue: GPULoadOp | GPUColor;
- storeOp?: GPUStoreOp;
-}
-
-declare interface GPURenderPassDepthStencilAttachment {
- view: GPUTextureView;
-
- depthLoadValue: GPULoadOp | number;
- depthStoreOp: GPUStoreOp;
- depthReadOnly?: boolean;
-
- stencilLoadValue: GPULoadOp | number;
- stencilStoreOp: GPUStoreOp;
- stencilReadOnly?: boolean;
-}
-
-declare type GPULoadOp = "load";
-
-declare type GPUStoreOp = "store" | "clear";
-
-declare class GPURenderBundle implements GPUObjectBase {
- label: string | null;
-}
-
-declare interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {}
-
-declare class GPURenderBundleEncoder
- implements GPUObjectBase, GPUProgrammablePassEncoder, GPURenderEncoderBase {
- label: string | null;
- draw(
- vertexCount: number,
- instanceCount?: number,
- firstVertex?: number,
- firstInstance?: number,
- ): undefined;
- drawIndexed(
- indexCount: number,
- instanceCount?: number,
- firstIndex?: number,
- baseVertex?: number,
- firstInstance?: number,
- ): undefined;
- drawIndexedIndirect(
- indirectBuffer: GPUBuffer,
- indirectOffset: number,
- ): undefined;
- drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): undefined;
- insertDebugMarker(markerLabel: string): undefined;
- popDebugGroup(): undefined;
- pushDebugGroup(groupLabel: string): undefined;
- setBindGroup(
- index: number,
- bindGroup: GPUBindGroup,
- dynamicOffsets?: number[],
- ): undefined;
- setBindGroup(
- index: number,
- bindGroup: GPUBindGroup,
- dynamicOffsetsData: Uint32Array,
- dynamicOffsetsDataStart: number,
- dynamicOffsetsDataLength: number,
- ): undefined;
- setIndexBuffer(
- buffer: GPUBuffer,
- indexFormat: GPUIndexFormat,
- offset?: number,
- size?: number,
- ): undefined;
- setPipeline(pipeline: GPURenderPipeline): undefined;
- setVertexBuffer(
- slot: number,
- buffer: GPUBuffer,
- offset?: number,
- size?: number,
- ): undefined;
-
- finish(descriptor?: GPURenderBundleDescriptor): GPURenderBundle;
-}
-
-declare interface GPURenderBundleEncoderDescriptor
- extends GPUObjectDescriptorBase {
- colorFormats: GPUTextureFormat[];
- depthStencilFormat?: GPUTextureFormat;
- sampleCount?: number;
-}
-
-declare class GPUQueue implements GPUObjectBase {
- label: string | null;
-
- submit(commandBuffers: GPUCommandBuffer[]): undefined;
-
- onSubmittedWorkDone(): Promise<undefined>;
-
- writeBuffer(
- buffer: GPUBuffer,
- bufferOffset: number,
- data: BufferSource,
- dataOffset?: number,
- size?: number,
- ): undefined;
-
- writeTexture(
- destination: GPUImageCopyTexture,
- data: BufferSource,
- dataLayout: GPUImageDataLayout,
- size: GPUExtent3D,
- ): undefined;
-}
-
-declare class GPUQuerySet implements GPUObjectBase {
- label: string | null;
-
- destroy(): undefined;
-}
-
-declare interface GPUQuerySetDescriptor extends GPUObjectDescriptorBase {
- type: GPUQueryType;
- count: number;
- pipelineStatistics?: GPUPipelineStatisticName[];
-}
-
-declare type GPUQueryType = "occlusion" | "pipeline-statistics" | "timestamp";
-
-declare type GPUPipelineStatisticName =
- | "vertex-shader-invocations"
- | "clipper-invocations"
- | "clipper-primitives-out"
- | "fragment-shader-invocations"
- | "compute-shader-invocations";
-
-declare type GPUDeviceLostReason = "destroyed";
-
-declare interface GPUDeviceLostInfo {
- readonly reason: GPUDeviceLostReason | undefined;
- readonly message: string;
-}
-
-declare type GPUErrorFilter = "out-of-memory" | "validation";
-
-declare class GPUOutOfMemoryError {
- constructor();
-}
-
-declare class GPUValidationError {
- constructor(message: string);
- readonly message: string;
-}
-
-declare type GPUError = GPUOutOfMemoryError | GPUValidationError;
-
-declare class GPUUncapturedErrorEvent extends Event {
- constructor(
- type: string,
- gpuUncapturedErrorEventInitDict: GPUUncapturedErrorEventInit,
- );
- readonly error: GPUError;
-}
-
-declare interface GPUUncapturedErrorEventInit extends EventInit {
- error?: GPUError;
-}
-
-declare interface GPUColorDict {
- r: number;
- g: number;
- b: number;
- a: number;
-}
-
-declare type GPUColor = number[] | GPUColorDict;
-
-declare interface GPUOrigin3DDict {
- x?: number;
- y?: number;
- z?: number;
-}
-
-declare type GPUOrigin3D = number[] | GPUOrigin3DDict;
-
-declare interface GPUExtent3DDict {
- width?: number;
- height?: number;
- depth?: number;
-}
-
-declare type GPUExtent3D = number[] | GPUExtent3DDict;
diff --git a/op_crates/webgpu/lib.rs b/op_crates/webgpu/lib.rs
deleted file mode 100644
index b5b2905b2..000000000
--- a/op_crates/webgpu/lib.rs
+++ /dev/null
@@ -1,871 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::error::AnyError;
-use deno_core::error::{bad_resource_id, not_supported};
-use deno_core::include_js_files;
-use deno_core::op_async;
-use deno_core::op_sync;
-use deno_core::Extension;
-use deno_core::OpFn;
-use deno_core::OpState;
-use deno_core::Resource;
-use deno_core::ResourceId;
-use deno_core::ZeroCopyBuf;
-use serde::Deserialize;
-use serde::Serialize;
-use std::borrow::Cow;
-use std::cell::RefCell;
-use std::path::PathBuf;
-use std::rc::Rc;
-pub use wgpu_core;
-pub use wgpu_types;
-
-use error::DomExceptionOperationError;
-use error::WebGpuResult;
-
-#[macro_use]
-mod macros {
- macro_rules! gfx_select {
- ($id:expr => $global:ident.$method:ident( $($param:expr),* )) => {
- match $id.backend() {
- #[cfg(all(not(target_arch = "wasm32"), not(any(target_os = "ios", target_os = "macos"))))]
- wgpu_types::Backend::Vulkan => $global.$method::<wgpu_core::backend::Vulkan>( $($param),* ),
- #[cfg(all(not(target_arch = "wasm32"), any(target_os = "ios", target_os = "macos")))]
- wgpu_types::Backend::Metal => $global.$method::<wgpu_core::backend::Metal>( $($param),* ),
- #[cfg(all(not(target_arch = "wasm32"), windows))]
- wgpu_types::Backend::Dx12 => $global.$method::<wgpu_core::backend::Dx12>( $($param),* ),
- #[cfg(all(not(target_arch = "wasm32"), windows))]
- wgpu_types::Backend::Dx11 => $global.$method::<wgpu_core::backend::Dx11>( $($param),* ),
- #[cfg(any(target_arch = "wasm32", all(unix, not(any(target_os = "ios", target_os = "macos")))))]
- wgpu_types::Backend::Gl => $global.$method::<wgpu_core::backend::Gl>( $($param),+ ),
- other => panic!("Unexpected backend {:?}", other),
- }
- };
- }
-}
-
-pub mod binding;
-pub mod buffer;
-pub mod bundle;
-pub mod command_encoder;
-pub mod compute_pass;
-pub mod error;
-pub mod pipeline;
-pub mod queue;
-pub mod render_pass;
-pub mod sampler;
-pub mod shader;
-pub mod texture;
-
-pub struct Unstable(pub bool);
-
-fn check_unstable(state: &OpState, api_name: &str) {
- let unstable = state.borrow::<Unstable>();
-
- if !unstable.0 {
- eprintln!(
- "Unstable API '{}'. The --unstable flag must be provided.",
- api_name
- );
- std::process::exit(70);
- }
-}
-
-type Instance = wgpu_core::hub::Global<wgpu_core::hub::IdentityManagerFactory>;
-
-struct WebGpuAdapter(wgpu_core::id::AdapterId);
-impl Resource for WebGpuAdapter {
- fn name(&self) -> Cow<str> {
- "webGPUAdapter".into()
- }
-}
-
-struct WebGpuDevice(wgpu_core::id::DeviceId);
-impl Resource for WebGpuDevice {
- fn name(&self) -> Cow<str> {
- "webGPUDevice".into()
- }
-}
-
-struct WebGpuQuerySet(wgpu_core::id::QuerySetId);
-impl Resource for WebGpuQuerySet {
- fn name(&self) -> Cow<str> {
- "webGPUQuerySet".into()
- }
-}
-
-pub fn init(unstable: bool) -> Extension {
- Extension::builder()
- .js(include_js_files!(
- prefix "deno:op_crates/webgpu",
- "01_webgpu.js",
- "02_idl_types.js",
- ))
- .ops(declare_webgpu_ops())
- .state(move |state| {
- // TODO: check & possibly streamline this
- // Unstable might be able to be OpMiddleware
- // let unstable_checker = state.borrow::<super::UnstableChecker>();
- // let unstable = unstable_checker.unstable;
- state.put(Unstable(unstable));
- Ok(())
- })
- .build()
-}
-
-pub fn get_declaration() -> PathBuf {
- PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("lib.deno_webgpu.d.ts")
-}
-
-fn deserialize_features(features: &wgpu_types::Features) -> Vec<&'static str> {
- let mut return_features: Vec<&'static str> = vec![];
-
- if features.contains(wgpu_types::Features::DEPTH_CLAMPING) {
- return_features.push("depth-clamping");
- }
- if features.contains(wgpu_types::Features::PIPELINE_STATISTICS_QUERY) {
- return_features.push("pipeline-statistics-query");
- }
- if features.contains(wgpu_types::Features::TEXTURE_COMPRESSION_BC) {
- return_features.push("texture-compression-bc");
- }
- if features.contains(wgpu_types::Features::TIMESTAMP_QUERY) {
- return_features.push("timestamp-query");
- }
-
- // extended from spec
- if features.contains(wgpu_types::Features::MAPPABLE_PRIMARY_BUFFERS) {
- return_features.push("mappable-primary-buffers");
- }
- if features.contains(wgpu_types::Features::SAMPLED_TEXTURE_BINDING_ARRAY) {
- return_features.push("sampled-texture-binding-array");
- }
- if features
- .contains(wgpu_types::Features::SAMPLED_TEXTURE_ARRAY_DYNAMIC_INDEXING)
- {
- return_features.push("sampled-texture-array-dynamic-indexing");
- }
- if features
- .contains(wgpu_types::Features::SAMPLED_TEXTURE_ARRAY_NON_UNIFORM_INDEXING)
- {
- return_features.push("sampled-texture-array-non-uniform-indexing");
- }
- if features.contains(wgpu_types::Features::UNSIZED_BINDING_ARRAY) {
- return_features.push("unsized-binding-array");
- }
- if features.contains(wgpu_types::Features::MULTI_DRAW_INDIRECT) {
- return_features.push("multi-draw-indirect");
- }
- if features.contains(wgpu_types::Features::MULTI_DRAW_INDIRECT_COUNT) {
- return_features.push("multi-draw-indirect-count");
- }
- if features.contains(wgpu_types::Features::PUSH_CONSTANTS) {
- return_features.push("push-constants");
- }
- if features.contains(wgpu_types::Features::ADDRESS_MODE_CLAMP_TO_BORDER) {
- return_features.push("address-mode-clamp-to-border");
- }
- if features.contains(wgpu_types::Features::NON_FILL_POLYGON_MODE) {
- return_features.push("non-fill-polygon-mode");
- }
- if features.contains(wgpu_types::Features::TEXTURE_COMPRESSION_ETC2) {
- return_features.push("texture-compression-etc2");
- }
- if features.contains(wgpu_types::Features::TEXTURE_COMPRESSION_ASTC_LDR) {
- return_features.push("texture-compression-astc-ldr");
- }
- if features
- .contains(wgpu_types::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES)
- {
- return_features.push("texture-adapter-specific-format-features");
- }
- if features.contains(wgpu_types::Features::SHADER_FLOAT64) {
- return_features.push("shader-float64");
- }
- if features.contains(wgpu_types::Features::VERTEX_ATTRIBUTE_64BIT) {
- return_features.push("vertex-attribute-64bit");
- }
-
- return_features
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RequestAdapterArgs {
- power_preference: Option<String>,
-}
-
-#[derive(Serialize)]
-#[serde(untagged)]
-pub enum GpuAdapterDeviceOrErr {
- Error { err: String },
- Features(GpuAdapterDevice),
-}
-
-#[derive(Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct GpuAdapterDevice {
- rid: ResourceId,
- name: Option<String>,
- limits: wgpu_types::Limits,
- features: Vec<&'static str>,
-}
-
-pub async fn op_webgpu_request_adapter(
- state: Rc<RefCell<OpState>>,
- args: RequestAdapterArgs,
- _bufs: Option<ZeroCopyBuf>,
-) -> Result<GpuAdapterDeviceOrErr, AnyError> {
- let mut state = state.borrow_mut();
- check_unstable(&state, "navigator.gpu.requestAdapter");
- let instance = if let Some(instance) = state.try_borrow::<Instance>() {
- instance
- } else {
- state.put(wgpu_core::hub::Global::new(
- "webgpu",
- wgpu_core::hub::IdentityManagerFactory,
- wgpu_types::BackendBit::PRIMARY,
- ));
- state.borrow::<Instance>()
- };
-
- let descriptor = wgpu_core::instance::RequestAdapterOptions {
- power_preference: match args.power_preference {
- Some(power_preference) => match power_preference.as_str() {
- "low-power" => wgpu_types::PowerPreference::LowPower,
- "high-performance" => wgpu_types::PowerPreference::HighPerformance,
- _ => unreachable!(),
- },
- None => Default::default(),
- },
- compatible_surface: None, // windowless
- };
- let res = instance.request_adapter(
- &descriptor,
- wgpu_core::instance::AdapterInputs::Mask(
- wgpu_types::BackendBit::PRIMARY,
- |_| std::marker::PhantomData,
- ),
- );
-
- let adapter = match res {
- Ok(adapter) => adapter,
- Err(err) => {
- return Ok(GpuAdapterDeviceOrErr::Error {
- err: err.to_string(),
- })
- }
- };
- let name = gfx_select!(adapter => instance.adapter_get_info(adapter))?.name;
- let adapter_features =
- gfx_select!(adapter => instance.adapter_features(adapter))?;
- let features = deserialize_features(&adapter_features);
- let adapter_limits =
- gfx_select!(adapter => instance.adapter_limits(adapter))?;
-
- let rid = state.resource_table.add(WebGpuAdapter(adapter));
-
- Ok(GpuAdapterDeviceOrErr::Features(GpuAdapterDevice {
- rid,
- name: Some(name),
- features,
- limits: adapter_limits,
- }))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct GpuLimits {
- _max_texture_dimension1d: Option<u32>,
- _max_texture_dimension2d: Option<u32>,
- _max_texture_dimension3d: Option<u32>,
- _max_texture_array_layers: Option<u32>,
- max_bind_groups: Option<u32>,
- max_dynamic_uniform_buffers_per_pipeline_layout: Option<u32>,
- max_dynamic_storage_buffers_per_pipeline_layout: Option<u32>,
- max_sampled_textures_per_shader_stage: Option<u32>,
- max_samplers_per_shader_stage: Option<u32>,
- max_storage_buffers_per_shader_stage: Option<u32>,
- max_storage_textures_per_shader_stage: Option<u32>,
- max_uniform_buffers_per_shader_stage: Option<u32>,
- max_uniform_buffer_binding_size: Option<u32>,
- _max_storage_buffer_binding_size: Option<u32>,
- _max_vertex_buffers: Option<u32>,
- _max_vertex_attributes: Option<u32>,
- _max_vertex_buffer_array_stride: Option<u32>,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RequestDeviceArgs {
- adapter_rid: ResourceId,
- label: Option<String>,
- non_guaranteed_features: Option<Vec<String>>,
- non_guaranteed_limits: Option<GpuLimits>,
-}
-
-pub async fn op_webgpu_request_device(
- state: Rc<RefCell<OpState>>,
- args: RequestDeviceArgs,
- _bufs: Option<ZeroCopyBuf>,
-) -> Result<GpuAdapterDevice, AnyError> {
- let mut state = state.borrow_mut();
- let adapter_resource = state
- .resource_table
- .get::<WebGpuAdapter>(args.adapter_rid)
- .ok_or_else(bad_resource_id)?;
- let adapter = adapter_resource.0;
- let instance = state.borrow::<Instance>();
-
- let mut features: wgpu_types::Features = wgpu_types::Features::empty();
-
- if let Some(passed_features) = args.non_guaranteed_features {
- if passed_features.contains(&"depth-clamping".to_string()) {
- features.set(wgpu_types::Features::DEPTH_CLAMPING, true);
- }
- if passed_features.contains(&"pipeline-statistics-query".to_string()) {
- features.set(wgpu_types::Features::PIPELINE_STATISTICS_QUERY, true);
- }
- if passed_features.contains(&"texture-compression-bc".to_string()) {
- features.set(wgpu_types::Features::TEXTURE_COMPRESSION_BC, true);
- }
- if passed_features.contains(&"timestamp-query".to_string()) {
- features.set(wgpu_types::Features::TIMESTAMP_QUERY, true);
- }
-
- // extended from spec
- if passed_features.contains(&"mappable-primary-buffers".to_string()) {
- features.set(wgpu_types::Features::MAPPABLE_PRIMARY_BUFFERS, true);
- }
- if passed_features.contains(&"sampled-texture-binding-array".to_string()) {
- features.set(wgpu_types::Features::SAMPLED_TEXTURE_BINDING_ARRAY, true);
- }
- if passed_features
- .contains(&"sampled-texture-array-dynamic-indexing".to_string())
- {
- features.set(
- wgpu_types::Features::SAMPLED_TEXTURE_ARRAY_DYNAMIC_INDEXING,
- true,
- );
- }
- if passed_features
- .contains(&"sampled-texture-array-non-uniform-indexing".to_string())
- {
- features.set(
- wgpu_types::Features::SAMPLED_TEXTURE_ARRAY_NON_UNIFORM_INDEXING,
- true,
- );
- }
- if passed_features.contains(&"unsized-binding-array".to_string()) {
- features.set(wgpu_types::Features::UNSIZED_BINDING_ARRAY, true);
- }
- if passed_features.contains(&"multi-draw-indirect".to_string()) {
- features.set(wgpu_types::Features::MULTI_DRAW_INDIRECT, true);
- }
- if passed_features.contains(&"multi-draw-indirect-count".to_string()) {
- features.set(wgpu_types::Features::MULTI_DRAW_INDIRECT_COUNT, true);
- }
- if passed_features.contains(&"push-constants".to_string()) {
- features.set(wgpu_types::Features::PUSH_CONSTANTS, true);
- }
- if passed_features.contains(&"address-mode-clamp-to-border".to_string()) {
- features.set(wgpu_types::Features::ADDRESS_MODE_CLAMP_TO_BORDER, true);
- }
- if passed_features.contains(&"non-fill-polygon-mode".to_string()) {
- features.set(wgpu_types::Features::NON_FILL_POLYGON_MODE, true);
- }
- if passed_features.contains(&"texture-compression-etc2".to_string()) {
- features.set(wgpu_types::Features::TEXTURE_COMPRESSION_ETC2, true);
- }
- if passed_features.contains(&"texture-compression-astc-ldr".to_string()) {
- features.set(wgpu_types::Features::TEXTURE_COMPRESSION_ASTC_LDR, true);
- }
- if passed_features
- .contains(&"texture-adapter-specific-format-features".to_string())
- {
- features.set(
- wgpu_types::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES,
- true,
- );
- }
- if passed_features.contains(&"shader-float64".to_string()) {
- features.set(wgpu_types::Features::SHADER_FLOAT64, true);
- }
- if passed_features.contains(&"vertex-attribute-64bit".to_string()) {
- features.set(wgpu_types::Features::VERTEX_ATTRIBUTE_64BIT, true);
- }
- }
-
- let descriptor = wgpu_types::DeviceDescriptor {
- label: args.label.map(Cow::from),
- features,
- limits: args
- .non_guaranteed_limits
- .map_or(Default::default(), |limits| wgpu_types::Limits {
- max_bind_groups: limits.max_bind_groups.unwrap_or(4),
- max_dynamic_uniform_buffers_per_pipeline_layout: limits
- .max_dynamic_uniform_buffers_per_pipeline_layout
- .unwrap_or(8),
- max_dynamic_storage_buffers_per_pipeline_layout: limits
- .max_dynamic_storage_buffers_per_pipeline_layout
- .unwrap_or(4),
- max_sampled_textures_per_shader_stage: limits
- .max_sampled_textures_per_shader_stage
- .unwrap_or(16),
- max_samplers_per_shader_stage: limits
- .max_samplers_per_shader_stage
- .unwrap_or(16),
- max_storage_buffers_per_shader_stage: limits
- .max_storage_buffers_per_shader_stage
- .unwrap_or(4),
- max_storage_textures_per_shader_stage: limits
- .max_storage_textures_per_shader_stage
- .unwrap_or(4),
- max_uniform_buffers_per_shader_stage: limits
- .max_uniform_buffers_per_shader_stage
- .unwrap_or(12),
- max_uniform_buffer_binding_size: limits
- .max_uniform_buffer_binding_size
- .unwrap_or(16384),
- max_push_constant_size: 0,
- }),
- };
-
- let (device, maybe_err) = gfx_select!(adapter => instance.adapter_request_device(
- adapter,
- &descriptor,
- std::env::var("DENO_WEBGPU_TRACE").ok().as_ref().map(std::path::Path::new),
- std::marker::PhantomData
- ));
- if let Some(err) = maybe_err {
- return Err(DomExceptionOperationError::new(&err.to_string()).into());
- }
-
- let device_features =
- gfx_select!(device => instance.device_features(device))?;
- let features = deserialize_features(&device_features);
- let limits = gfx_select!(device => instance.device_limits(device))?;
-
- let rid = state.resource_table.add(WebGpuDevice(device));
-
- Ok(GpuAdapterDevice {
- rid,
- name: None,
- features,
- limits,
- })
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CreateQuerySetArgs {
- device_rid: ResourceId,
- _label: Option<String>, // not yet implemented
- #[serde(rename = "type")]
- kind: String,
- count: u32,
- pipeline_statistics: Option<Vec<String>>,
-}
-
-pub fn op_webgpu_create_query_set(
- state: &mut OpState,
- args: CreateQuerySetArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let device_resource = state
- .resource_table
- .get::<WebGpuDevice>(args.device_rid)
- .ok_or_else(bad_resource_id)?;
- let device = device_resource.0;
- let instance = &state.borrow::<Instance>();
-
- let descriptor = wgpu_types::QuerySetDescriptor {
- ty: match args.kind.as_str() {
- "pipeline-statistics" => {
- let mut pipeline_statistics_names =
- wgpu_types::PipelineStatisticsTypes::empty();
-
- if let Some(pipeline_statistics) = args.pipeline_statistics {
- if pipeline_statistics
- .contains(&"vertex-shader-invocations".to_string())
- {
- pipeline_statistics_names.set(
- wgpu_types::PipelineStatisticsTypes::VERTEX_SHADER_INVOCATIONS,
- true,
- );
- }
- if pipeline_statistics.contains(&"clipper-invocations".to_string()) {
- pipeline_statistics_names.set(
- wgpu_types::PipelineStatisticsTypes::CLIPPER_INVOCATIONS,
- true,
- );
- }
- if pipeline_statistics.contains(&"clipper-primitives-out".to_string())
- {
- pipeline_statistics_names.set(
- wgpu_types::PipelineStatisticsTypes::CLIPPER_PRIMITIVES_OUT,
- true,
- );
- }
- if pipeline_statistics
- .contains(&"fragment-shader-invocations".to_string())
- {
- pipeline_statistics_names.set(
- wgpu_types::PipelineStatisticsTypes::FRAGMENT_SHADER_INVOCATIONS,
- true,
- );
- }
- if pipeline_statistics
- .contains(&"compute-shader-invocations".to_string())
- {
- pipeline_statistics_names.set(
- wgpu_types::PipelineStatisticsTypes::COMPUTE_SHADER_INVOCATIONS,
- true,
- );
- }
- };
-
- wgpu_types::QueryType::PipelineStatistics(pipeline_statistics_names)
- }
- "occlusion" => return Err(not_supported()),
- "timestamp" => wgpu_types::QueryType::Timestamp,
- _ => unreachable!(),
- },
- count: args.count,
- };
-
- let (query_set, maybe_err) = gfx_select!(device => instance.device_create_query_set(
- device,
- &descriptor,
- std::marker::PhantomData
- ));
-
- let rid = state.resource_table.add(WebGpuQuerySet(query_set));
-
- Ok(WebGpuResult::rid_err(rid, maybe_err))
-}
-
-fn declare_webgpu_ops() -> Vec<(&'static str, Box<OpFn>)> {
- vec![
- // Request device/adapter
- (
- "op_webgpu_request_adapter",
- op_async(op_webgpu_request_adapter),
- ),
- (
- "op_webgpu_request_device",
- op_async(op_webgpu_request_device),
- ),
- // Query Set
- (
- "op_webgpu_create_query_set",
- op_sync(op_webgpu_create_query_set),
- ),
- // buffer
- (
- "op_webgpu_create_buffer",
- op_sync(buffer::op_webgpu_create_buffer),
- ),
- (
- "op_webgpu_buffer_get_mapped_range",
- op_sync(buffer::op_webgpu_buffer_get_mapped_range),
- ),
- (
- "op_webgpu_buffer_unmap",
- op_sync(buffer::op_webgpu_buffer_unmap),
- ),
- // buffer async
- (
- "op_webgpu_buffer_get_map_async",
- op_async(buffer::op_webgpu_buffer_get_map_async),
- ),
- // remaining sync ops
-
- // texture
- (
- "op_webgpu_create_texture",
- op_sync(texture::op_webgpu_create_texture),
- ),
- (
- "op_webgpu_create_texture_view",
- op_sync(texture::op_webgpu_create_texture_view),
- ),
- // sampler
- (
- "op_webgpu_create_sampler",
- op_sync(sampler::op_webgpu_create_sampler),
- ),
- // binding
- (
- "op_webgpu_create_bind_group_layout",
- op_sync(binding::op_webgpu_create_bind_group_layout),
- ),
- (
- "op_webgpu_create_pipeline_layout",
- op_sync(binding::op_webgpu_create_pipeline_layout),
- ),
- (
- "op_webgpu_create_bind_group",
- op_sync(binding::op_webgpu_create_bind_group),
- ),
- // pipeline
- (
- "op_webgpu_create_compute_pipeline",
- op_sync(pipeline::op_webgpu_create_compute_pipeline),
- ),
- (
- "op_webgpu_compute_pipeline_get_bind_group_layout",
- op_sync(pipeline::op_webgpu_compute_pipeline_get_bind_group_layout),
- ),
- (
- "op_webgpu_create_render_pipeline",
- op_sync(pipeline::op_webgpu_create_render_pipeline),
- ),
- (
- "op_webgpu_render_pipeline_get_bind_group_layout",
- op_sync(pipeline::op_webgpu_render_pipeline_get_bind_group_layout),
- ),
- // command_encoder
- (
- "op_webgpu_create_command_encoder",
- op_sync(command_encoder::op_webgpu_create_command_encoder),
- ),
- (
- "op_webgpu_command_encoder_begin_render_pass",
- op_sync(command_encoder::op_webgpu_command_encoder_begin_render_pass),
- ),
- (
- "op_webgpu_command_encoder_begin_compute_pass",
- op_sync(command_encoder::op_webgpu_command_encoder_begin_compute_pass),
- ),
- (
- "op_webgpu_command_encoder_copy_buffer_to_buffer",
- op_sync(command_encoder::op_webgpu_command_encoder_copy_buffer_to_buffer),
- ),
- (
- "op_webgpu_command_encoder_copy_buffer_to_texture",
- op_sync(
- command_encoder::op_webgpu_command_encoder_copy_buffer_to_texture,
- ),
- ),
- (
- "op_webgpu_command_encoder_copy_texture_to_buffer",
- op_sync(
- command_encoder::op_webgpu_command_encoder_copy_texture_to_buffer,
- ),
- ),
- (
- "op_webgpu_command_encoder_copy_texture_to_texture",
- op_sync(
- command_encoder::op_webgpu_command_encoder_copy_texture_to_texture,
- ),
- ),
- (
- "op_webgpu_command_encoder_push_debug_group",
- op_sync(command_encoder::op_webgpu_command_encoder_push_debug_group),
- ),
- (
- "op_webgpu_command_encoder_pop_debug_group",
- op_sync(command_encoder::op_webgpu_command_encoder_pop_debug_group),
- ),
- (
- "op_webgpu_command_encoder_insert_debug_marker",
- op_sync(command_encoder::op_webgpu_command_encoder_insert_debug_marker),
- ),
- (
- "op_webgpu_command_encoder_write_timestamp",
- op_sync(command_encoder::op_webgpu_command_encoder_write_timestamp),
- ),
- (
- "op_webgpu_command_encoder_resolve_query_set",
- op_sync(command_encoder::op_webgpu_command_encoder_resolve_query_set),
- ),
- (
- "op_webgpu_command_encoder_finish",
- op_sync(command_encoder::op_webgpu_command_encoder_finish),
- ),
- // render_pass
- (
- "op_webgpu_render_pass_set_viewport",
- op_sync(render_pass::op_webgpu_render_pass_set_viewport),
- ),
- (
- "op_webgpu_render_pass_set_scissor_rect",
- op_sync(render_pass::op_webgpu_render_pass_set_scissor_rect),
- ),
- (
- "op_webgpu_render_pass_set_blend_color",
- op_sync(render_pass::op_webgpu_render_pass_set_blend_color),
- ),
- (
- "op_webgpu_render_pass_set_stencil_reference",
- op_sync(render_pass::op_webgpu_render_pass_set_stencil_reference),
- ),
- (
- "op_webgpu_render_pass_begin_pipeline_statistics_query",
- op_sync(
- render_pass::op_webgpu_render_pass_begin_pipeline_statistics_query,
- ),
- ),
- (
- "op_webgpu_render_pass_end_pipeline_statistics_query",
- op_sync(render_pass::op_webgpu_render_pass_end_pipeline_statistics_query),
- ),
- (
- "op_webgpu_render_pass_write_timestamp",
- op_sync(render_pass::op_webgpu_render_pass_write_timestamp),
- ),
- (
- "op_webgpu_render_pass_execute_bundles",
- op_sync(render_pass::op_webgpu_render_pass_execute_bundles),
- ),
- (
- "op_webgpu_render_pass_end_pass",
- op_sync(render_pass::op_webgpu_render_pass_end_pass),
- ),
- (
- "op_webgpu_render_pass_set_bind_group",
- op_sync(render_pass::op_webgpu_render_pass_set_bind_group),
- ),
- (
- "op_webgpu_render_pass_push_debug_group",
- op_sync(render_pass::op_webgpu_render_pass_push_debug_group),
- ),
- (
- "op_webgpu_render_pass_pop_debug_group",
- op_sync(render_pass::op_webgpu_render_pass_pop_debug_group),
- ),
- (
- "op_webgpu_render_pass_insert_debug_marker",
- op_sync(render_pass::op_webgpu_render_pass_insert_debug_marker),
- ),
- (
- "op_webgpu_render_pass_set_pipeline",
- op_sync(render_pass::op_webgpu_render_pass_set_pipeline),
- ),
- (
- "op_webgpu_render_pass_set_index_buffer",
- op_sync(render_pass::op_webgpu_render_pass_set_index_buffer),
- ),
- (
- "op_webgpu_render_pass_set_vertex_buffer",
- op_sync(render_pass::op_webgpu_render_pass_set_vertex_buffer),
- ),
- (
- "op_webgpu_render_pass_draw",
- op_sync(render_pass::op_webgpu_render_pass_draw),
- ),
- (
- "op_webgpu_render_pass_draw_indexed",
- op_sync(render_pass::op_webgpu_render_pass_draw_indexed),
- ),
- (
- "op_webgpu_render_pass_draw_indirect",
- op_sync(render_pass::op_webgpu_render_pass_draw_indirect),
- ),
- (
- "op_webgpu_render_pass_draw_indexed_indirect",
- op_sync(render_pass::op_webgpu_render_pass_draw_indexed_indirect),
- ),
- // compute_pass
- (
- "op_webgpu_compute_pass_set_pipeline",
- op_sync(compute_pass::op_webgpu_compute_pass_set_pipeline),
- ),
- (
- "op_webgpu_compute_pass_dispatch",
- op_sync(compute_pass::op_webgpu_compute_pass_dispatch),
- ),
- (
- "op_webgpu_compute_pass_dispatch_indirect",
- op_sync(compute_pass::op_webgpu_compute_pass_dispatch_indirect),
- ),
- (
- "op_webgpu_compute_pass_end_pass",
- op_sync(compute_pass::op_webgpu_compute_pass_end_pass),
- ),
- (
- "op_webgpu_compute_pass_set_bind_group",
- op_sync(compute_pass::op_webgpu_compute_pass_set_bind_group),
- ),
- (
- "op_webgpu_compute_pass_push_debug_group",
- op_sync(compute_pass::op_webgpu_compute_pass_push_debug_group),
- ),
- (
- "op_webgpu_compute_pass_pop_debug_group",
- op_sync(compute_pass::op_webgpu_compute_pass_pop_debug_group),
- ),
- (
- "op_webgpu_compute_pass_insert_debug_marker",
- op_sync(compute_pass::op_webgpu_compute_pass_insert_debug_marker),
- ),
- // bundle
- (
- "op_webgpu_create_render_bundle_encoder",
- op_sync(bundle::op_webgpu_create_render_bundle_encoder),
- ),
- (
- "op_webgpu_render_bundle_encoder_finish",
- op_sync(bundle::op_webgpu_render_bundle_encoder_finish),
- ),
- (
- "op_webgpu_render_bundle_encoder_set_bind_group",
- op_sync(bundle::op_webgpu_render_bundle_encoder_set_bind_group),
- ),
- (
- "op_webgpu_render_bundle_encoder_push_debug_group",
- op_sync(bundle::op_webgpu_render_bundle_encoder_push_debug_group),
- ),
- (
- "op_webgpu_render_bundle_encoder_pop_debug_group",
- op_sync(bundle::op_webgpu_render_bundle_encoder_pop_debug_group),
- ),
- (
- "op_webgpu_render_bundle_encoder_insert_debug_marker",
- op_sync(bundle::op_webgpu_render_bundle_encoder_insert_debug_marker),
- ),
- (
- "op_webgpu_render_bundle_encoder_set_pipeline",
- op_sync(bundle::op_webgpu_render_bundle_encoder_set_pipeline),
- ),
- (
- "op_webgpu_render_bundle_encoder_set_index_buffer",
- op_sync(bundle::op_webgpu_render_bundle_encoder_set_index_buffer),
- ),
- (
- "op_webgpu_render_bundle_encoder_set_vertex_buffer",
- op_sync(bundle::op_webgpu_render_bundle_encoder_set_vertex_buffer),
- ),
- (
- "op_webgpu_render_bundle_encoder_draw",
- op_sync(bundle::op_webgpu_render_bundle_encoder_draw),
- ),
- (
- "op_webgpu_render_bundle_encoder_draw_indexed",
- op_sync(bundle::op_webgpu_render_bundle_encoder_draw_indexed),
- ),
- (
- "op_webgpu_render_bundle_encoder_draw_indirect",
- op_sync(bundle::op_webgpu_render_bundle_encoder_draw_indirect),
- ),
- // queue
- (
- "op_webgpu_queue_submit",
- op_sync(queue::op_webgpu_queue_submit),
- ),
- (
- "op_webgpu_write_buffer",
- op_sync(queue::op_webgpu_write_buffer),
- ),
- (
- "op_webgpu_write_texture",
- op_sync(queue::op_webgpu_write_texture),
- ),
- // shader
- (
- "op_webgpu_create_shader_module",
- op_sync(shader::op_webgpu_create_shader_module),
- ),
- ]
-}
diff --git a/op_crates/webgpu/pipeline.rs b/op_crates/webgpu/pipeline.rs
deleted file mode 100644
index 8eb291b97..000000000
--- a/op_crates/webgpu/pipeline.rs
+++ /dev/null
@@ -1,643 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::error::bad_resource_id;
-use deno_core::error::AnyError;
-use deno_core::ResourceId;
-use deno_core::ZeroCopyBuf;
-use deno_core::{OpState, Resource};
-use serde::Deserialize;
-use serde::Serialize;
-use std::borrow::Cow;
-
-use super::error::{WebGpuError, WebGpuResult};
-
-pub(crate) struct WebGpuPipelineLayout(
- pub(crate) wgpu_core::id::PipelineLayoutId,
-);
-impl Resource for WebGpuPipelineLayout {
- fn name(&self) -> Cow<str> {
- "webGPUPipelineLayout".into()
- }
-}
-
-pub(crate) struct WebGpuComputePipeline(
- pub(crate) wgpu_core::id::ComputePipelineId,
-);
-impl Resource for WebGpuComputePipeline {
- fn name(&self) -> Cow<str> {
- "webGPUComputePipeline".into()
- }
-}
-
-pub(crate) struct WebGpuRenderPipeline(
- pub(crate) wgpu_core::id::RenderPipelineId,
-);
-impl Resource for WebGpuRenderPipeline {
- fn name(&self) -> Cow<str> {
- "webGPURenderPipeline".into()
- }
-}
-
-pub fn serialize_index_format(format: String) -> wgpu_types::IndexFormat {
- match format.as_str() {
- "uint16" => wgpu_types::IndexFormat::Uint16,
- "uint32" => wgpu_types::IndexFormat::Uint32,
- _ => unreachable!(),
- }
-}
-
-fn serialize_stencil_operation(
- operation: &str,
-) -> wgpu_types::StencilOperation {
- match operation {
- "keep" => wgpu_types::StencilOperation::Keep,
- "zero" => wgpu_types::StencilOperation::Zero,
- "replace" => wgpu_types::StencilOperation::Replace,
- "invert" => wgpu_types::StencilOperation::Invert,
- "increment-clamp" => wgpu_types::StencilOperation::IncrementClamp,
- "decrement-clamp" => wgpu_types::StencilOperation::DecrementClamp,
- "increment-wrap" => wgpu_types::StencilOperation::IncrementWrap,
- "decrement-wrap" => wgpu_types::StencilOperation::DecrementWrap,
- _ => unreachable!(),
- }
-}
-
-fn serialize_stencil_face_state(
- state: GpuStencilFaceState,
-) -> wgpu_types::StencilFaceState {
- wgpu_types::StencilFaceState {
- compare: state
- .compare
- .as_ref()
- .map_or(wgpu_types::CompareFunction::Always, |op| {
- super::sampler::serialize_compare_function(op)
- }),
- fail_op: state
- .fail_op
- .as_ref()
- .map_or(wgpu_types::StencilOperation::Keep, |op| {
- serialize_stencil_operation(op)
- }),
- depth_fail_op: state
- .depth_fail_op
- .as_ref()
- .map_or(wgpu_types::StencilOperation::Keep, |op| {
- serialize_stencil_operation(op)
- }),
- pass_op: state
- .pass_op
- .as_ref()
- .map_or(wgpu_types::StencilOperation::Keep, |op| {
- serialize_stencil_operation(op)
- }),
- }
-}
-
-fn serialize_blend_factor(blend_factor: &str) -> wgpu_types::BlendFactor {
- match blend_factor {
- "zero" => wgpu_types::BlendFactor::Zero,
- "one" => wgpu_types::BlendFactor::One,
- "src-color" => wgpu_types::BlendFactor::SrcColor,
- "one-minus-src-color" => wgpu_types::BlendFactor::OneMinusSrcColor,
- "src-alpha" => wgpu_types::BlendFactor::SrcAlpha,
- "one-minus-src-alpha" => wgpu_types::BlendFactor::OneMinusSrcAlpha,
- "dst-color" => wgpu_types::BlendFactor::DstColor,
- "one-minus-dst-color" => wgpu_types::BlendFactor::OneMinusDstColor,
- "dst-alpha" => wgpu_types::BlendFactor::DstAlpha,
- "one-minus-dst-alpha" => wgpu_types::BlendFactor::OneMinusDstAlpha,
- "src-alpha-saturated" => wgpu_types::BlendFactor::SrcAlphaSaturated,
- "blend-color" => wgpu_types::BlendFactor::BlendColor,
- "one-minus-blend-color" => wgpu_types::BlendFactor::OneMinusBlendColor,
- _ => unreachable!(),
- }
-}
-
-fn serialize_blend_component(
- blend: GpuBlendComponent,
-) -> wgpu_types::BlendState {
- wgpu_types::BlendState {
- src_factor: blend
- .src_factor
- .as_ref()
- .map_or(wgpu_types::BlendFactor::One, |factor| {
- serialize_blend_factor(factor)
- }),
- dst_factor: blend
- .dst_factor
- .as_ref()
- .map_or(wgpu_types::BlendFactor::Zero, |factor| {
- serialize_blend_factor(factor)
- }),
- operation: match &blend.operation {
- Some(operation) => match operation.as_str() {
- "add" => wgpu_types::BlendOperation::Add,
- "subtract" => wgpu_types::BlendOperation::Subtract,
- "reverse-subtract" => wgpu_types::BlendOperation::ReverseSubtract,
- "min" => wgpu_types::BlendOperation::Min,
- "max" => wgpu_types::BlendOperation::Max,
- _ => unreachable!(),
- },
- None => wgpu_types::BlendOperation::Add,
- },
- }
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct GpuProgrammableStage {
- module: u32,
- entry_point: String,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CreateComputePipelineArgs {
- device_rid: ResourceId,
- label: Option<String>,
- layout: Option<u32>,
- compute: GpuProgrammableStage,
-}
-
-pub fn op_webgpu_create_compute_pipeline(
- state: &mut OpState,
- args: CreateComputePipelineArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let device_resource = state
- .resource_table
- .get::<super::WebGpuDevice>(args.device_rid)
- .ok_or_else(bad_resource_id)?;
- let device = device_resource.0;
-
- let pipeline_layout = if let Some(rid) = args.layout {
- let id = state
- .resource_table
- .get::<WebGpuPipelineLayout>(rid)
- .ok_or_else(bad_resource_id)?;
- Some(id.0)
- } else {
- None
- };
-
- let compute_shader_module_resource = state
- .resource_table
- .get::<super::shader::WebGpuShaderModule>(args.compute.module)
- .ok_or_else(bad_resource_id)?;
-
- let descriptor = wgpu_core::pipeline::ComputePipelineDescriptor {
- label: args.label.map(Cow::from),
- layout: pipeline_layout,
- stage: wgpu_core::pipeline::ProgrammableStageDescriptor {
- module: compute_shader_module_resource.0,
- entry_point: Cow::from(args.compute.entry_point),
- },
- };
- let implicit_pipelines = match args.layout {
- Some(_) => None,
- None => Some(wgpu_core::device::ImplicitPipelineIds {
- root_id: std::marker::PhantomData,
- group_ids: &[std::marker::PhantomData; wgpu_core::MAX_BIND_GROUPS],
- }),
- };
-
- let (compute_pipeline, _, maybe_err) = gfx_select!(device => instance.device_create_compute_pipeline(
- device,
- &descriptor,
- std::marker::PhantomData,
- implicit_pipelines
- ));
-
- let rid = state
- .resource_table
- .add(WebGpuComputePipeline(compute_pipeline));
-
- Ok(WebGpuResult::rid_err(rid, maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct ComputePipelineGetBindGroupLayoutArgs {
- compute_pipeline_rid: ResourceId,
- index: u32,
-}
-
-#[derive(Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct PipelineLayout {
- rid: ResourceId,
- label: String,
- err: Option<WebGpuError>,
-}
-
-pub fn op_webgpu_compute_pipeline_get_bind_group_layout(
- state: &mut OpState,
- args: ComputePipelineGetBindGroupLayoutArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<PipelineLayout, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let compute_pipeline_resource = state
- .resource_table
- .get::<WebGpuComputePipeline>(args.compute_pipeline_rid)
- .ok_or_else(bad_resource_id)?;
- let compute_pipeline = compute_pipeline_resource.0;
-
- let (bind_group_layout, maybe_err) = gfx_select!(compute_pipeline => instance.compute_pipeline_get_bind_group_layout(compute_pipeline, args.index, std::marker::PhantomData));
-
- let label = gfx_select!(bind_group_layout => instance.bind_group_layout_label(bind_group_layout));
-
- let rid = state
- .resource_table
- .add(super::binding::WebGpuBindGroupLayout(bind_group_layout));
-
- Ok(PipelineLayout {
- rid,
- label,
- err: maybe_err.map(WebGpuError::from),
- })
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct GpuPrimitiveState {
- topology: Option<String>,
- strip_index_format: Option<String>,
- front_face: Option<String>,
- cull_mode: Option<String>,
-}
-
-#[derive(Deserialize, Clone)]
-#[serde(rename_all = "camelCase")]
-struct GpuBlendComponent {
- src_factor: Option<String>,
- dst_factor: Option<String>,
- operation: Option<String>,
-}
-
-#[derive(Deserialize, Clone)]
-#[serde(rename_all = "camelCase")]
-struct GpuBlendState {
- color: GpuBlendComponent,
- alpha: GpuBlendComponent,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct GpuColorTargetState {
- format: String,
- blend: Option<GpuBlendState>,
- write_mask: Option<u32>,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct GpuStencilFaceState {
- compare: Option<String>,
- fail_op: Option<String>,
- depth_fail_op: Option<String>,
- pass_op: Option<String>,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct GpuDepthStencilState {
- format: String,
- depth_write_enabled: Option<bool>,
- depth_compare: Option<String>,
- stencil_front: Option<GpuStencilFaceState>,
- stencil_back: Option<GpuStencilFaceState>,
- stencil_read_mask: Option<u32>,
- stencil_write_mask: Option<u32>,
- depth_bias: Option<i32>,
- depth_bias_slope_scale: Option<f32>,
- depth_bias_clamp: Option<f32>,
- clamp_depth: Option<bool>,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct GpuVertexAttribute {
- format: String,
- offset: u64,
- shader_location: u32,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct GpuVertexBufferLayout {
- array_stride: u64,
- step_mode: Option<String>,
- attributes: Vec<GpuVertexAttribute>,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct GpuVertexState {
- module: u32,
- entry_point: String,
- buffers: Option<Vec<Option<GpuVertexBufferLayout>>>,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct GpuMultisampleState {
- count: Option<u32>,
- mask: Option<u64>, // against spec, but future proof
- alpha_to_coverage_enabled: Option<bool>,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct GpuFragmentState {
- targets: Vec<GpuColorTargetState>,
- module: u32,
- entry_point: String,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CreateRenderPipelineArgs {
- device_rid: ResourceId,
- label: Option<String>,
- layout: Option<u32>,
- vertex: GpuVertexState,
- primitive: Option<GpuPrimitiveState>,
- depth_stencil: Option<GpuDepthStencilState>,
- multisample: Option<GpuMultisampleState>,
- fragment: Option<GpuFragmentState>,
-}
-
-pub fn op_webgpu_create_render_pipeline(
- state: &mut OpState,
- args: CreateRenderPipelineArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let device_resource = state
- .resource_table
- .get::<super::WebGpuDevice>(args.device_rid)
- .ok_or_else(bad_resource_id)?;
- let device = device_resource.0;
-
- let layout = if let Some(rid) = args.layout {
- let pipeline_layout_resource = state
- .resource_table
- .get::<WebGpuPipelineLayout>(rid)
- .ok_or_else(bad_resource_id)?;
- Some(pipeline_layout_resource.0)
- } else {
- None
- };
-
- let vertex_shader_module_resource = state
- .resource_table
- .get::<super::shader::WebGpuShaderModule>(args.vertex.module)
- .ok_or_else(bad_resource_id)?;
-
- let descriptor = wgpu_core::pipeline::RenderPipelineDescriptor {
- label: args.label.map(Cow::from),
- layout,
- vertex: wgpu_core::pipeline::VertexState {
- stage: wgpu_core::pipeline::ProgrammableStageDescriptor {
- module: vertex_shader_module_resource.0,
- entry_point: Cow::from(args.vertex.entry_point),
- },
- buffers: Cow::from(if let Some(buffers) = args.vertex.buffers {
- let mut return_buffers = vec![];
- for buffer in buffers.into_iter().flatten() {
- return_buffers.push(wgpu_core::pipeline::VertexBufferLayout {
- array_stride: buffer.array_stride,
- step_mode: match buffer.step_mode {
- Some(step_mode) => match step_mode.as_str() {
- "vertex" => wgpu_types::InputStepMode::Vertex,
- "instance" => wgpu_types::InputStepMode::Instance,
- _ => unreachable!(),
- },
- None => wgpu_types::InputStepMode::Vertex,
- },
- attributes: Cow::from(
- buffer
- .attributes
- .iter()
- .map(|attribute| wgpu_types::VertexAttribute {
- format: match attribute.format.as_str() {
- "uchar2" => wgpu_types::VertexFormat::Uchar2,
- "uchar4" => wgpu_types::VertexFormat::Uchar4,
- "char2" => wgpu_types::VertexFormat::Char2,
- "char4" => wgpu_types::VertexFormat::Char4,
- "uchar2norm" => wgpu_types::VertexFormat::Uchar2Norm,
- "uchar4norm" => wgpu_types::VertexFormat::Uchar4,
- "char2norm" => wgpu_types::VertexFormat::Char2Norm,
- "char4norm" => wgpu_types::VertexFormat::Char4Norm,
- "ushort2" => wgpu_types::VertexFormat::Ushort2,
- "ushort4" => wgpu_types::VertexFormat::Ushort4,
- "short2" => wgpu_types::VertexFormat::Short2,
- "short4" => wgpu_types::VertexFormat::Short4,
- "ushort2norm" => wgpu_types::VertexFormat::Ushort2Norm,
- "ushort4norm" => wgpu_types::VertexFormat::Ushort4Norm,
- "short2norm" => wgpu_types::VertexFormat::Short2Norm,
- "short4norm" => wgpu_types::VertexFormat::Short4Norm,
- "half2" => wgpu_types::VertexFormat::Half2,
- "half4" => wgpu_types::VertexFormat::Half4,
- "float" => wgpu_types::VertexFormat::Float,
- "float2" => wgpu_types::VertexFormat::Float2,
- "float3" => wgpu_types::VertexFormat::Float3,
- "float4" => wgpu_types::VertexFormat::Float4,
- "uint" => wgpu_types::VertexFormat::Uint,
- "uint2" => wgpu_types::VertexFormat::Uint2,
- "uint3" => wgpu_types::VertexFormat::Uint3,
- "uint4" => wgpu_types::VertexFormat::Uint4,
- "int" => wgpu_types::VertexFormat::Int,
- "int2" => wgpu_types::VertexFormat::Int2,
- "int3" => wgpu_types::VertexFormat::Int3,
- "int4" => wgpu_types::VertexFormat::Int4,
- _ => unreachable!(),
- },
- offset: attribute.offset,
- shader_location: attribute.shader_location,
- })
- .collect::<Vec<wgpu_types::VertexAttribute>>(),
- ),
- });
- }
- return_buffers
- } else {
- vec![]
- }),
- },
- primitive: args.primitive.map_or(Default::default(), |primitive| {
- wgpu_types::PrimitiveState {
- topology: match primitive.topology {
- Some(topology) => match topology.as_str() {
- "point-list" => wgpu_types::PrimitiveTopology::PointList,
- "line-list" => wgpu_types::PrimitiveTopology::LineList,
- "line-strip" => wgpu_types::PrimitiveTopology::LineStrip,
- "triangle-list" => wgpu_types::PrimitiveTopology::TriangleList,
- "triangle-strip" => wgpu_types::PrimitiveTopology::TriangleStrip,
- _ => unreachable!(),
- },
- None => wgpu_types::PrimitiveTopology::TriangleList,
- },
- strip_index_format: primitive
- .strip_index_format
- .map(serialize_index_format),
- front_face: match primitive.front_face {
- Some(front_face) => match front_face.as_str() {
- "ccw" => wgpu_types::FrontFace::Ccw,
- "cw" => wgpu_types::FrontFace::Cw,
- _ => unreachable!(),
- },
- None => wgpu_types::FrontFace::Ccw,
- },
- cull_mode: match primitive.cull_mode {
- Some(cull_mode) => match cull_mode.as_str() {
- "none" => wgpu_types::CullMode::None,
- "front" => wgpu_types::CullMode::Front,
- "back" => wgpu_types::CullMode::Back,
- _ => unreachable!(),
- },
- None => wgpu_types::CullMode::None,
- },
- polygon_mode: Default::default(), // native-only
- }
- }),
- depth_stencil: args.depth_stencil.map(|depth_stencil| {
- wgpu_types::DepthStencilState {
- format: super::texture::serialize_texture_format(&depth_stencil.format)
- .unwrap(),
- depth_write_enabled: depth_stencil.depth_write_enabled.unwrap_or(false),
- depth_compare: match depth_stencil.depth_compare {
- Some(depth_compare) => {
- super::sampler::serialize_compare_function(&depth_compare)
- }
- None => wgpu_types::CompareFunction::Always,
- },
- stencil: wgpu_types::StencilState {
- front: depth_stencil
- .stencil_front
- .map_or(Default::default(), serialize_stencil_face_state),
- back: depth_stencil
- .stencil_back
- .map_or(Default::default(), serialize_stencil_face_state),
- read_mask: depth_stencil.stencil_read_mask.unwrap_or(0xFFFFFFFF),
- write_mask: depth_stencil.stencil_write_mask.unwrap_or(0xFFFFFFFF),
- },
- bias: wgpu_types::DepthBiasState {
- constant: depth_stencil.depth_bias.unwrap_or(0),
- slope_scale: depth_stencil.depth_bias_slope_scale.unwrap_or(0.0),
- clamp: depth_stencil.depth_bias_clamp.unwrap_or(0.0),
- },
- clamp_depth: depth_stencil.clamp_depth.unwrap_or(false),
- }
- }),
- multisample: args.multisample.map_or(Default::default(), |multisample| {
- wgpu_types::MultisampleState {
- count: multisample.count.unwrap_or(1),
- mask: multisample.mask.unwrap_or(0xFFFFFFFF),
- alpha_to_coverage_enabled: multisample
- .alpha_to_coverage_enabled
- .unwrap_or(false),
- }
- }),
- fragment: args.fragment.map(|fragment| {
- let fragment_shader_module_resource = state
- .resource_table
- .get::<super::shader::WebGpuShaderModule>(fragment.module)
- .ok_or_else(bad_resource_id)
- .unwrap();
-
- wgpu_core::pipeline::FragmentState {
- stage: wgpu_core::pipeline::ProgrammableStageDescriptor {
- module: fragment_shader_module_resource.0,
- entry_point: Cow::from(fragment.entry_point),
- },
- targets: Cow::from(
- fragment
- .targets
- .iter()
- .map(|target| {
- let blends = target.blend.clone().map(|blend| {
- (
- serialize_blend_component(blend.alpha),
- serialize_blend_component(blend.color),
- )
- });
-
- wgpu_types::ColorTargetState {
- format: super::texture::serialize_texture_format(
- &target.format,
- )
- .unwrap(),
- alpha_blend: blends
- .clone()
- .map_or(Default::default(), |states| states.0),
- color_blend: blends
- .map_or(Default::default(), |states| states.1),
- write_mask: target
- .write_mask
- .map_or(Default::default(), |mask| {
- wgpu_types::ColorWrite::from_bits(mask).unwrap()
- }),
- }
- })
- .collect::<Vec<wgpu_types::ColorTargetState>>(),
- ),
- }
- }),
- };
-
- let implicit_pipelines = match args.layout {
- Some(_) => None,
- None => Some(wgpu_core::device::ImplicitPipelineIds {
- root_id: std::marker::PhantomData,
- group_ids: &[std::marker::PhantomData; wgpu_core::MAX_BIND_GROUPS],
- }),
- };
-
- let (render_pipeline, _, maybe_err) = gfx_select!(device => instance.device_create_render_pipeline(
- device,
- &descriptor,
- std::marker::PhantomData,
- implicit_pipelines
- ));
-
- let rid = state
- .resource_table
- .add(WebGpuRenderPipeline(render_pipeline));
-
- Ok(WebGpuResult::rid_err(rid, maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPipelineGetBindGroupLayoutArgs {
- render_pipeline_rid: ResourceId,
- index: u32,
-}
-
-pub fn op_webgpu_render_pipeline_get_bind_group_layout(
- state: &mut OpState,
- args: RenderPipelineGetBindGroupLayoutArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<PipelineLayout, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let render_pipeline_resource = state
- .resource_table
- .get::<WebGpuRenderPipeline>(args.render_pipeline_rid)
- .ok_or_else(bad_resource_id)?;
- let render_pipeline = render_pipeline_resource.0;
-
- let (bind_group_layout, maybe_err) = gfx_select!(render_pipeline => instance.render_pipeline_get_bind_group_layout(render_pipeline, args.index, std::marker::PhantomData));
-
- let label = gfx_select!(bind_group_layout => instance.bind_group_layout_label(bind_group_layout));
-
- let rid = state
- .resource_table
- .add(super::binding::WebGpuBindGroupLayout(bind_group_layout));
-
- Ok(PipelineLayout {
- rid,
- label,
- err: maybe_err.map(WebGpuError::from),
- })
-}
diff --git a/op_crates/webgpu/queue.rs b/op_crates/webgpu/queue.rs
deleted file mode 100644
index 93fd95502..000000000
--- a/op_crates/webgpu/queue.rs
+++ /dev/null
@@ -1,159 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::error::bad_resource_id;
-use deno_core::error::null_opbuf;
-use deno_core::error::AnyError;
-use deno_core::OpState;
-use deno_core::ResourceId;
-use deno_core::ZeroCopyBuf;
-use serde::Deserialize;
-
-use super::error::WebGpuResult;
-
-type WebGpuQueue = super::WebGpuDevice;
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct QueueSubmitArgs {
- queue_rid: ResourceId,
- command_buffers: Vec<u32>,
-}
-
-pub fn op_webgpu_queue_submit(
- state: &mut OpState,
- args: QueueSubmitArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let queue_resource = state
- .resource_table
- .get::<WebGpuQueue>(args.queue_rid)
- .ok_or_else(bad_resource_id)?;
- let queue = queue_resource.0;
-
- let mut ids = vec![];
-
- for rid in args.command_buffers {
- let buffer_resource = state
- .resource_table
- .get::<super::command_encoder::WebGpuCommandBuffer>(rid)
- .ok_or_else(bad_resource_id)?;
- ids.push(buffer_resource.0);
- }
-
- let maybe_err =
- gfx_select!(queue => instance.queue_submit(queue, &ids)).err();
-
- Ok(WebGpuResult::maybe_err(maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct GpuImageDataLayout {
- offset: Option<u64>,
- bytes_per_row: Option<u32>,
- rows_per_image: Option<u32>,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct QueueWriteBufferArgs {
- queue_rid: ResourceId,
- buffer: u32,
- buffer_offset: u64,
- data_offset: usize,
- size: Option<usize>,
-}
-
-pub fn op_webgpu_write_buffer(
- state: &mut OpState,
- args: QueueWriteBufferArgs,
- zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let zero_copy = zero_copy.ok_or_else(null_opbuf)?;
- let instance = state.borrow::<super::Instance>();
- let buffer_resource = state
- .resource_table
- .get::<super::buffer::WebGpuBuffer>(args.buffer)
- .ok_or_else(bad_resource_id)?;
- let buffer = buffer_resource.0;
- let queue_resource = state
- .resource_table
- .get::<WebGpuQueue>(args.queue_rid)
- .ok_or_else(bad_resource_id)?;
- let queue = queue_resource.0;
-
- let data = match args.size {
- Some(size) => &zero_copy[args.data_offset..(args.data_offset + size)],
- None => &zero_copy[args.data_offset..],
- };
- let maybe_err = gfx_select!(queue => instance.queue_write_buffer(
- queue,
- buffer,
- args.buffer_offset,
- data
- ))
- .err();
-
- Ok(WebGpuResult::maybe_err(maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct QueueWriteTextureArgs {
- queue_rid: ResourceId,
- destination: super::command_encoder::GpuImageCopyTexture,
- data_layout: GpuImageDataLayout,
- size: super::texture::GpuExtent3D,
-}
-
-pub fn op_webgpu_write_texture(
- state: &mut OpState,
- args: QueueWriteTextureArgs,
- zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let zero_copy = zero_copy.ok_or_else(null_opbuf)?;
- let instance = state.borrow::<super::Instance>();
- let texture_resource = state
- .resource_table
- .get::<super::texture::WebGpuTexture>(args.destination.texture)
- .ok_or_else(bad_resource_id)?;
- let queue_resource = state
- .resource_table
- .get::<WebGpuQueue>(args.queue_rid)
- .ok_or_else(bad_resource_id)?;
- let queue = queue_resource.0;
-
- let destination = wgpu_core::command::TextureCopyView {
- texture: texture_resource.0,
- mip_level: args.destination.mip_level.unwrap_or(0),
- origin: args
- .destination
- .origin
- .map_or(Default::default(), |origin| wgpu_types::Origin3d {
- x: origin.x.unwrap_or(0),
- y: origin.y.unwrap_or(0),
- z: origin.z.unwrap_or(0),
- }),
- };
- let data_layout = wgpu_types::TextureDataLayout {
- offset: args.data_layout.offset.unwrap_or(0),
- bytes_per_row: args.data_layout.bytes_per_row.unwrap_or(0),
- rows_per_image: args.data_layout.rows_per_image.unwrap_or(0),
- };
-
- let maybe_err = gfx_select!(queue => instance.queue_write_texture(
- queue,
- &destination,
- &*zero_copy,
- &data_layout,
- &wgpu_types::Extent3d {
- width: args.size.width.unwrap_or(1),
- height: args.size.height.unwrap_or(1),
- depth: args.size.depth.unwrap_or(1),
- }
- ))
- .err();
-
- Ok(WebGpuResult::maybe_err(maybe_err))
-}
diff --git a/op_crates/webgpu/render_pass.rs b/op_crates/webgpu/render_pass.rs
deleted file mode 100644
index 236c55939..000000000
--- a/op_crates/webgpu/render_pass.rs
+++ /dev/null
@@ -1,677 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::error::bad_resource_id;
-use deno_core::error::null_opbuf;
-use deno_core::error::AnyError;
-use deno_core::ResourceId;
-use deno_core::ZeroCopyBuf;
-use deno_core::{OpState, Resource};
-use serde::Deserialize;
-use std::borrow::Cow;
-use std::cell::RefCell;
-
-use super::error::WebGpuResult;
-
-pub(crate) struct WebGpuRenderPass(
- pub(crate) RefCell<wgpu_core::command::RenderPass>,
-);
-impl Resource for WebGpuRenderPass {
- fn name(&self) -> Cow<str> {
- "webGPURenderPass".into()
- }
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPassSetViewportArgs {
- render_pass_rid: ResourceId,
- x: f32,
- y: f32,
- width: f32,
- height: f32,
- min_depth: f32,
- max_depth: f32,
-}
-
-pub fn op_webgpu_render_pass_set_viewport(
- state: &mut OpState,
- args: RenderPassSetViewportArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let render_pass_resource = state
- .resource_table
- .get::<WebGpuRenderPass>(args.render_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- wgpu_core::command::render_ffi::wgpu_render_pass_set_viewport(
- &mut render_pass_resource.0.borrow_mut(),
- args.x,
- args.y,
- args.width,
- args.height,
- args.min_depth,
- args.max_depth,
- );
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPassSetScissorRectArgs {
- render_pass_rid: ResourceId,
- x: u32,
- y: u32,
- width: u32,
- height: u32,
-}
-
-pub fn op_webgpu_render_pass_set_scissor_rect(
- state: &mut OpState,
- args: RenderPassSetScissorRectArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let render_pass_resource = state
- .resource_table
- .get::<WebGpuRenderPass>(args.render_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- wgpu_core::command::render_ffi::wgpu_render_pass_set_scissor_rect(
- &mut render_pass_resource.0.borrow_mut(),
- args.x,
- args.y,
- args.width,
- args.height,
- );
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct GpuColor {
- pub r: f64,
- pub g: f64,
- pub b: f64,
- pub a: f64,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPassSetBlendColorArgs {
- render_pass_rid: ResourceId,
- color: GpuColor,
-}
-
-pub fn op_webgpu_render_pass_set_blend_color(
- state: &mut OpState,
- args: RenderPassSetBlendColorArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let render_pass_resource = state
- .resource_table
- .get::<WebGpuRenderPass>(args.render_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- wgpu_core::command::render_ffi::wgpu_render_pass_set_blend_color(
- &mut render_pass_resource.0.borrow_mut(),
- &wgpu_types::Color {
- r: args.color.r,
- g: args.color.g,
- b: args.color.b,
- a: args.color.a,
- },
- );
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPassSetStencilReferenceArgs {
- render_pass_rid: ResourceId,
- reference: u32,
-}
-
-pub fn op_webgpu_render_pass_set_stencil_reference(
- state: &mut OpState,
- args: RenderPassSetStencilReferenceArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let render_pass_resource = state
- .resource_table
- .get::<WebGpuRenderPass>(args.render_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- wgpu_core::command::render_ffi::wgpu_render_pass_set_stencil_reference(
- &mut render_pass_resource.0.borrow_mut(),
- args.reference,
- );
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPassBeginPipelineStatisticsQueryArgs {
- render_pass_rid: ResourceId,
- query_set: u32,
- query_index: u32,
-}
-
-pub fn op_webgpu_render_pass_begin_pipeline_statistics_query(
- state: &mut OpState,
- args: RenderPassBeginPipelineStatisticsQueryArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let render_pass_resource = state
- .resource_table
- .get::<WebGpuRenderPass>(args.render_pass_rid)
- .ok_or_else(bad_resource_id)?;
- let query_set_resource = state
- .resource_table
- .get::<super::WebGpuQuerySet>(args.query_set)
- .ok_or_else(bad_resource_id)?;
-
- unsafe {
- wgpu_core::command::render_ffi::wgpu_render_pass_begin_pipeline_statistics_query(
- &mut render_pass_resource.0.borrow_mut(),
- query_set_resource.0,
- args.query_index,
- );
- }
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPassEndPipelineStatisticsQueryArgs {
- render_pass_rid: ResourceId,
-}
-
-pub fn op_webgpu_render_pass_end_pipeline_statistics_query(
- state: &mut OpState,
- args: RenderPassEndPipelineStatisticsQueryArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let render_pass_resource = state
- .resource_table
- .get::<WebGpuRenderPass>(args.render_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- unsafe {
- wgpu_core::command::render_ffi::wgpu_render_pass_end_pipeline_statistics_query(
- &mut render_pass_resource.0.borrow_mut(),
- );
- }
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPassWriteTimestampArgs {
- render_pass_rid: ResourceId,
- query_set: u32,
- query_index: u32,
-}
-
-pub fn op_webgpu_render_pass_write_timestamp(
- state: &mut OpState,
- args: RenderPassWriteTimestampArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let render_pass_resource = state
- .resource_table
- .get::<WebGpuRenderPass>(args.render_pass_rid)
- .ok_or_else(bad_resource_id)?;
- let query_set_resource = state
- .resource_table
- .get::<super::WebGpuQuerySet>(args.query_set)
- .ok_or_else(bad_resource_id)?;
-
- unsafe {
- wgpu_core::command::render_ffi::wgpu_render_pass_write_timestamp(
- &mut render_pass_resource.0.borrow_mut(),
- query_set_resource.0,
- args.query_index,
- );
- }
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPassExecuteBundlesArgs {
- render_pass_rid: ResourceId,
- bundles: Vec<u32>,
-}
-
-pub fn op_webgpu_render_pass_execute_bundles(
- state: &mut OpState,
- args: RenderPassExecuteBundlesArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let mut render_bundle_ids = vec![];
-
- for rid in &args.bundles {
- let render_bundle_resource = state
- .resource_table
- .get::<super::bundle::WebGpuRenderBundle>(*rid)
- .ok_or_else(bad_resource_id)?;
- render_bundle_ids.push(render_bundle_resource.0);
- }
-
- let render_pass_resource = state
- .resource_table
- .get::<WebGpuRenderPass>(args.render_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- unsafe {
- wgpu_core::command::render_ffi::wgpu_render_pass_execute_bundles(
- &mut render_pass_resource.0.borrow_mut(),
- render_bundle_ids.as_ptr(),
- args.bundles.len(),
- );
- }
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPassEndPassArgs {
- command_encoder_rid: ResourceId,
- render_pass_rid: ResourceId,
-}
-
-pub fn op_webgpu_render_pass_end_pass(
- state: &mut OpState,
- args: RenderPassEndPassArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let command_encoder_resource = state
- .resource_table
- .get::<super::command_encoder::WebGpuCommandEncoder>(
- args.command_encoder_rid,
- )
- .ok_or_else(bad_resource_id)?;
- let command_encoder = command_encoder_resource.0;
- let render_pass_resource = state
- .resource_table
- .take::<WebGpuRenderPass>(args.render_pass_rid)
- .ok_or_else(bad_resource_id)?;
- let render_pass = &render_pass_resource.0.borrow();
- let instance = state.borrow::<super::Instance>();
-
- let maybe_err = gfx_select!(command_encoder => instance.command_encoder_run_render_pass(command_encoder, render_pass)).err();
-
- Ok(WebGpuResult::maybe_err(maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPassSetBindGroupArgs {
- render_pass_rid: ResourceId,
- index: u32,
- bind_group: u32,
- dynamic_offsets_data: Option<Vec<u32>>,
- dynamic_offsets_data_start: usize,
- dynamic_offsets_data_length: usize,
-}
-
-pub fn op_webgpu_render_pass_set_bind_group(
- state: &mut OpState,
- args: RenderPassSetBindGroupArgs,
- zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let bind_group_resource = state
- .resource_table
- .get::<super::binding::WebGpuBindGroup>(args.bind_group)
- .ok_or_else(bad_resource_id)?;
- let render_pass_resource = state
- .resource_table
- .get::<WebGpuRenderPass>(args.render_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- // I know this might look like it can be easily deduplicated, but it can not
- // be due to the lifetime of the args.dynamic_offsets_data slice. Because we
- // need to use a raw pointer here the slice can be freed before the pointer
- // is used in wgpu_render_pass_set_bind_group. See
- // https://matrix.to/#/!XFRnMvAfptAHthwBCx:matrix.org/$HgrlhD-Me1DwsGb8UdMu2Hqubgks8s7ILwWRwigOUAg
- match args.dynamic_offsets_data {
- Some(data) => unsafe {
- wgpu_core::command::render_ffi::wgpu_render_pass_set_bind_group(
- &mut render_pass_resource.0.borrow_mut(),
- args.index,
- bind_group_resource.0,
- data.as_slice().as_ptr(),
- args.dynamic_offsets_data_length,
- );
- },
- None => {
- let zero_copy = zero_copy.ok_or_else(null_opbuf)?;
- let (prefix, data, suffix) = unsafe { zero_copy.align_to::<u32>() };
- assert!(prefix.is_empty());
- assert!(suffix.is_empty());
- unsafe {
- wgpu_core::command::render_ffi::wgpu_render_pass_set_bind_group(
- &mut render_pass_resource.0.borrow_mut(),
- args.index,
- bind_group_resource.0,
- data[args.dynamic_offsets_data_start..].as_ptr(),
- args.dynamic_offsets_data_length,
- );
- }
- }
- };
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPassPushDebugGroupArgs {
- render_pass_rid: ResourceId,
- group_label: String,
-}
-
-pub fn op_webgpu_render_pass_push_debug_group(
- state: &mut OpState,
- args: RenderPassPushDebugGroupArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let render_pass_resource = state
- .resource_table
- .get::<WebGpuRenderPass>(args.render_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- unsafe {
- let label = std::ffi::CString::new(args.group_label).unwrap();
- wgpu_core::command::render_ffi::wgpu_render_pass_push_debug_group(
- &mut render_pass_resource.0.borrow_mut(),
- label.as_ptr(),
- 0, // wgpu#975
- );
- }
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPassPopDebugGroupArgs {
- render_pass_rid: ResourceId,
-}
-
-pub fn op_webgpu_render_pass_pop_debug_group(
- state: &mut OpState,
- args: RenderPassPopDebugGroupArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let render_pass_resource = state
- .resource_table
- .get::<WebGpuRenderPass>(args.render_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- wgpu_core::command::render_ffi::wgpu_render_pass_pop_debug_group(
- &mut render_pass_resource.0.borrow_mut(),
- );
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPassInsertDebugMarkerArgs {
- render_pass_rid: ResourceId,
- marker_label: String,
-}
-
-pub fn op_webgpu_render_pass_insert_debug_marker(
- state: &mut OpState,
- args: RenderPassInsertDebugMarkerArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let render_pass_resource = state
- .resource_table
- .get::<WebGpuRenderPass>(args.render_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- unsafe {
- let label = std::ffi::CString::new(args.marker_label).unwrap();
- wgpu_core::command::render_ffi::wgpu_render_pass_insert_debug_marker(
- &mut render_pass_resource.0.borrow_mut(),
- label.as_ptr(),
- 0, // wgpu#975
- );
- }
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPassSetPipelineArgs {
- render_pass_rid: ResourceId,
- pipeline: u32,
-}
-
-pub fn op_webgpu_render_pass_set_pipeline(
- state: &mut OpState,
- args: RenderPassSetPipelineArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let render_pipeline_resource = state
- .resource_table
- .get::<super::pipeline::WebGpuRenderPipeline>(args.pipeline)
- .ok_or_else(bad_resource_id)?;
- let render_pass_resource = state
- .resource_table
- .get::<WebGpuRenderPass>(args.render_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- wgpu_core::command::render_ffi::wgpu_render_pass_set_pipeline(
- &mut render_pass_resource.0.borrow_mut(),
- render_pipeline_resource.0,
- );
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPassSetIndexBufferArgs {
- render_pass_rid: ResourceId,
- buffer: u32,
- index_format: String,
- offset: u64,
- size: u64,
-}
-
-pub fn op_webgpu_render_pass_set_index_buffer(
- state: &mut OpState,
- args: RenderPassSetIndexBufferArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let buffer_resource = state
- .resource_table
- .get::<super::buffer::WebGpuBuffer>(args.buffer)
- .ok_or_else(bad_resource_id)?;
- let render_pass_resource = state
- .resource_table
- .get::<WebGpuRenderPass>(args.render_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- render_pass_resource.0.borrow_mut().set_index_buffer(
- buffer_resource.0,
- super::pipeline::serialize_index_format(args.index_format),
- args.offset,
- std::num::NonZeroU64::new(args.size),
- );
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPassSetVertexBufferArgs {
- render_pass_rid: ResourceId,
- slot: u32,
- buffer: u32,
- offset: u64,
- size: u64,
-}
-
-pub fn op_webgpu_render_pass_set_vertex_buffer(
- state: &mut OpState,
- args: RenderPassSetVertexBufferArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let buffer_resource = state
- .resource_table
- .get::<super::buffer::WebGpuBuffer>(args.buffer)
- .ok_or_else(bad_resource_id)?;
- let render_pass_resource = state
- .resource_table
- .get::<WebGpuRenderPass>(args.render_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- wgpu_core::command::render_ffi::wgpu_render_pass_set_vertex_buffer(
- &mut render_pass_resource.0.borrow_mut(),
- args.slot,
- buffer_resource.0,
- args.offset,
- std::num::NonZeroU64::new(args.size),
- );
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPassDrawArgs {
- render_pass_rid: ResourceId,
- vertex_count: u32,
- instance_count: u32,
- first_vertex: u32,
- first_instance: u32,
-}
-
-pub fn op_webgpu_render_pass_draw(
- state: &mut OpState,
- args: RenderPassDrawArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let render_pass_resource = state
- .resource_table
- .get::<WebGpuRenderPass>(args.render_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- wgpu_core::command::render_ffi::wgpu_render_pass_draw(
- &mut render_pass_resource.0.borrow_mut(),
- args.vertex_count,
- args.instance_count,
- args.first_vertex,
- args.first_instance,
- );
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPassDrawIndexedArgs {
- render_pass_rid: ResourceId,
- index_count: u32,
- instance_count: u32,
- first_index: u32,
- base_vertex: i32,
- first_instance: u32,
-}
-
-pub fn op_webgpu_render_pass_draw_indexed(
- state: &mut OpState,
- args: RenderPassDrawIndexedArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let render_pass_resource = state
- .resource_table
- .get::<WebGpuRenderPass>(args.render_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- wgpu_core::command::render_ffi::wgpu_render_pass_draw_indexed(
- &mut render_pass_resource.0.borrow_mut(),
- args.index_count,
- args.instance_count,
- args.first_index,
- args.base_vertex,
- args.first_instance,
- );
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPassDrawIndirectArgs {
- render_pass_rid: ResourceId,
- indirect_buffer: u32,
- indirect_offset: u64,
-}
-
-pub fn op_webgpu_render_pass_draw_indirect(
- state: &mut OpState,
- args: RenderPassDrawIndirectArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let buffer_resource = state
- .resource_table
- .get::<super::buffer::WebGpuBuffer>(args.indirect_buffer)
- .ok_or_else(bad_resource_id)?;
- let render_pass_resource = state
- .resource_table
- .get::<WebGpuRenderPass>(args.render_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- wgpu_core::command::render_ffi::wgpu_render_pass_draw_indirect(
- &mut render_pass_resource.0.borrow_mut(),
- buffer_resource.0,
- args.indirect_offset,
- );
-
- Ok(WebGpuResult::empty())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct RenderPassDrawIndexedIndirectArgs {
- render_pass_rid: ResourceId,
- indirect_buffer: u32,
- indirect_offset: u64,
-}
-
-pub fn op_webgpu_render_pass_draw_indexed_indirect(
- state: &mut OpState,
- args: RenderPassDrawIndexedIndirectArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let buffer_resource = state
- .resource_table
- .get::<super::buffer::WebGpuBuffer>(args.indirect_buffer)
- .ok_or_else(bad_resource_id)?;
- let render_pass_resource = state
- .resource_table
- .get::<WebGpuRenderPass>(args.render_pass_rid)
- .ok_or_else(bad_resource_id)?;
-
- wgpu_core::command::render_ffi::wgpu_render_pass_draw_indexed_indirect(
- &mut render_pass_resource.0.borrow_mut(),
- buffer_resource.0,
- args.indirect_offset,
- );
-
- Ok(WebGpuResult::empty())
-}
diff --git a/op_crates/webgpu/sampler.rs b/op_crates/webgpu/sampler.rs
deleted file mode 100644
index 5e0ebc61e..000000000
--- a/op_crates/webgpu/sampler.rs
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::error::bad_resource_id;
-use deno_core::error::AnyError;
-use deno_core::ResourceId;
-use deno_core::ZeroCopyBuf;
-use deno_core::{OpState, Resource};
-use serde::Deserialize;
-use std::borrow::Cow;
-
-use super::error::WebGpuResult;
-
-pub(crate) struct WebGpuSampler(pub(crate) wgpu_core::id::SamplerId);
-impl Resource for WebGpuSampler {
- fn name(&self) -> Cow<str> {
- "webGPUSampler".into()
- }
-}
-
-fn serialize_address_mode(
- address_mode: Option<String>,
-) -> wgpu_types::AddressMode {
- match address_mode {
- Some(address_mode) => match address_mode.as_str() {
- "clamp-to-edge" => wgpu_types::AddressMode::ClampToEdge,
- "repeat" => wgpu_types::AddressMode::Repeat,
- "mirror-repeat" => wgpu_types::AddressMode::MirrorRepeat,
- _ => unreachable!(),
- },
- None => wgpu_types::AddressMode::ClampToEdge,
- }
-}
-
-fn serialize_filter_mode(
- filter_mode: Option<String>,
-) -> wgpu_types::FilterMode {
- match filter_mode {
- Some(filter_mode) => match filter_mode.as_str() {
- "nearest" => wgpu_types::FilterMode::Nearest,
- "linear" => wgpu_types::FilterMode::Linear,
- _ => unreachable!(),
- },
- None => wgpu_types::FilterMode::Nearest,
- }
-}
-
-pub fn serialize_compare_function(
- compare: &str,
-) -> wgpu_types::CompareFunction {
- match compare {
- "never" => wgpu_types::CompareFunction::Never,
- "less" => wgpu_types::CompareFunction::Less,
- "equal" => wgpu_types::CompareFunction::Equal,
- "less-equal" => wgpu_types::CompareFunction::LessEqual,
- "greater" => wgpu_types::CompareFunction::Greater,
- "not-equal" => wgpu_types::CompareFunction::NotEqual,
- "greater-equal" => wgpu_types::CompareFunction::GreaterEqual,
- "always" => wgpu_types::CompareFunction::Always,
- _ => unreachable!(),
- }
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CreateSamplerArgs {
- device_rid: ResourceId,
- label: Option<String>,
- address_mode_u: Option<String>,
- address_mode_v: Option<String>,
- address_mode_w: Option<String>,
- mag_filter: Option<String>,
- min_filter: Option<String>,
- mipmap_filter: Option<String>,
- lod_min_clamp: Option<f32>,
- lod_max_clamp: Option<f32>,
- compare: Option<String>,
- max_anisotropy: Option<u8>,
-}
-
-pub fn op_webgpu_create_sampler(
- state: &mut OpState,
- args: CreateSamplerArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let device_resource = state
- .resource_table
- .get::<super::WebGpuDevice>(args.device_rid)
- .ok_or_else(bad_resource_id)?;
- let device = device_resource.0;
-
- let descriptor = wgpu_core::resource::SamplerDescriptor {
- label: args.label.map(Cow::from),
- address_modes: [
- serialize_address_mode(args.address_mode_u),
- serialize_address_mode(args.address_mode_v),
- serialize_address_mode(args.address_mode_w),
- ],
- mag_filter: serialize_filter_mode(args.mag_filter),
- min_filter: serialize_filter_mode(args.min_filter),
- mipmap_filter: serialize_filter_mode(args.mipmap_filter),
- lod_min_clamp: args.lod_min_clamp.unwrap_or(0.0),
- lod_max_clamp: args.lod_max_clamp.unwrap_or(
- wgpu_core::resource::SamplerDescriptor::default().lod_max_clamp,
- ),
- compare: args
- .compare
- .as_ref()
- .map(|compare| serialize_compare_function(compare)),
- anisotropy_clamp: std::num::NonZeroU8::new(
- args.max_anisotropy.unwrap_or(0),
- ),
- border_color: None, // native-only
- };
-
- let (sampler, maybe_err) = gfx_select!(device => instance.device_create_sampler(
- device,
- &descriptor,
- std::marker::PhantomData
- ));
-
- let rid = state.resource_table.add(WebGpuSampler(sampler));
-
- Ok(WebGpuResult::rid_err(rid, maybe_err))
-}
diff --git a/op_crates/webgpu/shader.rs b/op_crates/webgpu/shader.rs
deleted file mode 100644
index 0e653b470..000000000
--- a/op_crates/webgpu/shader.rs
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::error::bad_resource_id;
-use deno_core::error::null_opbuf;
-use deno_core::error::AnyError;
-use deno_core::ResourceId;
-use deno_core::ZeroCopyBuf;
-use deno_core::{OpState, Resource};
-use serde::Deserialize;
-use std::borrow::Cow;
-
-use super::error::WebGpuResult;
-
-pub(crate) struct WebGpuShaderModule(pub(crate) wgpu_core::id::ShaderModuleId);
-impl Resource for WebGpuShaderModule {
- fn name(&self) -> Cow<str> {
- "webGPUShaderModule".into()
- }
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CreateShaderModuleArgs {
- device_rid: ResourceId,
- label: Option<String>,
- code: Option<String>,
- _source_map: Option<()>, // not yet implemented
-}
-
-pub fn op_webgpu_create_shader_module(
- state: &mut OpState,
- args: CreateShaderModuleArgs,
- zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let device_resource = state
- .resource_table
- .get::<super::WebGpuDevice>(args.device_rid)
- .ok_or_else(bad_resource_id)?;
- let device = device_resource.0;
-
- let source = match args.code {
- Some(code) => {
- wgpu_core::pipeline::ShaderModuleSource::Wgsl(Cow::from(code))
- }
- None => wgpu_core::pipeline::ShaderModuleSource::SpirV(Cow::from(unsafe {
- match &zero_copy {
- Some(zero_copy) => {
- let (prefix, data, suffix) = zero_copy.align_to::<u32>();
- assert!(prefix.is_empty());
- assert!(suffix.is_empty());
- data
- }
- None => return Err(null_opbuf()),
- }
- })),
- };
-
- let mut flags = wgpu_types::ShaderFlags::default();
- flags.set(wgpu_types::ShaderFlags::VALIDATION, true);
- #[cfg(all(target_os = "macos", target_arch = "x86_64"))]
- flags.set(wgpu_types::ShaderFlags::EXPERIMENTAL_TRANSLATION, true);
-
- let descriptor = wgpu_core::pipeline::ShaderModuleDescriptor {
- label: args.label.map(Cow::from),
- flags,
- };
-
- let (shader_module, maybe_err) = gfx_select!(device => instance.device_create_shader_module(
- device,
- &descriptor,
- source,
- std::marker::PhantomData
- ));
-
- let rid = state.resource_table.add(WebGpuShaderModule(shader_module));
-
- Ok(WebGpuResult::rid_err(rid, maybe_err))
-}
diff --git a/op_crates/webgpu/texture.rs b/op_crates/webgpu/texture.rs
deleted file mode 100644
index 28b8ca1a4..000000000
--- a/op_crates/webgpu/texture.rs
+++ /dev/null
@@ -1,249 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::error::AnyError;
-use deno_core::error::{bad_resource_id, not_supported};
-use deno_core::ResourceId;
-use deno_core::ZeroCopyBuf;
-use deno_core::{OpState, Resource};
-use serde::Deserialize;
-use std::borrow::Cow;
-
-use super::error::WebGpuResult;
-pub(crate) struct WebGpuTexture(pub(crate) wgpu_core::id::TextureId);
-impl Resource for WebGpuTexture {
- fn name(&self) -> Cow<str> {
- "webGPUTexture".into()
- }
-}
-
-pub(crate) struct WebGpuTextureView(pub(crate) wgpu_core::id::TextureViewId);
-impl Resource for WebGpuTextureView {
- fn name(&self) -> Cow<str> {
- "webGPUTextureView".into()
- }
-}
-
-pub fn serialize_texture_format(
- format: &str,
-) -> Result<wgpu_types::TextureFormat, AnyError> {
- Ok(match format {
- // 8-bit formats
- "r8unorm" => wgpu_types::TextureFormat::R8Unorm,
- "r8snorm" => wgpu_types::TextureFormat::R8Snorm,
- "r8uint" => wgpu_types::TextureFormat::R8Uint,
- "r8sint" => wgpu_types::TextureFormat::R8Sint,
-
- // 16-bit formats
- "r16uint" => wgpu_types::TextureFormat::R16Uint,
- "r16sint" => wgpu_types::TextureFormat::R16Sint,
- "r16float" => wgpu_types::TextureFormat::R16Float,
- "rg8unorm" => wgpu_types::TextureFormat::Rg8Unorm,
- "rg8snorm" => wgpu_types::TextureFormat::Rg8Snorm,
- "rg8uint" => wgpu_types::TextureFormat::Rg8Uint,
- "rg8sint" => wgpu_types::TextureFormat::Rg8Sint,
-
- // 32-bit formats
- "r32uint" => wgpu_types::TextureFormat::R32Uint,
- "r32sint" => wgpu_types::TextureFormat::R32Sint,
- "r32float" => wgpu_types::TextureFormat::R32Float,
- "rg16uint" => wgpu_types::TextureFormat::Rg16Uint,
- "rg16sint" => wgpu_types::TextureFormat::Rg16Sint,
- "rg16float" => wgpu_types::TextureFormat::Rg16Float,
- "rgba8unorm" => wgpu_types::TextureFormat::Rgba8Unorm,
- "rgba8unorm-srgb" => wgpu_types::TextureFormat::Rgba8UnormSrgb,
- "rgba8snorm" => wgpu_types::TextureFormat::Rgba8Snorm,
- "rgba8uint" => wgpu_types::TextureFormat::Rgba8Uint,
- "rgba8sint" => wgpu_types::TextureFormat::Rgba8Sint,
- "bgra8unorm" => wgpu_types::TextureFormat::Bgra8Unorm,
- "bgra8unorm-srgb" => wgpu_types::TextureFormat::Bgra8UnormSrgb,
- // Packed 32-bit formats
- "rgb9e5ufloat" => return Err(not_supported()), // wgpu#967
- "rgb10a2unorm" => wgpu_types::TextureFormat::Rgb10a2Unorm,
- "rg11b10ufloat" => wgpu_types::TextureFormat::Rg11b10Float,
-
- // 64-bit formats
- "rg32uint" => wgpu_types::TextureFormat::Rg32Uint,
- "rg32sint" => wgpu_types::TextureFormat::Rg32Sint,
- "rg32float" => wgpu_types::TextureFormat::Rg32Float,
- "rgba16uint" => wgpu_types::TextureFormat::Rgba16Uint,
- "rgba16sint" => wgpu_types::TextureFormat::Rgba16Sint,
- "rgba16float" => wgpu_types::TextureFormat::Rgba16Float,
-
- // 128-bit formats
- "rgba32uint" => wgpu_types::TextureFormat::Rgba32Uint,
- "rgba32sint" => wgpu_types::TextureFormat::Rgba32Sint,
- "rgba32float" => wgpu_types::TextureFormat::Rgba32Float,
-
- // Depth and stencil formats
- "stencil8" => return Err(not_supported()), // wgpu#967
- "depth16unorm" => return Err(not_supported()), // wgpu#967
- "depth24plus" => wgpu_types::TextureFormat::Depth24Plus,
- "depth24plus-stencil8" => wgpu_types::TextureFormat::Depth24PlusStencil8,
- "depth32float" => wgpu_types::TextureFormat::Depth32Float,
-
- // BC compressed formats usable if "texture-compression-bc" is both
- // supported by the device/user agent and enabled in requestDevice.
- "bc1-rgba-unorm" => wgpu_types::TextureFormat::Bc1RgbaUnorm,
- "bc1-rgba-unorm-srgb" => wgpu_types::TextureFormat::Bc1RgbaUnormSrgb,
- "bc2-rgba-unorm" => wgpu_types::TextureFormat::Bc2RgbaUnorm,
- "bc2-rgba-unorm-srgb" => wgpu_types::TextureFormat::Bc2RgbaUnormSrgb,
- "bc3-rgba-unorm" => wgpu_types::TextureFormat::Bc3RgbaUnorm,
- "bc3-rgba-unorm-srgb" => wgpu_types::TextureFormat::Bc3RgbaUnormSrgb,
- "bc4-r-unorm" => wgpu_types::TextureFormat::Bc4RUnorm,
- "bc4-r-snorm" => wgpu_types::TextureFormat::Bc4RSnorm,
- "bc5-rg-unorm" => wgpu_types::TextureFormat::Bc5RgUnorm,
- "bc5-rg-snorm" => wgpu_types::TextureFormat::Bc5RgSnorm,
- "bc6h-rgb-ufloat" => wgpu_types::TextureFormat::Bc6hRgbUfloat,
- "bc6h-rgb-float" => wgpu_types::TextureFormat::Bc6hRgbSfloat, // wgpu#967
- "bc7-rgba-unorm" => wgpu_types::TextureFormat::Bc7RgbaUnorm,
- "bc7-rgba-unorm-srgb" => wgpu_types::TextureFormat::Bc7RgbaUnormSrgb,
-
- // "depth24unorm-stencil8" extension
- "depth24unorm-stencil8" => return Err(not_supported()), // wgpu#967
-
- // "depth32float-stencil8" extension
- "depth32float-stencil8" => return Err(not_supported()), // wgpu#967
- _ => unreachable!(),
- })
-}
-
-pub fn serialize_dimension(
- dimension: &str,
-) -> wgpu_types::TextureViewDimension {
- match dimension {
- "1d" => wgpu_types::TextureViewDimension::D1,
- "2d" => wgpu_types::TextureViewDimension::D2,
- "2d-array" => wgpu_types::TextureViewDimension::D2Array,
- "cube" => wgpu_types::TextureViewDimension::Cube,
- "cube-array" => wgpu_types::TextureViewDimension::CubeArray,
- "3d" => wgpu_types::TextureViewDimension::D3,
- _ => unreachable!(),
- }
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct GpuExtent3D {
- pub width: Option<u32>,
- pub height: Option<u32>,
- pub depth: Option<u32>,
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CreateTextureArgs {
- device_rid: ResourceId,
- label: Option<String>,
- size: GpuExtent3D,
- mip_level_count: Option<u32>,
- sample_count: Option<u32>,
- dimension: Option<String>,
- format: String,
- usage: u32,
-}
-
-pub fn op_webgpu_create_texture(
- state: &mut OpState,
- args: CreateTextureArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let device_resource = state
- .resource_table
- .get::<super::WebGpuDevice>(args.device_rid)
- .ok_or_else(bad_resource_id)?;
- let device = device_resource.0;
-
- let descriptor = wgpu_core::resource::TextureDescriptor {
- label: args.label.map(Cow::from),
- size: wgpu_types::Extent3d {
- width: args.size.width.unwrap_or(1),
- height: args.size.height.unwrap_or(1),
- depth: args.size.depth.unwrap_or(1),
- },
- mip_level_count: args.mip_level_count.unwrap_or(1),
- sample_count: args.sample_count.unwrap_or(1),
- dimension: match args.dimension {
- Some(dimension) => match dimension.as_str() {
- "1d" => wgpu_types::TextureDimension::D1,
- "2d" => wgpu_types::TextureDimension::D2,
- "3d" => wgpu_types::TextureDimension::D3,
- _ => unreachable!(),
- },
- None => wgpu_types::TextureDimension::D2,
- },
- format: serialize_texture_format(&args.format)?,
- usage: wgpu_types::TextureUsage::from_bits(args.usage).unwrap(),
- };
-
- let (texture, maybe_err) = gfx_select!(device => instance.device_create_texture(
- device,
- &descriptor,
- std::marker::PhantomData
- ));
-
- let rid = state.resource_table.add(WebGpuTexture(texture));
-
- Ok(WebGpuResult::rid_err(rid, maybe_err))
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CreateTextureViewArgs {
- texture_rid: ResourceId,
- label: Option<String>,
- format: Option<String>,
- dimension: Option<String>,
- aspect: Option<String>,
- base_mip_level: Option<u32>,
- mip_level_count: Option<u32>,
- base_array_layer: Option<u32>,
- array_layer_count: Option<u32>,
-}
-
-pub fn op_webgpu_create_texture_view(
- state: &mut OpState,
- args: CreateTextureViewArgs,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<WebGpuResult, AnyError> {
- let instance = state.borrow::<super::Instance>();
- let texture_resource = state
- .resource_table
- .get::<WebGpuTexture>(args.texture_rid)
- .ok_or_else(bad_resource_id)?;
- let texture = texture_resource.0;
-
- let descriptor = wgpu_core::resource::TextureViewDescriptor {
- label: args.label.map(Cow::from),
- format: args
- .format
- .map(|s| serialize_texture_format(&s))
- .transpose()?,
- dimension: args.dimension.map(|s| serialize_dimension(&s)),
- aspect: match args.aspect {
- Some(aspect) => match aspect.as_str() {
- "all" => wgpu_types::TextureAspect::All,
- "stencil-only" => wgpu_types::TextureAspect::StencilOnly,
- "depth-only" => wgpu_types::TextureAspect::DepthOnly,
- _ => unreachable!(),
- },
- None => wgpu_types::TextureAspect::All,
- },
- base_mip_level: args.base_mip_level.unwrap_or(0),
- level_count: std::num::NonZeroU32::new(args.mip_level_count.unwrap_or(0)),
- base_array_layer: args.base_array_layer.unwrap_or(0),
- array_layer_count: std::num::NonZeroU32::new(
- args.array_layer_count.unwrap_or(0),
- ),
- };
-
- let (texture_view, maybe_err) = gfx_select!(texture => instance.texture_create_view(
- texture,
- &descriptor,
- std::marker::PhantomData
- ));
-
- let rid = state.resource_table.add(WebGpuTextureView(texture_view));
-
- Ok(WebGpuResult::rid_err(rid, maybe_err))
-}
diff --git a/op_crates/webgpu/webgpu.idl b/op_crates/webgpu/webgpu.idl
deleted file mode 100644
index 598df7efb..000000000
--- a/op_crates/webgpu/webgpu.idl
+++ /dev/null
@@ -1,1023 +0,0 @@
-interface mixin GPUObjectBase {
- attribute USVString? label;
-};
-
-dictionary GPUObjectDescriptorBase {
- USVString label;
-};
-
-interface GPUAdapterLimits {
- readonly attribute GPUSize32 maxTextureDimension1D;
- readonly attribute GPUSize32 maxTextureDimension2D;
- readonly attribute GPUSize32 maxTextureDimension3D;
- readonly attribute GPUSize32 maxTextureArrayLayers;
- readonly attribute GPUSize32 maxBindGroups;
- readonly attribute GPUSize32 maxDynamicUniformBuffersPerPipelineLayout;
- readonly attribute GPUSize32 maxDynamicStorageBuffersPerPipelineLayout;
- readonly attribute GPUSize32 maxSampledTexturesPerShaderStage;
- readonly attribute GPUSize32 maxSamplersPerShaderStage;
- readonly attribute GPUSize32 maxStorageBuffersPerShaderStage;
- readonly attribute GPUSize32 maxStorageTexturesPerShaderStage;
- readonly attribute GPUSize32 maxUniformBuffersPerShaderStage;
- readonly attribute GPUSize32 maxUniformBufferBindingSize;
- readonly attribute GPUSize32 maxStorageBufferBindingSize;
- readonly attribute GPUSize32 maxVertexBuffers;
- readonly attribute GPUSize32 maxVertexAttributes;
- readonly attribute GPUSize32 maxVertexBufferArrayStride;
-};
-
-interface GPUAdapterFeatures {
- readonly setlike<GPUFeatureName>;
-};
-
-[Exposed=Window]
-partial interface Navigator {
- [SameObject] readonly attribute GPU gpu;
-};
-
-[Exposed=DedicatedWorker]
-partial interface WorkerNavigator {
- [SameObject] readonly attribute GPU gpu;
-};
-
-[Exposed=(Window, DedicatedWorker)]
-interface GPU {
- Promise<GPUAdapter?> requestAdapter(optional GPURequestAdapterOptions options = {});
-};
-
-dictionary GPURequestAdapterOptions {
- GPUPowerPreference powerPreference;
-};
-
-enum GPUPowerPreference {
- "low-power",
- "high-performance"
-};
-
-interface GPUAdapter {
- readonly attribute DOMString name;
- [SameObject] readonly attribute GPUAdapterFeatures features;
- [SameObject] readonly attribute GPUAdapterLimits limits;
-
- Promise<GPUDevice?> requestDevice(optional GPUDeviceDescriptor descriptor = {});
-};
-
-dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase {
- sequence<GPUFeatureName> nonGuaranteedFeatures = [];
- record<DOMString, GPUSize32> nonGuaranteedLimits = {};
-};
-
-enum GPUFeatureName {
- "depth-clamping",
- "depth24unorm-stencil8",
- "depth32float-stencil8",
- "pipeline-statistics-query",
- "texture-compression-bc",
- "timestamp-query",
-};
-
-[Exposed=(Window, DedicatedWorker), Serializable]
-interface GPUDevice : EventTarget {
- [SameObject] readonly attribute GPUAdapter adapter;
- readonly attribute FrozenArray<GPUFeatureName> features;
- readonly attribute object limits;
-
- [SameObject] readonly attribute GPUQueue queue;
-
- undefined destroy();
-
- GPUBuffer createBuffer(GPUBufferDescriptor descriptor);
- GPUTexture createTexture(GPUTextureDescriptor descriptor);
- GPUSampler createSampler(optional GPUSamplerDescriptor descriptor = {});
-
- GPUBindGroupLayout createBindGroupLayout(GPUBindGroupLayoutDescriptor descriptor);
- GPUPipelineLayout createPipelineLayout(GPUPipelineLayoutDescriptor descriptor);
- GPUBindGroup createBindGroup(GPUBindGroupDescriptor descriptor);
-
- GPUShaderModule createShaderModule(GPUShaderModuleDescriptor descriptor);
- GPUComputePipeline createComputePipeline(GPUComputePipelineDescriptor descriptor);
- GPURenderPipeline createRenderPipeline(GPURenderPipelineDescriptor descriptor);
- Promise<GPUComputePipeline> createComputePipelineAsync(GPUComputePipelineDescriptor descriptor);
- Promise<GPURenderPipeline> createRenderPipelineAsync(GPURenderPipelineDescriptor descriptor);
-
- GPUCommandEncoder createCommandEncoder(optional GPUCommandEncoderDescriptor descriptor = {});
- GPURenderBundleEncoder createRenderBundleEncoder(GPURenderBundleEncoderDescriptor descriptor);
-
- GPUQuerySet createQuerySet(GPUQuerySetDescriptor descriptor);
-};
-GPUDevice includes GPUObjectBase;
-
-[Serializable]
-interface GPUBuffer {
- Promise<undefined> mapAsync(GPUMapModeFlags mode, optional GPUSize64 offset = 0, optional GPUSize64 size);
- ArrayBuffer getMappedRange(optional GPUSize64 offset = 0, optional GPUSize64 size);
- undefined unmap();
-
- undefined destroy();
-};
-GPUBuffer includes GPUObjectBase;
-
-dictionary GPUBufferDescriptor : GPUObjectDescriptorBase {
- required GPUSize64 size;
- required GPUBufferUsageFlags usage;
- boolean mappedAtCreation = false;
-};
-
-typedef [EnforceRange] unsigned long GPUBufferUsageFlags;
-interface GPUBufferUsage {
- const GPUFlagsConstant MAP_READ = 0x0001;
- const GPUFlagsConstant MAP_WRITE = 0x0002;
- const GPUFlagsConstant COPY_SRC = 0x0004;
- const GPUFlagsConstant COPY_DST = 0x0008;
- const GPUFlagsConstant INDEX = 0x0010;
- const GPUFlagsConstant VERTEX = 0x0020;
- const GPUFlagsConstant UNIFORM = 0x0040;
- const GPUFlagsConstant STORAGE = 0x0080;
- const GPUFlagsConstant INDIRECT = 0x0100;
- const GPUFlagsConstant QUERY_RESOLVE = 0x0200;
-};
-
-typedef [EnforceRange] unsigned long GPUMapModeFlags;
-interface GPUMapMode {
- const GPUFlagsConstant READ = 0x0001;
- const GPUFlagsConstant WRITE = 0x0002;
-};
-
-[Serializable]
-interface GPUTexture {
- GPUTextureView createView(optional GPUTextureViewDescriptor descriptor = {});
-
- undefined destroy();
-};
-GPUTexture includes GPUObjectBase;
-
-dictionary GPUTextureDescriptor : GPUObjectDescriptorBase {
- required GPUExtent3D size;
- GPUIntegerCoordinate mipLevelCount = 1;
- GPUSize32 sampleCount = 1;
- GPUTextureDimension dimension = "2d";
- required GPUTextureFormat format;
- required GPUTextureUsageFlags usage;
-};
-
-enum GPUTextureDimension {
- "1d",
- "2d",
- "3d",
-};
-
-typedef [EnforceRange] unsigned long GPUTextureUsageFlags;
-interface GPUTextureUsage {
- const GPUFlagsConstant COPY_SRC = 0x01;
- const GPUFlagsConstant COPY_DST = 0x02;
- const GPUFlagsConstant SAMPLED = 0x04;
- const GPUFlagsConstant STORAGE = 0x08;
- const GPUFlagsConstant RENDER_ATTACHMENT = 0x10;
-};
-
-interface GPUTextureView {
-};
-GPUTextureView includes GPUObjectBase;
-
-dictionary GPUTextureViewDescriptor : GPUObjectDescriptorBase {
- GPUTextureFormat format;
- GPUTextureViewDimension dimension;
- GPUTextureAspect aspect = "all";
- GPUIntegerCoordinate baseMipLevel = 0;
- GPUIntegerCoordinate mipLevelCount;
- GPUIntegerCoordinate baseArrayLayer = 0;
- GPUIntegerCoordinate arrayLayerCount;
-};
-
-enum GPUTextureViewDimension {
- "1d",
- "2d",
- "2d-array",
- "cube",
- "cube-array",
- "3d"
-};
-
-enum GPUTextureAspect {
- "all",
- "stencil-only",
- "depth-only"
-};
-
-enum GPUTextureFormat {
- // 8-bit formats
- "r8unorm",
- "r8snorm",
- "r8uint",
- "r8sint",
-
- // 16-bit formats
- "r16uint",
- "r16sint",
- "r16float",
- "rg8unorm",
- "rg8snorm",
- "rg8uint",
- "rg8sint",
-
- // 32-bit formats
- "r32uint",
- "r32sint",
- "r32float",
- "rg16uint",
- "rg16sint",
- "rg16float",
- "rgba8unorm",
- "rgba8unorm-srgb",
- "rgba8snorm",
- "rgba8uint",
- "rgba8sint",
- "bgra8unorm",
- "bgra8unorm-srgb",
- // Packed 32-bit formats
- "rgb9e5ufloat",
- "rgb10a2unorm",
- "rg11b10ufloat",
-
- // 64-bit formats
- "rg32uint",
- "rg32sint",
- "rg32float",
- "rgba16uint",
- "rgba16sint",
- "rgba16float",
-
- // 128-bit formats
- "rgba32uint",
- "rgba32sint",
- "rgba32float",
-
- // Depth and stencil formats
- "stencil8",
- "depth16unorm",
- "depth24plus",
- "depth24plus-stencil8",
- "depth32float",
-
- // BC compressed formats usable if "texture-compression-bc" is both
- // supported by the device/user agent and enabled in requestDevice.
- "bc1-rgba-unorm",
- "bc1-rgba-unorm-srgb",
- "bc2-rgba-unorm",
- "bc2-rgba-unorm-srgb",
- "bc3-rgba-unorm",
- "bc3-rgba-unorm-srgb",
- "bc4-r-unorm",
- "bc4-r-snorm",
- "bc5-rg-unorm",
- "bc5-rg-snorm",
- "bc6h-rgb-ufloat",
- "bc6h-rgb-float",
- "bc7-rgba-unorm",
- "bc7-rgba-unorm-srgb",
-
- // "depth24unorm-stencil8" feature
- "depth24unorm-stencil8",
-
- // "depth32float-stencil8" feature
- "depth32float-stencil8",
-};
-
-interface GPUSampler {
-};
-GPUSampler includes GPUObjectBase;
-
-dictionary GPUSamplerDescriptor : GPUObjectDescriptorBase {
- GPUAddressMode addressModeU = "clamp-to-edge";
- GPUAddressMode addressModeV = "clamp-to-edge";
- GPUAddressMode addressModeW = "clamp-to-edge";
- GPUFilterMode magFilter = "nearest";
- GPUFilterMode minFilter = "nearest";
- GPUFilterMode mipmapFilter = "nearest";
- float lodMinClamp = 0;
- float lodMaxClamp = 0xffffffff; // TODO: What should this be? Was Number.MAX_VALUE.
- GPUCompareFunction compare;
- [Clamp] unsigned short maxAnisotropy = 1;
-};
-
-enum GPUAddressMode {
- "clamp-to-edge",
- "repeat",
- "mirror-repeat"
-};
-
-enum GPUFilterMode {
- "nearest",
- "linear"
-};
-
-enum GPUCompareFunction {
- "never",
- "less",
- "equal",
- "less-equal",
- "greater",
- "not-equal",
- "greater-equal",
- "always"
-};
-
-[Serializable]
-interface GPUBindGroupLayout {
-};
-GPUBindGroupLayout includes GPUObjectBase;
-
-dictionary GPUBindGroupLayoutDescriptor : GPUObjectDescriptorBase {
- required sequence<GPUBindGroupLayoutEntry> entries;
-};
-
-typedef [EnforceRange] unsigned long GPUShaderStageFlags;
-interface GPUShaderStage {
- const GPUFlagsConstant VERTEX = 0x1;
- const GPUFlagsConstant FRAGMENT = 0x2;
- const GPUFlagsConstant COMPUTE = 0x4;
-};
-
-dictionary GPUBindGroupLayoutEntry {
- required GPUIndex32 binding;
- required GPUShaderStageFlags visibility;
-
- GPUBufferBindingLayout buffer;
- GPUSamplerBindingLayout sampler;
- GPUTextureBindingLayout texture;
- GPUStorageTextureBindingLayout storageTexture;
-};
-
-enum GPUBufferBindingType {
- "uniform",
- "storage",
- "read-only-storage",
-};
-
-dictionary GPUBufferBindingLayout {
- GPUBufferBindingType type = "uniform";
- boolean hasDynamicOffset = false;
- GPUSize64 minBindingSize = 0;
-};
-
-enum GPUSamplerBindingType {
- "filtering",
- "non-filtering",
- "comparison",
-};
-
-dictionary GPUSamplerBindingLayout {
- GPUSamplerBindingType type = "filtering";
-};
-
-enum GPUTextureSampleType {
- "float",
- "unfilterable-float",
- "depth",
- "sint",
- "uint",
-};
-
-dictionary GPUTextureBindingLayout {
- GPUTextureSampleType sampleType = "float";
- GPUTextureViewDimension viewDimension = "2d";
- boolean multisampled = false;
-};
-
-enum GPUStorageTextureAccess {
- "read-only",
- "write-only",
-};
-
-dictionary GPUStorageTextureBindingLayout {
- required GPUStorageTextureAccess access;
- required GPUTextureFormat format;
- GPUTextureViewDimension viewDimension = "2d";
-};
-
-interface GPUBindGroup {
-};
-GPUBindGroup includes GPUObjectBase;
-
-dictionary GPUBindGroupDescriptor : GPUObjectDescriptorBase {
- required GPUBindGroupLayout layout;
- required sequence<GPUBindGroupEntry> entries;
-};
-
-typedef (GPUSampler or GPUTextureView or GPUBufferBinding) GPUBindingResource;
-
-dictionary GPUBindGroupEntry {
- required GPUIndex32 binding;
- required GPUBindingResource resource;
-};
-
-dictionary GPUBufferBinding {
- required GPUBuffer buffer;
- GPUSize64 offset = 0;
- GPUSize64 size;
-};
-
-[Serializable]
-interface GPUPipelineLayout {
-};
-GPUPipelineLayout includes GPUObjectBase;
-
-dictionary GPUPipelineLayoutDescriptor : GPUObjectDescriptorBase {
- required sequence<GPUBindGroupLayout> bindGroupLayouts;
-};
-
-enum GPUCompilationMessageType {
- "error",
- "warning",
- "info"
-};
-
-[Serializable]
-interface GPUCompilationMessage {
- readonly attribute DOMString message;
- readonly attribute GPUCompilationMessageType type;
- readonly attribute unsigned long long lineNum;
- readonly attribute unsigned long long linePos;
-};
-
-[Serializable]
-interface GPUCompilationInfo {
- readonly attribute FrozenArray<GPUCompilationMessage> messages;
-};
-
-[Serializable]
-interface GPUShaderModule {
- Promise<GPUCompilationInfo> compilationInfo();
-};
-GPUShaderModule includes GPUObjectBase;
-
-dictionary GPUShaderModuleDescriptor : GPUObjectDescriptorBase {
- required USVString code;
- object sourceMap;
-};
-
-dictionary GPUPipelineDescriptorBase : GPUObjectDescriptorBase {
- GPUPipelineLayout layout;
-};
-
-interface mixin GPUPipelineBase {
- GPUBindGroupLayout getBindGroupLayout(unsigned long index);
-};
-
-dictionary GPUProgrammableStage {
- required GPUShaderModule module;
- required USVString entryPoint;
-};
-
-[Serializable]
-interface GPUComputePipeline {
-};
-GPUComputePipeline includes GPUObjectBase;
-GPUComputePipeline includes GPUPipelineBase;
-
-dictionary GPUComputePipelineDescriptor : GPUPipelineDescriptorBase {
- required GPUProgrammableStage compute;
-};
-
-[Serializable]
-interface GPURenderPipeline {
-};
-GPURenderPipeline includes GPUObjectBase;
-GPURenderPipeline includes GPUPipelineBase;
-
-dictionary GPURenderPipelineDescriptor : GPUPipelineDescriptorBase {
- required GPUVertexState vertex;
- GPUPrimitiveState primitive = {};
- GPUDepthStencilState depthStencil;
- GPUMultisampleState multisample = {};
- GPUFragmentState fragment;
-};
-
-enum GPUPrimitiveTopology {
- "point-list",
- "line-list",
- "line-strip",
- "triangle-list",
- "triangle-strip"
-};
-
-dictionary GPUPrimitiveState {
- GPUPrimitiveTopology topology = "triangle-list";
- GPUIndexFormat stripIndexFormat;
- GPUFrontFace frontFace = "ccw";
- GPUCullMode cullMode = "none";
-};
-
-enum GPUFrontFace {
- "ccw",
- "cw"
-};
-
-enum GPUCullMode {
- "none",
- "front",
- "back"
-};
-
-dictionary GPUMultisampleState {
- GPUSize32 count = 1;
- GPUSampleMask mask = 0xFFFFFFFF;
- boolean alphaToCoverageEnabled = false;
-};
-
-dictionary GPUFragmentState: GPUProgrammableStage {
- required sequence<GPUColorTargetState> targets;
-};
-
-dictionary GPUColorTargetState {
- required GPUTextureFormat format;
-
- GPUBlendState blend;
- GPUColorWriteFlags writeMask = 0xF; // GPUColorWrite.ALL
-};
-
-dictionary GPUBlendState {
- required GPUBlendComponent color;
- required GPUBlendComponent alpha;
-};
-
-typedef [EnforceRange] unsigned long GPUColorWriteFlags;
-interface GPUColorWrite {
- const GPUFlagsConstant RED = 0x1;
- const GPUFlagsConstant GREEN = 0x2;
- const GPUFlagsConstant BLUE = 0x4;
- const GPUFlagsConstant ALPHA = 0x8;
- const GPUFlagsConstant ALL = 0xF;
-};
-
-dictionary GPUBlendComponent {
- GPUBlendFactor srcFactor = "one";
- GPUBlendFactor dstFactor = "zero";
- GPUBlendOperation operation = "add";
-};
-
-enum GPUBlendFactor {
- "zero",
- "one",
- "src-color",
- "one-minus-src-color",
- "src-alpha",
- "one-minus-src-alpha",
- "dst-color",
- "one-minus-dst-color",
- "dst-alpha",
- "one-minus-dst-alpha",
- "src-alpha-saturated",
- "blend-color",
- "one-minus-blend-color"
-};
-
-enum GPUBlendOperation {
- "add",
- "subtract",
- "reverse-subtract",
- "min",
- "max"
-};
-
-dictionary GPUDepthStencilState {
- required GPUTextureFormat format;
-
- boolean depthWriteEnabled = false;
- GPUCompareFunction depthCompare = "always";
-
- GPUStencilFaceState stencilFront = {};
- GPUStencilFaceState stencilBack = {};
-
- GPUStencilValue stencilReadMask = 0xFFFFFFFF;
- GPUStencilValue stencilWriteMask = 0xFFFFFFFF;
-
- GPUDepthBias depthBias = 0;
- float depthBiasSlopeScale = 0;
- float depthBiasClamp = 0;
-
- // Enable depth clamping (requires "depth-clamping" feature)
- boolean clampDepth = false;
-};
-
-dictionary GPUStencilFaceState {
- GPUCompareFunction compare = "always";
- GPUStencilOperation failOp = "keep";
- GPUStencilOperation depthFailOp = "keep";
- GPUStencilOperation passOp = "keep";
-};
-
-enum GPUStencilOperation {
- "keep",
- "zero",
- "replace",
- "invert",
- "increment-clamp",
- "decrement-clamp",
- "increment-wrap",
- "decrement-wrap"
-};
-
-enum GPUIndexFormat {
- "uint16",
- "uint32"
-};
-
-enum GPUVertexFormat {
- "uchar2",
- "uchar4",
- "char2",
- "char4",
- "uchar2norm",
- "uchar4norm",
- "char2norm",
- "char4norm",
- "ushort2",
- "ushort4",
- "short2",
- "short4",
- "ushort2norm",
- "ushort4norm",
- "short2norm",
- "short4norm",
- "half2",
- "half4",
- "float",
- "float2",
- "float3",
- "float4",
- "uint",
- "uint2",
- "uint3",
- "uint4",
- "int",
- "int2",
- "int3",
- "int4"
-};
-
-enum GPUInputStepMode {
- "vertex",
- "instance"
-};
-
-dictionary GPUVertexState: GPUProgrammableStage {
- sequence<GPUVertexBufferLayout?> buffers = [];
-};
-
-dictionary GPUVertexBufferLayout {
- required GPUSize64 arrayStride;
- GPUInputStepMode stepMode = "vertex";
- required sequence<GPUVertexAttribute> attributes;
-};
-
-dictionary GPUVertexAttribute {
- required GPUVertexFormat format;
- required GPUSize64 offset;
-
- required GPUIndex32 shaderLocation;
-};
-
-interface GPUCommandBuffer {
- readonly attribute Promise<double> executionTime;
-};
-GPUCommandBuffer includes GPUObjectBase;
-
-dictionary GPUCommandBufferDescriptor : GPUObjectDescriptorBase {
-};
-
-interface GPUCommandEncoder {
- GPURenderPassEncoder beginRenderPass(GPURenderPassDescriptor descriptor);
- GPUComputePassEncoder beginComputePass(optional GPUComputePassDescriptor descriptor = {});
-
- undefined copyBufferToBuffer(
- GPUBuffer source,
- GPUSize64 sourceOffset,
- GPUBuffer destination,
- GPUSize64 destinationOffset,
- GPUSize64 size);
-
- undefined copyBufferToTexture(
- GPUImageCopyBuffer source,
- GPUImageCopyTexture destination,
- GPUExtent3D copySize);
-
- undefined copyTextureToBuffer(
- GPUImageCopyTexture source,
- GPUImageCopyBuffer destination,
- GPUExtent3D copySize);
-
- undefined copyTextureToTexture(
- GPUImageCopyTexture source,
- GPUImageCopyTexture destination,
- GPUExtent3D copySize);
-
- undefined pushDebugGroup(USVString groupLabel);
- undefined popDebugGroup();
- undefined insertDebugMarker(USVString markerLabel);
-
- undefined writeTimestamp(GPUQuerySet querySet, GPUSize32 queryIndex);
-
- undefined resolveQuerySet(
- GPUQuerySet querySet,
- GPUSize32 firstQuery,
- GPUSize32 queryCount,
- GPUBuffer destination,
- GPUSize64 destinationOffset);
-
- GPUCommandBuffer finish(optional GPUCommandBufferDescriptor descriptor = {});
-};
-GPUCommandEncoder includes GPUObjectBase;
-
-dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase {
- boolean measureExecutionTime = false;
-
- // TODO: reusability flag?
-};
-
-dictionary GPUImageDataLayout {
- GPUSize64 offset = 0;
- GPUSize32 bytesPerRow;
- GPUSize32 rowsPerImage;
-};
-
-dictionary GPUImageCopyBuffer : GPUImageDataLayout {
- required GPUBuffer buffer;
-};
-
-dictionary GPUImageCopyTexture {
- required GPUTexture texture;
- GPUIntegerCoordinate mipLevel = 0;
- GPUOrigin3D origin = {};
- GPUTextureAspect aspect = "all";
-};
-
-interface mixin GPUProgrammablePassEncoder {
- undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup,
- optional sequence<GPUBufferDynamicOffset> dynamicOffsets = []);
-
- undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup,
- Uint32Array dynamicOffsetsData,
- GPUSize64 dynamicOffsetsDataStart,
- GPUSize32 dynamicOffsetsDataLength);
-
- undefined pushDebugGroup(USVString groupLabel);
- undefined popDebugGroup();
- undefined insertDebugMarker(USVString markerLabel);
-};
-
-interface GPUComputePassEncoder {
- undefined setPipeline(GPUComputePipeline pipeline);
- undefined dispatch(GPUSize32 x, optional GPUSize32 y = 1, optional GPUSize32 z = 1);
- undefined dispatchIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
-
- undefined beginPipelineStatisticsQuery(GPUQuerySet querySet, GPUSize32 queryIndex);
- undefined endPipelineStatisticsQuery();
-
- undefined writeTimestamp(GPUQuerySet querySet, GPUSize32 queryIndex);
-
- undefined endPass();
-};
-GPUComputePassEncoder includes GPUObjectBase;
-GPUComputePassEncoder includes GPUProgrammablePassEncoder;
-
-dictionary GPUComputePassDescriptor : GPUObjectDescriptorBase {
-};
-
-interface mixin GPURenderEncoderBase {
- undefined setPipeline(GPURenderPipeline pipeline);
-
- undefined setIndexBuffer(GPUBuffer buffer, GPUIndexFormat indexFormat, optional GPUSize64 offset = 0, optional GPUSize64 size = 0);
- undefined setVertexBuffer(GPUIndex32 slot, GPUBuffer buffer, optional GPUSize64 offset = 0, optional GPUSize64 size = 0);
-
- undefined draw(GPUSize32 vertexCount, optional GPUSize32 instanceCount = 1,
- optional GPUSize32 firstVertex = 0, optional GPUSize32 firstInstance = 0);
- undefined drawIndexed(GPUSize32 indexCount, optional GPUSize32 instanceCount = 1,
- optional GPUSize32 firstIndex = 0,
- optional GPUSignedOffset32 baseVertex = 0,
- optional GPUSize32 firstInstance = 0);
-
- undefined drawIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
- undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
-};
-
-interface GPURenderPassEncoder {
- undefined setViewport(float x, float y,
- float width, float height,
- float minDepth, float maxDepth);
-
- undefined setScissorRect(GPUIntegerCoordinate x, GPUIntegerCoordinate y,
- GPUIntegerCoordinate width, GPUIntegerCoordinate height);
-
- undefined setBlendColor(GPUColor color);
- undefined setStencilReference(GPUStencilValue reference);
-
- undefined beginOcclusionQuery(GPUSize32 queryIndex);
- undefined endOcclusionQuery();
-
- undefined beginPipelineStatisticsQuery(GPUQuerySet querySet, GPUSize32 queryIndex);
- undefined endPipelineStatisticsQuery();
-
- undefined writeTimestamp(GPUQuerySet querySet, GPUSize32 queryIndex);
-
- undefined executeBundles(sequence<GPURenderBundle> bundles);
- undefined endPass();
-};
-GPURenderPassEncoder includes GPUObjectBase;
-GPURenderPassEncoder includes GPUProgrammablePassEncoder;
-GPURenderPassEncoder includes GPURenderEncoderBase;
-
-dictionary GPURenderPassDescriptor : GPUObjectDescriptorBase {
- required sequence<GPURenderPassColorAttachment> colorAttachments;
- GPURenderPassDepthStencilAttachment depthStencilAttachment;
- GPUQuerySet occlusionQuerySet;
-};
-
-dictionary GPURenderPassColorAttachment {
- required GPUTextureView view;
- GPUTextureView resolveTarget;
-
- required (GPULoadOp or GPUColor) loadValue;
- GPUStoreOp storeOp = "store";
-};
-
-dictionary GPURenderPassDepthStencilAttachment {
- required GPUTextureView view;
-
- required (GPULoadOp or float) depthLoadValue;
- required GPUStoreOp depthStoreOp;
- boolean depthReadOnly = false;
-
- required (GPULoadOp or GPUStencilValue) stencilLoadValue;
- required GPUStoreOp stencilStoreOp;
- boolean stencilReadOnly = false;
-};
-
-enum GPULoadOp {
- "load"
-};
-
-enum GPUStoreOp {
- "store",
- "clear"
-};
-
-interface GPURenderBundle {
-};
-GPURenderBundle includes GPUObjectBase;
-
-dictionary GPURenderBundleDescriptor : GPUObjectDescriptorBase {
-};
-
-interface GPURenderBundleEncoder {
- GPURenderBundle finish(optional GPURenderBundleDescriptor descriptor = {});
-};
-GPURenderBundleEncoder includes GPUObjectBase;
-GPURenderBundleEncoder includes GPUProgrammablePassEncoder;
-GPURenderBundleEncoder includes GPURenderEncoderBase;
-
-dictionary GPURenderBundleEncoderDescriptor : GPUObjectDescriptorBase {
- required sequence<GPUTextureFormat> colorFormats;
- GPUTextureFormat depthStencilFormat;
- GPUSize32 sampleCount = 1;
-};
-
-interface GPUQueue {
- undefined submit(sequence<GPUCommandBuffer> commandBuffers);
-
- Promise<undefined> onSubmittedWorkDone();
-
- undefined writeBuffer(
- GPUBuffer buffer,
- GPUSize64 bufferOffset,
- [AllowShared] BufferSource data,
- optional GPUSize64 dataOffset = 0,
- optional GPUSize64 size);
-
- undefined writeTexture(
- GPUImageCopyTexture destination,
- [AllowShared] BufferSource data,
- GPUImageDataLayout dataLayout,
- GPUExtent3D size);
-};
-GPUQueue includes GPUObjectBase;
-
-interface GPUQuerySet {
- undefined destroy();
-};
-GPUQuerySet includes GPUObjectBase;
-
-dictionary GPUQuerySetDescriptor : GPUObjectDescriptorBase {
- required GPUQueryType type;
- required GPUSize32 count;
- sequence<GPUPipelineStatisticName> pipelineStatistics = [];
-};
-
-enum GPUQueryType {
- "occlusion",
- "pipeline-statistics",
- "timestamp"
-};
-
-enum GPUPipelineStatisticName {
- "vertex-shader-invocations",
- "clipper-invocations",
- "clipper-primitives-out",
- "fragment-shader-invocations",
- "compute-shader-invocations"
-};
-
-enum GPUDeviceLostReason {
- "destroyed",
-};
-
-interface GPUDeviceLostInfo {
- readonly attribute (GPUDeviceLostReason or undefined) reason;
- readonly attribute DOMString message;
-};
-
-partial interface GPUDevice {
- readonly attribute Promise<GPUDeviceLostInfo> lost;
-};
-
-enum GPUErrorFilter {
- "out-of-memory",
- "validation"
-};
-
-interface GPUOutOfMemoryError {
- constructor();
-};
-
-interface GPUValidationError {
- constructor(DOMString message);
- readonly attribute DOMString message;
-};
-
-typedef (GPUOutOfMemoryError or GPUValidationError) GPUError;
-
-partial interface GPUDevice {
- undefined pushErrorScope(GPUErrorFilter filter);
- Promise<GPUError?> popErrorScope();
-};
-
-[
- Exposed=(Window, DedicatedWorker)
-]
-interface GPUUncapturedErrorEvent : Event {
- constructor(
- DOMString type,
- GPUUncapturedErrorEventInit gpuUncapturedErrorEventInitDict
- );
- [SameObject] readonly attribute GPUError error;
-};
-
-dictionary GPUUncapturedErrorEventInit : EventInit {
- required GPUError error;
-};
-
-partial interface GPUDevice {
- [Exposed=(Window, DedicatedWorker)]
- attribute EventHandler onuncapturederror;
-};
-
-typedef [EnforceRange] unsigned long GPUBufferDynamicOffset;
-typedef [EnforceRange] unsigned long GPUStencilValue;
-typedef [EnforceRange] unsigned long GPUSampleMask;
-typedef [EnforceRange] long GPUDepthBias;
-
-typedef [EnforceRange] unsigned long long GPUSize64;
-typedef [EnforceRange] unsigned long GPUIntegerCoordinate;
-typedef [EnforceRange] unsigned long GPUIndex32;
-typedef [EnforceRange] unsigned long GPUSize32;
-typedef [EnforceRange] long GPUSignedOffset32;
-
-typedef unsigned long GPUFlagsConstant;
-
-dictionary GPUColorDict {
- required double r;
- required double g;
- required double b;
- required double a;
-};
-typedef (sequence<double> or GPUColorDict) GPUColor;
-
-dictionary GPUOrigin2DDict {
- GPUIntegerCoordinate x = 0;
- GPUIntegerCoordinate y = 0;
-};
-typedef (sequence<GPUIntegerCoordinate> or GPUOrigin2DDict) GPUOrigin2D;
-
-dictionary GPUOrigin3DDict {
- GPUIntegerCoordinate x = 0;
- GPUIntegerCoordinate y = 0;
- GPUIntegerCoordinate z = 0;
-};
-typedef (sequence<GPUIntegerCoordinate> or GPUOrigin3DDict) GPUOrigin3D;
-
-dictionary GPUExtent3DDict {
- GPUIntegerCoordinate width = 1;
- GPUIntegerCoordinate height = 1;
- GPUIntegerCoordinate depthOrArrayLayers = 1;
-};
-typedef (sequence<GPUIntegerCoordinate> or GPUExtent3DDict) GPUExtent3D;
diff --git a/op_crates/webidl/00_webidl.js b/op_crates/webidl/00_webidl.js
deleted file mode 100644
index 6bf98be06..000000000
--- a/op_crates/webidl/00_webidl.js
+++ /dev/null
@@ -1,919 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// Adapted from https://github.com/jsdom/webidl-conversions.
-// Copyright Domenic Denicola. Licensed under BSD-2-Clause License.
-// Original license at https://github.com/jsdom/webidl-conversions/blob/master/LICENSE.md.
-
-"use strict";
-
-((window) => {
- function makeException(ErrorType, message, opts = {}) {
- if (opts.globals) {
- ErrorType = opts.globals[ErrorType.name];
- }
- return new ErrorType(
- `${opts.prefix ? opts.prefix + ": " : ""}${
- opts.context ? opts.context : "Value"
- } ${message}`,
- );
- }
-
- function toNumber(value, opts = {}) {
- if (!opts.globals) {
- return +value;
- }
- if (typeof value === "bigint") {
- throw opts.globals.TypeError("Cannot convert a BigInt value to a number");
- }
- return opts.globals.Number(value);
- }
-
- function type(V) {
- if (V === null) {
- return "Null";
- }
- switch (typeof V) {
- case "undefined":
- return "Undefined";
- case "boolean":
- return "Boolean";
- case "number":
- return "Number";
- case "string":
- return "String";
- case "symbol":
- return "Symbol";
- case "bigint":
- return "BigInt";
- case "object":
- // Falls through
- case "function":
- // Falls through
- default:
- // Per ES spec, typeof returns an implemention-defined value that is not any of the existing ones for
- // uncallable non-standard exotic objects. Yet Type() which the Web IDL spec depends on returns Object for
- // such cases. So treat the default case as an object.
- return "Object";
- }
- }
-
- // Round x to the nearest integer, choosing the even integer if it lies halfway between two.
- function evenRound(x) {
- // There are four cases for numbers with fractional part being .5:
- //
- // case | x | floor(x) | round(x) | expected | x <> 0 | x % 1 | x & 1 | example
- // 1 | 2n + 0.5 | 2n | 2n + 1 | 2n | > | 0.5 | 0 | 0.5 -> 0
- // 2 | 2n + 1.5 | 2n + 1 | 2n + 2 | 2n + 2 | > | 0.5 | 1 | 1.5 -> 2
- // 3 | -2n - 0.5 | -2n - 1 | -2n | -2n | < | -0.5 | 0 | -0.5 -> 0
- // 4 | -2n - 1.5 | -2n - 2 | -2n - 1 | -2n - 2 | < | -0.5 | 1 | -1.5 -> -2
- // (where n is a non-negative integer)
- //
- // Branch here for cases 1 and 4
- if (
- (x > 0 && x % 1 === +0.5 && (x & 1) === 0) ||
- (x < 0 && x % 1 === -0.5 && (x & 1) === 1)
- ) {
- return censorNegativeZero(Math.floor(x));
- }
-
- return censorNegativeZero(Math.round(x));
- }
-
- function integerPart(n) {
- return censorNegativeZero(Math.trunc(n));
- }
-
- function sign(x) {
- return x < 0 ? -1 : 1;
- }
-
- function modulo(x, y) {
- // https://tc39.github.io/ecma262/#eqn-modulo
- // Note that http://stackoverflow.com/a/4467559/3191 does NOT work for large modulos
- const signMightNotMatch = x % y;
- if (sign(y) !== sign(signMightNotMatch)) {
- return signMightNotMatch + y;
- }
- return signMightNotMatch;
- }
-
- function censorNegativeZero(x) {
- return x === 0 ? 0 : x;
- }
-
- function createIntegerConversion(bitLength, typeOpts) {
- const isSigned = !typeOpts.unsigned;
-
- let lowerBound;
- let upperBound;
- if (bitLength === 64) {
- upperBound = Number.MAX_SAFE_INTEGER;
- lowerBound = !isSigned ? 0 : Number.MIN_SAFE_INTEGER;
- } else if (!isSigned) {
- lowerBound = 0;
- upperBound = Math.pow(2, bitLength) - 1;
- } else {
- lowerBound = -Math.pow(2, bitLength - 1);
- upperBound = Math.pow(2, bitLength - 1) - 1;
- }
-
- const twoToTheBitLength = Math.pow(2, bitLength);
- const twoToOneLessThanTheBitLength = Math.pow(2, bitLength - 1);
-
- return (V, opts = {}) => {
- let x = toNumber(V, opts);
- x = censorNegativeZero(x);
-
- if (opts.enforceRange) {
- if (!Number.isFinite(x)) {
- throw makeException(TypeError, "is not a finite number", opts);
- }
-
- x = integerPart(x);
-
- if (x < lowerBound || x > upperBound) {
- throw makeException(
- TypeError,
- `is outside the accepted range of ${lowerBound} to ${upperBound}, inclusive`,
- opts,
- );
- }
-
- return x;
- }
-
- if (!Number.isNaN(x) && opts.clamp) {
- x = Math.min(Math.max(x, lowerBound), upperBound);
- x = evenRound(x);
- return x;
- }
-
- if (!Number.isFinite(x) || x === 0) {
- return 0;
- }
- x = integerPart(x);
-
- // Math.pow(2, 64) is not accurately representable in JavaScript, so try to avoid these per-spec operations if
- // possible. Hopefully it's an optimization for the non-64-bitLength cases too.
- if (x >= lowerBound && x <= upperBound) {
- return x;
- }
-
- // These will not work great for bitLength of 64, but oh well. See the README for more details.
- x = modulo(x, twoToTheBitLength);
- if (isSigned && x >= twoToOneLessThanTheBitLength) {
- return x - twoToTheBitLength;
- }
- return x;
- };
- }
-
- function createLongLongConversion(bitLength, { unsigned }) {
- const upperBound = Number.MAX_SAFE_INTEGER;
- const lowerBound = unsigned ? 0 : Number.MIN_SAFE_INTEGER;
- const asBigIntN = unsigned ? BigInt.asUintN : BigInt.asIntN;
-
- return (V, opts = {}) => {
- let x = toNumber(V, opts);
- x = censorNegativeZero(x);
-
- if (opts.enforceRange) {
- if (!Number.isFinite(x)) {
- throw makeException(TypeError, "is not a finite number", opts);
- }
-
- x = integerPart(x);
-
- if (x < lowerBound || x > upperBound) {
- throw makeException(
- TypeError,
- `is outside the accepted range of ${lowerBound} to ${upperBound}, inclusive`,
- opts,
- );
- }
-
- return x;
- }
-
- if (!Number.isNaN(x) && opts.clamp) {
- x = Math.min(Math.max(x, lowerBound), upperBound);
- x = evenRound(x);
- return x;
- }
-
- if (!Number.isFinite(x) || x === 0) {
- return 0;
- }
-
- let xBigInt = BigInt(integerPart(x));
- xBigInt = asBigIntN(bitLength, xBigInt);
- return Number(xBigInt);
- };
- }
-
- const converters = [];
-
- converters.any = (V) => {
- return V;
- };
-
- converters.boolean = function (val) {
- return !!val;
- };
-
- converters.byte = createIntegerConversion(8, { unsigned: false });
- converters.octet = createIntegerConversion(8, { unsigned: true });
-
- converters.short = createIntegerConversion(16, { unsigned: false });
- converters["unsigned short"] = createIntegerConversion(16, {
- unsigned: true,
- });
-
- converters.long = createIntegerConversion(32, { unsigned: false });
- converters["unsigned long"] = createIntegerConversion(32, { unsigned: true });
-
- converters["long long"] = createLongLongConversion(64, { unsigned: false });
- converters["unsigned long long"] = createLongLongConversion(64, {
- unsigned: true,
- });
-
- converters.float = (V, opts) => {
- const x = toNumber(V, opts);
-
- if (!Number.isFinite(x)) {
- throw makeException(
- TypeError,
- "is not a finite floating-point value",
- opts,
- );
- }
-
- if (Object.is(x, -0)) {
- return x;
- }
-
- const y = Math.fround(x);
-
- if (!Number.isFinite(y)) {
- throw makeException(
- TypeError,
- "is outside the range of a single-precision floating-point value",
- opts,
- );
- }
-
- return y;
- };
-
- converters["unrestricted float"] = (V, opts) => {
- const x = toNumber(V, opts);
-
- if (isNaN(x)) {
- return x;
- }
-
- if (Object.is(x, -0)) {
- return x;
- }
-
- return Math.fround(x);
- };
-
- converters.double = (V, opts) => {
- const x = toNumber(V, opts);
-
- if (!Number.isFinite(x)) {
- throw makeException(
- TypeError,
- "is not a finite floating-point value",
- opts,
- );
- }
-
- return x;
- };
-
- converters["unrestricted double"] = (V, opts) => {
- const x = toNumber(V, opts);
-
- return x;
- };
-
- converters.DOMString = function (V, opts = {}) {
- if (opts.treatNullAsEmptyString && V === null) {
- return "";
- }
-
- if (typeof V === "symbol") {
- throw makeException(
- TypeError,
- "is a symbol, which cannot be converted to a string",
- opts,
- );
- }
-
- const StringCtor = opts.globals ? opts.globals.String : String;
- return StringCtor(V);
- };
-
- converters.ByteString = (V, opts) => {
- const x = converters.DOMString(V, opts);
- let c;
- for (let i = 0; (c = x.codePointAt(i)) !== undefined; ++i) {
- if (c > 255) {
- throw makeException(TypeError, "is not a valid ByteString", opts);
- }
- }
-
- return x;
- };
-
- converters.USVString = (V, opts) => {
- const S = converters.DOMString(V, opts);
- const n = S.length;
- const U = [];
- for (let i = 0; i < n; ++i) {
- const c = S.charCodeAt(i);
- if (c < 0xd800 || c > 0xdfff) {
- U.push(String.fromCodePoint(c));
- } else if (0xdc00 <= c && c <= 0xdfff) {
- U.push(String.fromCodePoint(0xfffd));
- } else if (i === n - 1) {
- U.push(String.fromCodePoint(0xfffd));
- } else {
- const d = S.charCodeAt(i + 1);
- if (0xdc00 <= d && d <= 0xdfff) {
- const a = c & 0x3ff;
- const b = d & 0x3ff;
- U.push(String.fromCodePoint((2 << 15) + (2 << 9) * a + b));
- ++i;
- } else {
- U.push(String.fromCodePoint(0xfffd));
- }
- }
- }
-
- return U.join("");
- };
-
- converters.object = (V, opts) => {
- if (type(V) !== "Object") {
- throw makeException(TypeError, "is not an object", opts);
- }
-
- return V;
- };
-
- // Not exported, but used in Function and VoidFunction.
-
- // Neither Function nor VoidFunction is defined with [TreatNonObjectAsNull], so
- // handling for that is omitted.
- function convertCallbackFunction(V, opts) {
- if (typeof V !== "function") {
- throw makeException(TypeError, "is not a function", opts);
- }
- return V;
- }
-
- function isNonSharedArrayBuffer(V) {
- return V instanceof ArrayBuffer;
- }
-
- function isSharedArrayBuffer(V) {
- return V instanceof SharedArrayBuffer;
- }
-
- function isArrayBufferDetached(V) {
- try {
- // eslint-disable-next-line no-new
- new Uint8Array(V);
- return false;
- } catch {
- return true;
- }
- }
-
- converters.ArrayBuffer = (V, opts = {}) => {
- if (!isNonSharedArrayBuffer(V)) {
- if (opts.allowShared && !isSharedArrayBuffer(V)) {
- throw makeException(
- TypeError,
- "is not an ArrayBuffer or SharedArrayBuffer",
- opts,
- );
- }
- throw makeException(TypeError, "is not an ArrayBuffer", opts);
- }
- if (isArrayBufferDetached(V)) {
- throw makeException(TypeError, "is a detached ArrayBuffer", opts);
- }
-
- return V;
- };
-
- converters.DataView = (V, opts = {}) => {
- if (!(V instanceof DataView)) {
- throw makeException(TypeError, "is not a DataView", opts);
- }
-
- if (!opts.allowShared && isSharedArrayBuffer(V.buffer)) {
- throw makeException(
- TypeError,
- "is backed by a SharedArrayBuffer, which is not allowed",
- opts,
- );
- }
- if (isArrayBufferDetached(V.buffer)) {
- throw makeException(
- TypeError,
- "is backed by a detached ArrayBuffer",
- opts,
- );
- }
-
- return V;
- };
-
- // Returns the unforgeable `TypedArray` constructor name or `undefined`,
- // if the `this` value isn't a valid `TypedArray` object.
- //
- // https://tc39.es/ecma262/#sec-get-%typedarray%.prototype-@@tostringtag
- const typedArrayNameGetter = Object.getOwnPropertyDescriptor(
- Object.getPrototypeOf(Uint8Array).prototype,
- Symbol.toStringTag,
- ).get;
- [
- Int8Array,
- Int16Array,
- Int32Array,
- Uint8Array,
- Uint16Array,
- Uint32Array,
- Uint8ClampedArray,
- Float32Array,
- Float64Array,
- ].forEach((func) => {
- const name = func.name;
- const article = /^[AEIOU]/.test(name) ? "an" : "a";
- converters[name] = (V, opts = {}) => {
- if (!ArrayBuffer.isView(V) || typedArrayNameGetter.call(V) !== name) {
- throw makeException(
- TypeError,
- `is not ${article} ${name} object`,
- opts,
- );
- }
- if (!opts.allowShared && isSharedArrayBuffer(V.buffer)) {
- throw makeException(
- TypeError,
- "is a view on a SharedArrayBuffer, which is not allowed",
- opts,
- );
- }
- if (isArrayBufferDetached(V.buffer)) {
- throw makeException(
- TypeError,
- "is a view on a detached ArrayBuffer",
- opts,
- );
- }
-
- return V;
- };
- });
-
- // Common definitions
-
- converters.ArrayBufferView = (V, opts = {}) => {
- if (!ArrayBuffer.isView(V)) {
- throw makeException(
- TypeError,
- "is not a view on an ArrayBuffer or SharedArrayBuffer",
- opts,
- );
- }
-
- if (!opts.allowShared && isSharedArrayBuffer(V.buffer)) {
- throw makeException(
- TypeError,
- "is a view on a SharedArrayBuffer, which is not allowed",
- opts,
- );
- }
-
- if (isArrayBufferDetached(V.buffer)) {
- throw makeException(
- TypeError,
- "is a view on a detached ArrayBuffer",
- opts,
- );
- }
- return V;
- };
-
- converters.BufferSource = (V, opts = {}) => {
- if (ArrayBuffer.isView(V)) {
- if (!opts.allowShared && isSharedArrayBuffer(V.buffer)) {
- throw makeException(
- TypeError,
- "is a view on a SharedArrayBuffer, which is not allowed",
- opts,
- );
- }
-
- if (isArrayBufferDetached(V.buffer)) {
- throw makeException(
- TypeError,
- "is a view on a detached ArrayBuffer",
- opts,
- );
- }
- return V;
- }
-
- if (!opts.allowShared && !isNonSharedArrayBuffer(V)) {
- throw makeException(
- TypeError,
- "is not an ArrayBuffer or a view on one",
- opts,
- );
- }
- if (
- opts.allowShared &&
- !isSharedArrayBuffer(V) &&
- !isNonSharedArrayBuffer(V)
- ) {
- throw makeException(
- TypeError,
- "is not an ArrayBuffer, SharedArrayBuffer, or a view on one",
- opts,
- );
- }
- if (isArrayBufferDetached(V)) {
- throw makeException(TypeError, "is a detached ArrayBuffer", opts);
- }
-
- return V;
- };
-
- converters.DOMTimeStamp = converters["unsigned long long"];
-
- converters.Function = convertCallbackFunction;
-
- converters.VoidFunction = convertCallbackFunction;
-
- converters["UVString?"] = createNullableConverter(
- converters.USVString,
- );
- converters["sequence<double>"] = createSequenceConverter(
- converters["double"],
- );
-
- function requiredArguments(length, required, opts = {}) {
- if (length < required) {
- const errMsg = `${
- opts.prefix ? opts.prefix + ": " : ""
- }${required} argument${
- required === 1 ? "" : "s"
- } required, but only ${length} present.`;
- throw new TypeError(errMsg);
- }
- }
-
- function isEmptyObject(V) {
- for (const _ in V) return false;
- return true;
- }
-
- function createDictionaryConverter(name, ...dictionaries) {
- let hasRequiredKey = false;
- const allMembers = [];
- for (const members of dictionaries) {
- for (const member of members) {
- if (member.required) {
- hasRequiredKey = true;
- }
- allMembers.push(member);
- }
- }
- allMembers.sort((a, b) => {
- if (a.key == b.key) {
- return 0;
- }
- return a.key < b.key ? -1 : 1;
- });
-
- const defaultValues = {};
- for (const member of allMembers) {
- if ("defaultValue" in member) {
- const idlMemberValue = member.defaultValue;
- const imvType = typeof idlMemberValue;
- // Copy by value types can be directly assigned, copy by reference types
- // need to be re-created for each allocation.
- if (
- imvType === "number" || imvType === "boolean" ||
- imvType === "string" || imvType === "bigint" ||
- imvType === "undefined"
- ) {
- defaultValues[member.key] = idlMemberValue;
- } else {
- Object.defineProperty(defaultValues, member.key, {
- get() {
- return member.defaultValue;
- },
- });
- }
- }
- }
-
- return function (V, opts = {}) {
- const typeV = type(V);
- switch (typeV) {
- case "Undefined":
- case "Null":
- case "Object":
- break;
- default:
- throw makeException(
- TypeError,
- "can not be converted to a dictionary",
- opts,
- );
- }
- const esDict = V;
-
- const idlDict = { ...defaultValues };
-
- // NOTE: fast path Null and Undefined and empty objects.
- if (
- (V === undefined || V === null || isEmptyObject(V)) && !hasRequiredKey
- ) {
- return idlDict;
- }
-
- for (const member of allMembers) {
- const key = member.key;
-
- let esMemberValue;
- if (typeV === "Undefined" || typeV === "Null") {
- esMemberValue = undefined;
- } else {
- esMemberValue = esDict[key];
- }
-
- if (esMemberValue !== undefined) {
- const context = `'${key}' of '${name}'${
- opts.context ? ` (${opts.context})` : ""
- }`;
- const converter = member.converter;
- const idlMemberValue = converter(esMemberValue, { ...opts, context });
- idlDict[key] = idlMemberValue;
- } else if (member.required) {
- throw makeException(
- TypeError,
- `can not be converted to '${name}' because '${key}' is required in '${name}'.`,
- { ...opts },
- );
- }
- }
-
- return idlDict;
- };
- }
-
- // https://heycam.github.io/webidl/#es-enumeration
- function createEnumConverter(name, values) {
- const E = new Set(values);
-
- return function (V, opts = {}) {
- const S = String(V);
-
- if (!E.has(S)) {
- throw new TypeError(
- `${
- opts.prefix ? opts.prefix + ": " : ""
- }The provided value '${S}' is not a valid enum value of type ${name}.`,
- );
- }
-
- return S;
- };
- }
-
- function createNullableConverter(converter) {
- return (V, opts = {}) => {
- // FIXME: If Type(V) is not Object, and the conversion to an IDL value is
- // being performed due to V being assigned to an attribute whose type is a
- // nullable callback function that is annotated with
- // [LegacyTreatNonObjectAsNull], then return the IDL nullable type T?
- // value null.
-
- if (V === null || V === undefined) return null;
- return converter(V, opts);
- };
- }
-
- // https://heycam.github.io/webidl/#es-sequence
- function createSequenceConverter(converter) {
- return function (V, opts = {}) {
- if (typeof V !== "object") {
- throw makeException(
- TypeError,
- "can not be converted to sequence.",
- opts,
- );
- }
- const iter = V?.[Symbol.iterator]?.();
- if (iter === undefined) {
- throw makeException(
- TypeError,
- "can not be converted to sequence.",
- opts,
- );
- }
- const array = [];
- while (true) {
- const res = iter?.next?.();
- if (res === undefined) {
- throw makeException(
- TypeError,
- "can not be converted to sequence.",
- opts,
- );
- }
- if (res.done === true) break;
- const val = converter(res.value, {
- ...opts,
- context: `${opts.context}, index ${array.length}`,
- });
- array.push(val);
- }
- return array;
- };
- }
-
- function createRecordConverter(keyConverter, valueConverter) {
- return (V, opts) => {
- if (typeof V !== "object") {
- throw makeException(
- TypeError,
- "can not be converted to dictionary.",
- opts,
- );
- }
- const keys = Reflect.ownKeys(V);
- const result = {};
- for (const key of keys) {
- const desc = Object.getOwnPropertyDescriptor(V, key);
- if (desc !== undefined && desc.enumerable === true) {
- const typedKey = keyConverter(key, opts);
- const value = V[key];
- const typedValue = valueConverter(value, opts);
- result[typedKey] = typedValue;
- }
- }
- return result;
- };
- }
-
- const brand = Symbol("[[webidl.brand]]");
-
- function createInterfaceConverter(name, prototype) {
- return (V, opts) => {
- if (!(V instanceof prototype) || V[brand] !== brand) {
- throw makeException(TypeError, `is not of type ${name}.`, opts);
- }
- return V;
- };
- }
-
- function createBranded(Type) {
- const t = Object.create(Type.prototype);
- t[brand] = brand;
- return t;
- }
-
- function assertBranded(self, prototype) {
- if (!(self instanceof prototype) || self[brand] !== brand) {
- throw new TypeError("Illegal invocation");
- }
- }
-
- function illegalConstructor() {
- throw new TypeError("Illegal constructor");
- }
-
- function define(target, source) {
- for (const key of Reflect.ownKeys(source)) {
- const descriptor = Reflect.getOwnPropertyDescriptor(source, key);
- if (descriptor && !Reflect.defineProperty(target, key, descriptor)) {
- throw new TypeError(`Cannot redefine property: ${String(key)}`);
- }
- }
- }
-
- const _iteratorInternal = Symbol("iterator internal");
-
- const globalIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf(
- [][Symbol.iterator](),
- ));
-
- function mixinPairIterable(name, prototype, dataSymbol, keyKey, valueKey) {
- const iteratorPrototype = Object.create(globalIteratorPrototype, {
- [Symbol.toStringTag]: { configurable: true, value: `${name} Iterator` },
- });
- define(iteratorPrototype, {
- next() {
- const internal = this && this[_iteratorInternal];
- if (!internal) {
- throw new TypeError(
- `next() called on a value that is not a ${name} iterator object`,
- );
- }
- const { target, kind, index } = internal;
- const values = target[dataSymbol];
- const len = values.length;
- if (index >= len) {
- return { value: undefined, done: true };
- }
- const pair = values[index];
- internal.index = index + 1;
- let result;
- switch (kind) {
- case "key":
- result = pair[keyKey];
- break;
- case "value":
- result = pair[valueKey];
- break;
- case "key+value":
- result = [pair[keyKey], pair[valueKey]];
- break;
- }
- return { value: result, done: false };
- },
- });
- function createDefaultIterator(target, kind) {
- const iterator = Object.create(iteratorPrototype);
- Object.defineProperty(iterator, _iteratorInternal, {
- value: { target, kind, index: 0 },
- configurable: true,
- });
- return iterator;
- }
-
- const methods = {
- entries() {
- assertBranded(this, prototype);
- return createDefaultIterator(this, "key+value");
- },
- [Symbol.iterator]() {
- assertBranded(this, prototype);
- return createDefaultIterator(this, "key+value");
- },
- keys() {
- assertBranded(this, prototype);
- return createDefaultIterator(this, "key");
- },
- values() {
- assertBranded(this, prototype);
- return createDefaultIterator(this, "value");
- },
- forEach(idlCallback, thisArg) {
- assertBranded(this, prototype);
- const prefix = `Failed to execute 'forEach' on '${name}'`;
- requiredArguments(arguments.length, 1, { prefix });
- idlCallback = converters["Function"](idlCallback, {
- prefix,
- context: "Argument 1",
- });
- idlCallback = idlCallback.bind(thisArg ?? globalThis);
- const pairs = this[dataSymbol];
- for (let i = 0; i < pairs.length; i++) {
- const entry = pairs[i];
- idlCallback(entry[valueKey], entry[keyKey], this);
- }
- },
- };
-
- return Object.assign(prototype.prototype, methods);
- }
-
- window.__bootstrap ??= {};
- window.__bootstrap.webidl = {
- makeException,
- converters,
- requiredArguments,
- createDictionaryConverter,
- createEnumConverter,
- createNullableConverter,
- createSequenceConverter,
- createRecordConverter,
- createInterfaceConverter,
- brand,
- createBranded,
- assertBranded,
- illegalConstructor,
- mixinPairIterable,
- };
-})(this);
diff --git a/op_crates/webidl/Cargo.toml b/op_crates/webidl/Cargo.toml
deleted file mode 100644
index 90a3e2cb9..000000000
--- a/op_crates/webidl/Cargo.toml
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-[package]
-name = "deno_webidl"
-version = "0.5.0"
-edition = "2018"
-description = "WebIDL implementation for Deno"
-authors = ["the Deno authors"]
-license = "MIT"
-readme = "README.md"
-repository = "https://github.com/denoland/deno"
-
-[lib]
-path = "lib.rs"
-
-[dependencies]
-deno_core = { version = "0.86.0", path = "../../core" }
diff --git a/op_crates/webidl/README.md b/op_crates/webidl/README.md
deleted file mode 100644
index ce2d661e3..000000000
--- a/op_crates/webidl/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# deno_webidl
-
-This crate implements WebIDL for Deno. It consists of infrastructure to do ECMA
--> WebIDL conversions.
-
-Spec: https://heycam.github.io/webidl/
diff --git a/op_crates/webidl/internal.d.ts b/op_crates/webidl/internal.d.ts
deleted file mode 100644
index ca72566a5..000000000
--- a/op_crates/webidl/internal.d.ts
+++ /dev/null
@@ -1,303 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-// deno-lint-ignore-file no-explicit-any ban-types
-
-/// <reference no-default-lib="true" />
-/// <reference lib="esnext" />
-
-declare namespace globalThis {
- declare namespace __bootstrap {
- declare namespace webidl {
- declare interface ConverterOpts {
- /**
- * The prefix for error messages created by this converter.
- * Examples:
- * - `Failed to construct 'Event'`
- * - `Failed to execute 'removeEventListener' on 'EventTarget'`
- */
- prefix: string;
- }
- declare interface ValueConverterOpts extends ConverterOpts {
- /**
- * The context of this value error messages created by this converter.
- * Examples:
- * - `Argument 1`
- * - `Argument 3`
- */
- context: string;
- }
- declare function makeException(
- ErrorType: any,
- message: string,
- opts: ValueConverterOpts,
- ): any;
- declare interface IntConverterOpts extends ValueConverterOpts {
- /**
- * Wether to throw if the number is outside of the acceptable values for
- * this type.
- */
- enforceRange?: boolean;
- /**
- * Wether to clamp this number to the acceptable values for this type.
- */
- clamp?: boolean;
- }
- declare interface StringConverterOpts extends ValueConverterOpts {
- /**
- * Wether to treat `null` value as an empty string.
- */
- treatNullAsEmptyString?: boolean;
- }
- declare interface BufferConverterOpts extends ValueConverterOpts {
- /**
- * Wether to allow `SharedArrayBuffer` (not just `ArrayBuffer`).
- */
- allowShared?: boolean;
- }
- declare const converters: {
- any(v: any): any;
- /**
- * Convert a value into a `boolean` (bool).
- */
- boolean(v: any, opts?: IntConverterOpts): boolean;
- /**
- * Convert a value into a `byte` (int8).
- */
- byte(v: any, opts?: IntConverterOpts): number;
- /**
- * Convert a value into a `octet` (uint8).
- */
- octet(v: any, opts?: IntConverterOpts): number;
- /**
- * Convert a value into a `short` (int16).
- */
- short(v: any, opts?: IntConverterOpts): number;
- /**
- * Convert a value into a `unsigned short` (uint16).
- */
- ["unsigned short"](v: any, opts?: IntConverterOpts): number;
- /**
- * Convert a value into a `long` (int32).
- */
- long(v: any, opts?: IntConverterOpts): number;
- /**
- * Convert a value into a `unsigned long` (uint32).
- */
- ["unsigned long"](v: any, opts?: IntConverterOpts): number;
- /**
- * Convert a value into a `long long` (int64).
- * **Note this is truncated to a JS number (53 bit precision).**
- */
- ["long long"](v: any, opts?: IntConverterOpts): number;
- /**
- * Convert a value into a `unsigned long long` (uint64).
- * **Note this is truncated to a JS number (53 bit precision).**
- */
- ["unsigned long long"](v: any, opts?: IntConverterOpts): number;
- /**
- * Convert a value into a `float` (f32).
- */
- float(v: any, opts?: ValueConverterOpts): number;
- /**
- * Convert a value into a `unrestricted float` (f32, infinity, or NaN).
- */
- ["unrestricted float"](v: any, opts?: ValueConverterOpts): number;
- /**
- * Convert a value into a `double` (f64).
- */
- double(v: any, opts?: ValueConverterOpts): number;
- /**
- * Convert a value into a `unrestricted double` (f64, infinity, or NaN).
- */
- ["unrestricted double"](v: any, opts?: ValueConverterOpts): number;
- /**
- * Convert a value into a `DOMString` (string).
- */
- DOMString(v: any, opts?: StringConverterOpts): string;
- /**
- * Convert a value into a `ByteString` (string with only u8 codepoints).
- */
- ByteString(v: any, opts?: StringConverterOpts): string;
- /**
- * Convert a value into a `USVString` (string with only valid non
- * surrogate Unicode code points).
- */
- USVString(v: any, opts?: StringConverterOpts): string;
- /**
- * Convert a value into an `object` (object).
- */
- object(v: any, opts?: ValueConverterOpts): object;
- /**
- * Convert a value into an `ArrayBuffer` (ArrayBuffer).
- */
- ArrayBuffer(v: any, opts?: BufferConverterOpts): ArrayBuffer;
- /**
- * Convert a value into a `DataView` (ArrayBuffer).
- */
- DataView(v: any, opts?: BufferConverterOpts): DataView;
- /**
- * Convert a value into a `Int8Array` (Int8Array).
- */
- Int8Array(v: any, opts?: BufferConverterOpts): Int8Array;
- /**
- * Convert a value into a `Int16Array` (Int16Array).
- */
- Int16Array(v: any, opts?: BufferConverterOpts): Int16Array;
- /**
- * Convert a value into a `Int32Array` (Int32Array).
- */
- Int32Array(v: any, opts?: BufferConverterOpts): Int32Array;
- /**
- * Convert a value into a `Uint8Array` (Uint8Array).
- */
- Uint8Array(v: any, opts?: BufferConverterOpts): Uint8Array;
- /**
- * Convert a value into a `Uint16Array` (Uint16Array).
- */
- Uint16Array(v: any, opts?: BufferConverterOpts): Uint16Array;
- /**
- * Convert a value into a `Uint32Array` (Uint32Array).
- */
- Uint32Array(v: any, opts?: BufferConverterOpts): Uint32Array;
- /**
- * Convert a value into a `Uint8ClampedArray` (Uint8ClampedArray).
- */
- Uint8ClampedArray(
- v: any,
- opts?: BufferConverterOpts,
- ): Uint8ClampedArray;
- /**
- * Convert a value into a `Float32Array` (Float32Array).
- */
- Float32Array(v: any, opts?: BufferConverterOpts): Float32Array;
- /**
- * Convert a value into a `Float64Array` (Float64Array).
- */
- Float64Array(v: any, opts?: BufferConverterOpts): Float64Array;
- /**
- * Convert a value into an `ArrayBufferView` (ArrayBufferView).
- */
- ArrayBufferView(v: any, opts?: BufferConverterOpts): ArrayBufferView;
- /**
- * Convert a value into a `BufferSource` (ArrayBuffer or ArrayBufferView).
- */
- BufferSource(
- v: any,
- opts?: BufferConverterOpts,
- ): ArrayBuffer | ArrayBufferView;
- /**
- * Convert a value into a `DOMTimeStamp` (u64). Alias for unsigned long long
- */
- DOMTimeStamp(v: any, opts?: IntConverterOpts): number;
- /**
- * Convert a value into a `Function` ((...args: any[]) => any).
- */
- Function(v: any, opts?: ValueConverterOpts): (...args: any) => any;
- /**
- * Convert a value into a `VoidFunction` (() => void).
- */
- VoidFunction(v: any, opts?: ValueConverterOpts): () => void;
- ["UVString?"](v: any, opts?: ValueConverterOpts): string | null;
- ["sequence<double>"](v: any, opts?: ValueConverterOpts): number[];
-
- [type: string]: (v: any, opts: ValueConverterOpts) => any;
- };
-
- /**
- * Assert that the a function has at least a required amount of arguments.
- */
- declare function requiredArguments(
- length: number,
- required: number,
- opts: ConverterOpts,
- ): void;
- declare type Dictionary = DictionaryMember[];
- declare interface DictionaryMember {
- key: string;
- converter: (v: any, opts: ValueConverterOpts) => any;
- defaultValue?: any;
- required?: boolean;
- }
-
- /**
- * Create a converter for dictionaries.
- */
- declare function createDictionaryConverter<T>(
- name: string,
- ...dictionaries: Dictionary[]
- ): (v: any, opts: ValueConverterOpts) => T;
-
- /**
- * Create a converter for enums.
- */
- declare function createEnumConverter(
- name: string,
- values: string[],
- ): (v: any, opts: ValueConverterOpts) => string;
-
- /**
- * Create a converter that makes the contained type nullable.
- */
- declare function createNullableConverter<T>(
- converter: (v: any, opts: ValueConverterOpts) => T,
- ): (v: any, opts: ValueConverterOpts) => T | null;
-
- /**
- * Create a converter that converts a sequence of the inner type.
- */
- declare function createSequenceConverter<T>(
- converter: (v: any, opts: ValueConverterOpts) => T,
- ): (v: any, opts: ValueConverterOpts) => T[];
-
- /**
- * Throw an illegal constructor error.
- */
- declare function illegalConstructor(): never;
-
- /**
- * The branding symbol.
- */
- declare const brand: unique symbol;
-
- /**
- * Create a branded instance of an interface.
- */
- declare function createBranded(self: any): any;
-
- /**
- * Assert that self is branded.
- */
- declare function assertBranded(self: any, type: any): void;
-
- /**
- * Create a converter for interfaces.
- */
- declare function createInterfaceConverter(
- name: string,
- prototype: any,
- ): (v: any, opts: ValueConverterOpts) => any;
-
- declare function createRecordConverter<
- K extends string | number | symbol,
- V,
- >(
- keyConverter: (v: any, opts: ValueConverterOpts) => K,
- valueConverter: (v: any, opts: ValueConverterOpts) => V,
- ): (
- v: Record<K, V>,
- opts: ValueConverterOpts,
- ) => any;
-
- /**
- * Mix in the iterable declarations defined in WebIDL.
- * https://heycam.github.io/webidl/#es-iterable
- */
- declare function mixinPairIterable(
- name: string,
- prototype: any,
- dataSymbol: symbol,
- keyKey: string | number | symbol,
- valueKey: string | number | symbol,
- ): void;
- }
- }
-}
diff --git a/op_crates/webidl/lib.rs b/op_crates/webidl/lib.rs
deleted file mode 100644
index c73c60bab..000000000
--- a/op_crates/webidl/lib.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::include_js_files;
-use deno_core::Extension;
-
-/// Load and execute the javascript code.
-pub fn init() -> Extension {
- Extension::builder()
- .js(include_js_files!(
- prefix "deno:op_crates/webidl",
- "00_webidl.js",
- ))
- .build()
-}
diff --git a/op_crates/websocket/01_websocket.js b/op_crates/websocket/01_websocket.js
deleted file mode 100644
index c77af4566..000000000
--- a/op_crates/websocket/01_websocket.js
+++ /dev/null
@@ -1,401 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-"use strict";
-
-((window) => {
- const core = window.Deno.core;
-
- // provided by "deno_web"
- const { URL } = window.__bootstrap.url;
-
- const CONNECTING = 0;
- const OPEN = 1;
- const CLOSING = 2;
- const CLOSED = 3;
-
- function requiredArguments(
- name,
- length,
- required,
- ) {
- if (length < required) {
- const errMsg = `${name} requires at least ${required} argument${
- required === 1 ? "" : "s"
- }, but only ${length} present`;
- throw new TypeError(errMsg);
- }
- }
-
- /**
- * Tries to close the resource (and ignores BadResource errors).
- * @param {number} rid
- */
- function tryClose(rid) {
- try {
- core.close(rid);
- } catch (err) {
- // Ignore error if the socket has already been closed.
- if (!(err instanceof Deno.errors.BadResource)) throw err;
- }
- }
-
- const handlerSymbol = Symbol("eventHandlers");
- function makeWrappedHandler(handler) {
- function wrappedHandler(...args) {
- if (typeof wrappedHandler.handler !== "function") {
- return;
- }
- return wrappedHandler.handler.call(this, ...args);
- }
- wrappedHandler.handler = handler;
- return wrappedHandler;
- }
- // TODO(lucacasonato) reuse when we can reuse code between web crates
- function defineEventHandler(emitter, name) {
- // HTML specification section 8.1.5.1
- Object.defineProperty(emitter, `on${name}`, {
- get() {
- return this[handlerSymbol]?.get(name)?.handler;
- },
- set(value) {
- if (!this[handlerSymbol]) {
- this[handlerSymbol] = new Map();
- }
- let handlerWrapper = this[handlerSymbol]?.get(name);
- if (handlerWrapper) {
- handlerWrapper.handler = value;
- } else {
- handlerWrapper = makeWrappedHandler(value);
- this.addEventListener(name, handlerWrapper);
- }
- this[handlerSymbol].set(name, handlerWrapper);
- },
- configurable: true,
- enumerable: true,
- });
- }
-
- class WebSocket extends EventTarget {
- #readyState = CONNECTING;
-
- constructor(url, protocols = []) {
- super();
- requiredArguments("WebSocket", arguments.length, 1);
-
- const wsURL = new URL(url);
-
- if (wsURL.protocol !== "ws:" && wsURL.protocol !== "wss:") {
- throw new DOMException(
- "Only ws & wss schemes are allowed in a WebSocket URL.",
- "SyntaxError",
- );
- }
-
- if (wsURL.hash !== "" || wsURL.href.endsWith("#")) {
- throw new DOMException(
- "Fragments are not allowed in a WebSocket URL.",
- "SyntaxError",
- );
- }
-
- this.#url = wsURL.href;
-
- core.opSync("op_ws_check_permission", this.#url);
-
- if (protocols && typeof protocols === "string") {
- protocols = [protocols];
- }
-
- if (
- protocols.some((x) => protocols.indexOf(x) !== protocols.lastIndexOf(x))
- ) {
- throw new DOMException(
- "Can't supply multiple times the same protocol.",
- "SyntaxError",
- );
- }
-
- core.opAsync("op_ws_create", {
- url: wsURL.href,
- protocols: protocols.join(", "),
- }).then((create) => {
- if (create.success) {
- this.#rid = create.rid;
- this.#extensions = create.extensions;
- this.#protocol = create.protocol;
-
- if (this.#readyState === CLOSING) {
- core.opAsync("op_ws_close", {
- rid: this.#rid,
- }).then(() => {
- this.#readyState = CLOSED;
-
- const errEvent = new ErrorEvent("error");
- errEvent.target = this;
- this.dispatchEvent(errEvent);
-
- const event = new CloseEvent("close");
- event.target = this;
- this.dispatchEvent(event);
- tryClose(this.#rid);
- });
- } else {
- this.#readyState = OPEN;
- const event = new Event("open");
- event.target = this;
- this.dispatchEvent(event);
-
- this.#eventLoop();
- }
- } else {
- this.#readyState = CLOSED;
-
- const errEvent = new ErrorEvent("error");
- errEvent.target = this;
- this.dispatchEvent(errEvent);
-
- const closeEvent = new CloseEvent("close");
- closeEvent.target = this;
- this.dispatchEvent(closeEvent);
- }
- }).catch((err) => {
- this.#readyState = CLOSED;
-
- const errorEv = new ErrorEvent(
- "error",
- { error: err, message: err.toString() },
- );
- errorEv.target = this;
- this.dispatchEvent(errorEv);
-
- const closeEv = new CloseEvent("close");
- closeEv.target = this;
- this.dispatchEvent(closeEv);
- });
- }
-
- get CONNECTING() {
- return CONNECTING;
- }
- get OPEN() {
- return OPEN;
- }
- get CLOSING() {
- return CLOSING;
- }
- get CLOSED() {
- return CLOSED;
- }
-
- get readyState() {
- return this.#readyState;
- }
-
- #extensions = "";
- #protocol = "";
- #url = "";
- #rid;
-
- get extensions() {
- return this.#extensions;
- }
- get protocol() {
- return this.#protocol;
- }
-
- #binaryType = "blob";
- get binaryType() {
- return this.#binaryType;
- }
- set binaryType(value) {
- if (value === "blob" || value === "arraybuffer") {
- this.#binaryType = value;
- }
- }
- #bufferedAmount = 0;
- get bufferedAmount() {
- return this.#bufferedAmount;
- }
-
- get url() {
- return this.#url;
- }
-
- send(data) {
- requiredArguments("WebSocket.send", arguments.length, 1);
-
- if (this.#readyState != OPEN) {
- throw Error("readyState not OPEN");
- }
-
- const sendTypedArray = (ta) => {
- this.#bufferedAmount += ta.size;
- core.opAsync("op_ws_send", {
- rid: this.#rid,
- kind: "binary",
- }, ta).then(() => {
- this.#bufferedAmount -= ta.size;
- });
- };
-
- if (data instanceof Blob) {
- data.slice().arrayBuffer().then((ab) =>
- sendTypedArray(new DataView(ab))
- );
- } else if (
- data instanceof Int8Array || data instanceof Int16Array ||
- data instanceof Int32Array || data instanceof Uint8Array ||
- data instanceof Uint16Array || data instanceof Uint32Array ||
- data instanceof Uint8ClampedArray || data instanceof Float32Array ||
- data instanceof Float64Array || data instanceof DataView
- ) {
- sendTypedArray(data);
- } else if (data instanceof ArrayBuffer) {
- sendTypedArray(new DataView(data));
- } else {
- const string = String(data);
- const encoder = new TextEncoder();
- const d = encoder.encode(string);
- this.#bufferedAmount += d.size;
- core.opAsync("op_ws_send", {
- rid: this.#rid,
- kind: "text",
- text: string,
- }).then(() => {
- this.#bufferedAmount -= d.size;
- });
- }
- }
-
- close(code, reason) {
- if (code && !(code === 1000 || (3000 <= code && code < 5000))) {
- throw new DOMException(
- "The close code must be either 1000 or in the range of 3000 to 4999.",
- "NotSupportedError",
- );
- }
-
- const encoder = new TextEncoder();
- if (reason && encoder.encode(reason).byteLength > 123) {
- throw new DOMException(
- "The close reason may not be longer than 123 bytes.",
- "SyntaxError",
- );
- }
-
- if (this.#readyState === CONNECTING) {
- this.#readyState = CLOSING;
- } else if (this.#readyState === OPEN) {
- this.#readyState = CLOSING;
-
- core.opAsync("op_ws_close", {
- rid: this.#rid,
- code,
- reason,
- }).then(() => {
- this.#readyState = CLOSED;
- const event = new CloseEvent("close", {
- wasClean: true,
- code,
- reason,
- });
- event.target = this;
- this.dispatchEvent(event);
- tryClose(this.#rid);
- });
- }
- }
-
- async #eventLoop() {
- while (this.#readyState === OPEN) {
- const { kind, value } = await core.opAsync(
- "op_ws_next_event",
- this.#rid,
- );
-
- switch (kind) {
- case "string": {
- const event = new MessageEvent("message", {
- data: value,
- origin: this.#url,
- });
- event.target = this;
- this.dispatchEvent(event);
- break;
- }
- case "binary": {
- let data;
-
- if (this.binaryType === "blob") {
- data = new Blob([value]);
- } else {
- data = value.buffer;
- }
-
- const event = new MessageEvent("message", {
- data,
- origin: this.#url,
- });
- event.target = this;
- this.dispatchEvent(event);
- break;
- }
- case "ping": {
- core.opAsync("op_ws_send", {
- rid: this.#rid,
- kind: "pong",
- });
- break;
- }
- case "close": {
- this.#readyState = CLOSED;
-
- const event = new CloseEvent("close", {
- wasClean: true,
- code: value.code,
- reason: value.reason,
- });
- event.target = this;
- this.dispatchEvent(event);
- tryClose(this.#rid);
- break;
- }
- case "error": {
- this.#readyState = CLOSED;
-
- const errorEv = new ErrorEvent("error");
- errorEv.target = this;
- this.dispatchEvent(errorEv);
-
- const closeEv = new CloseEvent("close");
- closeEv.target = this;
- this.dispatchEvent(closeEv);
- tryClose(this.#rid);
- break;
- }
- }
- }
- }
- }
-
- Object.defineProperties(WebSocket, {
- CONNECTING: {
- value: 0,
- },
- OPEN: {
- value: 1,
- },
- CLOSING: {
- value: 2,
- },
- CLOSED: {
- value: 3,
- },
- });
-
- defineEventHandler(WebSocket.prototype, "message");
- defineEventHandler(WebSocket.prototype, "error");
- defineEventHandler(WebSocket.prototype, "close");
- defineEventHandler(WebSocket.prototype, "open");
-
- window.__bootstrap.webSocket = { WebSocket };
-})(this);
diff --git a/op_crates/websocket/Cargo.toml b/op_crates/websocket/Cargo.toml
deleted file mode 100644
index 516401204..000000000
--- a/op_crates/websocket/Cargo.toml
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-[package]
-name = "deno_websocket"
-version = "0.10.0"
-edition = "2018"
-description = "Implementation of WebSocket API for Deno"
-authors = ["the Deno authors"]
-license = "MIT"
-readme = "README.md"
-repository = "https://github.com/denoland/deno"
-
-[lib]
-path = "lib.rs"
-
-[dependencies]
-deno_core = { version = "0.86.0", path = "../../core" }
-http = "0.2.3"
-serde = { version = "1.0.125", features = ["derive"] }
-tokio = { version = "1.4.0", features = ["full"] }
-tokio-rustls = "0.22.0"
-tokio-tungstenite = { version = "0.14.0", features = ["rustls-tls"] }
-webpki = "0.21.4"
-webpki-roots = "0.21.1"
diff --git a/op_crates/websocket/README.md b/op_crates/websocket/README.md
deleted file mode 100644
index d6495f397..000000000
--- a/op_crates/websocket/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# deno_websocket
-
-This op crate implements the websocket functions of Deno.
-
-Spec: https://html.spec.whatwg.org/multipage/web-sockets.html
diff --git a/op_crates/websocket/lib.deno_websocket.d.ts b/op_crates/websocket/lib.deno_websocket.d.ts
deleted file mode 100644
index 31e5782a6..000000000
--- a/op_crates/websocket/lib.deno_websocket.d.ts
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-// deno-lint-ignore-file no-explicit-any
-
-/// <reference no-default-lib="true" />
-/// <reference lib="esnext" />
-
-interface CloseEventInit extends EventInit {
- code?: number;
- reason?: string;
- wasClean?: boolean;
-}
-
-declare class CloseEvent extends Event {
- constructor(type: string, eventInitDict?: CloseEventInit);
- /**
- * Returns the WebSocket connection close code provided by the server.
- */
- readonly code: number;
- /**
- * Returns the WebSocket connection close reason provided by the server.
- */
- readonly reason: string;
- /**
- * Returns true if the connection closed cleanly; false otherwise.
- */
- readonly wasClean: boolean;
-}
-
-interface WebSocketEventMap {
- close: CloseEvent;
- error: Event;
- message: MessageEvent;
- open: Event;
-}
-
-/** Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection. */
-declare class WebSocket extends EventTarget {
- constructor(url: string, protocols?: string | string[]);
-
- static readonly CLOSED: number;
- static readonly CLOSING: number;
- static readonly CONNECTING: number;
- static readonly OPEN: number;
-
- /**
- * Returns a string that indicates how binary data from the WebSocket object is exposed to scripts:
- *
- * Can be set, to change how binary data is returned. The default is "blob".
- */
- binaryType: BinaryType;
- /**
- * Returns the number of bytes of application data (UTF-8 text and binary data) that have been queued using send() but not yet been transmitted to the network.
- *
- * If the WebSocket connection is closed, this attribute's value will only increase with each call to the send() method. (The number does not reset to zero once the connection closes.)
- */
- readonly bufferedAmount: number;
- /**
- * Returns the extensions selected by the server, if any.
- */
- readonly extensions: string;
- onclose: ((this: WebSocket, ev: CloseEvent) => any) | null;
- onerror: ((this: WebSocket, ev: Event | ErrorEvent) => any) | null;
- onmessage: ((this: WebSocket, ev: MessageEvent) => any) | null;
- onopen: ((this: WebSocket, ev: Event) => any) | null;
- /**
- * Returns the subprotocol selected by the server, if any. It can be used in conjunction with the array form of the constructor's second argument to perform subprotocol negotiation.
- */
- readonly protocol: string;
- /**
- * Returns the state of the WebSocket object's connection. It can have the values described below.
- */
- readonly readyState: number;
- /**
- * Returns the URL that was used to establish the WebSocket connection.
- */
- readonly url: string;
- /**
- * Closes the WebSocket connection, optionally using code as the the WebSocket connection close code and reason as the the WebSocket connection close reason.
- */
- close(code?: number, reason?: string): void;
- /**
- * Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
- */
- send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void;
- readonly CLOSED: number;
- readonly CLOSING: number;
- readonly CONNECTING: number;
- readonly OPEN: number;
- addEventListener<K extends keyof WebSocketEventMap>(
- type: K,
- listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any,
- options?: boolean | AddEventListenerOptions,
- ): void;
- addEventListener(
- type: string,
- listener: EventListenerOrEventListenerObject,
- options?: boolean | AddEventListenerOptions,
- ): void;
- removeEventListener<K extends keyof WebSocketEventMap>(
- type: K,
- listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any,
- options?: boolean | EventListenerOptions,
- ): void;
- removeEventListener(
- type: string,
- listener: EventListenerOrEventListenerObject,
- options?: boolean | EventListenerOptions,
- ): void;
-}
-
-type BinaryType = "arraybuffer" | "blob";
diff --git a/op_crates/websocket/lib.rs b/op_crates/websocket/lib.rs
deleted file mode 100644
index acf823775..000000000
--- a/op_crates/websocket/lib.rs
+++ /dev/null
@@ -1,367 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-use deno_core::error::bad_resource_id;
-use deno_core::error::invalid_hostname;
-use deno_core::error::null_opbuf;
-use deno_core::error::type_error;
-use deno_core::error::AnyError;
-use deno_core::futures::stream::SplitSink;
-use deno_core::futures::stream::SplitStream;
-use deno_core::futures::SinkExt;
-use deno_core::futures::StreamExt;
-use deno_core::include_js_files;
-use deno_core::op_async;
-use deno_core::op_sync;
-use deno_core::url;
-use deno_core::AsyncRefCell;
-use deno_core::CancelFuture;
-use deno_core::CancelHandle;
-use deno_core::Extension;
-use deno_core::OpState;
-use deno_core::RcRef;
-use deno_core::Resource;
-use deno_core::ResourceId;
-use deno_core::ZeroCopyBuf;
-
-use http::{Method, Request, Uri};
-use serde::Deserialize;
-use serde::Serialize;
-use std::borrow::Cow;
-use std::cell::RefCell;
-use std::io::BufReader;
-use std::io::Cursor;
-use std::path::PathBuf;
-use std::rc::Rc;
-use std::sync::Arc;
-use tokio::net::TcpStream;
-use tokio_rustls::{rustls::ClientConfig, TlsConnector};
-use tokio_tungstenite::tungstenite::Error as TungsteniteError;
-use tokio_tungstenite::tungstenite::{
- handshake::client::Response, protocol::frame::coding::CloseCode,
- protocol::CloseFrame, Message,
-};
-use tokio_tungstenite::MaybeTlsStream;
-use tokio_tungstenite::{client_async, WebSocketStream};
-use webpki::DNSNameRef;
-
-pub use tokio_tungstenite; // Re-export tokio_tungstenite
-
-#[derive(Clone)]
-pub struct WsCaData(pub Vec<u8>);
-#[derive(Clone)]
-pub struct WsUserAgent(pub String);
-
-pub trait WebSocketPermissions {
- fn check_net_url(&mut self, _url: &url::Url) -> Result<(), AnyError>;
-}
-
-/// For use with `op_websocket_*` when the user does not want permissions.
-pub struct NoWebSocketPermissions;
-
-impl WebSocketPermissions for NoWebSocketPermissions {
- fn check_net_url(&mut self, _url: &url::Url) -> Result<(), AnyError> {
- Ok(())
- }
-}
-
-type WsStream = WebSocketStream<MaybeTlsStream<TcpStream>>;
-struct WsStreamResource {
- tx: AsyncRefCell<SplitSink<WsStream, Message>>,
- rx: AsyncRefCell<SplitStream<WsStream>>,
- // When a `WsStreamResource` resource is closed, all pending 'read' ops are
- // canceled, while 'write' ops are allowed to complete. Therefore only
- // 'read' futures are attached to this cancel handle.
- cancel: CancelHandle,
-}
-
-impl Resource for WsStreamResource {
- fn name(&self) -> Cow<str> {
- "webSocketStream".into()
- }
-}
-
-impl WsStreamResource {}
-
-// This op is needed because creating a WS instance in JavaScript is a sync
-// operation and should throw error when permissions are not fulfilled,
-// but actual op that connects WS is async.
-pub fn op_ws_check_permission<WP>(
- state: &mut OpState,
- url: String,
- _zero_copy: Option<ZeroCopyBuf>,
-) -> Result<(), AnyError>
-where
- WP: WebSocketPermissions + 'static,
-{
- state
- .borrow_mut::<WP>()
- .check_net_url(&url::Url::parse(&url)?)?;
-
- Ok(())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CreateArgs {
- url: String,
- protocols: String,
-}
-
-#[derive(Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CreateResponse {
- success: bool,
- rid: Option<ResourceId>,
- protocol: Option<String>,
- extensions: Option<String>,
-}
-
-pub async fn op_ws_create<WP>(
- state: Rc<RefCell<OpState>>,
- args: CreateArgs,
- _bufs: Option<ZeroCopyBuf>,
-) -> Result<CreateResponse, AnyError>
-where
- WP: WebSocketPermissions + 'static,
-{
- {
- let mut s = state.borrow_mut();
- s.borrow_mut::<WP>()
- .check_net_url(&url::Url::parse(&args.url)?)
- .expect(
- "Permission check should have been done in op_ws_check_permission",
- );
- }
-
- let ws_ca_data = state.borrow().try_borrow::<WsCaData>().cloned();
- let user_agent = state.borrow().borrow::<WsUserAgent>().0.clone();
- let uri: Uri = args.url.parse()?;
- let mut request = Request::builder().method(Method::GET).uri(&uri);
-
- request = request.header("User-Agent", user_agent);
-
- if !args.protocols.is_empty() {
- request = request.header("Sec-WebSocket-Protocol", args.protocols);
- }
-
- let request = request.body(())?;
- let domain = &uri.host().unwrap().to_string();
- let port = &uri.port_u16().unwrap_or(match uri.scheme_str() {
- Some("wss") => 443,
- Some("ws") => 80,
- _ => unreachable!(),
- });
- let addr = format!("{}:{}", domain, port);
- let try_socket = TcpStream::connect(addr).await;
- let tcp_socket = match try_socket.map_err(TungsteniteError::Io) {
- Ok(socket) => socket,
- Err(_) => {
- return Ok(CreateResponse {
- success: false,
- rid: None,
- protocol: None,
- extensions: None,
- })
- }
- };
-
- let socket: MaybeTlsStream<TcpStream> = match uri.scheme_str() {
- Some("ws") => MaybeTlsStream::Plain(tcp_socket),
- Some("wss") => {
- let mut config = ClientConfig::new();
- config
- .root_store
- .add_server_trust_anchors(&webpki_roots::TLS_SERVER_ROOTS);
-
- if let Some(ws_ca_data) = ws_ca_data {
- let reader = &mut BufReader::new(Cursor::new(ws_ca_data.0));
- config.root_store.add_pem_file(reader).unwrap();
- }
-
- let tls_connector = TlsConnector::from(Arc::new(config));
- let dnsname = DNSNameRef::try_from_ascii_str(domain)
- .map_err(|_| invalid_hostname(domain))?;
- let tls_socket = tls_connector.connect(dnsname, tcp_socket).await?;
- MaybeTlsStream::Rustls(tls_socket)
- }
- _ => unreachable!(),
- };
-
- let (stream, response): (WsStream, Response) =
- client_async(request, socket).await.map_err(|err| {
- type_error(format!(
- "failed to connect to WebSocket: {}",
- err.to_string()
- ))
- })?;
-
- let (ws_tx, ws_rx) = stream.split();
- let resource = WsStreamResource {
- rx: AsyncRefCell::new(ws_rx),
- tx: AsyncRefCell::new(ws_tx),
- cancel: Default::default(),
- };
- let mut state = state.borrow_mut();
- let rid = state.resource_table.add(resource);
-
- let protocol = match response.headers().get("Sec-WebSocket-Protocol") {
- Some(header) => header.to_str().unwrap(),
- None => "",
- };
- let extensions = response
- .headers()
- .get_all("Sec-WebSocket-Extensions")
- .iter()
- .map(|header| header.to_str().unwrap())
- .collect::<String>();
- Ok(CreateResponse {
- success: true,
- rid: Some(rid),
- protocol: Some(protocol.to_string()),
- extensions: Some(extensions),
- })
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SendArgs {
- rid: ResourceId,
- kind: String,
- text: Option<String>,
-}
-
-pub async fn op_ws_send(
- state: Rc<RefCell<OpState>>,
- args: SendArgs,
- buf: Option<ZeroCopyBuf>,
-) -> Result<(), AnyError> {
- let msg = match args.kind.as_str() {
- "text" => Message::Text(args.text.unwrap()),
- "binary" => Message::Binary(buf.ok_or_else(null_opbuf)?.to_vec()),
- "pong" => Message::Pong(vec![]),
- _ => unreachable!(),
- };
- let rid = args.rid;
-
- let resource = state
- .borrow_mut()
- .resource_table
- .get::<WsStreamResource>(rid)
- .ok_or_else(bad_resource_id)?;
- let mut tx = RcRef::map(&resource, |r| &r.tx).borrow_mut().await;
- tx.send(msg).await?;
- Ok(())
-}
-
-#[derive(Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct CloseArgs {
- rid: ResourceId,
- code: Option<u16>,
- reason: Option<String>,
-}
-
-pub async fn op_ws_close(
- state: Rc<RefCell<OpState>>,
- args: CloseArgs,
- _bufs: Option<ZeroCopyBuf>,
-) -> Result<(), AnyError> {
- let rid = args.rid;
- let msg = Message::Close(args.code.map(|c| CloseFrame {
- code: CloseCode::from(c),
- reason: match args.reason {
- Some(reason) => Cow::from(reason),
- None => Default::default(),
- },
- }));
-
- let resource = state
- .borrow_mut()
- .resource_table
- .get::<WsStreamResource>(rid)
- .ok_or_else(bad_resource_id)?;
- let mut tx = RcRef::map(&resource, |r| &r.tx).borrow_mut().await;
- tx.send(msg).await?;
- Ok(())
-}
-
-#[derive(Serialize)]
-#[serde(tag = "kind", content = "value", rename_all = "camelCase")]
-pub enum NextEventResponse {
- String(String),
- Binary(ZeroCopyBuf),
- Close { code: u16, reason: String },
- Ping,
- Pong,
- Error,
- Closed,
-}
-
-pub async fn op_ws_next_event(
- state: Rc<RefCell<OpState>>,
- rid: ResourceId,
- _bufs: Option<ZeroCopyBuf>,
-) -> Result<NextEventResponse, AnyError> {
- let resource = state
- .borrow_mut()
- .resource_table
- .get::<WsStreamResource>(rid)
- .ok_or_else(bad_resource_id)?;
-
- let mut rx = RcRef::map(&resource, |r| &r.rx).borrow_mut().await;
- let cancel = RcRef::map(resource, |r| &r.cancel);
- let val = rx.next().or_cancel(cancel).await?;
- let res = match val {
- Some(Ok(Message::Text(text))) => NextEventResponse::String(text),
- Some(Ok(Message::Binary(data))) => NextEventResponse::Binary(data.into()),
- Some(Ok(Message::Close(Some(frame)))) => NextEventResponse::Close {
- code: frame.code.into(),
- reason: frame.reason.to_string(),
- },
- Some(Ok(Message::Close(None))) => NextEventResponse::Close {
- code: 1005,
- reason: String::new(),
- },
- Some(Ok(Message::Ping(_))) => NextEventResponse::Ping,
- Some(Ok(Message::Pong(_))) => NextEventResponse::Pong,
- Some(Err(_)) => NextEventResponse::Error,
- None => {
- state.borrow_mut().resource_table.close(rid).unwrap();
- NextEventResponse::Closed
- }
- };
- Ok(res)
-}
-
-pub fn init<P: WebSocketPermissions + 'static>(
- user_agent: String,
- ca_data: Option<Vec<u8>>,
-) -> Extension {
- Extension::builder()
- .js(include_js_files!(
- prefix "deno:op_crates/websocket",
- "01_websocket.js",
- ))
- .ops(vec![
- (
- "op_ws_check_permission",
- op_sync(op_ws_check_permission::<P>),
- ),
- ("op_ws_create", op_async(op_ws_create::<P>)),
- ("op_ws_send", op_async(op_ws_send)),
- ("op_ws_close", op_async(op_ws_close)),
- ("op_ws_next_event", op_async(op_ws_next_event)),
- ])
- .state(move |state| {
- state.put::<WsUserAgent>(WsUserAgent(user_agent.clone()));
- if let Some(ca_data) = ca_data.clone() {
- state.put::<WsCaData>(WsCaData(ca_data));
- }
- Ok(())
- })
- .build()
-}
-
-pub fn get_declaration() -> PathBuf {
- PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("lib.deno_websocket.d.ts")
-}