@novnc/novnc
Advanced tools
Comparing version 1.4.0-beta-gb76358e to 1.4.0-g10ee10c
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -9,4 +9,4 @@ value: true | ||
var Log = _interopRequireWildcard(require("./util/logging.js")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
@@ -16,3 +16,3 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// From: http://hg.mozilla.org/mozilla-central/raw-file/ec10630b1a54/js/src/devtools/jint/sunspider/string-base64.js | ||
var _default = { | ||
var _default = exports["default"] = { | ||
/* Convert data (an array of integers) to a Base64 string. */ | ||
@@ -102,3 +102,2 @@ toBase64Table: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split(''), | ||
}; | ||
/* End of Base64 namespace */ | ||
exports["default"] = _default; | ||
/* End of Base64 namespace */ |
@@ -7,8 +7,8 @@ "use strict"; | ||
exports["default"] = void 0; | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } | ||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } | ||
/* | ||
@@ -22,7 +22,7 @@ * noVNC: HTML5 VNC client | ||
*/ | ||
var CopyRectDecoder = /*#__PURE__*/function () { | ||
var CopyRectDecoder = exports["default"] = /*#__PURE__*/function () { | ||
function CopyRectDecoder() { | ||
_classCallCheck(this, CopyRectDecoder); | ||
} | ||
_createClass(CopyRectDecoder, [{ | ||
return _createClass(CopyRectDecoder, [{ | ||
key: "decodeRect", | ||
@@ -42,4 +42,2 @@ value: function decodeRect(x, y, width, height, sock, display, depth) { | ||
}]); | ||
return CopyRectDecoder; | ||
}(); | ||
exports["default"] = CopyRectDecoder; | ||
}(); |
@@ -8,11 +8,18 @@ "use strict"; | ||
var Log = _interopRequireWildcard(require("../util/logging.js")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
var HextileDecoder = /*#__PURE__*/function () { | ||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } | ||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* | ||
* noVNC: HTML5 VNC client | ||
* Copyright (C) 2019 The noVNC Authors | ||
* Licensed under MPL 2.0 (see LICENSE.txt) | ||
* | ||
* See README.md for usage and integration instructions. | ||
* | ||
*/ | ||
var HextileDecoder = exports["default"] = /*#__PURE__*/function () { | ||
function HextileDecoder() { | ||
@@ -24,3 +31,3 @@ _classCallCheck(this, HextileDecoder); | ||
} | ||
_createClass(HextileDecoder, [{ | ||
return _createClass(HextileDecoder, [{ | ||
key: "decodeRect", | ||
@@ -39,5 +46,3 @@ value: function decodeRect(x, y, width, height, sock, display, depth) { | ||
} | ||
var rQ = sock.rQ; | ||
var rQi = sock.rQi; | ||
var subencoding = rQ[rQi]; // Peek | ||
var subencoding = sock.rQpeek8(); | ||
if (subencoding > 30) { | ||
@@ -75,3 +80,3 @@ // Raw | ||
} | ||
var subrects = rQ[rQi + bytes - 1]; // Peek | ||
var subrects = sock.rQpeekBytes(bytes).at(-1); | ||
if (subencoding & 0x10) { | ||
@@ -90,3 +95,3 @@ // SubrectsColoured | ||
// We know the encoding and have a whole tile | ||
rQi++; | ||
sock.rQshift8(); | ||
if (subencoding === 0) { | ||
@@ -102,18 +107,16 @@ if (this._lastsubencoding & 0x01) { | ||
var pixels = tw * th; | ||
var data = sock.rQshiftBytes(pixels * 4, false); | ||
// Max sure the image is fully opaque | ||
for (var i = 0; i < pixels; i++) { | ||
rQ[rQi + i * 4 + 3] = 255; | ||
data[i * 4 + 3] = 255; | ||
} | ||
display.blitImage(tx, ty, tw, th, rQ, rQi); | ||
rQi += bytes - 1; | ||
display.blitImage(tx, ty, tw, th, data, 0); | ||
} else { | ||
if (subencoding & 0x02) { | ||
// Background | ||
this._background = [rQ[rQi], rQ[rQi + 1], rQ[rQi + 2], rQ[rQi + 3]]; | ||
rQi += 4; | ||
this._background = new Uint8Array(sock.rQshiftBytes(4)); | ||
} | ||
if (subencoding & 0x04) { | ||
// Foreground | ||
this._foreground = [rQ[rQi], rQ[rQi + 1], rQ[rQi + 2], rQ[rQi + 3]]; | ||
rQi += 4; | ||
this._foreground = new Uint8Array(sock.rQshiftBytes(4)); | ||
} | ||
@@ -123,4 +126,3 @@ this._startTile(tx, ty, tw, th, this._background); | ||
// AnySubrects | ||
var _subrects = rQ[rQi]; | ||
rQi++; | ||
var _subrects = sock.rQshift8(); | ||
for (var s = 0; s < _subrects; s++) { | ||
@@ -130,13 +132,10 @@ var color = void 0; | ||
// SubrectsColoured | ||
color = [rQ[rQi], rQ[rQi + 1], rQ[rQi + 2], rQ[rQi + 3]]; | ||
rQi += 4; | ||
color = sock.rQshiftBytes(4); | ||
} else { | ||
color = this._foreground; | ||
} | ||
var xy = rQ[rQi]; | ||
rQi++; | ||
var xy = sock.rQshift8(); | ||
var sx = xy >> 4; | ||
var sy = xy & 0x0f; | ||
var wh = rQ[rQi]; | ||
rQi++; | ||
var wh = sock.rQshift8(); | ||
var sw = (wh >> 4) + 1; | ||
@@ -149,3 +148,2 @@ var sh = (wh & 0x0f) + 1; | ||
} | ||
sock.rQi = rQi; | ||
this._lastsubencoding = subencoding; | ||
@@ -206,4 +204,2 @@ this._tiles--; | ||
}]); | ||
return HextileDecoder; | ||
}(); | ||
exports["default"] = HextileDecoder; | ||
}(); |
@@ -7,8 +7,15 @@ "use strict"; | ||
exports["default"] = void 0; | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } | ||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } | ||
/* | ||
@@ -22,3 +29,3 @@ * noVNC: HTML5 VNC client | ||
*/ | ||
var JPEGDecoder = /*#__PURE__*/function () { | ||
var JPEGDecoder = exports["default"] = /*#__PURE__*/function () { | ||
function JPEGDecoder() { | ||
@@ -28,125 +35,144 @@ _classCallCheck(this, JPEGDecoder); | ||
// and Huffman tables, so we need to cache them. | ||
this._quantTables = []; | ||
this._huffmanTables = []; | ||
this._cachedQuantTables = []; | ||
this._cachedHuffmanTables = []; | ||
this._jpegLength = 0; | ||
this._segments = []; | ||
} | ||
_createClass(JPEGDecoder, [{ | ||
return _createClass(JPEGDecoder, [{ | ||
key: "decodeRect", | ||
value: function decodeRect(x, y, width, height, sock, display, depth) { | ||
// A rect of JPEG encodings is simply a JPEG file | ||
if (!this._parseJPEG(sock.rQslice(0))) { | ||
return false; | ||
while (true) { | ||
var segment = this._readSegment(sock); | ||
if (segment === null) { | ||
return false; | ||
} | ||
this._segments.push(segment); | ||
// End of image? | ||
if (segment[1] === 0xD9) { | ||
break; | ||
} | ||
} | ||
var data = sock.rQshiftBytes(this._jpegLength); | ||
if (this._quantTables.length != 0 && this._huffmanTables.length != 0) { | ||
// If there are quantization tables and Huffman tables in the JPEG | ||
// image, we can directly render it. | ||
display.imageRect(x, y, width, height, "image/jpeg", data); | ||
return true; | ||
} else { | ||
// Otherwise we need to insert cached tables. | ||
var sofIndex = this._segments.findIndex(function (x) { | ||
return x[1] == 0xC0 || x[1] == 0xC2; | ||
}); | ||
if (sofIndex == -1) { | ||
throw new Error("Illegal JPEG image without SOF"); | ||
var huffmanTables = []; | ||
var quantTables = []; | ||
var _iterator = _createForOfIteratorHelper(this._segments), | ||
_step; | ||
try { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var _segment = _step.value; | ||
var type = _segment[1]; | ||
if (type === 0xC4) { | ||
// Huffman tables | ||
huffmanTables.push(_segment); | ||
} else if (type === 0xDB) { | ||
// Quantization tables | ||
quantTables.push(_segment); | ||
} | ||
} | ||
var segments = this._segments.slice(0, sofIndex); | ||
segments = segments.concat(this._quantTables.length ? this._quantTables : this._cachedQuantTables); | ||
segments.push(this._segments[sofIndex]); | ||
segments = segments.concat(this._huffmanTables.length ? this._huffmanTables : this._cachedHuffmanTables, this._segments.slice(sofIndex + 1)); | ||
var length = 0; | ||
for (var i = 0; i < segments.length; i++) { | ||
length += segments[i].length; | ||
} catch (err) { | ||
_iterator.e(err); | ||
} finally { | ||
_iterator.f(); | ||
} | ||
var sofIndex = this._segments.findIndex(function (x) { | ||
return x[1] == 0xC0 || x[1] == 0xC2; | ||
}); | ||
if (sofIndex == -1) { | ||
throw new Error("Illegal JPEG image without SOF"); | ||
} | ||
if (quantTables.length === 0) { | ||
var _this$_segments; | ||
(_this$_segments = this._segments).splice.apply(_this$_segments, [sofIndex + 1, 0].concat(_toConsumableArray(this._cachedQuantTables))); | ||
} | ||
if (huffmanTables.length === 0) { | ||
var _this$_segments2; | ||
(_this$_segments2 = this._segments).splice.apply(_this$_segments2, [sofIndex + 1, 0].concat(_toConsumableArray(this._cachedHuffmanTables))); | ||
} | ||
var length = 0; | ||
var _iterator2 = _createForOfIteratorHelper(this._segments), | ||
_step2; | ||
try { | ||
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { | ||
var _segment2 = _step2.value; | ||
length += _segment2.length; | ||
} | ||
var _data = new Uint8Array(length); | ||
length = 0; | ||
for (var _i = 0; _i < segments.length; _i++) { | ||
_data.set(segments[_i], length); | ||
length += segments[_i].length; | ||
} catch (err) { | ||
_iterator2.e(err); | ||
} finally { | ||
_iterator2.f(); | ||
} | ||
var data = new Uint8Array(length); | ||
length = 0; | ||
var _iterator3 = _createForOfIteratorHelper(this._segments), | ||
_step3; | ||
try { | ||
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { | ||
var _segment3 = _step3.value; | ||
data.set(_segment3, length); | ||
length += _segment3.length; | ||
} | ||
display.imageRect(x, y, width, height, "image/jpeg", _data); | ||
return true; | ||
} catch (err) { | ||
_iterator3.e(err); | ||
} finally { | ||
_iterator3.f(); | ||
} | ||
display.imageRect(x, y, width, height, "image/jpeg", data); | ||
if (huffmanTables.length !== 0) { | ||
this._cachedHuffmanTables = huffmanTables; | ||
} | ||
if (quantTables.length !== 0) { | ||
this._cachedQuantTables = quantTables; | ||
} | ||
this._segments = []; | ||
return true; | ||
} | ||
}, { | ||
key: "_parseJPEG", | ||
value: function _parseJPEG(buffer) { | ||
if (this._quantTables.length != 0) { | ||
this._cachedQuantTables = this._quantTables; | ||
key: "_readSegment", | ||
value: function _readSegment(sock) { | ||
if (sock.rQwait("JPEG", 2)) { | ||
return null; | ||
} | ||
if (this._huffmanTables.length != 0) { | ||
this._cachedHuffmanTables = this._huffmanTables; | ||
var marker = sock.rQshift8(); | ||
if (marker != 0xFF) { | ||
throw new Error("Illegal JPEG marker received (byte: " + marker + ")"); | ||
} | ||
this._quantTables = []; | ||
this._huffmanTables = []; | ||
this._segments = []; | ||
var i = 0; | ||
var bufferLength = buffer.length; | ||
while (true) { | ||
var j = i; | ||
if (j + 2 > bufferLength) { | ||
return false; | ||
} | ||
if (buffer[j] != 0xFF) { | ||
throw new Error("Illegal JPEG marker received (byte: " + buffer[j] + ")"); | ||
} | ||
var type = buffer[j + 1]; | ||
j += 2; | ||
if (type == 0xD9) { | ||
this._jpegLength = j; | ||
this._segments.push(buffer.slice(i, j)); | ||
return true; | ||
} else if (type == 0xDA) { | ||
// start of scan | ||
var hasFoundEndOfScan = false; | ||
for (var k = j + 3; k + 1 < bufferLength; k++) { | ||
if (buffer[k] == 0xFF && buffer[k + 1] != 0x00 && !(buffer[k + 1] >= 0xD0 && buffer[k + 1] <= 0xD7)) { | ||
j = k; | ||
hasFoundEndOfScan = true; | ||
break; | ||
} | ||
var type = sock.rQshift8(); | ||
if (type >= 0xD0 && type <= 0xD9 || type == 0x01) { | ||
// No length after marker | ||
return new Uint8Array([marker, type]); | ||
} | ||
if (sock.rQwait("JPEG", 2, 2)) { | ||
return null; | ||
} | ||
var length = sock.rQshift16(); | ||
if (length < 2) { | ||
throw new Error("Illegal JPEG length received (length: " + length + ")"); | ||
} | ||
if (sock.rQwait("JPEG", length - 2, 4)) { | ||
return null; | ||
} | ||
var extra = 0; | ||
if (type === 0xDA) { | ||
// start of scan | ||
extra += 2; | ||
while (true) { | ||
if (sock.rQwait("JPEG", length - 2 + extra, 4)) { | ||
return null; | ||
} | ||
if (!hasFoundEndOfScan) { | ||
return false; | ||
var data = sock.rQpeekBytes(length - 2 + extra, false); | ||
if (data.at(-2) === 0xFF && data.at(-1) !== 0x00 && !(data.at(-1) >= 0xD0 && data.at(-1) <= 0xD7)) { | ||
extra -= 2; | ||
break; | ||
} | ||
this._segments.push(buffer.slice(i, j)); | ||
i = j; | ||
continue; | ||
} else if (type >= 0xD0 && type < 0xD9 || type == 0x01) { | ||
// No length after marker | ||
this._segments.push(buffer.slice(i, j)); | ||
i = j; | ||
continue; | ||
extra++; | ||
} | ||
if (j + 2 > bufferLength) { | ||
return false; | ||
} | ||
var length = (buffer[j] << 8) + buffer[j + 1] - 2; | ||
if (length < 0) { | ||
throw new Error("Illegal JPEG length received (length: " + length + ")"); | ||
} | ||
j += 2; | ||
if (j + length > bufferLength) { | ||
return false; | ||
} | ||
j += length; | ||
var segment = buffer.slice(i, j); | ||
if (type == 0xC4) { | ||
// Huffman tables | ||
this._huffmanTables.push(segment); | ||
} else if (type == 0xDB) { | ||
// Quantization tables | ||
this._quantTables.push(segment); | ||
} | ||
this._segments.push(segment); | ||
i = j; | ||
} | ||
var segment = new Uint8Array(2 + length + extra); | ||
segment[0] = marker; | ||
segment[1] = type; | ||
segment[2] = length >> 8; | ||
segment[3] = length; | ||
segment.set(sock.rQshiftBytes(length - 2 + extra, false), 4); | ||
return segment; | ||
} | ||
}]); | ||
return JPEGDecoder; | ||
}(); | ||
exports["default"] = JPEGDecoder; | ||
}(); |
@@ -7,8 +7,8 @@ "use strict"; | ||
exports["default"] = void 0; | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } | ||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } | ||
/* | ||
@@ -22,3 +22,3 @@ * noVNC: HTML5 VNC client | ||
*/ | ||
var RawDecoder = /*#__PURE__*/function () { | ||
var RawDecoder = exports["default"] = /*#__PURE__*/function () { | ||
function RawDecoder() { | ||
@@ -28,3 +28,3 @@ _classCallCheck(this, RawDecoder); | ||
} | ||
_createClass(RawDecoder, [{ | ||
return _createClass(RawDecoder, [{ | ||
key: "decodeRect", | ||
@@ -40,39 +40,31 @@ value: function decodeRect(x, y, width, height, sock, display, depth) { | ||
var bytesPerLine = width * pixelSize; | ||
if (sock.rQwait("RAW", bytesPerLine)) { | ||
return false; | ||
} | ||
var curY = y + (height - this._lines); | ||
var currHeight = Math.min(this._lines, Math.floor(sock.rQlen / bytesPerLine)); | ||
var pixels = width * currHeight; | ||
var data = sock.rQ; | ||
var index = sock.rQi; | ||
while (this._lines > 0) { | ||
if (sock.rQwait("RAW", bytesPerLine)) { | ||
return false; | ||
} | ||
var curY = y + (height - this._lines); | ||
var data = sock.rQshiftBytes(bytesPerLine, false); | ||
// Convert data if needed | ||
if (depth == 8) { | ||
var newdata = new Uint8Array(pixels * 4); | ||
for (var i = 0; i < pixels; i++) { | ||
newdata[i * 4 + 0] = (data[index + i] >> 0 & 0x3) * 255 / 3; | ||
newdata[i * 4 + 1] = (data[index + i] >> 2 & 0x3) * 255 / 3; | ||
newdata[i * 4 + 2] = (data[index + i] >> 4 & 0x3) * 255 / 3; | ||
newdata[i * 4 + 3] = 255; | ||
// Convert data if needed | ||
if (depth == 8) { | ||
var newdata = new Uint8Array(width * 4); | ||
for (var i = 0; i < width; i++) { | ||
newdata[i * 4 + 0] = (data[i] >> 0 & 0x3) * 255 / 3; | ||
newdata[i * 4 + 1] = (data[i] >> 2 & 0x3) * 255 / 3; | ||
newdata[i * 4 + 2] = (data[i] >> 4 & 0x3) * 255 / 3; | ||
newdata[i * 4 + 3] = 255; | ||
} | ||
data = newdata; | ||
} | ||
data = newdata; | ||
index = 0; | ||
} | ||
// Max sure the image is fully opaque | ||
for (var _i = 0; _i < pixels; _i++) { | ||
data[index + _i * 4 + 3] = 255; | ||
// Max sure the image is fully opaque | ||
for (var _i = 0; _i < width; _i++) { | ||
data[_i * 4 + 3] = 255; | ||
} | ||
display.blitImage(x, curY, width, 1, data, 0); | ||
this._lines--; | ||
} | ||
display.blitImage(x, curY, width, currHeight, data, index); | ||
sock.rQskipBytes(currHeight * bytesPerLine); | ||
this._lines -= currHeight; | ||
if (this._lines > 0) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
}]); | ||
return RawDecoder; | ||
}(); | ||
exports["default"] = RawDecoder; | ||
}(); |
@@ -7,8 +7,8 @@ "use strict"; | ||
exports["default"] = void 0; | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } | ||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } | ||
/* | ||
@@ -22,3 +22,3 @@ * noVNC: HTML5 VNC client | ||
*/ | ||
var RREDecoder = /*#__PURE__*/function () { | ||
var RREDecoder = exports["default"] = /*#__PURE__*/function () { | ||
function RREDecoder() { | ||
@@ -28,3 +28,3 @@ _classCallCheck(this, RREDecoder); | ||
} | ||
_createClass(RREDecoder, [{ | ||
return _createClass(RREDecoder, [{ | ||
key: "decodeRect", | ||
@@ -55,4 +55,2 @@ value: function decodeRect(x, y, width, height, sock, display, depth) { | ||
}]); | ||
return RREDecoder; | ||
}(); | ||
exports["default"] = RREDecoder; | ||
}(); |
@@ -10,11 +10,19 @@ "use strict"; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
var TightDecoder = /*#__PURE__*/function () { | ||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } | ||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* | ||
* noVNC: HTML5 VNC client | ||
* Copyright (C) 2019 The noVNC Authors | ||
* (c) 2012 Michael Tinglof, Joe Balaz, Les Piech (Mercuri.ca) | ||
* Licensed under MPL 2.0 (see LICENSE.txt) | ||
* | ||
* See README.md for usage and integration instructions. | ||
* | ||
*/ | ||
var TightDecoder = exports["default"] = /*#__PURE__*/function () { | ||
function TightDecoder() { | ||
@@ -32,3 +40,3 @@ _classCallCheck(this, TightDecoder); | ||
} | ||
_createClass(TightDecoder, [{ | ||
return _createClass(TightDecoder, [{ | ||
key: "decodeRect", | ||
@@ -76,6 +84,4 @@ value: function decodeRect(x, y, width, height, sock, display, depth) { | ||
} | ||
var rQi = sock.rQi; | ||
var rQ = sock.rQ; | ||
display.fillRect(x, y, width, height, [rQ[rQi], rQ[rQi + 1], rQ[rQi + 2]], false); | ||
sock.rQskipBytes(3); | ||
var pixel = sock.rQshiftBytes(3); | ||
display.fillRect(x, y, width, height, pixel, false); | ||
return true; | ||
@@ -164,3 +170,2 @@ } | ||
} | ||
display.blitImage(x, y, width, height, rgbx, 0, false); | ||
@@ -291,3 +296,3 @@ return true; | ||
} | ||
var data = sock.rQshiftBytes(this._len); | ||
var data = sock.rQshiftBytes(this._len, false); | ||
this._len = 0; | ||
@@ -305,4 +310,2 @@ return data; | ||
}]); | ||
return TightDecoder; | ||
}(); | ||
exports["default"] = TightDecoder; | ||
}(); |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -13,19 +13,25 @@ value: true | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } | ||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } | ||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
var TightPNGDecoder = /*#__PURE__*/function (_TightDecoder) { | ||
_inherits(TightPNGDecoder, _TightDecoder); | ||
var _super = _createSuper(TightPNGDecoder); | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } /* | ||
* noVNC: HTML5 VNC client | ||
* Copyright (C) 2019 The noVNC Authors | ||
* Licensed under MPL 2.0 (see LICENSE.txt) | ||
* | ||
* See README.md for usage and integration instructions. | ||
* | ||
*/ | ||
var TightPNGDecoder = exports["default"] = /*#__PURE__*/function (_TightDecoder) { | ||
function TightPNGDecoder() { | ||
_classCallCheck(this, TightPNGDecoder); | ||
return _super.apply(this, arguments); | ||
return _callSuper(this, TightPNGDecoder, arguments); | ||
} | ||
_createClass(TightPNGDecoder, [{ | ||
_inherits(TightPNGDecoder, _TightDecoder); | ||
return _createClass(TightPNGDecoder, [{ | ||
key: "_pngRect", | ||
@@ -46,4 +52,2 @@ value: function _pngRect(x, y, width, height, sock, display, depth) { | ||
}]); | ||
return TightPNGDecoder; | ||
}(_tight["default"]); | ||
exports["default"] = TightPNGDecoder; | ||
}(_tight["default"]); |
@@ -9,11 +9,18 @@ "use strict"; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } | ||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* | ||
* noVNC: HTML5 VNC client | ||
* Copyright (C) 2021 The noVNC Authors | ||
* Licensed under MPL 2.0 (see LICENSE.txt) | ||
* | ||
* See README.md for usage and integration instructions. | ||
* | ||
*/ | ||
var ZRLE_TILE_WIDTH = 64; | ||
var ZRLE_TILE_HEIGHT = 64; | ||
var ZRLEDecoder = /*#__PURE__*/function () { | ||
var ZRLEDecoder = exports["default"] = /*#__PURE__*/function () { | ||
function ZRLEDecoder() { | ||
@@ -26,3 +33,3 @@ _classCallCheck(this, ZRLEDecoder); | ||
} | ||
_createClass(ZRLEDecoder, [{ | ||
return _createClass(ZRLEDecoder, [{ | ||
key: "decodeRect", | ||
@@ -39,3 +46,3 @@ value: function decodeRect(x, y, width, height, sock, display, depth) { | ||
} | ||
var data = sock.rQshiftBytes(this._length); | ||
var data = sock.rQshiftBytes(this._length, false); | ||
this._inflator.setInput(data); | ||
@@ -95,3 +102,2 @@ for (var ty = y; ty < y + height; ty += ZRLE_TILE_HEIGHT) { | ||
} | ||
return data; | ||
@@ -190,4 +196,2 @@ } | ||
}]); | ||
return ZRLEDecoder; | ||
}(); | ||
exports["default"] = ZRLEDecoder; | ||
}(); |
@@ -10,9 +10,15 @@ "use strict"; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
var Deflator = /*#__PURE__*/function () { | ||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } | ||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* | ||
* noVNC: HTML5 VNC client | ||
* Copyright (C) 2020 The noVNC Authors | ||
* Licensed under MPL 2.0 (see LICENSE.txt) | ||
* | ||
* See README.md for usage and integration instructions. | ||
*/ | ||
var Deflator = exports["default"] = /*#__PURE__*/function () { | ||
function Deflator() { | ||
@@ -23,6 +29,5 @@ _classCallCheck(this, Deflator); | ||
this.outputBuffer = new Uint8Array(this.chunkSize); | ||
this.windowBits = 5; | ||
(0, _deflate2.deflateInit)(this.strm, this.windowBits); | ||
(0, _deflate2.deflateInit)(this.strm, _deflate2.Z_DEFAULT_COMPRESSION); | ||
} | ||
_createClass(Deflator, [{ | ||
return _createClass(Deflator, [{ | ||
key: "deflate", | ||
@@ -85,4 +90,2 @@ value: function deflate(inData) { | ||
}]); | ||
return Deflator; | ||
}(); | ||
exports["default"] = Deflator; | ||
}(); |
@@ -11,11 +11,17 @@ "use strict"; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
var Display = /*#__PURE__*/function () { | ||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } | ||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* | ||
* noVNC: HTML5 VNC client | ||
* Copyright (C) 2019 The noVNC Authors | ||
* Licensed under MPL 2.0 (see LICENSE.txt) | ||
* | ||
* See README.md for usage and integration instructions. | ||
*/ | ||
var Display = exports["default"] = /*#__PURE__*/function () { | ||
function Display(target) { | ||
@@ -25,3 +31,3 @@ _classCallCheck(this, Display); | ||
this._renderQ = []; // queue drawing actions for in-oder rendering | ||
this._flushing = false; | ||
this._flushPromise = null; | ||
@@ -71,10 +77,6 @@ // the full frame buffer (logical canvas) size | ||
this._clipViewport = false; | ||
// ===== EVENT HANDLERS ===== | ||
this.onflush = function () {}; // A flush request has finished | ||
} | ||
// ===== PROPERTIES ===== | ||
_createClass(Display, [{ | ||
return _createClass(Display, [{ | ||
key: "scale", | ||
@@ -310,6 +312,12 @@ get: function get() { | ||
value: function flush() { | ||
var _this = this; | ||
if (this._renderQ.length === 0) { | ||
this.onflush(); | ||
return Promise.resolve(); | ||
} else { | ||
this._flushing = true; | ||
if (this._flushPromise === null) { | ||
this._flushPromise = new Promise(function (resolve) { | ||
_this._flushResolve = resolve; | ||
}); | ||
} | ||
return this._flushPromise; | ||
} | ||
@@ -516,10 +524,9 @@ } | ||
} | ||
if (this._renderQ.length === 0 && this._flushing) { | ||
this._flushing = false; | ||
this.onflush(); | ||
if (this._renderQ.length === 0 && this._flushPromise !== null) { | ||
this._flushResolve(); | ||
this._flushPromise = null; | ||
this._flushResolve = null; | ||
} | ||
} | ||
}]); | ||
return Display; | ||
}(); | ||
exports["default"] = Display; | ||
}(); |
@@ -16,3 +16,3 @@ "use strict"; | ||
var encodings = { | ||
var encodings = exports.encodings = { | ||
encodingRaw: 0, | ||
@@ -32,2 +32,3 @@ encodingCopyRect: 1, | ||
pseudoEncodingQEMUExtendedKeyEvent: -258, | ||
pseudoEncodingQEMULedEvent: -261, | ||
pseudoEncodingDesktopName: -307, | ||
@@ -43,3 +44,2 @@ pseudoEncodingExtendedDesktopSize: -308, | ||
}; | ||
exports.encodings = encodings; | ||
function encodingName(num) { | ||
@@ -46,0 +46,0 @@ switch (num) { |
@@ -10,9 +10,15 @@ "use strict"; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
var Inflate = /*#__PURE__*/function () { | ||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } | ||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* | ||
* noVNC: HTML5 VNC client | ||
* Copyright (C) 2020 The noVNC Authors | ||
* Licensed under MPL 2.0 (see LICENSE.txt) | ||
* | ||
* See README.md for usage and integration instructions. | ||
*/ | ||
var Inflate = exports["default"] = /*#__PURE__*/function () { | ||
function Inflate() { | ||
@@ -23,6 +29,5 @@ _classCallCheck(this, Inflate); | ||
this.strm.output = new Uint8Array(this.chunkSize); | ||
this.windowBits = 5; | ||
(0, _inflate2.inflateInit)(this.strm, this.windowBits); | ||
(0, _inflate2.inflateInit)(this.strm); | ||
} | ||
_createClass(Inflate, [{ | ||
return _createClass(Inflate, [{ | ||
key: "setInput", | ||
@@ -74,4 +79,2 @@ value: function setInput(data) { | ||
}]); | ||
return Inflate; | ||
}(); | ||
exports["default"] = Inflate; | ||
}(); |
@@ -313,3 +313,2 @@ "use strict"; | ||
addNumpad("9", _keysym["default"].XK_9, _keysym["default"].XK_KP_9); | ||
var _default = DOMKeyTable; | ||
exports["default"] = _default; | ||
var _default = exports["default"] = DOMKeyTable; |
@@ -22,3 +22,3 @@ "use strict"; | ||
/* eslint-disable key-spacing */ | ||
var _default = { | ||
var _default = exports["default"] = { | ||
// 3.1.1.1. Writing System Keys | ||
@@ -128,3 +128,2 @@ | ||
'WakeUp': 'WakeUp' | ||
}; | ||
exports["default"] = _default; | ||
}; |
@@ -7,8 +7,8 @@ "use strict"; | ||
exports["default"] = void 0; | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } | ||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } | ||
/* | ||
@@ -46,3 +46,3 @@ * noVNC: HTML5 VNC client | ||
var GH_TWOTOUCH_TIMEOUT = 50; | ||
var GestureHandler = /*#__PURE__*/function () { | ||
var GestureHandler = exports["default"] = /*#__PURE__*/function () { | ||
function GestureHandler() { | ||
@@ -60,3 +60,3 @@ _classCallCheck(this, GestureHandler); | ||
} | ||
_createClass(GestureHandler, [{ | ||
return _createClass(GestureHandler, [{ | ||
key: "attach", | ||
@@ -576,4 +576,2 @@ value: function attach(target) { | ||
}]); | ||
return GestureHandler; | ||
}(); | ||
exports["default"] = GestureHandler; | ||
}(); |
@@ -13,14 +13,18 @@ "use strict"; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } | ||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* | ||
* noVNC: HTML5 VNC client | ||
* Copyright (C) 2019 The noVNC Authors | ||
* Licensed under MPL 2.0 or any later version (see LICENSE.txt) | ||
*/ | ||
// | ||
// Keyboard event handler | ||
// | ||
var Keyboard = /*#__PURE__*/function () { | ||
var Keyboard = exports["default"] = /*#__PURE__*/function () { | ||
function Keyboard(target) { | ||
@@ -46,5 +50,7 @@ _classCallCheck(this, Keyboard); | ||
// ===== PRIVATE METHODS ===== | ||
_createClass(Keyboard, [{ | ||
return _createClass(Keyboard, [{ | ||
key: "_sendKeyEvent", | ||
value: function _sendKeyEvent(keysym, code, down) { | ||
var numlock = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; | ||
var capslock = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null; | ||
if (down) { | ||
@@ -59,4 +65,4 @@ this._keyDownList[code] = keysym; | ||
} | ||
Log.Debug("onkeyevent " + (down ? "down" : "up") + ", keysym: " + keysym, ", code: " + code); | ||
this.onkeyevent(keysym, code, down); | ||
Log.Debug("onkeyevent " + (down ? "down" : "up") + ", keysym: " + keysym, ", code: " + code + ", numlock: " + numlock + ", capslock: " + capslock); | ||
this.onkeyevent(keysym, code, down, numlock, capslock); | ||
} | ||
@@ -97,3 +103,11 @@ }, { | ||
var keysym = KeyboardUtil.getKeysym(e); | ||
var numlock = e.getModifierState('NumLock'); | ||
var capslock = e.getModifierState('CapsLock'); | ||
// getModifierState for NumLock is not supported on mac and ios and always returns false. | ||
// Set to null to indicate unknown/unsupported instead. | ||
if (browser.isMac() || browser.isIOS()) { | ||
numlock = null; | ||
} | ||
// Windows doesn't have a proper AltGr, but handles it using | ||
@@ -117,3 +131,3 @@ // fake Ctrl+Alt. However the remote end might not be Windows, | ||
} else { | ||
this._sendKeyEvent(_keysym["default"].XK_Control_L, "ControlLeft", true); | ||
this._sendKeyEvent(_keysym["default"].XK_Control_L, "ControlLeft", true, numlock, capslock); | ||
} | ||
@@ -129,4 +143,4 @@ } | ||
// after each other | ||
this._sendKeyEvent(keysym, code, true); | ||
this._sendKeyEvent(keysym, code, false); | ||
this._sendKeyEvent(keysym, code, true, numlock, capslock); | ||
this._sendKeyEvent(keysym, code, false, numlock, capslock); | ||
} | ||
@@ -167,4 +181,4 @@ (0, _events.stopEvent)(e); | ||
if ((browser.isMac() || browser.isIOS()) && e.metaKey && code !== 'MetaLeft' && code !== 'MetaRight') { | ||
this._sendKeyEvent(keysym, code, true); | ||
this._sendKeyEvent(keysym, code, false); | ||
this._sendKeyEvent(keysym, code, true, numlock, capslock); | ||
this._sendKeyEvent(keysym, code, false, numlock, capslock); | ||
(0, _events.stopEvent)(e); | ||
@@ -179,4 +193,4 @@ return; | ||
if ((browser.isMac() || browser.isIOS()) && code === 'CapsLock') { | ||
this._sendKeyEvent(_keysym["default"].XK_Caps_Lock, 'CapsLock', true); | ||
this._sendKeyEvent(_keysym["default"].XK_Caps_Lock, 'CapsLock', false); | ||
this._sendKeyEvent(_keysym["default"].XK_Caps_Lock, 'CapsLock', true, numlock, capslock); | ||
this._sendKeyEvent(_keysym["default"].XK_Caps_Lock, 'CapsLock', false, numlock, capslock); | ||
(0, _events.stopEvent)(e); | ||
@@ -190,4 +204,4 @@ return; | ||
if (browser.isWindows() && jpBadKeys.includes(keysym)) { | ||
this._sendKeyEvent(keysym, code, true); | ||
this._sendKeyEvent(keysym, code, false); | ||
this._sendKeyEvent(keysym, code, true, numlock, capslock); | ||
this._sendKeyEvent(keysym, code, false, numlock, capslock); | ||
(0, _events.stopEvent)(e); | ||
@@ -205,3 +219,3 @@ return; | ||
} | ||
this._sendKeyEvent(keysym, code, true); | ||
this._sendKeyEvent(keysym, code, true, numlock, capslock); | ||
} | ||
@@ -288,4 +302,2 @@ }, { | ||
}]); | ||
return Keyboard; | ||
}(); | ||
exports["default"] = Keyboard; | ||
}(); |
@@ -8,3 +8,3 @@ "use strict"; | ||
/* eslint-disable key-spacing */ | ||
var _default = { | ||
var _default = exports["default"] = { | ||
XK_VoidSymbol: 0xffffff, | ||
@@ -879,3 +879,2 @@ /* Void symbol */ | ||
XF86XK_LogGrabInfo: 0x1008FE25 | ||
}; | ||
exports["default"] = _default; | ||
}; |
@@ -1335,3 +1335,3 @@ "use strict"; | ||
}; | ||
var _default = { | ||
var _default = exports["default"] = { | ||
lookup: function lookup(u) { | ||
@@ -1352,3 +1352,2 @@ // Latin-1 is one-to-one mapping | ||
} | ||
}; | ||
exports["default"] = _default; | ||
}; |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -16,4 +16,4 @@ value: true | ||
var browser = _interopRequireWildcard(require("../util/browser.js")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -95,3 +95,3 @@ // Get 'KeyboardEvent.code', handling legacy browsers | ||
// Are we getting a proper key value? | ||
if (evt.key !== undefined) { | ||
if (evt.key !== undefined && evt.key !== 'Unidentified') { | ||
// Mozilla isn't fully in sync with the spec yet | ||
@@ -98,0 +98,0 @@ switch (evt.key) { |
@@ -16,3 +16,3 @@ "use strict"; | ||
*/ | ||
var _default = { | ||
var _default = exports["default"] = { | ||
0x08: 'Backspace', | ||
@@ -122,3 +122,2 @@ 0x09: 'Tab', | ||
0xe1: 'AltRight' // Only when it is AltGraph | ||
}; | ||
exports["default"] = _default; | ||
}; |
@@ -13,3 +13,3 @@ "use strict"; | ||
*/ | ||
var _default = { | ||
var _default = exports["default"] = { | ||
"Again": 0xe005, | ||
@@ -344,3 +344,2 @@ /* html:Again (Again) -> linux:129 (KEY_AGAIN) -> atset1:57349 */ | ||
"WakeUp": 0xe063 /* html:WakeUp (WakeUp) -> linux:143 (KEY_WAKEUP) -> atset1:57443 */ | ||
}; | ||
exports["default"] = _default; | ||
}; |
844
lib/ra2.js
@@ -6,16 +6,16 @@ "use strict"; | ||
}); | ||
exports["default"] = exports.RSACipher = exports.RA2Cipher = exports.AESEAXCipher = void 0; | ||
var _base = _interopRequireDefault(require("./base64.js")); | ||
exports["default"] = void 0; | ||
var _strings = require("./util/strings.js"); | ||
var _eventtarget = _interopRequireDefault(require("./util/eventtarget.js")); | ||
var _crypto = _interopRequireDefault(require("./crypto/crypto.js")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } | ||
@@ -26,20 +26,14 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
var AESEAXCipher = /*#__PURE__*/function () { | ||
function AESEAXCipher() { | ||
_classCallCheck(this, AESEAXCipher); | ||
this._rawKey = null; | ||
this._ctrKey = null; | ||
this._cbcKey = null; | ||
this._zeroBlock = new Uint8Array(16); | ||
this._prefixBlock0 = this._zeroBlock; | ||
this._prefixBlock1 = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]); | ||
this._prefixBlock2 = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2]); | ||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } | ||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } | ||
var RA2Cipher = /*#__PURE__*/function () { | ||
function RA2Cipher() { | ||
_classCallCheck(this, RA2Cipher); | ||
this._cipher = null; | ||
this._counter = new Uint8Array(16); | ||
} | ||
_createClass(AESEAXCipher, [{ | ||
key: "_encryptBlock", | ||
return _createClass(RA2Cipher, [{ | ||
key: "setKey", | ||
value: function () { | ||
var _encryptBlock2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(block) { | ||
var encrypted; | ||
var _setKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(key) { | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
@@ -49,10 +43,8 @@ while (1) switch (_context.prev = _context.next) { | ||
_context.next = 2; | ||
return window.crypto.subtle.encrypt({ | ||
name: "AES-CBC", | ||
iv: this._zeroBlock | ||
}, this._cbcKey, block); | ||
return _crypto["default"].importKey("raw", key, { | ||
name: "AES-EAX" | ||
}, false, ["encrypt, decrypt"]); | ||
case 2: | ||
encrypted = _context.sent; | ||
return _context.abrupt("return", new Uint8Array(encrypted).slice(0, 16)); | ||
case 4: | ||
this._cipher = _context.sent; | ||
case 3: | ||
case "end": | ||
@@ -63,178 +55,3 @@ return _context.stop(); | ||
})); | ||
function _encryptBlock(_x) { | ||
return _encryptBlock2.apply(this, arguments); | ||
} | ||
return _encryptBlock; | ||
}() | ||
}, { | ||
key: "_initCMAC", | ||
value: function () { | ||
var _initCMAC2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { | ||
var k1, k2, v, i, lut; | ||
return _regeneratorRuntime().wrap(function _callee2$(_context2) { | ||
while (1) switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_context2.next = 2; | ||
return this._encryptBlock(this._zeroBlock); | ||
case 2: | ||
k1 = _context2.sent; | ||
k2 = new Uint8Array(16); | ||
v = k1[0] >>> 6; | ||
for (i = 0; i < 15; i++) { | ||
k2[i] = k1[i + 1] >> 6 | k1[i] << 2; | ||
k1[i] = k1[i + 1] >> 7 | k1[i] << 1; | ||
} | ||
lut = [0x0, 0x87, 0x0e, 0x89]; | ||
k2[14] ^= v >>> 1; | ||
k2[15] = k1[15] << 2 ^ lut[v]; | ||
k1[15] = k1[15] << 1 ^ lut[v >> 1]; | ||
this._k1 = k1; | ||
this._k2 = k2; | ||
case 12: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
}, _callee2, this); | ||
})); | ||
function _initCMAC() { | ||
return _initCMAC2.apply(this, arguments); | ||
} | ||
return _initCMAC; | ||
}() | ||
}, { | ||
key: "_encryptCTR", | ||
value: function () { | ||
var _encryptCTR2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(data, counter) { | ||
var encrypted; | ||
return _regeneratorRuntime().wrap(function _callee3$(_context3) { | ||
while (1) switch (_context3.prev = _context3.next) { | ||
case 0: | ||
_context3.next = 2; | ||
return window.crypto.subtle.encrypt({ | ||
"name": "AES-CTR", | ||
counter: counter, | ||
length: 128 | ||
}, this._ctrKey, data); | ||
case 2: | ||
encrypted = _context3.sent; | ||
return _context3.abrupt("return", new Uint8Array(encrypted)); | ||
case 4: | ||
case "end": | ||
return _context3.stop(); | ||
} | ||
}, _callee3, this); | ||
})); | ||
function _encryptCTR(_x2, _x3) { | ||
return _encryptCTR2.apply(this, arguments); | ||
} | ||
return _encryptCTR; | ||
}() | ||
}, { | ||
key: "_decryptCTR", | ||
value: function () { | ||
var _decryptCTR2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(data, counter) { | ||
var decrypted; | ||
return _regeneratorRuntime().wrap(function _callee4$(_context4) { | ||
while (1) switch (_context4.prev = _context4.next) { | ||
case 0: | ||
_context4.next = 2; | ||
return window.crypto.subtle.decrypt({ | ||
"name": "AES-CTR", | ||
counter: counter, | ||
length: 128 | ||
}, this._ctrKey, data); | ||
case 2: | ||
decrypted = _context4.sent; | ||
return _context4.abrupt("return", new Uint8Array(decrypted)); | ||
case 4: | ||
case "end": | ||
return _context4.stop(); | ||
} | ||
}, _callee4, this); | ||
})); | ||
function _decryptCTR(_x4, _x5) { | ||
return _decryptCTR2.apply(this, arguments); | ||
} | ||
return _decryptCTR; | ||
}() | ||
}, { | ||
key: "_computeCMAC", | ||
value: function () { | ||
var _computeCMAC2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(data, prefixBlock) { | ||
var n, m, r, cbcData, i, _i, cbcEncrypted, mac; | ||
return _regeneratorRuntime().wrap(function _callee5$(_context5) { | ||
while (1) switch (_context5.prev = _context5.next) { | ||
case 0: | ||
if (!(prefixBlock.length !== 16)) { | ||
_context5.next = 2; | ||
break; | ||
} | ||
return _context5.abrupt("return", null); | ||
case 2: | ||
n = Math.floor(data.length / 16); | ||
m = Math.ceil(data.length / 16); | ||
r = data.length - n * 16; | ||
cbcData = new Uint8Array((m + 1) * 16); | ||
cbcData.set(prefixBlock); | ||
cbcData.set(data, 16); | ||
if (r === 0) { | ||
for (i = 0; i < 16; i++) { | ||
cbcData[n * 16 + i] ^= this._k1[i]; | ||
} | ||
} else { | ||
cbcData[(n + 1) * 16 + r] = 0x80; | ||
for (_i = 0; _i < 16; _i++) { | ||
cbcData[(n + 1) * 16 + _i] ^= this._k2[_i]; | ||
} | ||
} | ||
_context5.next = 11; | ||
return window.crypto.subtle.encrypt({ | ||
name: "AES-CBC", | ||
iv: this._zeroBlock | ||
}, this._cbcKey, cbcData); | ||
case 11: | ||
cbcEncrypted = _context5.sent; | ||
cbcEncrypted = new Uint8Array(cbcEncrypted); | ||
mac = cbcEncrypted.slice(cbcEncrypted.length - 32, cbcEncrypted.length - 16); | ||
return _context5.abrupt("return", mac); | ||
case 15: | ||
case "end": | ||
return _context5.stop(); | ||
} | ||
}, _callee5, this); | ||
})); | ||
function _computeCMAC(_x6, _x7) { | ||
return _computeCMAC2.apply(this, arguments); | ||
} | ||
return _computeCMAC; | ||
}() | ||
}, { | ||
key: "setKey", | ||
value: function () { | ||
var _setKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(key) { | ||
return _regeneratorRuntime().wrap(function _callee6$(_context6) { | ||
while (1) switch (_context6.prev = _context6.next) { | ||
case 0: | ||
this._rawKey = key; | ||
_context6.next = 3; | ||
return window.crypto.subtle.importKey("raw", key, { | ||
"name": "AES-CTR" | ||
}, false, ["encrypt", "decrypt"]); | ||
case 3: | ||
this._ctrKey = _context6.sent; | ||
_context6.next = 6; | ||
return window.crypto.subtle.importKey("raw", key, { | ||
"name": "AES-CBC" | ||
}, false, ["encrypt", "decrypt"]); | ||
case 6: | ||
this._cbcKey = _context6.sent; | ||
_context6.next = 9; | ||
return this._initCMAC(); | ||
case 9: | ||
case "end": | ||
return _context6.stop(); | ||
} | ||
}, _callee6, this); | ||
})); | ||
function setKey(_x8) { | ||
function setKey(_x) { | ||
return _setKey.apply(this, arguments); | ||
@@ -245,147 +62,18 @@ } | ||
}, { | ||
key: "encrypt", | ||
value: function () { | ||
var _encrypt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(message, associatedData, nonce) { | ||
var nCMAC, encrypted, adCMAC, mac, i, res; | ||
return _regeneratorRuntime().wrap(function _callee7$(_context7) { | ||
while (1) switch (_context7.prev = _context7.next) { | ||
case 0: | ||
_context7.next = 2; | ||
return this._computeCMAC(nonce, this._prefixBlock0); | ||
case 2: | ||
nCMAC = _context7.sent; | ||
_context7.next = 5; | ||
return this._encryptCTR(message, nCMAC); | ||
case 5: | ||
encrypted = _context7.sent; | ||
_context7.next = 8; | ||
return this._computeCMAC(associatedData, this._prefixBlock1); | ||
case 8: | ||
adCMAC = _context7.sent; | ||
_context7.next = 11; | ||
return this._computeCMAC(encrypted, this._prefixBlock2); | ||
case 11: | ||
mac = _context7.sent; | ||
for (i = 0; i < 16; i++) { | ||
mac[i] ^= nCMAC[i] ^ adCMAC[i]; | ||
} | ||
res = new Uint8Array(16 + encrypted.length); | ||
res.set(encrypted); | ||
res.set(mac, encrypted.length); | ||
return _context7.abrupt("return", res); | ||
case 17: | ||
case "end": | ||
return _context7.stop(); | ||
} | ||
}, _callee7, this); | ||
})); | ||
function encrypt(_x9, _x10, _x11) { | ||
return _encrypt.apply(this, arguments); | ||
} | ||
return encrypt; | ||
}() | ||
}, { | ||
key: "decrypt", | ||
value: function () { | ||
var _decrypt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(encrypted, associatedData, nonce, mac) { | ||
var nCMAC, adCMAC, computedMac, i, _i2, res; | ||
return _regeneratorRuntime().wrap(function _callee8$(_context8) { | ||
while (1) switch (_context8.prev = _context8.next) { | ||
case 0: | ||
_context8.next = 2; | ||
return this._computeCMAC(nonce, this._prefixBlock0); | ||
case 2: | ||
nCMAC = _context8.sent; | ||
_context8.next = 5; | ||
return this._computeCMAC(associatedData, this._prefixBlock1); | ||
case 5: | ||
adCMAC = _context8.sent; | ||
_context8.next = 8; | ||
return this._computeCMAC(encrypted, this._prefixBlock2); | ||
case 8: | ||
computedMac = _context8.sent; | ||
for (i = 0; i < 16; i++) { | ||
computedMac[i] ^= nCMAC[i] ^ adCMAC[i]; | ||
} | ||
if (!(computedMac.length !== mac.length)) { | ||
_context8.next = 12; | ||
break; | ||
} | ||
return _context8.abrupt("return", null); | ||
case 12: | ||
_i2 = 0; | ||
case 13: | ||
if (!(_i2 < mac.length)) { | ||
_context8.next = 19; | ||
break; | ||
} | ||
if (!(computedMac[_i2] !== mac[_i2])) { | ||
_context8.next = 16; | ||
break; | ||
} | ||
return _context8.abrupt("return", null); | ||
case 16: | ||
_i2++; | ||
_context8.next = 13; | ||
break; | ||
case 19: | ||
_context8.next = 21; | ||
return this._decryptCTR(encrypted, nCMAC); | ||
case 21: | ||
res = _context8.sent; | ||
return _context8.abrupt("return", res); | ||
case 23: | ||
case "end": | ||
return _context8.stop(); | ||
} | ||
}, _callee8, this); | ||
})); | ||
function decrypt(_x12, _x13, _x14, _x15) { | ||
return _decrypt.apply(this, arguments); | ||
} | ||
return decrypt; | ||
}() | ||
}]); | ||
return AESEAXCipher; | ||
}(); | ||
exports.AESEAXCipher = AESEAXCipher; | ||
var RA2Cipher = /*#__PURE__*/function () { | ||
function RA2Cipher() { | ||
_classCallCheck(this, RA2Cipher); | ||
this._cipher = new AESEAXCipher(); | ||
this._counter = new Uint8Array(16); | ||
} | ||
_createClass(RA2Cipher, [{ | ||
key: "setKey", | ||
value: function () { | ||
var _setKey2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(key) { | ||
return _regeneratorRuntime().wrap(function _callee9$(_context9) { | ||
while (1) switch (_context9.prev = _context9.next) { | ||
case 0: | ||
_context9.next = 2; | ||
return this._cipher.setKey(key); | ||
case 2: | ||
case "end": | ||
return _context9.stop(); | ||
} | ||
}, _callee9, this); | ||
})); | ||
function setKey(_x16) { | ||
return _setKey2.apply(this, arguments); | ||
} | ||
return setKey; | ||
}() | ||
}, { | ||
key: "makeMessage", | ||
value: function () { | ||
var _makeMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(message) { | ||
var _makeMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(message) { | ||
var ad, encrypted, i, res; | ||
return _regeneratorRuntime().wrap(function _callee10$(_context10) { | ||
while (1) switch (_context10.prev = _context10.next) { | ||
return _regeneratorRuntime().wrap(function _callee2$(_context2) { | ||
while (1) switch (_context2.prev = _context2.next) { | ||
case 0: | ||
ad = new Uint8Array([(message.length & 0xff00) >>> 8, message.length & 0xff]); | ||
_context10.next = 3; | ||
return this._cipher.encrypt(message, ad, this._counter); | ||
_context2.next = 3; | ||
return _crypto["default"].encrypt({ | ||
name: "AES-EAX", | ||
iv: this._counter, | ||
additionalData: ad | ||
}, this._cipher, message); | ||
case 3: | ||
encrypted = _context10.sent; | ||
encrypted = _context2.sent; | ||
for (i = 0; i < 16 && this._counter[i]++ === 255; i++); | ||
@@ -395,10 +83,10 @@ res = new Uint8Array(message.length + 2 + 16); | ||
res.set(encrypted, 2); | ||
return _context10.abrupt("return", res); | ||
return _context2.abrupt("return", res); | ||
case 9: | ||
case "end": | ||
return _context10.stop(); | ||
return _context2.stop(); | ||
} | ||
}, _callee10, this); | ||
}, _callee2, this); | ||
})); | ||
function makeMessage(_x17) { | ||
function makeMessage(_x2) { | ||
return _makeMessage.apply(this, arguments); | ||
@@ -411,21 +99,25 @@ } | ||
value: function () { | ||
var _receiveMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(length, encrypted, mac) { | ||
var _receiveMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(length, encrypted) { | ||
var ad, res, i; | ||
return _regeneratorRuntime().wrap(function _callee11$(_context11) { | ||
while (1) switch (_context11.prev = _context11.next) { | ||
return _regeneratorRuntime().wrap(function _callee3$(_context3) { | ||
while (1) switch (_context3.prev = _context3.next) { | ||
case 0: | ||
ad = new Uint8Array([(length & 0xff00) >>> 8, length & 0xff]); | ||
_context11.next = 3; | ||
return this._cipher.decrypt(encrypted, ad, this._counter, mac); | ||
_context3.next = 3; | ||
return _crypto["default"].decrypt({ | ||
name: "AES-EAX", | ||
iv: this._counter, | ||
additionalData: ad | ||
}, this._cipher, encrypted); | ||
case 3: | ||
res = _context11.sent; | ||
res = _context3.sent; | ||
for (i = 0; i < 16 && this._counter[i]++ === 255; i++); | ||
return _context11.abrupt("return", res); | ||
return _context3.abrupt("return", res); | ||
case 6: | ||
case "end": | ||
return _context11.stop(); | ||
return _context3.stop(); | ||
} | ||
}, _callee11, this); | ||
}, _callee3, this); | ||
})); | ||
function receiveMessage(_x18, _x19, _x20) { | ||
function receiveMessage(_x3, _x4) { | ||
return _receiveMessage.apply(this, arguments); | ||
@@ -436,200 +128,8 @@ } | ||
}]); | ||
return RA2Cipher; | ||
}(); | ||
exports.RA2Cipher = RA2Cipher; | ||
var RSACipher = /*#__PURE__*/function () { | ||
function RSACipher(keyLength) { | ||
_classCallCheck(this, RSACipher); | ||
this._key = null; | ||
this._keyLength = keyLength; | ||
this._keyBytes = Math.ceil(keyLength / 8); | ||
this._n = null; | ||
this._e = null; | ||
this._d = null; | ||
this._nBigInt = null; | ||
this._eBigInt = null; | ||
this._dBigInt = null; | ||
} | ||
_createClass(RSACipher, [{ | ||
key: "_base64urlDecode", | ||
value: function _base64urlDecode(data) { | ||
data = data.replace(/-/g, "+").replace(/_/g, "/"); | ||
data = data.padEnd(Math.ceil(data.length / 4) * 4, "="); | ||
return _base["default"].decode(data); | ||
} | ||
}, { | ||
key: "_u8ArrayToBigInt", | ||
value: function _u8ArrayToBigInt(arr) { | ||
var hex = '0x'; | ||
for (var i = 0; i < arr.length; i++) { | ||
hex += arr[i].toString(16).padStart(2, '0'); | ||
} | ||
return BigInt(hex); | ||
} | ||
}, { | ||
key: "_padArray", | ||
value: function _padArray(arr, length) { | ||
var res = new Uint8Array(length); | ||
res.set(arr, length - arr.length); | ||
return res; | ||
} | ||
}, { | ||
key: "_bigIntToU8Array", | ||
value: function _bigIntToU8Array(bigint) { | ||
var padLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | ||
var hex = bigint.toString(16); | ||
if (padLength === 0) { | ||
padLength = Math.ceil(hex.length / 2) * 2; | ||
} | ||
hex = hex.padStart(padLength * 2, '0'); | ||
var length = hex.length / 2; | ||
var arr = new Uint8Array(length); | ||
for (var i = 0; i < length; i++) { | ||
arr[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16); | ||
} | ||
return arr; | ||
} | ||
}, { | ||
key: "_modPow", | ||
value: function _modPow(b, e, m) { | ||
if (m === 1n) { | ||
return 0; | ||
} | ||
var r = 1n; | ||
b = b % m; | ||
while (e > 0) { | ||
if (e % 2n === 1n) { | ||
r = r * b % m; | ||
} | ||
e = e / 2n; | ||
b = b * b % m; | ||
} | ||
return r; | ||
} | ||
}, { | ||
key: "generateKey", | ||
value: function () { | ||
var _generateKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() { | ||
var privateKey; | ||
return _regeneratorRuntime().wrap(function _callee12$(_context12) { | ||
while (1) switch (_context12.prev = _context12.next) { | ||
case 0: | ||
_context12.next = 2; | ||
return window.crypto.subtle.generateKey({ | ||
name: "RSA-OAEP", | ||
modulusLength: this._keyLength, | ||
publicExponent: new Uint8Array([0x01, 0x00, 0x01]), | ||
hash: { | ||
name: "SHA-256" | ||
} | ||
}, true, ["encrypt", "decrypt"]); | ||
case 2: | ||
this._key = _context12.sent; | ||
_context12.next = 5; | ||
return window.crypto.subtle.exportKey("jwk", this._key.privateKey); | ||
case 5: | ||
privateKey = _context12.sent; | ||
this._n = this._padArray(this._base64urlDecode(privateKey.n), this._keyBytes); | ||
this._nBigInt = this._u8ArrayToBigInt(this._n); | ||
this._e = this._padArray(this._base64urlDecode(privateKey.e), this._keyBytes); | ||
this._eBigInt = this._u8ArrayToBigInt(this._e); | ||
this._d = this._padArray(this._base64urlDecode(privateKey.d), this._keyBytes); | ||
this._dBigInt = this._u8ArrayToBigInt(this._d); | ||
case 12: | ||
case "end": | ||
return _context12.stop(); | ||
} | ||
}, _callee12, this); | ||
})); | ||
function generateKey() { | ||
return _generateKey.apply(this, arguments); | ||
} | ||
return generateKey; | ||
}() | ||
}, { | ||
key: "setPublicKey", | ||
value: function setPublicKey(n, e) { | ||
if (n.length !== this._keyBytes || e.length !== this._keyBytes) { | ||
return; | ||
} | ||
this._n = new Uint8Array(this._keyBytes); | ||
this._e = new Uint8Array(this._keyBytes); | ||
this._n.set(n); | ||
this._e.set(e); | ||
this._nBigInt = this._u8ArrayToBigInt(this._n); | ||
this._eBigInt = this._u8ArrayToBigInt(this._e); | ||
} | ||
}, { | ||
key: "encrypt", | ||
value: function encrypt(message) { | ||
if (message.length > this._keyBytes - 11) { | ||
return null; | ||
} | ||
var ps = new Uint8Array(this._keyBytes - message.length - 3); | ||
window.crypto.getRandomValues(ps); | ||
for (var i = 0; i < ps.length; i++) { | ||
ps[i] = Math.floor(ps[i] * 254 / 255 + 1); | ||
} | ||
var em = new Uint8Array(this._keyBytes); | ||
em[1] = 0x02; | ||
em.set(ps, 2); | ||
em.set(message, ps.length + 3); | ||
var emBigInt = this._u8ArrayToBigInt(em); | ||
var c = this._modPow(emBigInt, this._eBigInt, this._nBigInt); | ||
return this._bigIntToU8Array(c, this._keyBytes); | ||
} | ||
}, { | ||
key: "decrypt", | ||
value: function decrypt(message) { | ||
if (message.length !== this._keyBytes) { | ||
return null; | ||
} | ||
var msgBigInt = this._u8ArrayToBigInt(message); | ||
var emBigInt = this._modPow(msgBigInt, this._dBigInt, this._nBigInt); | ||
var em = this._bigIntToU8Array(emBigInt, this._keyBytes); | ||
if (em[0] !== 0x00 || em[1] !== 0x02) { | ||
return null; | ||
} | ||
var i = 2; | ||
for (; i < em.length; i++) { | ||
if (em[i] === 0x00) { | ||
break; | ||
} | ||
} | ||
if (i === em.length) { | ||
return null; | ||
} | ||
return em.slice(i + 1, em.length); | ||
} | ||
}, { | ||
key: "keyLength", | ||
get: function get() { | ||
return this._keyLength; | ||
} | ||
}, { | ||
key: "n", | ||
get: function get() { | ||
return this._n; | ||
} | ||
}, { | ||
key: "e", | ||
get: function get() { | ||
return this._e; | ||
} | ||
}, { | ||
key: "d", | ||
get: function get() { | ||
return this._d; | ||
} | ||
}]); | ||
return RSACipher; | ||
}(); | ||
exports.RSACipher = RSACipher; | ||
var RSAAESAuthenticationState = /*#__PURE__*/function (_EventTargetMixin) { | ||
_inherits(RSAAESAuthenticationState, _EventTargetMixin); | ||
var _super = _createSuper(RSAAESAuthenticationState); | ||
var RSAAESAuthenticationState = exports["default"] = /*#__PURE__*/function (_EventTargetMixin) { | ||
function RSAAESAuthenticationState(sock, getCredentials) { | ||
var _this; | ||
_classCallCheck(this, RSAAESAuthenticationState); | ||
_this = _super.call(this); | ||
_this = _callSuper(this, RSAAESAuthenticationState); | ||
_this._hasStarted = false; | ||
@@ -646,3 +146,4 @@ _this._checkSock = null; | ||
} | ||
_createClass(RSAAESAuthenticationState, [{ | ||
_inherits(RSAAESAuthenticationState, _EventTargetMixin); | ||
return _createClass(RSAAESAuthenticationState, [{ | ||
key: "_waitSockAsync", | ||
@@ -742,16 +243,16 @@ value: function _waitSockAsync(len) { | ||
value: function () { | ||
var _negotiateRA2neAuthAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() { | ||
var serverKeyLengthBuffer, serverKeyLength, serverKeyBytes, serverN, serverE, serverRSACipher, serverPublickey, clientKeyLength, clientKeyBytes, clientRSACipher, clientN, clientE, clientPublicKey, clientRandom, clientEncryptedRandom, clientRandomMessage, serverEncryptedRandom, serverRandom, clientSessionKey, serverSessionKey, clientCipher, serverCipher, serverHash, clientHash, serverHashReceived, i, subtype, username, password, credentials, _i3, _i4; | ||
return _regeneratorRuntime().wrap(function _callee13$(_context13) { | ||
while (1) switch (_context13.prev = _context13.next) { | ||
var _negotiateRA2neAuthAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() { | ||
var serverKeyLengthBuffer, serverKeyLength, serverKeyBytes, serverN, serverE, serverRSACipher, serverPublickey, approveKey, clientKeyLength, clientKeyBytes, clientRSACipher, clientExportedRSAKey, clientN, clientE, clientPublicKey, clientRandom, clientEncryptedRandom, clientRandomMessage, serverEncryptedRandom, serverRandom, clientSessionKey, serverSessionKey, clientCipher, serverCipher, serverHash, clientHash, serverHashReceived, i, subtype, waitCredentials, username, password, credentials, _i, _i2; | ||
return _regeneratorRuntime().wrap(function _callee4$(_context4) { | ||
while (1) switch (_context4.prev = _context4.next) { | ||
case 0: | ||
this._hasStarted = true; | ||
// 1: Receive server public key | ||
_context13.next = 3; | ||
_context4.next = 3; | ||
return this._waitSockAsync(4); | ||
case 3: | ||
serverKeyLengthBuffer = this._sock.rQslice(0, 4); | ||
serverKeyLengthBuffer = this._sock.rQpeekBytes(4); | ||
serverKeyLength = this._sock.rQshift32(); | ||
if (!(serverKeyLength < 1024)) { | ||
_context13.next = 9; | ||
_context4.next = 9; | ||
break; | ||
@@ -762,3 +263,3 @@ } | ||
if (!(serverKeyLength > 8192)) { | ||
_context13.next = 11; | ||
_context4.next = 11; | ||
break; | ||
@@ -769,3 +270,3 @@ } | ||
serverKeyBytes = Math.ceil(serverKeyLength / 8); | ||
_context13.next = 14; | ||
_context4.next = 14; | ||
return this._waitSockAsync(serverKeyBytes * 2); | ||
@@ -775,4 +276,11 @@ case 14: | ||
serverE = this._sock.rQshiftBytes(serverKeyBytes); | ||
serverRSACipher = new RSACipher(serverKeyLength); | ||
serverRSACipher.setPublicKey(serverN, serverE); | ||
_context4.next = 18; | ||
return _crypto["default"].importKey("raw", { | ||
n: serverN, | ||
e: serverE | ||
}, { | ||
name: "RSA-PKCS1-v1_5" | ||
}, false, ["encrypt"]); | ||
case 18: | ||
serverRSACipher = _context4.sent; | ||
serverPublickey = new Uint8Array(4 + serverKeyBytes * 2); | ||
@@ -784,2 +292,3 @@ serverPublickey.set(serverKeyLengthBuffer); | ||
// verify server public key | ||
approveKey = this._waitApproveKeyAsync(); | ||
this.dispatchEvent(new CustomEvent("serververification", { | ||
@@ -791,14 +300,22 @@ detail: { | ||
})); | ||
_context13.next = 25; | ||
return this._waitApproveKeyAsync(); | ||
case 25: | ||
_context4.next = 27; | ||
return approveKey; | ||
case 27: | ||
// 2: Send client public key | ||
clientKeyLength = 2048; | ||
clientKeyBytes = Math.ceil(clientKeyLength / 8); | ||
clientRSACipher = new RSACipher(clientKeyLength); | ||
_context13.next = 30; | ||
return clientRSACipher.generateKey(); | ||
case 30: | ||
clientN = clientRSACipher.n; | ||
clientE = clientRSACipher.e; | ||
_context4.next = 31; | ||
return _crypto["default"].generateKey({ | ||
name: "RSA-PKCS1-v1_5", | ||
modulusLength: clientKeyLength, | ||
publicExponent: new Uint8Array([1, 0, 1]) | ||
}, true, ["encrypt"]); | ||
case 31: | ||
clientRSACipher = _context4.sent.privateKey; | ||
_context4.next = 34; | ||
return _crypto["default"].exportKey("raw", clientRSACipher); | ||
case 34: | ||
clientExportedRSAKey = _context4.sent; | ||
clientN = clientExportedRSAKey.n; | ||
clientE = clientExportedRSAKey.e; | ||
clientPublicKey = new Uint8Array(4 + clientKeyBytes * 2); | ||
@@ -811,3 +328,4 @@ clientPublicKey[0] = (clientKeyLength & 0xff000000) >>> 24; | ||
clientPublicKey.set(clientE, 4 + clientKeyBytes); | ||
this._sock.send(clientPublicKey); | ||
this._sock.sQpushBytes(clientPublicKey); | ||
this._sock.flush(); | ||
@@ -817,3 +335,8 @@ // 3: Send client random | ||
window.crypto.getRandomValues(clientRandom); | ||
clientEncryptedRandom = serverRSACipher.encrypt(clientRandom); | ||
_context4.next = 50; | ||
return _crypto["default"].encrypt({ | ||
name: "RSA-PKCS1-v1_5" | ||
}, serverRSACipher, clientRandom); | ||
case 50: | ||
clientEncryptedRandom = _context4.sent; | ||
clientRandomMessage = new Uint8Array(2 + serverKeyBytes); | ||
@@ -823,22 +346,28 @@ clientRandomMessage[0] = (serverKeyBytes & 0xff00) >>> 8; | ||
clientRandomMessage.set(clientEncryptedRandom, 2); | ||
this._sock.send(clientRandomMessage); | ||
this._sock.sQpushBytes(clientRandomMessage); | ||
this._sock.flush(); | ||
// 4: Receive server random | ||
_context13.next = 50; | ||
_context4.next = 59; | ||
return this._waitSockAsync(2); | ||
case 50: | ||
case 59: | ||
if (!(this._sock.rQshift16() !== clientKeyBytes)) { | ||
_context13.next = 52; | ||
_context4.next = 61; | ||
break; | ||
} | ||
throw new Error("RA2: wrong encrypted message length"); | ||
case 52: | ||
case 61: | ||
serverEncryptedRandom = this._sock.rQshiftBytes(clientKeyBytes); | ||
serverRandom = clientRSACipher.decrypt(serverEncryptedRandom); | ||
_context4.next = 64; | ||
return _crypto["default"].decrypt({ | ||
name: "RSA-PKCS1-v1_5" | ||
}, clientRSACipher, serverEncryptedRandom); | ||
case 64: | ||
serverRandom = _context4.sent; | ||
if (!(serverRandom === null || serverRandom.length !== 16)) { | ||
_context13.next = 56; | ||
_context4.next = 67; | ||
break; | ||
} | ||
throw new Error("RA2: corrupted server encrypted random"); | ||
case 56: | ||
case 67: | ||
// 5: Compute session keys and set ciphers | ||
@@ -851,20 +380,20 @@ clientSessionKey = new Uint8Array(32); | ||
serverSessionKey.set(serverRandom, 16); | ||
_context13.next = 64; | ||
_context4.next = 75; | ||
return window.crypto.subtle.digest("SHA-1", clientSessionKey); | ||
case 64: | ||
clientSessionKey = _context13.sent; | ||
case 75: | ||
clientSessionKey = _context4.sent; | ||
clientSessionKey = new Uint8Array(clientSessionKey).slice(0, 16); | ||
_context13.next = 68; | ||
_context4.next = 79; | ||
return window.crypto.subtle.digest("SHA-1", serverSessionKey); | ||
case 68: | ||
serverSessionKey = _context13.sent; | ||
case 79: | ||
serverSessionKey = _context4.sent; | ||
serverSessionKey = new Uint8Array(serverSessionKey).slice(0, 16); | ||
clientCipher = new RA2Cipher(); | ||
_context13.next = 73; | ||
_context4.next = 84; | ||
return clientCipher.setKey(clientSessionKey); | ||
case 73: | ||
case 84: | ||
serverCipher = new RA2Cipher(); | ||
_context13.next = 76; | ||
_context4.next = 87; | ||
return serverCipher.setKey(serverSessionKey); | ||
case 76: | ||
case 87: | ||
// 6: Compute and exchange hashes | ||
@@ -877,75 +406,77 @@ serverHash = new Uint8Array(8 + serverKeyBytes * 2 + clientKeyBytes * 2); | ||
clientHash.set(serverPublickey, 4 + clientKeyBytes * 2); | ||
_context13.next = 84; | ||
_context4.next = 95; | ||
return window.crypto.subtle.digest("SHA-1", serverHash); | ||
case 84: | ||
serverHash = _context13.sent; | ||
_context13.next = 87; | ||
case 95: | ||
serverHash = _context4.sent; | ||
_context4.next = 98; | ||
return window.crypto.subtle.digest("SHA-1", clientHash); | ||
case 87: | ||
clientHash = _context13.sent; | ||
case 98: | ||
clientHash = _context4.sent; | ||
serverHash = new Uint8Array(serverHash); | ||
clientHash = new Uint8Array(clientHash); | ||
_context13.t0 = this._sock; | ||
_context13.next = 93; | ||
_context4.t0 = this._sock; | ||
_context4.next = 104; | ||
return clientCipher.makeMessage(clientHash); | ||
case 93: | ||
_context13.t1 = _context13.sent; | ||
_context13.t0.send.call(_context13.t0, _context13.t1); | ||
_context13.next = 97; | ||
case 104: | ||
_context4.t1 = _context4.sent; | ||
_context4.t0.sQpushBytes.call(_context4.t0, _context4.t1); | ||
this._sock.flush(); | ||
_context4.next = 109; | ||
return this._waitSockAsync(2 + 20 + 16); | ||
case 97: | ||
case 109: | ||
if (!(this._sock.rQshift16() !== 20)) { | ||
_context13.next = 99; | ||
_context4.next = 111; | ||
break; | ||
} | ||
throw new Error("RA2: wrong server hash"); | ||
case 99: | ||
_context13.next = 101; | ||
return serverCipher.receiveMessage(20, this._sock.rQshiftBytes(20), this._sock.rQshiftBytes(16)); | ||
case 101: | ||
serverHashReceived = _context13.sent; | ||
case 111: | ||
_context4.next = 113; | ||
return serverCipher.receiveMessage(20, this._sock.rQshiftBytes(20 + 16)); | ||
case 113: | ||
serverHashReceived = _context4.sent; | ||
if (!(serverHashReceived === null)) { | ||
_context13.next = 104; | ||
_context4.next = 116; | ||
break; | ||
} | ||
throw new Error("RA2: failed to authenticate the message"); | ||
case 104: | ||
case 116: | ||
i = 0; | ||
case 105: | ||
case 117: | ||
if (!(i < 20)) { | ||
_context13.next = 111; | ||
_context4.next = 123; | ||
break; | ||
} | ||
if (!(serverHashReceived[i] !== serverHash[i])) { | ||
_context13.next = 108; | ||
_context4.next = 120; | ||
break; | ||
} | ||
throw new Error("RA2: wrong server hash"); | ||
case 108: | ||
case 120: | ||
i++; | ||
_context13.next = 105; | ||
_context4.next = 117; | ||
break; | ||
case 111: | ||
_context13.next = 113; | ||
case 123: | ||
_context4.next = 125; | ||
return this._waitSockAsync(2 + 1 + 16); | ||
case 113: | ||
case 125: | ||
if (!(this._sock.rQshift16() !== 1)) { | ||
_context13.next = 115; | ||
_context4.next = 127; | ||
break; | ||
} | ||
throw new Error("RA2: wrong subtype"); | ||
case 115: | ||
_context13.next = 117; | ||
return serverCipher.receiveMessage(1, this._sock.rQshiftBytes(1), this._sock.rQshiftBytes(16)); | ||
case 117: | ||
subtype = _context13.sent; | ||
case 127: | ||
_context4.next = 129; | ||
return serverCipher.receiveMessage(1, this._sock.rQshiftBytes(1 + 16)); | ||
case 129: | ||
subtype = _context4.sent; | ||
if (!(subtype === null)) { | ||
_context13.next = 120; | ||
_context4.next = 132; | ||
break; | ||
} | ||
throw new Error("RA2: failed to authenticate the message"); | ||
case 120: | ||
case 132: | ||
subtype = subtype[0]; | ||
waitCredentials = this._waitCredentialsAsync(subtype); | ||
if (!(subtype === 1)) { | ||
_context13.next = 125; | ||
_context4.next = 138; | ||
break; | ||
@@ -960,7 +491,7 @@ } | ||
} | ||
_context13.next = 130; | ||
_context4.next = 143; | ||
break; | ||
case 125: | ||
case 138: | ||
if (!(subtype === 2)) { | ||
_context13.next = 129; | ||
_context4.next = 142; | ||
break; | ||
@@ -975,10 +506,10 @@ } | ||
} | ||
_context13.next = 130; | ||
_context4.next = 143; | ||
break; | ||
case 129: | ||
case 142: | ||
throw new Error("RA2: wrong subtype"); | ||
case 130: | ||
_context13.next = 132; | ||
return this._waitCredentialsAsync(subtype); | ||
case 132: | ||
case 143: | ||
_context4.next = 145; | ||
return waitCredentials; | ||
case 145: | ||
if (subtype === 1) { | ||
@@ -993,19 +524,20 @@ username = (0, _strings.encodeUTF8)(this._getCredentials().username).slice(0, 255); | ||
credentials[username.length + 1] = password.length; | ||
for (_i3 = 0; _i3 < username.length; _i3++) { | ||
credentials[_i3 + 1] = username.charCodeAt(_i3); | ||
for (_i = 0; _i < username.length; _i++) { | ||
credentials[_i + 1] = username.charCodeAt(_i); | ||
} | ||
for (_i4 = 0; _i4 < password.length; _i4++) { | ||
credentials[username.length + 2 + _i4] = password.charCodeAt(_i4); | ||
for (_i2 = 0; _i2 < password.length; _i2++) { | ||
credentials[username.length + 2 + _i2] = password.charCodeAt(_i2); | ||
} | ||
_context13.t2 = this._sock; | ||
_context13.next = 142; | ||
_context4.t2 = this._sock; | ||
_context4.next = 155; | ||
return clientCipher.makeMessage(credentials); | ||
case 142: | ||
_context13.t3 = _context13.sent; | ||
_context13.t2.send.call(_context13.t2, _context13.t3); | ||
case 144: | ||
case 155: | ||
_context4.t3 = _context4.sent; | ||
_context4.t2.sQpushBytes.call(_context4.t2, _context4.t3); | ||
this._sock.flush(); | ||
case 158: | ||
case "end": | ||
return _context13.stop(); | ||
return _context4.stop(); | ||
} | ||
}, _callee13, this); | ||
}, _callee4, this); | ||
})); | ||
@@ -1026,4 +558,2 @@ function negotiateRA2neAuthAsync() { | ||
}]); | ||
return RSAAESAuthenticationState; | ||
}(_eventtarget["default"]); | ||
exports["default"] = RSAAESAuthenticationState; | ||
}(_eventtarget["default"]); |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -25,4 +25,4 @@ value: true | ||
var Log = _interopRequireWildcard(require("./logging.js")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } | ||
/* | ||
@@ -39,3 +39,3 @@ * noVNC: HTML5 VNC client | ||
// Touch detection | ||
var isTouchDevice = 'ontouchstart' in document.documentElement || | ||
var isTouchDevice = exports.isTouchDevice = 'ontouchstart' in document.documentElement || | ||
// requried for Chrome debugger | ||
@@ -45,3 +45,2 @@ document.ontouchstart !== undefined || | ||
navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0; | ||
exports.isTouchDevice = isTouchDevice; | ||
window.addEventListener('touchstart', function onFirstTouch() { | ||
@@ -54,4 +53,3 @@ exports.isTouchDevice = isTouchDevice = true; | ||
// brings us a bit closer but is not optimal. | ||
var dragThreshold = 10 * (window.devicePixelRatio || 1); | ||
exports.dragThreshold = dragThreshold; | ||
var dragThreshold = exports.dragThreshold = 10 * (window.devicePixelRatio || 1); | ||
var _supportsCursorURIs = false; | ||
@@ -70,4 +68,3 @@ try { | ||
} | ||
var supportsCursorURIs = _supportsCursorURIs; | ||
exports.supportsCursorURIs = supportsCursorURIs; | ||
var supportsCursorURIs = exports.supportsCursorURIs = _supportsCursorURIs; | ||
var _hasScrollbarGutter = true; | ||
@@ -95,3 +92,3 @@ try { | ||
} | ||
var hasScrollbarGutter = _hasScrollbarGutter; | ||
var hasScrollbarGutter = exports.hasScrollbarGutter = _hasScrollbarGutter; | ||
@@ -106,3 +103,3 @@ /* | ||
/* OS */ | ||
exports.hasScrollbarGutter = hasScrollbarGutter; | ||
function isMac() { | ||
@@ -109,0 +106,0 @@ return !!/mac/i.exec(navigator.platform); |
@@ -8,10 +8,14 @@ "use strict"; | ||
var _browser = require("./browser.js"); | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } | ||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* | ||
* noVNC: HTML5 VNC client | ||
* Copyright (C) 2019 The noVNC Authors | ||
* Licensed under MPL 2.0 or any later version (see LICENSE.txt) | ||
*/ | ||
var useFallback = !_browser.supportsCursorURIs || _browser.isTouchDevice; | ||
var Cursor = /*#__PURE__*/function () { | ||
var Cursor = exports["default"] = /*#__PURE__*/function () { | ||
function Cursor() { | ||
@@ -47,3 +51,3 @@ _classCallCheck(this, Cursor); | ||
} | ||
_createClass(Cursor, [{ | ||
return _createClass(Cursor, [{ | ||
key: "attach", | ||
@@ -83,3 +87,5 @@ value: function attach(target) { | ||
this._target.removeEventListener('mouseup', this._eventHandlers.mouseup, options); | ||
document.body.removeChild(this._canvas); | ||
if (document.contains(this._canvas)) { | ||
document.body.removeChild(this._canvas); | ||
} | ||
} | ||
@@ -266,4 +272,2 @@ this._target = null; | ||
}]); | ||
return Cursor; | ||
}(); | ||
exports["default"] = Cursor; | ||
}(); |
@@ -7,8 +7,8 @@ "use strict"; | ||
exports["default"] = void 0; | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } | ||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } | ||
/* | ||
@@ -21,3 +21,3 @@ * noVNC: HTML5 VNC client | ||
*/ | ||
var EventTargetMixin = /*#__PURE__*/function () { | ||
var EventTargetMixin = exports["default"] = /*#__PURE__*/function () { | ||
function EventTargetMixin() { | ||
@@ -27,3 +27,3 @@ _classCallCheck(this, EventTargetMixin); | ||
} | ||
_createClass(EventTargetMixin, [{ | ||
return _createClass(EventTargetMixin, [{ | ||
key: "addEventListener", | ||
@@ -56,4 +56,2 @@ value: function addEventListener(type, callback) { | ||
}]); | ||
return EventTargetMixin; | ||
}(); | ||
exports["default"] = EventTargetMixin; | ||
}(); |
@@ -22,10 +22,6 @@ "use strict"; | ||
var _logLevel = 'warn'; | ||
var Debug = function Debug() {}; | ||
exports.Debug = Debug; | ||
var Info = function Info() {}; | ||
exports.Info = Info; | ||
var Warn = function Warn() {}; | ||
exports.Warn = Warn; | ||
var Error = function Error() {}; | ||
exports.Error = Error; | ||
var Debug = exports.Debug = function Debug() {}; | ||
var Info = exports.Info = function Info() {}; | ||
var Warn = exports.Warn = function Warn() {}; | ||
var Error = exports.Error = function Error() {}; | ||
function initLogging(level) { | ||
@@ -57,3 +53,2 @@ if (typeof level === 'undefined') { | ||
} | ||
function getLogging() { | ||
@@ -60,0 +55,0 @@ return _logLevel; |
@@ -53,7 +53,4 @@ "use strict"; | ||
} | ||
var Buf8 = Uint8Array; | ||
exports.Buf8 = Buf8; | ||
var Buf16 = Uint16Array; | ||
exports.Buf16 = Buf16; | ||
var Buf32 = Int32Array; | ||
exports.Buf32 = Buf32; | ||
var Buf8 = exports.Buf8 = Uint8Array; | ||
var Buf16 = exports.Buf16 = Uint16Array; | ||
var Buf32 = exports.Buf32 = Int32Array; |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports["default"] = void 0; | ||
var _default = { | ||
var _default = exports["default"] = { | ||
/* Allowed flush values; see deflate() and inflate() below for details */ | ||
@@ -48,3 +48,2 @@ Z_NO_FLUSH: 0, | ||
//Z_NULL: null // Use -1 or null inline, depending on var type | ||
}; | ||
exports["default"] = _default; | ||
}; |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -23,4 +23,4 @@ value: true | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } | ||
/* Public constants ==========================================================*/ | ||
@@ -30,12 +30,8 @@ /* ===========================================================================*/ | ||
/* Allowed flush values; see deflate() and inflate() below for details */ | ||
var Z_NO_FLUSH = 0; | ||
exports.Z_NO_FLUSH = Z_NO_FLUSH; | ||
var Z_PARTIAL_FLUSH = 1; | ||
var Z_NO_FLUSH = exports.Z_NO_FLUSH = 0; | ||
var Z_PARTIAL_FLUSH = exports.Z_PARTIAL_FLUSH = 1; | ||
//export const Z_SYNC_FLUSH = 2; | ||
exports.Z_PARTIAL_FLUSH = Z_PARTIAL_FLUSH; | ||
var Z_FULL_FLUSH = 3; | ||
exports.Z_FULL_FLUSH = Z_FULL_FLUSH; | ||
var Z_FINISH = 4; | ||
exports.Z_FINISH = Z_FINISH; | ||
var Z_BLOCK = 5; | ||
var Z_FULL_FLUSH = exports.Z_FULL_FLUSH = 3; | ||
var Z_FINISH = exports.Z_FINISH = 4; | ||
var Z_BLOCK = exports.Z_BLOCK = 5; | ||
//export const Z_TREES = 6; | ||
@@ -46,15 +42,10 @@ | ||
*/ | ||
exports.Z_BLOCK = Z_BLOCK; | ||
var Z_OK = 0; | ||
exports.Z_OK = Z_OK; | ||
var Z_STREAM_END = 1; | ||
var Z_OK = exports.Z_OK = 0; | ||
var Z_STREAM_END = exports.Z_STREAM_END = 1; | ||
//export const Z_NEED_DICT = 2; | ||
//export const Z_ERRNO = -1; | ||
exports.Z_STREAM_END = Z_STREAM_END; | ||
var Z_STREAM_ERROR = -2; | ||
exports.Z_STREAM_ERROR = Z_STREAM_ERROR; | ||
var Z_DATA_ERROR = -3; | ||
var Z_STREAM_ERROR = exports.Z_STREAM_ERROR = -2; | ||
var Z_DATA_ERROR = exports.Z_DATA_ERROR = -3; | ||
//export const Z_MEM_ERROR = -4; | ||
exports.Z_DATA_ERROR = Z_DATA_ERROR; | ||
var Z_BUF_ERROR = -5; | ||
var Z_BUF_ERROR = exports.Z_BUF_ERROR = -5; | ||
//export const Z_VERSION_ERROR = -6; | ||
@@ -66,14 +57,8 @@ | ||
//export const Z_BEST_COMPRESSION = 9; | ||
exports.Z_BUF_ERROR = Z_BUF_ERROR; | ||
var Z_DEFAULT_COMPRESSION = -1; | ||
exports.Z_DEFAULT_COMPRESSION = Z_DEFAULT_COMPRESSION; | ||
var Z_FILTERED = 1; | ||
exports.Z_FILTERED = Z_FILTERED; | ||
var Z_HUFFMAN_ONLY = 2; | ||
exports.Z_HUFFMAN_ONLY = Z_HUFFMAN_ONLY; | ||
var Z_RLE = 3; | ||
exports.Z_RLE = Z_RLE; | ||
var Z_FIXED = 4; | ||
exports.Z_FIXED = Z_FIXED; | ||
var Z_DEFAULT_STRATEGY = 0; | ||
var Z_DEFAULT_COMPRESSION = exports.Z_DEFAULT_COMPRESSION = -1; | ||
var Z_FILTERED = exports.Z_FILTERED = 1; | ||
var Z_HUFFMAN_ONLY = exports.Z_HUFFMAN_ONLY = 2; | ||
var Z_RLE = exports.Z_RLE = 3; | ||
var Z_FIXED = exports.Z_FIXED = 4; | ||
var Z_DEFAULT_STRATEGY = exports.Z_DEFAULT_STRATEGY = 0; | ||
@@ -84,11 +69,9 @@ /* Possible values of the data_type field (though see inflate()) */ | ||
//export const Z_ASCII = 1; // = Z_TEXT | ||
exports.Z_DEFAULT_STRATEGY = Z_DEFAULT_STRATEGY; | ||
var Z_UNKNOWN = 2; | ||
var Z_UNKNOWN = exports.Z_UNKNOWN = 2; | ||
/* The deflate compression method */ | ||
exports.Z_UNKNOWN = Z_UNKNOWN; | ||
var Z_DEFLATED = 8; | ||
var Z_DEFLATED = exports.Z_DEFLATED = 8; | ||
/*============================================================================*/ | ||
exports.Z_DEFLATED = Z_DEFLATED; | ||
var MAX_MEM_LEVEL = 9; | ||
@@ -240,3 +223,2 @@ /* Maximum value for memLevel in deflateInit2 */ | ||
var limit = s.strstart > s.w_size - MIN_LOOKAHEAD ? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0 /*NIL*/; | ||
var _win = s.window; // shortcut | ||
@@ -547,3 +529,2 @@ | ||
} | ||
s.insert = 0; | ||
@@ -567,3 +548,2 @@ if (flush === Z_FINISH) { | ||
} | ||
return BS_NEED_MORE; | ||
@@ -622,3 +602,2 @@ } | ||
} | ||
if (s.match_length >= MIN_MATCH) { | ||
@@ -680,3 +659,2 @@ // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only | ||
} | ||
s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; | ||
@@ -700,3 +678,2 @@ if (flush === Z_FINISH) { | ||
} | ||
return BS_BLOCK_DONE; | ||
@@ -817,3 +794,2 @@ } | ||
} | ||
s.strstart++; | ||
@@ -858,3 +834,2 @@ s.lookahead--; | ||
} | ||
return BS_BLOCK_DONE; | ||
@@ -933,3 +908,2 @@ } | ||
} | ||
s.insert = 0; | ||
@@ -953,3 +927,2 @@ if (flush === Z_FINISH) { | ||
} | ||
return BS_BLOCK_DONE; | ||
@@ -993,3 +966,2 @@ } | ||
} | ||
s.insert = 0; | ||
@@ -1013,3 +985,2 @@ if (flush === Z_FINISH) { | ||
} | ||
return BS_BLOCK_DONE; | ||
@@ -1251,3 +1222,2 @@ } | ||
} | ||
function deflateResetKeep(strm) { | ||
@@ -1267,3 +1237,2 @@ var s; | ||
} | ||
s.status = s.wrap ? INIT_STATE : BUSY_STATE; | ||
@@ -1598,3 +1567,2 @@ strm.adler = s.wrap === 2 ? 0 // crc32(0, Z_NULL, 0) | ||
} | ||
return Z_OK; | ||
@@ -1609,3 +1577,2 @@ /* If flush != Z_NO_FLUSH && avail_out == 0, the next call | ||
} | ||
if (bstate === BS_BLOCK_DONE) { | ||
@@ -1766,3 +1733,3 @@ if (flush === Z_PARTIAL_FLUSH) { | ||
} | ||
var deflateInfo = 'pako deflate (from Nodeca project)'; | ||
var deflateInfo = exports.deflateInfo = 'pako deflate (from Nodeca project)'; | ||
@@ -1776,3 +1743,2 @@ /* Not implemented | ||
exports.deflateTune = deflateTune; | ||
*/ | ||
exports.deflateInfo = deflateInfo; | ||
*/ |
@@ -150,3 +150,2 @@ "use strict"; | ||
op = here >>> 16 & 0xff /*here.op*/; | ||
if (op & 16) { | ||
@@ -208,3 +207,2 @@ /* distance base */ | ||
} | ||
from = 0; // window index | ||
@@ -211,0 +209,0 @@ from_source = s_window; |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -24,4 +24,4 @@ value: true | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } | ||
var CODES = 0; | ||
@@ -39,7 +39,5 @@ var LENS = 1; | ||
//export const Z_FULL_FLUSH = 3; | ||
var Z_FINISH = 4; | ||
exports.Z_FINISH = Z_FINISH; | ||
var Z_BLOCK = 5; | ||
exports.Z_BLOCK = Z_BLOCK; | ||
var Z_TREES = 6; | ||
var Z_FINISH = exports.Z_FINISH = 4; | ||
var Z_BLOCK = exports.Z_BLOCK = 5; | ||
var Z_TREES = exports.Z_TREES = 6; | ||
@@ -49,26 +47,18 @@ /* Return codes for the compression/decompression functions. Negative values | ||
*/ | ||
exports.Z_TREES = Z_TREES; | ||
var Z_OK = 0; | ||
exports.Z_OK = Z_OK; | ||
var Z_STREAM_END = 1; | ||
exports.Z_STREAM_END = Z_STREAM_END; | ||
var Z_NEED_DICT = 2; | ||
var Z_OK = exports.Z_OK = 0; | ||
var Z_STREAM_END = exports.Z_STREAM_END = 1; | ||
var Z_NEED_DICT = exports.Z_NEED_DICT = 2; | ||
//export const Z_ERRNO = -1; | ||
exports.Z_NEED_DICT = Z_NEED_DICT; | ||
var Z_STREAM_ERROR = -2; | ||
exports.Z_STREAM_ERROR = Z_STREAM_ERROR; | ||
var Z_DATA_ERROR = -3; | ||
exports.Z_DATA_ERROR = Z_DATA_ERROR; | ||
var Z_MEM_ERROR = -4; | ||
exports.Z_MEM_ERROR = Z_MEM_ERROR; | ||
var Z_BUF_ERROR = -5; | ||
var Z_STREAM_ERROR = exports.Z_STREAM_ERROR = -2; | ||
var Z_DATA_ERROR = exports.Z_DATA_ERROR = -3; | ||
var Z_MEM_ERROR = exports.Z_MEM_ERROR = -4; | ||
var Z_BUF_ERROR = exports.Z_BUF_ERROR = -5; | ||
//export const Z_VERSION_ERROR = -6; | ||
/* The deflate compression method */ | ||
exports.Z_BUF_ERROR = Z_BUF_ERROR; | ||
var Z_DEFLATED = 8; | ||
var Z_DEFLATED = exports.Z_DEFLATED = 8; | ||
/* STATES ====================================================================*/ | ||
/* ===========================================================================*/ | ||
exports.Z_DEFLATED = Z_DEFLATED; | ||
var HEAD = 1; /* i: waiting for magic header */ | ||
@@ -176,3 +166,2 @@ var FLAGS = 2; /* i: waiting for method and flags (gzip) */ | ||
} | ||
function inflateResetKeep(strm) { | ||
@@ -268,3 +257,2 @@ var state; | ||
} | ||
return ret; | ||
@@ -630,3 +618,2 @@ } | ||
} | ||
state.mode = EXTRA; | ||
@@ -656,3 +643,2 @@ /* falls through */ | ||
} | ||
if (state.flags & 0x0200) { | ||
@@ -748,3 +734,2 @@ state.check = (0, _crc["default"])(state.check, input, copy, next); | ||
} | ||
if (state.head) { | ||
@@ -971,3 +956,2 @@ state.head.hcrc = state.flags >> 9 & 1; | ||
} | ||
while (state.have < 19) { | ||
@@ -1015,3 +999,2 @@ state.lens[order[state.have++]] = 0; | ||
} | ||
if (here_val < 16) { | ||
@@ -1096,3 +1079,2 @@ //--- DROPBITS(here.bits) ---// | ||
} | ||
if (state.have + copy > state.nlen + state.ndist) { | ||
@@ -1211,3 +1193,2 @@ strm.msg = 'invalid bit length repeat'; | ||
} | ||
if (here_op && (here_op & 0xf0) === 0) { | ||
@@ -1309,3 +1290,2 @@ last_bits = here_bits; | ||
} | ||
if ((here_op & 0xf0) === 0) { | ||
@@ -1412,3 +1392,2 @@ last_bits = here_bits; | ||
} | ||
if (copy > state.wnext) { | ||
@@ -1483,3 +1462,2 @@ copy -= state.wnext; | ||
} | ||
state.mode = LENGTH; | ||
@@ -1510,3 +1488,2 @@ /* falls through */ | ||
} | ||
state.mode = DONE; | ||
@@ -1631,3 +1608,3 @@ /* falls through */ | ||
} | ||
var inflateInfo = 'pako inflate (from Nodeca project)'; | ||
var inflateInfo = exports.inflateInfo = 'pako inflate (from Nodeca project)'; | ||
@@ -1642,3 +1619,2 @@ /* Not implemented | ||
exports.inflateUndermine = inflateUndermine; | ||
*/ | ||
exports.inflateInfo = inflateInfo; | ||
*/ |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -9,4 +9,4 @@ value: true | ||
var utils = _interopRequireWildcard(require("../utils/common.js")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } | ||
var MAXBITS = 15; | ||
@@ -117,3 +117,2 @@ var ENOUGH_LENS = 852; | ||
} | ||
for (min = 1; min < max; min++) { | ||
@@ -137,3 +136,2 @@ if (count[min] !== 0) { | ||
} | ||
if (left > 0 && (type === CODES || max !== 1)) { | ||
@@ -140,0 +138,0 @@ return -1; /* incomplete set */ |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports["default"] = void 0; | ||
var _default = { | ||
var _default = exports["default"] = { | ||
2: 'need dictionary', | ||
@@ -26,3 +26,2 @@ /* Z_NEED_DICT 2 */ | ||
'-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ | ||
}; | ||
exports["default"] = _default; | ||
}; |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -13,4 +13,4 @@ value: true | ||
var utils = _interopRequireWildcard(require("../utils/common.js")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } | ||
/* Public constants ==========================================================*/ | ||
@@ -173,3 +173,2 @@ /* ===========================================================================*/ | ||
} | ||
function d_code(dist) { | ||
@@ -626,3 +625,2 @@ return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; | ||
} | ||
dist--; /* dist is now the match distance - 1 */ | ||
@@ -698,3 +696,2 @@ code = d_code(dist); | ||
} | ||
desc.max_code = max_code; | ||
@@ -774,3 +771,2 @@ | ||
nextlen = tree[(n + 1) * 2 + 1] /*.Len*/; | ||
if (++count < max_count && curlen === nextlen) { | ||
@@ -790,3 +786,2 @@ continue; | ||
} | ||
count = 0; | ||
@@ -834,3 +829,2 @@ prevlen = curlen; | ||
nextlen = tree[(n + 1) * 2 + 1] /*.Len*/; | ||
if (++count < max_count && curlen === nextlen) { | ||
@@ -1075,3 +1069,2 @@ continue; | ||
} | ||
if (stored_len + 4 <= opt_lenb && buf !== -1) { | ||
@@ -1078,0 +1071,0 @@ /* 4: two words for the lengths */ |
@@ -8,5 +8,5 @@ "use strict"; | ||
var Log = _interopRequireWildcard(require("./util/logging.js")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
@@ -21,4 +21,16 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } | ||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* | ||
* Websock: high-performance buffering wrapper | ||
* Copyright (C) 2019 The noVNC Authors | ||
* Licensed under MPL 2.0 (see LICENSE.txt) | ||
* | ||
* Websock is similar to the standard WebSocket / RTCDataChannel object | ||
* but with extra buffer handling. | ||
* | ||
* Websock has built-in receive queue buffering; the message event | ||
* does not contain actual data but is simply a notification that | ||
* there is new data available. Several rQ* methods are available to | ||
* read binary data off of the receive queue. | ||
*/ | ||
// this has performance issues in some versions Chromium, and | ||
@@ -46,3 +58,3 @@ // doesn't gain a tremendous amount of performance increase in Firefox | ||
var rawChannelProps = ["send", "close", "binaryType", "onerror", "onmessage", "onopen", "protocol", "readyState"]; | ||
var Websock = /*#__PURE__*/function () { | ||
var Websock = exports["default"] = /*#__PURE__*/function () { | ||
function Websock() { | ||
@@ -72,3 +84,3 @@ _classCallCheck(this, Websock); | ||
// Getters and Setters | ||
_createClass(Websock, [{ | ||
return _createClass(Websock, [{ | ||
key: "readyState", | ||
@@ -92,28 +104,5 @@ get: function get() { | ||
} | ||
}, { | ||
key: "sQ", | ||
get: function get() { | ||
return this._sQ; | ||
} | ||
}, { | ||
key: "rQ", | ||
get: function get() { | ||
return this._rQ; | ||
} | ||
}, { | ||
key: "rQi", | ||
get: function get() { | ||
return this._rQi; | ||
}, | ||
set: function set(val) { | ||
this._rQi = val; | ||
} | ||
// Receive Queue | ||
}, { | ||
key: "rQlen", | ||
get: function get() { | ||
return this._rQlen - this._rQi; | ||
} | ||
}, { | ||
key: "rQpeek8", | ||
@@ -152,3 +141,3 @@ value: function rQpeek8() { | ||
} | ||
return res; | ||
return res >>> 0; | ||
} | ||
@@ -158,9 +147,6 @@ }, { | ||
value: function rQshiftStr(len) { | ||
if (typeof len === 'undefined') { | ||
len = this.rQlen; | ||
} | ||
var str = ""; | ||
// Handle large arrays in steps to avoid long strings on the stack | ||
for (var i = 0; i < len; i += 4096) { | ||
var part = this.rQshiftBytes(Math.min(4096, len - i)); | ||
var part = this.rQshiftBytes(Math.min(4096, len - i), false); | ||
str += String.fromCharCode.apply(null, part); | ||
@@ -173,7 +159,9 @@ } | ||
value: function rQshiftBytes(len) { | ||
if (typeof len === 'undefined') { | ||
len = this.rQlen; | ||
var copy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
this._rQi += len; | ||
if (copy) { | ||
return this._rQ.slice(this._rQi - len, this._rQi); | ||
} else { | ||
return this._rQ.subarray(this._rQi - len, this._rQi); | ||
} | ||
this._rQi += len; | ||
return new Uint8Array(this._rQ.buffer, this._rQi - len, len); | ||
} | ||
@@ -183,5 +171,2 @@ }, { | ||
value: function rQshiftTo(target, len) { | ||
if (len === undefined) { | ||
len = this.rQlen; | ||
} | ||
// TODO: make this just use set with views when using a ArrayBuffer to store the rQ | ||
@@ -192,6 +177,10 @@ target.set(new Uint8Array(this._rQ.buffer, this._rQi, len)); | ||
}, { | ||
key: "rQslice", | ||
value: function rQslice(start) { | ||
var end = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.rQlen; | ||
return new Uint8Array(this._rQ.buffer, this._rQi + start, end - start); | ||
key: "rQpeekBytes", | ||
value: function rQpeekBytes(len) { | ||
var copy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
if (copy) { | ||
return this._rQ.slice(this._rQi, this._rQi + len); | ||
} else { | ||
return this._rQ.subarray(this._rQi, this._rQi + len); | ||
} | ||
} | ||
@@ -205,3 +194,3 @@ | ||
value: function rQwait(msg, num, goback) { | ||
if (this.rQlen < num) { | ||
if (this._rQlen - this._rQi < num) { | ||
if (goback) { | ||
@@ -215,3 +204,2 @@ if (this._rQi < goback) { | ||
} | ||
return false; | ||
@@ -222,6 +210,50 @@ } | ||
}, { | ||
key: "sQpush8", | ||
value: function sQpush8(num) { | ||
this._sQensureSpace(1); | ||
this._sQ[this._sQlen++] = num; | ||
} | ||
}, { | ||
key: "sQpush16", | ||
value: function sQpush16(num) { | ||
this._sQensureSpace(2); | ||
this._sQ[this._sQlen++] = num >> 8 & 0xff; | ||
this._sQ[this._sQlen++] = num >> 0 & 0xff; | ||
} | ||
}, { | ||
key: "sQpush32", | ||
value: function sQpush32(num) { | ||
this._sQensureSpace(4); | ||
this._sQ[this._sQlen++] = num >> 24 & 0xff; | ||
this._sQ[this._sQlen++] = num >> 16 & 0xff; | ||
this._sQ[this._sQlen++] = num >> 8 & 0xff; | ||
this._sQ[this._sQlen++] = num >> 0 & 0xff; | ||
} | ||
}, { | ||
key: "sQpushString", | ||
value: function sQpushString(str) { | ||
var bytes = str.split('').map(function (chr) { | ||
return chr.charCodeAt(0); | ||
}); | ||
this.sQpushBytes(new Uint8Array(bytes)); | ||
} | ||
}, { | ||
key: "sQpushBytes", | ||
value: function sQpushBytes(bytes) { | ||
for (var offset = 0; offset < bytes.length;) { | ||
this._sQensureSpace(1); | ||
var chunkSize = this._sQbufferSize - this._sQlen; | ||
if (chunkSize > bytes.length - offset) { | ||
chunkSize = bytes.length - offset; | ||
} | ||
this._sQ.set(bytes.subarray(offset, chunkSize), this._sQlen); | ||
this._sQlen += chunkSize; | ||
offset += chunkSize; | ||
} | ||
} | ||
}, { | ||
key: "flush", | ||
value: function flush() { | ||
if (this._sQlen > 0 && this.readyState === 'open') { | ||
this._websocket.send(this._encodeMessage()); | ||
this._websocket.send(new Uint8Array(this._sQ.buffer, 0, this._sQlen)); | ||
this._sQlen = 0; | ||
@@ -231,15 +263,8 @@ } | ||
}, { | ||
key: "send", | ||
value: function send(arr) { | ||
this._sQ.set(arr, this._sQlen); | ||
this._sQlen += arr.length; | ||
this.flush(); | ||
key: "_sQensureSpace", | ||
value: function _sQensureSpace(bytes) { | ||
if (this._sQbufferSize - this._sQlen < bytes) { | ||
this.flush(); | ||
} | ||
} | ||
}, { | ||
key: "sendString", | ||
value: function sendString(str) { | ||
this.send(str.split('').map(function (chr) { | ||
return chr.charCodeAt(0); | ||
})); | ||
} | ||
@@ -324,9 +349,2 @@ // Event Handlers | ||
// private methods | ||
}, { | ||
key: "_encodeMessage", | ||
value: function _encodeMessage() { | ||
// Put in a binary arraybuffer | ||
// according to the spec, you can send ArrayBufferViews with the send method | ||
return new Uint8Array(this._sQ.buffer, 0, this._sQlen); | ||
} | ||
@@ -337,3 +355,3 @@ // We want to move all the unread data to the start of the queue, | ||
// performance reasons we combine these two actions to avoid | ||
// unneccessary copying. | ||
// unnecessary copying. | ||
}, { | ||
@@ -355,3 +373,3 @@ key: "_expandCompactRQ", | ||
this._rQbufferSize = MAX_RQ_GROW_SIZE; | ||
if (this._rQbufferSize - this.rQlen < minFit) { | ||
if (this._rQbufferSize - (this._rQlen - this._rQi) < minFit) { | ||
throw new Error("Receive Queue buffer exceeded " + MAX_RQ_GROW_SIZE + " bytes, and the new message could not fit"); | ||
@@ -373,5 +391,11 @@ } | ||
}, { | ||
key: "_DecodeMessage", | ||
value: function _DecodeMessage(data) { | ||
var u8 = new Uint8Array(data); | ||
key: "_recvMessage", | ||
value: function _recvMessage(e) { | ||
if (this._rQlen == this._rQi) { | ||
// All data has now been processed, this means we | ||
// can reset the receive queue. | ||
this._rQlen = 0; | ||
this._rQi = 0; | ||
} | ||
var u8 = new Uint8Array(e.data); | ||
if (u8.length > this._rQbufferSize - this._rQlen) { | ||
@@ -382,15 +406,4 @@ this._expandCompactRQ(u8.length); | ||
this._rQlen += u8.length; | ||
} | ||
}, { | ||
key: "_recvMessage", | ||
value: function _recvMessage(e) { | ||
this._DecodeMessage(e.data); | ||
if (this.rQlen > 0) { | ||
if (this._rQlen - this._rQi > 0) { | ||
this._eventHandlers.message(); | ||
if (this._rQlen == this._rQi) { | ||
// All data has now been processed, this means we | ||
// can reset the receive queue. | ||
this._rQlen = 0; | ||
this._rQi = 0; | ||
} | ||
} else { | ||
@@ -401,4 +414,2 @@ Log.Debug("Ignoring empty message"); | ||
}]); | ||
return Websock; | ||
}(); | ||
exports["default"] = Websock; | ||
}(); |
{ | ||
"name": "@novnc/novnc", | ||
"version": "1.4.0-beta-gb76358e", | ||
"version": "1.4.0-g10ee10c", | ||
"description": "An HTML5 VNC client", | ||
@@ -17,5 +17,3 @@ "browser": "lib/rfb", | ||
"docs/LIBRARY.md", | ||
"docs/LICENSE*", | ||
"core", | ||
"vendor/pako" | ||
"docs/LICENSE*" | ||
], | ||
@@ -43,15 +41,10 @@ "scripts": { | ||
"@babel/core": "latest", | ||
"@babel/plugin-syntax-dynamic-import": "latest", | ||
"@babel/plugin-transform-modules-commonjs": "latest", | ||
"@babel/preset-env": "latest", | ||
"@babel/cli": "latest", | ||
"babel-plugin-import-redirect": "latest", | ||
"browserify": "latest", | ||
"babelify": "latest", | ||
"core-js": "latest", | ||
"chai": "latest", | ||
"commander": "latest", | ||
"es-module-loader": "latest", | ||
"eslint": "latest", | ||
"fs-extra": "latest", | ||
"globals": "latest", | ||
"jsdom": "latest", | ||
@@ -58,0 +51,0 @@ "karma": "latest", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
25
4
741418
62
17358