rterm-backend 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/gybackend.cjs +855 -425
- package/package.json +5 -5
package/bin/gybackend.cjs
CHANGED
|
@@ -9770,9 +9770,9 @@ var require_semver = __commonJS({
|
|
|
9770
9770
|
} else {
|
|
9771
9771
|
this.prerelease = m2[4].split(".").map((id) => {
|
|
9772
9772
|
if (/^[0-9]+$/.test(id)) {
|
|
9773
|
-
const
|
|
9774
|
-
if (
|
|
9775
|
-
return
|
|
9773
|
+
const num3 = +id;
|
|
9774
|
+
if (num3 >= 0 && num3 < MAX_SAFE_INTEGER) {
|
|
9775
|
+
return num3;
|
|
9776
9776
|
}
|
|
9777
9777
|
}
|
|
9778
9778
|
return id;
|
|
@@ -11676,8 +11676,8 @@ var require_base64_js = __commonJS({
|
|
|
11676
11676
|
}
|
|
11677
11677
|
return arr3;
|
|
11678
11678
|
}
|
|
11679
|
-
function tripletToBase64(
|
|
11680
|
-
return lookup2[
|
|
11679
|
+
function tripletToBase64(num3) {
|
|
11680
|
+
return lookup2[num3 >> 18 & 63] + lookup2[num3 >> 12 & 63] + lookup2[num3 >> 6 & 63] + lookup2[num3 & 63];
|
|
11681
11681
|
}
|
|
11682
11682
|
function encodeChunk(uint8, start, end) {
|
|
11683
11683
|
var tmp;
|
|
@@ -13479,8 +13479,8 @@ var require_pdf_worker = __commonJS({
|
|
|
13479
13479
|
return Dict2;
|
|
13480
13480
|
})();
|
|
13481
13481
|
var Ref = (function RefClosure() {
|
|
13482
|
-
function Ref2(
|
|
13483
|
-
this.num =
|
|
13482
|
+
function Ref2(num3, gen) {
|
|
13483
|
+
this.num = num3;
|
|
13484
13484
|
this.gen = gen;
|
|
13485
13485
|
}
|
|
13486
13486
|
Ref2.prototype = {
|
|
@@ -16141,14 +16141,14 @@ var require_pdf_worker = __commonJS({
|
|
|
16141
16141
|
}
|
|
16142
16142
|
}
|
|
16143
16143
|
if (Number.isInteger(buf1)) {
|
|
16144
|
-
var
|
|
16144
|
+
var num3 = buf1;
|
|
16145
16145
|
if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
|
|
16146
|
-
var ref = new _primitives.Ref(
|
|
16146
|
+
var ref = new _primitives.Ref(num3, this.buf1);
|
|
16147
16147
|
this.shift();
|
|
16148
16148
|
this.shift();
|
|
16149
16149
|
return ref;
|
|
16150
16150
|
}
|
|
16151
|
-
return
|
|
16151
|
+
return num3;
|
|
16152
16152
|
}
|
|
16153
16153
|
if ((0, _util.isString)(buf1)) {
|
|
16154
16154
|
var str3 = buf1;
|
|
@@ -23875,17 +23875,17 @@ var require_pdf_worker = __commonJS({
|
|
|
23875
23875
|
if (!(0, _primitives.isRef)(ref)) {
|
|
23876
23876
|
throw new Error("ref object is not a reference");
|
|
23877
23877
|
}
|
|
23878
|
-
var
|
|
23879
|
-
if (
|
|
23880
|
-
var cacheEntry = this.cache[
|
|
23878
|
+
var num3 = ref.num;
|
|
23879
|
+
if (num3 in this.cache) {
|
|
23880
|
+
var cacheEntry = this.cache[num3];
|
|
23881
23881
|
if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
|
|
23882
23882
|
cacheEntry.objId = ref.toString();
|
|
23883
23883
|
}
|
|
23884
23884
|
return cacheEntry;
|
|
23885
23885
|
}
|
|
23886
|
-
var xrefEntry = this.getEntry(
|
|
23886
|
+
var xrefEntry = this.getEntry(num3);
|
|
23887
23887
|
if (xrefEntry === null) {
|
|
23888
|
-
return this.cache[
|
|
23888
|
+
return this.cache[num3] = null;
|
|
23889
23889
|
}
|
|
23890
23890
|
if (xrefEntry.uncompressed) {
|
|
23891
23891
|
xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
|
|
@@ -23901,7 +23901,7 @@ var require_pdf_worker = __commonJS({
|
|
|
23901
23901
|
},
|
|
23902
23902
|
fetchUncompressed: function XRef_fetchUncompressed(ref, xrefEntry, suppressEncryption) {
|
|
23903
23903
|
var gen = ref.gen;
|
|
23904
|
-
var
|
|
23904
|
+
var num3 = ref.num;
|
|
23905
23905
|
if (xrefEntry.gen !== gen) {
|
|
23906
23906
|
throw new _util.FormatError("inconsistent generation in XRef");
|
|
23907
23907
|
}
|
|
@@ -23916,25 +23916,25 @@ var require_pdf_worker = __commonJS({
|
|
|
23916
23916
|
if (!Number.isInteger(obj2)) {
|
|
23917
23917
|
obj2 = parseInt(obj2, 10);
|
|
23918
23918
|
}
|
|
23919
|
-
if (obj1 !==
|
|
23919
|
+
if (obj1 !== num3 || obj2 !== gen || !(0, _primitives.isCmd)(obj3)) {
|
|
23920
23920
|
throw new _util.FormatError("bad XRef entry");
|
|
23921
23921
|
}
|
|
23922
23922
|
if (obj3.cmd !== "obj") {
|
|
23923
23923
|
if (obj3.cmd.indexOf("obj") === 0) {
|
|
23924
|
-
|
|
23925
|
-
if (!Number.isNaN(
|
|
23926
|
-
return
|
|
23924
|
+
num3 = parseInt(obj3.cmd.substring(3), 10);
|
|
23925
|
+
if (!Number.isNaN(num3)) {
|
|
23926
|
+
return num3;
|
|
23927
23927
|
}
|
|
23928
23928
|
}
|
|
23929
23929
|
throw new _util.FormatError("bad XRef entry");
|
|
23930
23930
|
}
|
|
23931
23931
|
if (this.encrypt && !suppressEncryption) {
|
|
23932
|
-
xrefEntry = parser.getObj(this.encrypt.createCipherTransform(
|
|
23932
|
+
xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num3, gen));
|
|
23933
23933
|
} else {
|
|
23934
23934
|
xrefEntry = parser.getObj();
|
|
23935
23935
|
}
|
|
23936
23936
|
if (!(0, _primitives.isStream)(xrefEntry)) {
|
|
23937
|
-
this.cache[
|
|
23937
|
+
this.cache[num3] = xrefEntry;
|
|
23938
23938
|
}
|
|
23939
23939
|
return xrefEntry;
|
|
23940
23940
|
},
|
|
@@ -23951,13 +23951,13 @@ var require_pdf_worker = __commonJS({
|
|
|
23951
23951
|
}
|
|
23952
23952
|
var parser = new _parser2.Parser(new _parser2.Lexer(stream), false, this);
|
|
23953
23953
|
parser.allowStreams = true;
|
|
23954
|
-
var i, entries = [],
|
|
23954
|
+
var i, entries = [], num3, nums = [];
|
|
23955
23955
|
for (i = 0; i < n2; ++i) {
|
|
23956
|
-
|
|
23957
|
-
if (!Number.isInteger(
|
|
23958
|
-
throw new _util.FormatError("invalid object number in the ObjStm stream: " +
|
|
23956
|
+
num3 = parser.getObj();
|
|
23957
|
+
if (!Number.isInteger(num3)) {
|
|
23958
|
+
throw new _util.FormatError("invalid object number in the ObjStm stream: " + num3);
|
|
23959
23959
|
}
|
|
23960
|
-
nums.push(
|
|
23960
|
+
nums.push(num3);
|
|
23961
23961
|
var offset = parser.getObj();
|
|
23962
23962
|
if (!Number.isInteger(offset)) {
|
|
23963
23963
|
throw new _util.FormatError("invalid object offset in the ObjStm stream: " + offset);
|
|
@@ -23968,10 +23968,10 @@ var require_pdf_worker = __commonJS({
|
|
|
23968
23968
|
if ((0, _primitives.isCmd)(parser.buf1, "endobj")) {
|
|
23969
23969
|
parser.shift();
|
|
23970
23970
|
}
|
|
23971
|
-
|
|
23972
|
-
var entry = this.entries[
|
|
23971
|
+
num3 = nums[i];
|
|
23972
|
+
var entry = this.entries[num3];
|
|
23973
23973
|
if (entry && entry.offset === tableOffset && entry.gen === i) {
|
|
23974
|
-
this.cache[
|
|
23974
|
+
this.cache[num3] = entries[i];
|
|
23975
23975
|
}
|
|
23976
23976
|
}
|
|
23977
23977
|
xrefEntry = entries[xrefEntry.gen];
|
|
@@ -27939,14 +27939,14 @@ var require_pdf_worker = __commonJS({
|
|
|
27939
27939
|
this.eff = dict.get("EFF") || this.stmf;
|
|
27940
27940
|
}
|
|
27941
27941
|
}
|
|
27942
|
-
function buildObjectKey(
|
|
27942
|
+
function buildObjectKey(num3, gen, encryptionKey, isAes) {
|
|
27943
27943
|
var key = new Uint8Array(encryptionKey.length + 9), i, n2;
|
|
27944
27944
|
for (i = 0, n2 = encryptionKey.length; i < n2; ++i) {
|
|
27945
27945
|
key[i] = encryptionKey[i];
|
|
27946
27946
|
}
|
|
27947
|
-
key[i++] =
|
|
27948
|
-
key[i++] =
|
|
27949
|
-
key[i++] =
|
|
27947
|
+
key[i++] = num3 & 255;
|
|
27948
|
+
key[i++] = num3 >> 8 & 255;
|
|
27949
|
+
key[i++] = num3 >> 16 & 255;
|
|
27950
27950
|
key[i++] = gen & 255;
|
|
27951
27951
|
key[i++] = gen >> 8 & 255;
|
|
27952
27952
|
if (isAes) {
|
|
@@ -27958,7 +27958,7 @@ var require_pdf_worker = __commonJS({
|
|
|
27958
27958
|
var hash2 = calculateMD5(key, 0, i);
|
|
27959
27959
|
return hash2.subarray(0, Math.min(encryptionKey.length + 5, 16));
|
|
27960
27960
|
}
|
|
27961
|
-
function buildCipherConstructor(cf, name,
|
|
27961
|
+
function buildCipherConstructor(cf, name, num3, gen, key) {
|
|
27962
27962
|
if (!(0, _primitives.isName)(name)) {
|
|
27963
27963
|
throw new _util.FormatError("Invalid crypt filter name.");
|
|
27964
27964
|
}
|
|
@@ -27974,12 +27974,12 @@ var require_pdf_worker = __commonJS({
|
|
|
27974
27974
|
}
|
|
27975
27975
|
if (cfm.name === "V2") {
|
|
27976
27976
|
return function cipherTransformFactoryBuildCipherConstructorV2() {
|
|
27977
|
-
return new ARCFourCipher(buildObjectKey(
|
|
27977
|
+
return new ARCFourCipher(buildObjectKey(num3, gen, key, false));
|
|
27978
27978
|
};
|
|
27979
27979
|
}
|
|
27980
27980
|
if (cfm.name === "AESV2") {
|
|
27981
27981
|
return function cipherTransformFactoryBuildCipherConstructorAESV2() {
|
|
27982
|
-
return new AES128Cipher(buildObjectKey(
|
|
27982
|
+
return new AES128Cipher(buildObjectKey(num3, gen, key, true));
|
|
27983
27983
|
};
|
|
27984
27984
|
}
|
|
27985
27985
|
if (cfm.name === "AESV3") {
|
|
@@ -27990,11 +27990,11 @@ var require_pdf_worker = __commonJS({
|
|
|
27990
27990
|
throw new _util.FormatError("Unknown crypto method");
|
|
27991
27991
|
}
|
|
27992
27992
|
CipherTransformFactory2.prototype = {
|
|
27993
|
-
createCipherTransform: function CipherTransformFactory_createCipherTransform(
|
|
27993
|
+
createCipherTransform: function CipherTransformFactory_createCipherTransform(num3, gen) {
|
|
27994
27994
|
if (this.algorithm === 4 || this.algorithm === 5) {
|
|
27995
|
-
return new CipherTransform(buildCipherConstructor(this.cf, this.stmf,
|
|
27995
|
+
return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num3, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num3, gen, this.encryptionKey));
|
|
27996
27996
|
}
|
|
27997
|
-
var key = buildObjectKey(
|
|
27997
|
+
var key = buildObjectKey(num3, gen, this.encryptionKey, false);
|
|
27998
27998
|
var cipherConstructor = function buildCipherCipherConstructor() {
|
|
27999
27999
|
return new ARCFourCipher(key);
|
|
28000
28000
|
};
|
|
@@ -32196,12 +32196,12 @@ var require_pdf_worker = __commonJS({
|
|
|
32196
32196
|
}
|
|
32197
32197
|
return this.encodeFloat(value);
|
|
32198
32198
|
},
|
|
32199
|
-
encodeFloat: function CFFCompiler_encodeFloat(
|
|
32200
|
-
var value =
|
|
32199
|
+
encodeFloat: function CFFCompiler_encodeFloat(num3) {
|
|
32200
|
+
var value = num3.toString();
|
|
32201
32201
|
var m2 = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
|
|
32202
32202
|
if (m2) {
|
|
32203
32203
|
var epsilon = parseFloat("1e" + ((m2[2] ? +m2[2] : 0) + m2[1].length));
|
|
32204
|
-
value = (Math.round(
|
|
32204
|
+
value = (Math.round(num3 * epsilon) / epsilon).toString();
|
|
32205
32205
|
}
|
|
32206
32206
|
var nibbles = "";
|
|
32207
32207
|
var i, ii;
|
|
@@ -35935,51 +35935,51 @@ var require_pdf_worker = __commonJS({
|
|
|
35935
35935
|
return this.parts.join("");
|
|
35936
35936
|
}
|
|
35937
35937
|
};
|
|
35938
|
-
function buildAddOperation(num1,
|
|
35939
|
-
if (
|
|
35938
|
+
function buildAddOperation(num1, num22) {
|
|
35939
|
+
if (num22.type === "literal" && num22.number === 0) {
|
|
35940
35940
|
return num1;
|
|
35941
35941
|
}
|
|
35942
35942
|
if (num1.type === "literal" && num1.number === 0) {
|
|
35943
|
-
return
|
|
35943
|
+
return num22;
|
|
35944
35944
|
}
|
|
35945
|
-
if (
|
|
35946
|
-
return new AstLiteral(num1.number +
|
|
35945
|
+
if (num22.type === "literal" && num1.type === "literal") {
|
|
35946
|
+
return new AstLiteral(num1.number + num22.number);
|
|
35947
35947
|
}
|
|
35948
|
-
return new AstBinaryOperation("+", num1,
|
|
35948
|
+
return new AstBinaryOperation("+", num1, num22, num1.min + num22.min, num1.max + num22.max);
|
|
35949
35949
|
}
|
|
35950
|
-
function buildMulOperation(num1,
|
|
35951
|
-
if (
|
|
35952
|
-
if (
|
|
35950
|
+
function buildMulOperation(num1, num22) {
|
|
35951
|
+
if (num22.type === "literal") {
|
|
35952
|
+
if (num22.number === 0) {
|
|
35953
35953
|
return new AstLiteral(0);
|
|
35954
|
-
} else if (
|
|
35954
|
+
} else if (num22.number === 1) {
|
|
35955
35955
|
return num1;
|
|
35956
35956
|
} else if (num1.type === "literal") {
|
|
35957
|
-
return new AstLiteral(num1.number *
|
|
35957
|
+
return new AstLiteral(num1.number * num22.number);
|
|
35958
35958
|
}
|
|
35959
35959
|
}
|
|
35960
35960
|
if (num1.type === "literal") {
|
|
35961
35961
|
if (num1.number === 0) {
|
|
35962
35962
|
return new AstLiteral(0);
|
|
35963
35963
|
} else if (num1.number === 1) {
|
|
35964
|
-
return
|
|
35964
|
+
return num22;
|
|
35965
35965
|
}
|
|
35966
35966
|
}
|
|
35967
|
-
var min = Math.min(num1.min *
|
|
35968
|
-
var max = Math.max(num1.min *
|
|
35969
|
-
return new AstBinaryOperation("*", num1,
|
|
35967
|
+
var min = Math.min(num1.min * num22.min, num1.min * num22.max, num1.max * num22.min, num1.max * num22.max);
|
|
35968
|
+
var max = Math.max(num1.min * num22.min, num1.min * num22.max, num1.max * num22.min, num1.max * num22.max);
|
|
35969
|
+
return new AstBinaryOperation("*", num1, num22, min, max);
|
|
35970
35970
|
}
|
|
35971
|
-
function buildSubOperation(num1,
|
|
35972
|
-
if (
|
|
35973
|
-
if (
|
|
35971
|
+
function buildSubOperation(num1, num22) {
|
|
35972
|
+
if (num22.type === "literal") {
|
|
35973
|
+
if (num22.number === 0) {
|
|
35974
35974
|
return num1;
|
|
35975
35975
|
} else if (num1.type === "literal") {
|
|
35976
|
-
return new AstLiteral(num1.number -
|
|
35976
|
+
return new AstLiteral(num1.number - num22.number);
|
|
35977
35977
|
}
|
|
35978
35978
|
}
|
|
35979
|
-
if (
|
|
35980
|
-
return
|
|
35979
|
+
if (num22.type === "binary" && num22.op === "-" && num1.type === "literal" && num1.number === 1 && num22.arg1.type === "literal" && num22.arg1.number === 1) {
|
|
35980
|
+
return num22.arg2;
|
|
35981
35981
|
}
|
|
35982
|
-
return new AstBinaryOperation("-", num1,
|
|
35982
|
+
return new AstBinaryOperation("-", num1, num22, num1.min - num22.max, num1.max - num22.min);
|
|
35983
35983
|
}
|
|
35984
35984
|
function buildMinOperation(num1, max) {
|
|
35985
35985
|
if (num1.min >= max) {
|
|
@@ -35999,7 +35999,7 @@ var require_pdf_worker = __commonJS({
|
|
|
35999
35999
|
var inputSize = domain2.length >> 1, outputSize = range.length >> 1;
|
|
36000
36000
|
var lastRegister = 0;
|
|
36001
36001
|
var n2, j;
|
|
36002
|
-
var num1,
|
|
36002
|
+
var num1, num22, ast1, ast2, tmpVar, item;
|
|
36003
36003
|
for (i = 0; i < inputSize; i++) {
|
|
36004
36004
|
stack.push(new AstArgument(i, domain2[i * 2], domain2[i * 2 + 1]));
|
|
36005
36005
|
}
|
|
@@ -36014,9 +36014,9 @@ var require_pdf_worker = __commonJS({
|
|
|
36014
36014
|
if (stack.length < 2) {
|
|
36015
36015
|
return null;
|
|
36016
36016
|
}
|
|
36017
|
-
|
|
36017
|
+
num22 = stack.pop();
|
|
36018
36018
|
num1 = stack.pop();
|
|
36019
|
-
stack.push(buildAddOperation(num1,
|
|
36019
|
+
stack.push(buildAddOperation(num1, num22));
|
|
36020
36020
|
break;
|
|
36021
36021
|
case "cvr":
|
|
36022
36022
|
if (stack.length < 1) {
|
|
@@ -36027,17 +36027,17 @@ var require_pdf_worker = __commonJS({
|
|
|
36027
36027
|
if (stack.length < 2) {
|
|
36028
36028
|
return null;
|
|
36029
36029
|
}
|
|
36030
|
-
|
|
36030
|
+
num22 = stack.pop();
|
|
36031
36031
|
num1 = stack.pop();
|
|
36032
|
-
stack.push(buildMulOperation(num1,
|
|
36032
|
+
stack.push(buildMulOperation(num1, num22));
|
|
36033
36033
|
break;
|
|
36034
36034
|
case "sub":
|
|
36035
36035
|
if (stack.length < 2) {
|
|
36036
36036
|
return null;
|
|
36037
36037
|
}
|
|
36038
|
-
|
|
36038
|
+
num22 = stack.pop();
|
|
36039
36039
|
num1 = stack.pop();
|
|
36040
|
-
stack.push(buildSubOperation(num1,
|
|
36040
|
+
stack.push(buildSubOperation(num1, num22));
|
|
36041
36041
|
break;
|
|
36042
36042
|
case "exch":
|
|
36043
36043
|
if (stack.length < 2) {
|
|
@@ -36099,12 +36099,12 @@ var require_pdf_worker = __commonJS({
|
|
|
36099
36099
|
if (stack.length < 2) {
|
|
36100
36100
|
return null;
|
|
36101
36101
|
}
|
|
36102
|
-
|
|
36102
|
+
num22 = stack.pop();
|
|
36103
36103
|
num1 = stack.pop();
|
|
36104
|
-
if (
|
|
36104
|
+
if (num22.type !== "literal" || num1.type !== "literal") {
|
|
36105
36105
|
return null;
|
|
36106
36106
|
}
|
|
36107
|
-
j =
|
|
36107
|
+
j = num22.number;
|
|
36108
36108
|
n2 = num1.number;
|
|
36109
36109
|
if (n2 <= 0 || !Number.isInteger(n2) || !Number.isInteger(j) || stack.length < n2) {
|
|
36110
36110
|
return null;
|
|
@@ -43391,8 +43391,8 @@ var require_pdf_worker = __commonJS({
|
|
|
43391
43391
|
},
|
|
43392
43392
|
get numPages() {
|
|
43393
43393
|
var linearization = this.linearization;
|
|
43394
|
-
var
|
|
43395
|
-
return (0, _util.shadow)(this, "numPages",
|
|
43394
|
+
var num3 = linearization ? linearization.numPages : this.catalog.numPages;
|
|
43395
|
+
return (0, _util.shadow)(this, "numPages", num3);
|
|
43396
43396
|
},
|
|
43397
43397
|
get documentInfo() {
|
|
43398
43398
|
var docInfo = {
|
|
@@ -46449,11 +46449,11 @@ var require_pdf_worker = __commonJS({
|
|
|
46449
46449
|
var n2 = this.readNumber();
|
|
46450
46450
|
return n2 & 1 ? ~(n2 >>> 1) : n2 >>> 1;
|
|
46451
46451
|
},
|
|
46452
|
-
readHex: function readHex(
|
|
46453
|
-
|
|
46452
|
+
readHex: function readHex(num3, size) {
|
|
46453
|
+
num3.set(this.buffer.subarray(this.pos, this.pos + size + 1));
|
|
46454
46454
|
this.pos += size + 1;
|
|
46455
46455
|
},
|
|
46456
|
-
readHexNumber: function readHexNumber(
|
|
46456
|
+
readHexNumber: function readHexNumber(num3, size) {
|
|
46457
46457
|
var last;
|
|
46458
46458
|
var stack = this.tmpBuf, sp = 0;
|
|
46459
46459
|
do {
|
|
@@ -46470,19 +46470,19 @@ var require_pdf_worker = __commonJS({
|
|
|
46470
46470
|
buffer = stack[--sp] << bufferSize | buffer;
|
|
46471
46471
|
bufferSize += 7;
|
|
46472
46472
|
}
|
|
46473
|
-
|
|
46473
|
+
num3[i] = buffer & 255;
|
|
46474
46474
|
i--;
|
|
46475
46475
|
buffer >>= 8;
|
|
46476
46476
|
bufferSize -= 8;
|
|
46477
46477
|
}
|
|
46478
46478
|
},
|
|
46479
|
-
readHexSigned: function readHexSigned(
|
|
46480
|
-
this.readHexNumber(
|
|
46481
|
-
var sign =
|
|
46479
|
+
readHexSigned: function readHexSigned(num3, size) {
|
|
46480
|
+
this.readHexNumber(num3, size);
|
|
46481
|
+
var sign = num3[size] & 1 ? 255 : 0;
|
|
46482
46482
|
var c = 0;
|
|
46483
46483
|
for (var i = 0; i <= size; i++) {
|
|
46484
|
-
c = (c & 1) << 8 |
|
|
46485
|
-
|
|
46484
|
+
c = (c & 1) << 8 | num3[i];
|
|
46485
|
+
num3[i] = c >> 1 ^ sign;
|
|
46486
46486
|
}
|
|
46487
46487
|
},
|
|
46488
46488
|
readString: function readString() {
|
|
@@ -47103,15 +47103,15 @@ var require_pdf_worker = __commonJS({
|
|
|
47103
47103
|
return IdentityToUnicodeMap2;
|
|
47104
47104
|
})();
|
|
47105
47105
|
var OpenTypeFileBuilder = (function OpenTypeFileBuilderClosure() {
|
|
47106
|
-
function writeInt16(dest, offset,
|
|
47107
|
-
dest[offset] =
|
|
47108
|
-
dest[offset + 1] =
|
|
47106
|
+
function writeInt16(dest, offset, num3) {
|
|
47107
|
+
dest[offset] = num3 >> 8 & 255;
|
|
47108
|
+
dest[offset + 1] = num3 & 255;
|
|
47109
47109
|
}
|
|
47110
|
-
function writeInt32(dest, offset,
|
|
47111
|
-
dest[offset] =
|
|
47112
|
-
dest[offset + 1] =
|
|
47113
|
-
dest[offset + 2] =
|
|
47114
|
-
dest[offset + 3] =
|
|
47110
|
+
function writeInt32(dest, offset, num3) {
|
|
47111
|
+
dest[offset] = num3 >> 24 & 255;
|
|
47112
|
+
dest[offset + 1] = num3 >> 16 & 255;
|
|
47113
|
+
dest[offset + 2] = num3 >> 8 & 255;
|
|
47114
|
+
dest[offset + 3] = num3 & 255;
|
|
47115
47115
|
}
|
|
47116
47116
|
function writeData(dest, offset, data) {
|
|
47117
47117
|
var i, ii;
|
|
@@ -50267,9 +50267,9 @@ var require_pdf_worker = __commonJS({
|
|
|
50267
50267
|
error40 = true;
|
|
50268
50268
|
break;
|
|
50269
50269
|
}
|
|
50270
|
-
var
|
|
50270
|
+
var num22 = this.stack.pop();
|
|
50271
50271
|
var num1 = this.stack.pop();
|
|
50272
|
-
this.stack.push(num1 /
|
|
50272
|
+
this.stack.push(num1 / num22);
|
|
50273
50273
|
break;
|
|
50274
50274
|
case (12 << 8) + 16:
|
|
50275
50275
|
if (this.stack.length < 2) {
|
|
@@ -75687,8 +75687,8 @@ var require_pdf_worker2 = __commonJS({
|
|
|
75687
75687
|
return Dict2;
|
|
75688
75688
|
})();
|
|
75689
75689
|
var Ref = (function RefClosure() {
|
|
75690
|
-
function Ref2(
|
|
75691
|
-
this.num =
|
|
75690
|
+
function Ref2(num3, gen) {
|
|
75691
|
+
this.num = num3;
|
|
75692
75692
|
this.gen = gen;
|
|
75693
75693
|
}
|
|
75694
75694
|
Ref2.prototype = {
|
|
@@ -78349,14 +78349,14 @@ var require_pdf_worker2 = __commonJS({
|
|
|
78349
78349
|
}
|
|
78350
78350
|
}
|
|
78351
78351
|
if (Number.isInteger(buf1)) {
|
|
78352
|
-
var
|
|
78352
|
+
var num3 = buf1;
|
|
78353
78353
|
if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
|
|
78354
|
-
var ref = new _primitives.Ref(
|
|
78354
|
+
var ref = new _primitives.Ref(num3, this.buf1);
|
|
78355
78355
|
this.shift();
|
|
78356
78356
|
this.shift();
|
|
78357
78357
|
return ref;
|
|
78358
78358
|
}
|
|
78359
|
-
return
|
|
78359
|
+
return num3;
|
|
78360
78360
|
}
|
|
78361
78361
|
if ((0, _util.isString)(buf1)) {
|
|
78362
78362
|
var str3 = buf1;
|
|
@@ -86079,17 +86079,17 @@ var require_pdf_worker2 = __commonJS({
|
|
|
86079
86079
|
if (!(0, _primitives.isRef)(ref)) {
|
|
86080
86080
|
throw new Error("ref object is not a reference");
|
|
86081
86081
|
}
|
|
86082
|
-
var
|
|
86083
|
-
if (
|
|
86084
|
-
var cacheEntry = this.cache[
|
|
86082
|
+
var num3 = ref.num;
|
|
86083
|
+
if (num3 in this.cache) {
|
|
86084
|
+
var cacheEntry = this.cache[num3];
|
|
86085
86085
|
if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
|
|
86086
86086
|
cacheEntry.objId = ref.toString();
|
|
86087
86087
|
}
|
|
86088
86088
|
return cacheEntry;
|
|
86089
86089
|
}
|
|
86090
|
-
var xrefEntry = this.getEntry(
|
|
86090
|
+
var xrefEntry = this.getEntry(num3);
|
|
86091
86091
|
if (xrefEntry === null) {
|
|
86092
|
-
return this.cache[
|
|
86092
|
+
return this.cache[num3] = null;
|
|
86093
86093
|
}
|
|
86094
86094
|
if (xrefEntry.uncompressed) {
|
|
86095
86095
|
xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
|
|
@@ -86105,7 +86105,7 @@ var require_pdf_worker2 = __commonJS({
|
|
|
86105
86105
|
},
|
|
86106
86106
|
fetchUncompressed: function XRef_fetchUncompressed(ref, xrefEntry, suppressEncryption) {
|
|
86107
86107
|
var gen = ref.gen;
|
|
86108
|
-
var
|
|
86108
|
+
var num3 = ref.num;
|
|
86109
86109
|
if (xrefEntry.gen !== gen) {
|
|
86110
86110
|
throw new _util.FormatError("inconsistent generation in XRef");
|
|
86111
86111
|
}
|
|
@@ -86120,25 +86120,25 @@ var require_pdf_worker2 = __commonJS({
|
|
|
86120
86120
|
if (!Number.isInteger(obj2)) {
|
|
86121
86121
|
obj2 = parseInt(obj2, 10);
|
|
86122
86122
|
}
|
|
86123
|
-
if (obj1 !==
|
|
86123
|
+
if (obj1 !== num3 || obj2 !== gen || !(0, _primitives.isCmd)(obj3)) {
|
|
86124
86124
|
throw new _util.FormatError("bad XRef entry");
|
|
86125
86125
|
}
|
|
86126
86126
|
if (obj3.cmd !== "obj") {
|
|
86127
86127
|
if (obj3.cmd.indexOf("obj") === 0) {
|
|
86128
|
-
|
|
86129
|
-
if (!Number.isNaN(
|
|
86130
|
-
return
|
|
86128
|
+
num3 = parseInt(obj3.cmd.substring(3), 10);
|
|
86129
|
+
if (!Number.isNaN(num3)) {
|
|
86130
|
+
return num3;
|
|
86131
86131
|
}
|
|
86132
86132
|
}
|
|
86133
86133
|
throw new _util.FormatError("bad XRef entry");
|
|
86134
86134
|
}
|
|
86135
86135
|
if (this.encrypt && !suppressEncryption) {
|
|
86136
|
-
xrefEntry = parser.getObj(this.encrypt.createCipherTransform(
|
|
86136
|
+
xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num3, gen));
|
|
86137
86137
|
} else {
|
|
86138
86138
|
xrefEntry = parser.getObj();
|
|
86139
86139
|
}
|
|
86140
86140
|
if (!(0, _primitives.isStream)(xrefEntry)) {
|
|
86141
|
-
this.cache[
|
|
86141
|
+
this.cache[num3] = xrefEntry;
|
|
86142
86142
|
}
|
|
86143
86143
|
return xrefEntry;
|
|
86144
86144
|
},
|
|
@@ -86155,13 +86155,13 @@ var require_pdf_worker2 = __commonJS({
|
|
|
86155
86155
|
}
|
|
86156
86156
|
var parser = new _parser2.Parser(new _parser2.Lexer(stream), false, this);
|
|
86157
86157
|
parser.allowStreams = true;
|
|
86158
|
-
var i, entries = [],
|
|
86158
|
+
var i, entries = [], num3, nums = [];
|
|
86159
86159
|
for (i = 0; i < n2; ++i) {
|
|
86160
|
-
|
|
86161
|
-
if (!Number.isInteger(
|
|
86162
|
-
throw new _util.FormatError("invalid object number in the ObjStm stream: " +
|
|
86160
|
+
num3 = parser.getObj();
|
|
86161
|
+
if (!Number.isInteger(num3)) {
|
|
86162
|
+
throw new _util.FormatError("invalid object number in the ObjStm stream: " + num3);
|
|
86163
86163
|
}
|
|
86164
|
-
nums.push(
|
|
86164
|
+
nums.push(num3);
|
|
86165
86165
|
var offset = parser.getObj();
|
|
86166
86166
|
if (!Number.isInteger(offset)) {
|
|
86167
86167
|
throw new _util.FormatError("invalid object offset in the ObjStm stream: " + offset);
|
|
@@ -86172,10 +86172,10 @@ var require_pdf_worker2 = __commonJS({
|
|
|
86172
86172
|
if ((0, _primitives.isCmd)(parser.buf1, "endobj")) {
|
|
86173
86173
|
parser.shift();
|
|
86174
86174
|
}
|
|
86175
|
-
|
|
86176
|
-
var entry = this.entries[
|
|
86175
|
+
num3 = nums[i];
|
|
86176
|
+
var entry = this.entries[num3];
|
|
86177
86177
|
if (entry && entry.offset === tableOffset && entry.gen === i) {
|
|
86178
|
-
this.cache[
|
|
86178
|
+
this.cache[num3] = entries[i];
|
|
86179
86179
|
}
|
|
86180
86180
|
}
|
|
86181
86181
|
xrefEntry = entries[xrefEntry.gen];
|
|
@@ -90143,14 +90143,14 @@ var require_pdf_worker2 = __commonJS({
|
|
|
90143
90143
|
this.eff = dict.get("EFF") || this.stmf;
|
|
90144
90144
|
}
|
|
90145
90145
|
}
|
|
90146
|
-
function buildObjectKey(
|
|
90146
|
+
function buildObjectKey(num3, gen, encryptionKey, isAes) {
|
|
90147
90147
|
var key = new Uint8Array(encryptionKey.length + 9), i, n2;
|
|
90148
90148
|
for (i = 0, n2 = encryptionKey.length; i < n2; ++i) {
|
|
90149
90149
|
key[i] = encryptionKey[i];
|
|
90150
90150
|
}
|
|
90151
|
-
key[i++] =
|
|
90152
|
-
key[i++] =
|
|
90153
|
-
key[i++] =
|
|
90151
|
+
key[i++] = num3 & 255;
|
|
90152
|
+
key[i++] = num3 >> 8 & 255;
|
|
90153
|
+
key[i++] = num3 >> 16 & 255;
|
|
90154
90154
|
key[i++] = gen & 255;
|
|
90155
90155
|
key[i++] = gen >> 8 & 255;
|
|
90156
90156
|
if (isAes) {
|
|
@@ -90162,7 +90162,7 @@ var require_pdf_worker2 = __commonJS({
|
|
|
90162
90162
|
var hash2 = calculateMD5(key, 0, i);
|
|
90163
90163
|
return hash2.subarray(0, Math.min(encryptionKey.length + 5, 16));
|
|
90164
90164
|
}
|
|
90165
|
-
function buildCipherConstructor(cf, name,
|
|
90165
|
+
function buildCipherConstructor(cf, name, num3, gen, key) {
|
|
90166
90166
|
if (!(0, _primitives.isName)(name)) {
|
|
90167
90167
|
throw new _util.FormatError("Invalid crypt filter name.");
|
|
90168
90168
|
}
|
|
@@ -90178,12 +90178,12 @@ var require_pdf_worker2 = __commonJS({
|
|
|
90178
90178
|
}
|
|
90179
90179
|
if (cfm.name === "V2") {
|
|
90180
90180
|
return function cipherTransformFactoryBuildCipherConstructorV2() {
|
|
90181
|
-
return new ARCFourCipher(buildObjectKey(
|
|
90181
|
+
return new ARCFourCipher(buildObjectKey(num3, gen, key, false));
|
|
90182
90182
|
};
|
|
90183
90183
|
}
|
|
90184
90184
|
if (cfm.name === "AESV2") {
|
|
90185
90185
|
return function cipherTransformFactoryBuildCipherConstructorAESV2() {
|
|
90186
|
-
return new AES128Cipher(buildObjectKey(
|
|
90186
|
+
return new AES128Cipher(buildObjectKey(num3, gen, key, true));
|
|
90187
90187
|
};
|
|
90188
90188
|
}
|
|
90189
90189
|
if (cfm.name === "AESV3") {
|
|
@@ -90194,11 +90194,11 @@ var require_pdf_worker2 = __commonJS({
|
|
|
90194
90194
|
throw new _util.FormatError("Unknown crypto method");
|
|
90195
90195
|
}
|
|
90196
90196
|
CipherTransformFactory2.prototype = {
|
|
90197
|
-
createCipherTransform: function CipherTransformFactory_createCipherTransform(
|
|
90197
|
+
createCipherTransform: function CipherTransformFactory_createCipherTransform(num3, gen) {
|
|
90198
90198
|
if (this.algorithm === 4 || this.algorithm === 5) {
|
|
90199
|
-
return new CipherTransform(buildCipherConstructor(this.cf, this.stmf,
|
|
90199
|
+
return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num3, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num3, gen, this.encryptionKey));
|
|
90200
90200
|
}
|
|
90201
|
-
var key = buildObjectKey(
|
|
90201
|
+
var key = buildObjectKey(num3, gen, this.encryptionKey, false);
|
|
90202
90202
|
var cipherConstructor = function buildCipherCipherConstructor() {
|
|
90203
90203
|
return new ARCFourCipher(key);
|
|
90204
90204
|
};
|
|
@@ -94400,12 +94400,12 @@ var require_pdf_worker2 = __commonJS({
|
|
|
94400
94400
|
}
|
|
94401
94401
|
return this.encodeFloat(value);
|
|
94402
94402
|
},
|
|
94403
|
-
encodeFloat: function CFFCompiler_encodeFloat(
|
|
94404
|
-
var value =
|
|
94403
|
+
encodeFloat: function CFFCompiler_encodeFloat(num3) {
|
|
94404
|
+
var value = num3.toString();
|
|
94405
94405
|
var m2 = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
|
|
94406
94406
|
if (m2) {
|
|
94407
94407
|
var epsilon = parseFloat("1e" + ((m2[2] ? +m2[2] : 0) + m2[1].length));
|
|
94408
|
-
value = (Math.round(
|
|
94408
|
+
value = (Math.round(num3 * epsilon) / epsilon).toString();
|
|
94409
94409
|
}
|
|
94410
94410
|
var nibbles = "";
|
|
94411
94411
|
var i, ii;
|
|
@@ -98150,51 +98150,51 @@ var require_pdf_worker2 = __commonJS({
|
|
|
98150
98150
|
return this.parts.join("");
|
|
98151
98151
|
}
|
|
98152
98152
|
};
|
|
98153
|
-
function buildAddOperation(num1,
|
|
98154
|
-
if (
|
|
98153
|
+
function buildAddOperation(num1, num22) {
|
|
98154
|
+
if (num22.type === "literal" && num22.number === 0) {
|
|
98155
98155
|
return num1;
|
|
98156
98156
|
}
|
|
98157
98157
|
if (num1.type === "literal" && num1.number === 0) {
|
|
98158
|
-
return
|
|
98158
|
+
return num22;
|
|
98159
98159
|
}
|
|
98160
|
-
if (
|
|
98161
|
-
return new AstLiteral(num1.number +
|
|
98160
|
+
if (num22.type === "literal" && num1.type === "literal") {
|
|
98161
|
+
return new AstLiteral(num1.number + num22.number);
|
|
98162
98162
|
}
|
|
98163
|
-
return new AstBinaryOperation("+", num1,
|
|
98163
|
+
return new AstBinaryOperation("+", num1, num22, num1.min + num22.min, num1.max + num22.max);
|
|
98164
98164
|
}
|
|
98165
|
-
function buildMulOperation(num1,
|
|
98166
|
-
if (
|
|
98167
|
-
if (
|
|
98165
|
+
function buildMulOperation(num1, num22) {
|
|
98166
|
+
if (num22.type === "literal") {
|
|
98167
|
+
if (num22.number === 0) {
|
|
98168
98168
|
return new AstLiteral(0);
|
|
98169
|
-
} else if (
|
|
98169
|
+
} else if (num22.number === 1) {
|
|
98170
98170
|
return num1;
|
|
98171
98171
|
} else if (num1.type === "literal") {
|
|
98172
|
-
return new AstLiteral(num1.number *
|
|
98172
|
+
return new AstLiteral(num1.number * num22.number);
|
|
98173
98173
|
}
|
|
98174
98174
|
}
|
|
98175
98175
|
if (num1.type === "literal") {
|
|
98176
98176
|
if (num1.number === 0) {
|
|
98177
98177
|
return new AstLiteral(0);
|
|
98178
98178
|
} else if (num1.number === 1) {
|
|
98179
|
-
return
|
|
98179
|
+
return num22;
|
|
98180
98180
|
}
|
|
98181
98181
|
}
|
|
98182
|
-
var min = Math.min(num1.min *
|
|
98183
|
-
var max = Math.max(num1.min *
|
|
98184
|
-
return new AstBinaryOperation("*", num1,
|
|
98182
|
+
var min = Math.min(num1.min * num22.min, num1.min * num22.max, num1.max * num22.min, num1.max * num22.max);
|
|
98183
|
+
var max = Math.max(num1.min * num22.min, num1.min * num22.max, num1.max * num22.min, num1.max * num22.max);
|
|
98184
|
+
return new AstBinaryOperation("*", num1, num22, min, max);
|
|
98185
98185
|
}
|
|
98186
|
-
function buildSubOperation(num1,
|
|
98187
|
-
if (
|
|
98188
|
-
if (
|
|
98186
|
+
function buildSubOperation(num1, num22) {
|
|
98187
|
+
if (num22.type === "literal") {
|
|
98188
|
+
if (num22.number === 0) {
|
|
98189
98189
|
return num1;
|
|
98190
98190
|
} else if (num1.type === "literal") {
|
|
98191
|
-
return new AstLiteral(num1.number -
|
|
98191
|
+
return new AstLiteral(num1.number - num22.number);
|
|
98192
98192
|
}
|
|
98193
98193
|
}
|
|
98194
|
-
if (
|
|
98195
|
-
return
|
|
98194
|
+
if (num22.type === "binary" && num22.op === "-" && num1.type === "literal" && num1.number === 1 && num22.arg1.type === "literal" && num22.arg1.number === 1) {
|
|
98195
|
+
return num22.arg2;
|
|
98196
98196
|
}
|
|
98197
|
-
return new AstBinaryOperation("-", num1,
|
|
98197
|
+
return new AstBinaryOperation("-", num1, num22, num1.min - num22.max, num1.max - num22.min);
|
|
98198
98198
|
}
|
|
98199
98199
|
function buildMinOperation(num1, max) {
|
|
98200
98200
|
if (num1.min >= max) {
|
|
@@ -98214,7 +98214,7 @@ var require_pdf_worker2 = __commonJS({
|
|
|
98214
98214
|
var inputSize = domain2.length >> 1, outputSize = range.length >> 1;
|
|
98215
98215
|
var lastRegister = 0;
|
|
98216
98216
|
var n2, j;
|
|
98217
|
-
var num1,
|
|
98217
|
+
var num1, num22, ast1, ast2, tmpVar, item;
|
|
98218
98218
|
for (i = 0; i < inputSize; i++) {
|
|
98219
98219
|
stack.push(new AstArgument(i, domain2[i * 2], domain2[i * 2 + 1]));
|
|
98220
98220
|
}
|
|
@@ -98229,9 +98229,9 @@ var require_pdf_worker2 = __commonJS({
|
|
|
98229
98229
|
if (stack.length < 2) {
|
|
98230
98230
|
return null;
|
|
98231
98231
|
}
|
|
98232
|
-
|
|
98232
|
+
num22 = stack.pop();
|
|
98233
98233
|
num1 = stack.pop();
|
|
98234
|
-
stack.push(buildAddOperation(num1,
|
|
98234
|
+
stack.push(buildAddOperation(num1, num22));
|
|
98235
98235
|
break;
|
|
98236
98236
|
case "cvr":
|
|
98237
98237
|
if (stack.length < 1) {
|
|
@@ -98242,17 +98242,17 @@ var require_pdf_worker2 = __commonJS({
|
|
|
98242
98242
|
if (stack.length < 2) {
|
|
98243
98243
|
return null;
|
|
98244
98244
|
}
|
|
98245
|
-
|
|
98245
|
+
num22 = stack.pop();
|
|
98246
98246
|
num1 = stack.pop();
|
|
98247
|
-
stack.push(buildMulOperation(num1,
|
|
98247
|
+
stack.push(buildMulOperation(num1, num22));
|
|
98248
98248
|
break;
|
|
98249
98249
|
case "sub":
|
|
98250
98250
|
if (stack.length < 2) {
|
|
98251
98251
|
return null;
|
|
98252
98252
|
}
|
|
98253
|
-
|
|
98253
|
+
num22 = stack.pop();
|
|
98254
98254
|
num1 = stack.pop();
|
|
98255
|
-
stack.push(buildSubOperation(num1,
|
|
98255
|
+
stack.push(buildSubOperation(num1, num22));
|
|
98256
98256
|
break;
|
|
98257
98257
|
case "exch":
|
|
98258
98258
|
if (stack.length < 2) {
|
|
@@ -98314,12 +98314,12 @@ var require_pdf_worker2 = __commonJS({
|
|
|
98314
98314
|
if (stack.length < 2) {
|
|
98315
98315
|
return null;
|
|
98316
98316
|
}
|
|
98317
|
-
|
|
98317
|
+
num22 = stack.pop();
|
|
98318
98318
|
num1 = stack.pop();
|
|
98319
|
-
if (
|
|
98319
|
+
if (num22.type !== "literal" || num1.type !== "literal") {
|
|
98320
98320
|
return null;
|
|
98321
98321
|
}
|
|
98322
|
-
j =
|
|
98322
|
+
j = num22.number;
|
|
98323
98323
|
n2 = num1.number;
|
|
98324
98324
|
if (n2 <= 0 || !Number.isInteger(n2) || !Number.isInteger(j) || stack.length < n2) {
|
|
98325
98325
|
return null;
|
|
@@ -105599,8 +105599,8 @@ var require_pdf_worker2 = __commonJS({
|
|
|
105599
105599
|
},
|
|
105600
105600
|
get numPages() {
|
|
105601
105601
|
var linearization = this.linearization;
|
|
105602
|
-
var
|
|
105603
|
-
return (0, _util.shadow)(this, "numPages",
|
|
105602
|
+
var num3 = linearization ? linearization.numPages : this.catalog.numPages;
|
|
105603
|
+
return (0, _util.shadow)(this, "numPages", num3);
|
|
105604
105604
|
},
|
|
105605
105605
|
get documentInfo() {
|
|
105606
105606
|
var docInfo = {
|
|
@@ -108657,11 +108657,11 @@ var require_pdf_worker2 = __commonJS({
|
|
|
108657
108657
|
var n2 = this.readNumber();
|
|
108658
108658
|
return n2 & 1 ? ~(n2 >>> 1) : n2 >>> 1;
|
|
108659
108659
|
},
|
|
108660
|
-
readHex: function readHex(
|
|
108661
|
-
|
|
108660
|
+
readHex: function readHex(num3, size) {
|
|
108661
|
+
num3.set(this.buffer.subarray(this.pos, this.pos + size + 1));
|
|
108662
108662
|
this.pos += size + 1;
|
|
108663
108663
|
},
|
|
108664
|
-
readHexNumber: function readHexNumber(
|
|
108664
|
+
readHexNumber: function readHexNumber(num3, size) {
|
|
108665
108665
|
var last;
|
|
108666
108666
|
var stack = this.tmpBuf, sp = 0;
|
|
108667
108667
|
do {
|
|
@@ -108678,19 +108678,19 @@ var require_pdf_worker2 = __commonJS({
|
|
|
108678
108678
|
buffer = stack[--sp] << bufferSize | buffer;
|
|
108679
108679
|
bufferSize += 7;
|
|
108680
108680
|
}
|
|
108681
|
-
|
|
108681
|
+
num3[i] = buffer & 255;
|
|
108682
108682
|
i--;
|
|
108683
108683
|
buffer >>= 8;
|
|
108684
108684
|
bufferSize -= 8;
|
|
108685
108685
|
}
|
|
108686
108686
|
},
|
|
108687
|
-
readHexSigned: function readHexSigned(
|
|
108688
|
-
this.readHexNumber(
|
|
108689
|
-
var sign =
|
|
108687
|
+
readHexSigned: function readHexSigned(num3, size) {
|
|
108688
|
+
this.readHexNumber(num3, size);
|
|
108689
|
+
var sign = num3[size] & 1 ? 255 : 0;
|
|
108690
108690
|
var c = 0;
|
|
108691
108691
|
for (var i = 0; i <= size; i++) {
|
|
108692
|
-
c = (c & 1) << 8 |
|
|
108693
|
-
|
|
108692
|
+
c = (c & 1) << 8 | num3[i];
|
|
108693
|
+
num3[i] = c >> 1 ^ sign;
|
|
108694
108694
|
}
|
|
108695
108695
|
},
|
|
108696
108696
|
readString: function readString() {
|
|
@@ -109311,15 +109311,15 @@ var require_pdf_worker2 = __commonJS({
|
|
|
109311
109311
|
return IdentityToUnicodeMap2;
|
|
109312
109312
|
})();
|
|
109313
109313
|
var OpenTypeFileBuilder = (function OpenTypeFileBuilderClosure() {
|
|
109314
|
-
function writeInt16(dest, offset,
|
|
109315
|
-
dest[offset] =
|
|
109316
|
-
dest[offset + 1] =
|
|
109314
|
+
function writeInt16(dest, offset, num3) {
|
|
109315
|
+
dest[offset] = num3 >> 8 & 255;
|
|
109316
|
+
dest[offset + 1] = num3 & 255;
|
|
109317
109317
|
}
|
|
109318
|
-
function writeInt32(dest, offset,
|
|
109319
|
-
dest[offset] =
|
|
109320
|
-
dest[offset + 1] =
|
|
109321
|
-
dest[offset + 2] =
|
|
109322
|
-
dest[offset + 3] =
|
|
109318
|
+
function writeInt32(dest, offset, num3) {
|
|
109319
|
+
dest[offset] = num3 >> 24 & 255;
|
|
109320
|
+
dest[offset + 1] = num3 >> 16 & 255;
|
|
109321
|
+
dest[offset + 2] = num3 >> 8 & 255;
|
|
109322
|
+
dest[offset + 3] = num3 & 255;
|
|
109323
109323
|
}
|
|
109324
109324
|
function writeData(dest, offset, data) {
|
|
109325
109325
|
var i, ii;
|
|
@@ -112469,9 +112469,9 @@ var require_pdf_worker2 = __commonJS({
|
|
|
112469
112469
|
error40 = true;
|
|
112470
112470
|
break;
|
|
112471
112471
|
}
|
|
112472
|
-
var
|
|
112472
|
+
var num22 = this.stack.pop();
|
|
112473
112473
|
var num1 = this.stack.pop();
|
|
112474
|
-
this.stack.push(num1 /
|
|
112474
|
+
this.stack.push(num1 / num22);
|
|
112475
112475
|
break;
|
|
112476
112476
|
case (12 << 8) + 16:
|
|
112477
112477
|
if (this.stack.length < 2) {
|
|
@@ -136635,8 +136635,8 @@ var require_pdf_worker3 = __commonJS({
|
|
|
136635
136635
|
}
|
|
136636
136636
|
return result;
|
|
136637
136637
|
};
|
|
136638
|
-
Util2.sign = function Util_sign(
|
|
136639
|
-
return
|
|
136638
|
+
Util2.sign = function Util_sign(num3) {
|
|
136639
|
+
return num3 < 0 ? -1 : 1;
|
|
136640
136640
|
};
|
|
136641
136641
|
var ROMAN_NUMBER_MAP = ["", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM", "", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC", "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"];
|
|
136642
136642
|
Util2.toRoman = function Util_toRoman(number4, lowerCase) {
|
|
@@ -137530,8 +137530,8 @@ var require_pdf_worker3 = __commonJS({
|
|
|
137530
137530
|
return Dict2;
|
|
137531
137531
|
})();
|
|
137532
137532
|
var Ref = (function RefClosure() {
|
|
137533
|
-
function Ref2(
|
|
137534
|
-
this.num =
|
|
137533
|
+
function Ref2(num3, gen) {
|
|
137534
|
+
this.num = num3;
|
|
137535
137535
|
this.gen = gen;
|
|
137536
137536
|
}
|
|
137537
137537
|
Ref2.prototype = {
|
|
@@ -140352,14 +140352,14 @@ var require_pdf_worker3 = __commonJS({
|
|
|
140352
140352
|
}
|
|
140353
140353
|
}
|
|
140354
140354
|
if ((0, _util.isInt)(buf1)) {
|
|
140355
|
-
var
|
|
140355
|
+
var num3 = buf1;
|
|
140356
140356
|
if ((0, _util.isInt)(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
|
|
140357
|
-
var ref = new _primitives.Ref(
|
|
140357
|
+
var ref = new _primitives.Ref(num3, this.buf1);
|
|
140358
140358
|
this.shift();
|
|
140359
140359
|
this.shift();
|
|
140360
140360
|
return ref;
|
|
140361
140361
|
}
|
|
140362
|
-
return
|
|
140362
|
+
return num3;
|
|
140363
140363
|
}
|
|
140364
140364
|
if ((0, _util.isString)(buf1)) {
|
|
140365
140365
|
var str3 = buf1;
|
|
@@ -146452,51 +146452,51 @@ var require_pdf_worker3 = __commonJS({
|
|
|
146452
146452
|
return this.parts.join("");
|
|
146453
146453
|
}
|
|
146454
146454
|
};
|
|
146455
|
-
function buildAddOperation(num1,
|
|
146456
|
-
if (
|
|
146455
|
+
function buildAddOperation(num1, num22) {
|
|
146456
|
+
if (num22.type === "literal" && num22.number === 0) {
|
|
146457
146457
|
return num1;
|
|
146458
146458
|
}
|
|
146459
146459
|
if (num1.type === "literal" && num1.number === 0) {
|
|
146460
|
-
return
|
|
146460
|
+
return num22;
|
|
146461
146461
|
}
|
|
146462
|
-
if (
|
|
146463
|
-
return new AstLiteral(num1.number +
|
|
146462
|
+
if (num22.type === "literal" && num1.type === "literal") {
|
|
146463
|
+
return new AstLiteral(num1.number + num22.number);
|
|
146464
146464
|
}
|
|
146465
|
-
return new AstBinaryOperation("+", num1,
|
|
146465
|
+
return new AstBinaryOperation("+", num1, num22, num1.min + num22.min, num1.max + num22.max);
|
|
146466
146466
|
}
|
|
146467
|
-
function buildMulOperation(num1,
|
|
146468
|
-
if (
|
|
146469
|
-
if (
|
|
146467
|
+
function buildMulOperation(num1, num22) {
|
|
146468
|
+
if (num22.type === "literal") {
|
|
146469
|
+
if (num22.number === 0) {
|
|
146470
146470
|
return new AstLiteral(0);
|
|
146471
|
-
} else if (
|
|
146471
|
+
} else if (num22.number === 1) {
|
|
146472
146472
|
return num1;
|
|
146473
146473
|
} else if (num1.type === "literal") {
|
|
146474
|
-
return new AstLiteral(num1.number *
|
|
146474
|
+
return new AstLiteral(num1.number * num22.number);
|
|
146475
146475
|
}
|
|
146476
146476
|
}
|
|
146477
146477
|
if (num1.type === "literal") {
|
|
146478
146478
|
if (num1.number === 0) {
|
|
146479
146479
|
return new AstLiteral(0);
|
|
146480
146480
|
} else if (num1.number === 1) {
|
|
146481
|
-
return
|
|
146481
|
+
return num22;
|
|
146482
146482
|
}
|
|
146483
146483
|
}
|
|
146484
|
-
var min = Math.min(num1.min *
|
|
146485
|
-
var max = Math.max(num1.min *
|
|
146486
|
-
return new AstBinaryOperation("*", num1,
|
|
146484
|
+
var min = Math.min(num1.min * num22.min, num1.min * num22.max, num1.max * num22.min, num1.max * num22.max);
|
|
146485
|
+
var max = Math.max(num1.min * num22.min, num1.min * num22.max, num1.max * num22.min, num1.max * num22.max);
|
|
146486
|
+
return new AstBinaryOperation("*", num1, num22, min, max);
|
|
146487
146487
|
}
|
|
146488
|
-
function buildSubOperation(num1,
|
|
146489
|
-
if (
|
|
146490
|
-
if (
|
|
146488
|
+
function buildSubOperation(num1, num22) {
|
|
146489
|
+
if (num22.type === "literal") {
|
|
146490
|
+
if (num22.number === 0) {
|
|
146491
146491
|
return num1;
|
|
146492
146492
|
} else if (num1.type === "literal") {
|
|
146493
|
-
return new AstLiteral(num1.number -
|
|
146493
|
+
return new AstLiteral(num1.number - num22.number);
|
|
146494
146494
|
}
|
|
146495
146495
|
}
|
|
146496
|
-
if (
|
|
146497
|
-
return
|
|
146496
|
+
if (num22.type === "binary" && num22.op === "-" && num1.type === "literal" && num1.number === 1 && num22.arg1.type === "literal" && num22.arg1.number === 1) {
|
|
146497
|
+
return num22.arg2;
|
|
146498
146498
|
}
|
|
146499
|
-
return new AstBinaryOperation("-", num1,
|
|
146499
|
+
return new AstBinaryOperation("-", num1, num22, num1.min - num22.max, num1.max - num22.min);
|
|
146500
146500
|
}
|
|
146501
146501
|
function buildMinOperation(num1, max) {
|
|
146502
146502
|
if (num1.min >= max) {
|
|
@@ -146516,7 +146516,7 @@ var require_pdf_worker3 = __commonJS({
|
|
|
146516
146516
|
var inputSize = domain2.length >> 1, outputSize = range.length >> 1;
|
|
146517
146517
|
var lastRegister = 0;
|
|
146518
146518
|
var n2, j;
|
|
146519
|
-
var num1,
|
|
146519
|
+
var num1, num22, ast1, ast2, tmpVar, item;
|
|
146520
146520
|
for (i = 0; i < inputSize; i++) {
|
|
146521
146521
|
stack.push(new AstArgument(i, domain2[i * 2], domain2[i * 2 + 1]));
|
|
146522
146522
|
}
|
|
@@ -146531,9 +146531,9 @@ var require_pdf_worker3 = __commonJS({
|
|
|
146531
146531
|
if (stack.length < 2) {
|
|
146532
146532
|
return null;
|
|
146533
146533
|
}
|
|
146534
|
-
|
|
146534
|
+
num22 = stack.pop();
|
|
146535
146535
|
num1 = stack.pop();
|
|
146536
|
-
stack.push(buildAddOperation(num1,
|
|
146536
|
+
stack.push(buildAddOperation(num1, num22));
|
|
146537
146537
|
break;
|
|
146538
146538
|
case "cvr":
|
|
146539
146539
|
if (stack.length < 1) {
|
|
@@ -146544,17 +146544,17 @@ var require_pdf_worker3 = __commonJS({
|
|
|
146544
146544
|
if (stack.length < 2) {
|
|
146545
146545
|
return null;
|
|
146546
146546
|
}
|
|
146547
|
-
|
|
146547
|
+
num22 = stack.pop();
|
|
146548
146548
|
num1 = stack.pop();
|
|
146549
|
-
stack.push(buildMulOperation(num1,
|
|
146549
|
+
stack.push(buildMulOperation(num1, num22));
|
|
146550
146550
|
break;
|
|
146551
146551
|
case "sub":
|
|
146552
146552
|
if (stack.length < 2) {
|
|
146553
146553
|
return null;
|
|
146554
146554
|
}
|
|
146555
|
-
|
|
146555
|
+
num22 = stack.pop();
|
|
146556
146556
|
num1 = stack.pop();
|
|
146557
|
-
stack.push(buildSubOperation(num1,
|
|
146557
|
+
stack.push(buildSubOperation(num1, num22));
|
|
146558
146558
|
break;
|
|
146559
146559
|
case "exch":
|
|
146560
146560
|
if (stack.length < 2) {
|
|
@@ -146616,12 +146616,12 @@ var require_pdf_worker3 = __commonJS({
|
|
|
146616
146616
|
if (stack.length < 2) {
|
|
146617
146617
|
return null;
|
|
146618
146618
|
}
|
|
146619
|
-
|
|
146619
|
+
num22 = stack.pop();
|
|
146620
146620
|
num1 = stack.pop();
|
|
146621
|
-
if (
|
|
146621
|
+
if (num22.type !== "literal" || num1.type !== "literal") {
|
|
146622
146622
|
return null;
|
|
146623
146623
|
}
|
|
146624
|
-
j =
|
|
146624
|
+
j = num22.number;
|
|
146625
146625
|
n2 = num1.number;
|
|
146626
146626
|
if (n2 <= 0 || (n2 | 0) !== n2 || (j | 0) !== j || stack.length < n2) {
|
|
146627
146627
|
return null;
|
|
@@ -150150,12 +150150,12 @@ var require_pdf_worker3 = __commonJS({
|
|
|
150150
150150
|
}
|
|
150151
150151
|
return this.encodeFloat(value);
|
|
150152
150152
|
},
|
|
150153
|
-
encodeFloat: function CFFCompiler_encodeFloat(
|
|
150154
|
-
var value =
|
|
150153
|
+
encodeFloat: function CFFCompiler_encodeFloat(num3) {
|
|
150154
|
+
var value = num3.toString();
|
|
150155
150155
|
var m2 = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
|
|
150156
150156
|
if (m2) {
|
|
150157
150157
|
var epsilon = parseFloat("1e" + ((m2[2] ? +m2[2] : 0) + m2[1].length));
|
|
150158
|
-
value = (Math.round(
|
|
150158
|
+
value = (Math.round(num3 * epsilon) / epsilon).toString();
|
|
150159
150159
|
}
|
|
150160
150160
|
var nibbles = "";
|
|
150161
150161
|
var i, ii;
|
|
@@ -152270,14 +152270,14 @@ var require_pdf_worker3 = __commonJS({
|
|
|
152270
152270
|
this.eff = dict.get("EFF") || this.stmf;
|
|
152271
152271
|
}
|
|
152272
152272
|
}
|
|
152273
|
-
function buildObjectKey(
|
|
152273
|
+
function buildObjectKey(num3, gen, encryptionKey, isAes) {
|
|
152274
152274
|
var key = new Uint8Array(encryptionKey.length + 9), i, n2;
|
|
152275
152275
|
for (i = 0, n2 = encryptionKey.length; i < n2; ++i) {
|
|
152276
152276
|
key[i] = encryptionKey[i];
|
|
152277
152277
|
}
|
|
152278
|
-
key[i++] =
|
|
152279
|
-
key[i++] =
|
|
152280
|
-
key[i++] =
|
|
152278
|
+
key[i++] = num3 & 255;
|
|
152279
|
+
key[i++] = num3 >> 8 & 255;
|
|
152280
|
+
key[i++] = num3 >> 16 & 255;
|
|
152281
152281
|
key[i++] = gen & 255;
|
|
152282
152282
|
key[i++] = gen >> 8 & 255;
|
|
152283
152283
|
if (isAes) {
|
|
@@ -152289,7 +152289,7 @@ var require_pdf_worker3 = __commonJS({
|
|
|
152289
152289
|
var hash2 = calculateMD5(key, 0, i);
|
|
152290
152290
|
return hash2.subarray(0, Math.min(encryptionKey.length + 5, 16));
|
|
152291
152291
|
}
|
|
152292
|
-
function buildCipherConstructor(cf, name,
|
|
152292
|
+
function buildCipherConstructor(cf, name, num3, gen, key) {
|
|
152293
152293
|
if (!(0, _primitives.isName)(name)) {
|
|
152294
152294
|
throw new _util.FormatError("Invalid crypt filter name.");
|
|
152295
152295
|
}
|
|
@@ -152305,12 +152305,12 @@ var require_pdf_worker3 = __commonJS({
|
|
|
152305
152305
|
}
|
|
152306
152306
|
if (cfm.name === "V2") {
|
|
152307
152307
|
return function cipherTransformFactoryBuildCipherConstructorV2() {
|
|
152308
|
-
return new ARCFourCipher(buildObjectKey(
|
|
152308
|
+
return new ARCFourCipher(buildObjectKey(num3, gen, key, false));
|
|
152309
152309
|
};
|
|
152310
152310
|
}
|
|
152311
152311
|
if (cfm.name === "AESV2") {
|
|
152312
152312
|
return function cipherTransformFactoryBuildCipherConstructorAESV2() {
|
|
152313
|
-
return new AES128Cipher(buildObjectKey(
|
|
152313
|
+
return new AES128Cipher(buildObjectKey(num3, gen, key, true));
|
|
152314
152314
|
};
|
|
152315
152315
|
}
|
|
152316
152316
|
if (cfm.name === "AESV3") {
|
|
@@ -152321,11 +152321,11 @@ var require_pdf_worker3 = __commonJS({
|
|
|
152321
152321
|
throw new _util.FormatError("Unknown crypto method");
|
|
152322
152322
|
}
|
|
152323
152323
|
CipherTransformFactory2.prototype = {
|
|
152324
|
-
createCipherTransform: function CipherTransformFactory_createCipherTransform(
|
|
152324
|
+
createCipherTransform: function CipherTransformFactory_createCipherTransform(num3, gen) {
|
|
152325
152325
|
if (this.algorithm === 4 || this.algorithm === 5) {
|
|
152326
|
-
return new CipherTransform(buildCipherConstructor(this.cf, this.stmf,
|
|
152326
|
+
return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num3, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num3, gen, this.encryptionKey));
|
|
152327
152327
|
}
|
|
152328
|
-
var key = buildObjectKey(
|
|
152328
|
+
var key = buildObjectKey(num3, gen, this.encryptionKey, false);
|
|
152329
152329
|
var cipherConstructor = function buildCipherCipherConstructor() {
|
|
152330
152330
|
return new ARCFourCipher(key);
|
|
152331
152331
|
};
|
|
@@ -158290,17 +158290,17 @@ var require_pdf_worker3 = __commonJS({
|
|
|
158290
158290
|
if (!(0, _primitives.isRef)(ref)) {
|
|
158291
158291
|
throw new Error("ref object is not a reference");
|
|
158292
158292
|
}
|
|
158293
|
-
var
|
|
158294
|
-
if (
|
|
158295
|
-
var cacheEntry = this.cache[
|
|
158293
|
+
var num3 = ref.num;
|
|
158294
|
+
if (num3 in this.cache) {
|
|
158295
|
+
var cacheEntry = this.cache[num3];
|
|
158296
158296
|
if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
|
|
158297
158297
|
cacheEntry.objId = ref.toString();
|
|
158298
158298
|
}
|
|
158299
158299
|
return cacheEntry;
|
|
158300
158300
|
}
|
|
158301
|
-
var xrefEntry = this.getEntry(
|
|
158301
|
+
var xrefEntry = this.getEntry(num3);
|
|
158302
158302
|
if (xrefEntry === null) {
|
|
158303
|
-
return this.cache[
|
|
158303
|
+
return this.cache[num3] = null;
|
|
158304
158304
|
}
|
|
158305
158305
|
if (xrefEntry.uncompressed) {
|
|
158306
158306
|
xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
|
|
@@ -158316,7 +158316,7 @@ var require_pdf_worker3 = __commonJS({
|
|
|
158316
158316
|
},
|
|
158317
158317
|
fetchUncompressed: function XRef_fetchUncompressed(ref, xrefEntry, suppressEncryption) {
|
|
158318
158318
|
var gen = ref.gen;
|
|
158319
|
-
var
|
|
158319
|
+
var num3 = ref.num;
|
|
158320
158320
|
if (xrefEntry.gen !== gen) {
|
|
158321
158321
|
throw new _util.FormatError("inconsistent generation in XRef");
|
|
158322
158322
|
}
|
|
@@ -158325,25 +158325,25 @@ var require_pdf_worker3 = __commonJS({
|
|
|
158325
158325
|
var obj1 = parser.getObj();
|
|
158326
158326
|
var obj2 = parser.getObj();
|
|
158327
158327
|
var obj3 = parser.getObj();
|
|
158328
|
-
if (!(0, _util.isInt)(obj1) || parseInt(obj1, 10) !==
|
|
158328
|
+
if (!(0, _util.isInt)(obj1) || parseInt(obj1, 10) !== num3 || !(0, _util.isInt)(obj2) || parseInt(obj2, 10) !== gen || !(0, _primitives.isCmd)(obj3)) {
|
|
158329
158329
|
throw new _util.FormatError("bad XRef entry");
|
|
158330
158330
|
}
|
|
158331
158331
|
if (!(0, _primitives.isCmd)(obj3, "obj")) {
|
|
158332
158332
|
if (obj3.cmd.indexOf("obj") === 0) {
|
|
158333
|
-
|
|
158334
|
-
if (!isNaN(
|
|
158335
|
-
return
|
|
158333
|
+
num3 = parseInt(obj3.cmd.substring(3), 10);
|
|
158334
|
+
if (!isNaN(num3)) {
|
|
158335
|
+
return num3;
|
|
158336
158336
|
}
|
|
158337
158337
|
}
|
|
158338
158338
|
throw new _util.FormatError("bad XRef entry");
|
|
158339
158339
|
}
|
|
158340
158340
|
if (this.encrypt && !suppressEncryption) {
|
|
158341
|
-
xrefEntry = parser.getObj(this.encrypt.createCipherTransform(
|
|
158341
|
+
xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num3, gen));
|
|
158342
158342
|
} else {
|
|
158343
158343
|
xrefEntry = parser.getObj();
|
|
158344
158344
|
}
|
|
158345
158345
|
if (!(0, _primitives.isStream)(xrefEntry)) {
|
|
158346
|
-
this.cache[
|
|
158346
|
+
this.cache[num3] = xrefEntry;
|
|
158347
158347
|
}
|
|
158348
158348
|
return xrefEntry;
|
|
158349
158349
|
},
|
|
@@ -158360,13 +158360,13 @@ var require_pdf_worker3 = __commonJS({
|
|
|
158360
158360
|
}
|
|
158361
158361
|
var parser = new _parser2.Parser(new _parser2.Lexer(stream), false, this);
|
|
158362
158362
|
parser.allowStreams = true;
|
|
158363
|
-
var i, entries = [],
|
|
158363
|
+
var i, entries = [], num3, nums = [];
|
|
158364
158364
|
for (i = 0; i < n2; ++i) {
|
|
158365
|
-
|
|
158366
|
-
if (!(0, _util.isInt)(
|
|
158367
|
-
throw new _util.FormatError("invalid object number in the ObjStm stream: " +
|
|
158365
|
+
num3 = parser.getObj();
|
|
158366
|
+
if (!(0, _util.isInt)(num3)) {
|
|
158367
|
+
throw new _util.FormatError("invalid object number in the ObjStm stream: " + num3);
|
|
158368
158368
|
}
|
|
158369
|
-
nums.push(
|
|
158369
|
+
nums.push(num3);
|
|
158370
158370
|
var offset = parser.getObj();
|
|
158371
158371
|
if (!(0, _util.isInt)(offset)) {
|
|
158372
158372
|
throw new _util.FormatError("invalid object offset in the ObjStm stream: " + offset);
|
|
@@ -158377,10 +158377,10 @@ var require_pdf_worker3 = __commonJS({
|
|
|
158377
158377
|
if ((0, _primitives.isCmd)(parser.buf1, "endobj")) {
|
|
158378
158378
|
parser.shift();
|
|
158379
158379
|
}
|
|
158380
|
-
|
|
158381
|
-
var entry = this.entries[
|
|
158380
|
+
num3 = nums[i];
|
|
158381
|
+
var entry = this.entries[num3];
|
|
158382
158382
|
if (entry && entry.offset === tableOffset && entry.gen === i) {
|
|
158383
|
-
this.cache[
|
|
158383
|
+
this.cache[num3] = entries[i];
|
|
158384
158384
|
}
|
|
158385
158385
|
}
|
|
158386
158386
|
xrefEntry = entries[xrefEntry.gen];
|
|
@@ -164038,11 +164038,11 @@ var require_pdf_worker3 = __commonJS({
|
|
|
164038
164038
|
var n2 = this.readNumber();
|
|
164039
164039
|
return n2 & 1 ? ~(n2 >>> 1) : n2 >>> 1;
|
|
164040
164040
|
},
|
|
164041
|
-
readHex: function readHex(
|
|
164042
|
-
|
|
164041
|
+
readHex: function readHex(num3, size) {
|
|
164042
|
+
num3.set(this.buffer.subarray(this.pos, this.pos + size + 1));
|
|
164043
164043
|
this.pos += size + 1;
|
|
164044
164044
|
},
|
|
164045
|
-
readHexNumber: function readHexNumber(
|
|
164045
|
+
readHexNumber: function readHexNumber(num3, size) {
|
|
164046
164046
|
var last;
|
|
164047
164047
|
var stack = this.tmpBuf, sp = 0;
|
|
164048
164048
|
do {
|
|
@@ -164059,19 +164059,19 @@ var require_pdf_worker3 = __commonJS({
|
|
|
164059
164059
|
buffer = stack[--sp] << bufferSize | buffer;
|
|
164060
164060
|
bufferSize += 7;
|
|
164061
164061
|
}
|
|
164062
|
-
|
|
164062
|
+
num3[i] = buffer & 255;
|
|
164063
164063
|
i--;
|
|
164064
164064
|
buffer >>= 8;
|
|
164065
164065
|
bufferSize -= 8;
|
|
164066
164066
|
}
|
|
164067
164067
|
},
|
|
164068
|
-
readHexSigned: function readHexSigned(
|
|
164069
|
-
this.readHexNumber(
|
|
164070
|
-
var sign =
|
|
164068
|
+
readHexSigned: function readHexSigned(num3, size) {
|
|
164069
|
+
this.readHexNumber(num3, size);
|
|
164070
|
+
var sign = num3[size] & 1 ? 255 : 0;
|
|
164071
164071
|
var c = 0;
|
|
164072
164072
|
for (var i = 0; i <= size; i++) {
|
|
164073
|
-
c = (c & 1) << 8 |
|
|
164074
|
-
|
|
164073
|
+
c = (c & 1) << 8 | num3[i];
|
|
164074
|
+
num3[i] = c >> 1 ^ sign;
|
|
164075
164075
|
}
|
|
164076
164076
|
},
|
|
164077
164077
|
readString: function readString() {
|
|
@@ -164959,8 +164959,8 @@ var require_pdf_worker3 = __commonJS({
|
|
|
164959
164959
|
},
|
|
164960
164960
|
get numPages() {
|
|
164961
164961
|
var linearization = this.linearization;
|
|
164962
|
-
var
|
|
164963
|
-
return (0, _util.shadow)(this, "numPages",
|
|
164962
|
+
var num3 = linearization ? linearization.numPages : this.catalog.numPages;
|
|
164963
|
+
return (0, _util.shadow)(this, "numPages", num3);
|
|
164964
164964
|
},
|
|
164965
164965
|
get documentInfo() {
|
|
164966
164966
|
var docInfo = {
|
|
@@ -165938,15 +165938,15 @@ var require_pdf_worker3 = __commonJS({
|
|
|
165938
165938
|
return IdentityToUnicodeMap2;
|
|
165939
165939
|
})();
|
|
165940
165940
|
var OpenTypeFileBuilder = (function OpenTypeFileBuilderClosure() {
|
|
165941
|
-
function writeInt16(dest, offset,
|
|
165942
|
-
dest[offset] =
|
|
165943
|
-
dest[offset + 1] =
|
|
165941
|
+
function writeInt16(dest, offset, num3) {
|
|
165942
|
+
dest[offset] = num3 >> 8 & 255;
|
|
165943
|
+
dest[offset + 1] = num3 & 255;
|
|
165944
165944
|
}
|
|
165945
|
-
function writeInt32(dest, offset,
|
|
165946
|
-
dest[offset] =
|
|
165947
|
-
dest[offset + 1] =
|
|
165948
|
-
dest[offset + 2] =
|
|
165949
|
-
dest[offset + 3] =
|
|
165945
|
+
function writeInt32(dest, offset, num3) {
|
|
165946
|
+
dest[offset] = num3 >> 24 & 255;
|
|
165947
|
+
dest[offset + 1] = num3 >> 16 & 255;
|
|
165948
|
+
dest[offset + 2] = num3 >> 8 & 255;
|
|
165949
|
+
dest[offset + 3] = num3 & 255;
|
|
165950
165950
|
}
|
|
165951
165951
|
function writeData(dest, offset, data) {
|
|
165952
165952
|
var i, ii;
|
|
@@ -174962,9 +174962,9 @@ var require_pdf_worker3 = __commonJS({
|
|
|
174962
174962
|
error40 = true;
|
|
174963
174963
|
break;
|
|
174964
174964
|
}
|
|
174965
|
-
var
|
|
174965
|
+
var num22 = this.stack.pop();
|
|
174966
174966
|
var num1 = this.stack.pop();
|
|
174967
|
-
this.stack.push(num1 /
|
|
174967
|
+
this.stack.push(num1 / num22);
|
|
174968
174968
|
break;
|
|
174969
174969
|
case (12 << 8) + 16:
|
|
174970
174970
|
if (this.stack.length < 2) {
|
|
@@ -177551,8 +177551,8 @@ var require_pdf3 = __commonJS({
|
|
|
177551
177551
|
}
|
|
177552
177552
|
return result;
|
|
177553
177553
|
};
|
|
177554
|
-
Util2.sign = function Util_sign(
|
|
177555
|
-
return
|
|
177554
|
+
Util2.sign = function Util_sign(num3) {
|
|
177555
|
+
return num3 < 0 ? -1 : 1;
|
|
177556
177556
|
};
|
|
177557
177557
|
var ROMAN_NUMBER_MAP = ["", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM", "", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC", "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"];
|
|
177558
177558
|
Util2.toRoman = function Util_toRoman(number4, lowerCase) {
|
|
@@ -199047,8 +199047,8 @@ var require_pdf_worker4 = __commonJS({
|
|
|
199047
199047
|
},
|
|
199048
199048
|
get numPages() {
|
|
199049
199049
|
var linearization = this.linearization;
|
|
199050
|
-
var
|
|
199051
|
-
return (0, _util.shadow)(this, "numPages",
|
|
199050
|
+
var num3 = linearization ? linearization.numPages : this.catalog.numPages;
|
|
199051
|
+
return (0, _util.shadow)(this, "numPages", num3);
|
|
199052
199052
|
},
|
|
199053
199053
|
get documentInfo() {
|
|
199054
199054
|
var docInfo = {
|
|
@@ -200229,17 +200229,17 @@ var require_pdf_worker4 = __commonJS({
|
|
|
200229
200229
|
if (!(0, _primitives.isRef)(ref)) {
|
|
200230
200230
|
throw new Error("ref object is not a reference");
|
|
200231
200231
|
}
|
|
200232
|
-
var
|
|
200233
|
-
if (
|
|
200234
|
-
var cacheEntry = this.cache[
|
|
200232
|
+
var num3 = ref.num;
|
|
200233
|
+
if (num3 in this.cache) {
|
|
200234
|
+
var cacheEntry = this.cache[num3];
|
|
200235
200235
|
if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
|
|
200236
200236
|
cacheEntry.objId = ref.toString();
|
|
200237
200237
|
}
|
|
200238
200238
|
return cacheEntry;
|
|
200239
200239
|
}
|
|
200240
|
-
var xrefEntry = this.getEntry(
|
|
200240
|
+
var xrefEntry = this.getEntry(num3);
|
|
200241
200241
|
if (xrefEntry === null) {
|
|
200242
|
-
return this.cache[
|
|
200242
|
+
return this.cache[num3] = null;
|
|
200243
200243
|
}
|
|
200244
200244
|
if (xrefEntry.uncompressed) {
|
|
200245
200245
|
xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
|
|
@@ -200255,7 +200255,7 @@ var require_pdf_worker4 = __commonJS({
|
|
|
200255
200255
|
},
|
|
200256
200256
|
fetchUncompressed: function XRef_fetchUncompressed(ref, xrefEntry, suppressEncryption) {
|
|
200257
200257
|
var gen = ref.gen;
|
|
200258
|
-
var
|
|
200258
|
+
var num3 = ref.num;
|
|
200259
200259
|
if (xrefEntry.gen !== gen) {
|
|
200260
200260
|
throw new _util.FormatError("inconsistent generation in XRef");
|
|
200261
200261
|
}
|
|
@@ -200270,25 +200270,25 @@ var require_pdf_worker4 = __commonJS({
|
|
|
200270
200270
|
if (!Number.isInteger(obj2)) {
|
|
200271
200271
|
obj2 = parseInt(obj2, 10);
|
|
200272
200272
|
}
|
|
200273
|
-
if (obj1 !==
|
|
200273
|
+
if (obj1 !== num3 || obj2 !== gen || !(0, _primitives.isCmd)(obj3)) {
|
|
200274
200274
|
throw new _util.FormatError("bad XRef entry");
|
|
200275
200275
|
}
|
|
200276
200276
|
if (obj3.cmd !== "obj") {
|
|
200277
200277
|
if (obj3.cmd.indexOf("obj") === 0) {
|
|
200278
|
-
|
|
200279
|
-
if (!Number.isNaN(
|
|
200280
|
-
return
|
|
200278
|
+
num3 = parseInt(obj3.cmd.substring(3), 10);
|
|
200279
|
+
if (!Number.isNaN(num3)) {
|
|
200280
|
+
return num3;
|
|
200281
200281
|
}
|
|
200282
200282
|
}
|
|
200283
200283
|
throw new _util.FormatError("bad XRef entry");
|
|
200284
200284
|
}
|
|
200285
200285
|
if (this.encrypt && !suppressEncryption) {
|
|
200286
|
-
xrefEntry = parser.getObj(this.encrypt.createCipherTransform(
|
|
200286
|
+
xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num3, gen));
|
|
200287
200287
|
} else {
|
|
200288
200288
|
xrefEntry = parser.getObj();
|
|
200289
200289
|
}
|
|
200290
200290
|
if (!(0, _primitives.isStream)(xrefEntry)) {
|
|
200291
|
-
this.cache[
|
|
200291
|
+
this.cache[num3] = xrefEntry;
|
|
200292
200292
|
}
|
|
200293
200293
|
return xrefEntry;
|
|
200294
200294
|
},
|
|
@@ -200305,13 +200305,13 @@ var require_pdf_worker4 = __commonJS({
|
|
|
200305
200305
|
}
|
|
200306
200306
|
var parser = new _parser2.Parser(new _parser2.Lexer(stream), false, this);
|
|
200307
200307
|
parser.allowStreams = true;
|
|
200308
|
-
var i, entries = [],
|
|
200308
|
+
var i, entries = [], num3, nums = [];
|
|
200309
200309
|
for (i = 0; i < n2; ++i) {
|
|
200310
|
-
|
|
200311
|
-
if (!Number.isInteger(
|
|
200312
|
-
throw new _util.FormatError("invalid object number in the ObjStm stream: " +
|
|
200310
|
+
num3 = parser.getObj();
|
|
200311
|
+
if (!Number.isInteger(num3)) {
|
|
200312
|
+
throw new _util.FormatError("invalid object number in the ObjStm stream: " + num3);
|
|
200313
200313
|
}
|
|
200314
|
-
nums.push(
|
|
200314
|
+
nums.push(num3);
|
|
200315
200315
|
var offset = parser.getObj();
|
|
200316
200316
|
if (!Number.isInteger(offset)) {
|
|
200317
200317
|
throw new _util.FormatError("invalid object offset in the ObjStm stream: " + offset);
|
|
@@ -200322,10 +200322,10 @@ var require_pdf_worker4 = __commonJS({
|
|
|
200322
200322
|
if ((0, _primitives.isCmd)(parser.buf1, "endobj")) {
|
|
200323
200323
|
parser.shift();
|
|
200324
200324
|
}
|
|
200325
|
-
|
|
200326
|
-
var entry = this.entries[
|
|
200325
|
+
num3 = nums[i];
|
|
200326
|
+
var entry = this.entries[num3];
|
|
200327
200327
|
if (entry && entry.offset === tableOffset && entry.gen === i) {
|
|
200328
|
-
this.cache[
|
|
200328
|
+
this.cache[num3] = entries[i];
|
|
200329
200329
|
}
|
|
200330
200330
|
}
|
|
200331
200331
|
xrefEntry = entries[xrefEntry.gen];
|
|
@@ -200805,8 +200805,8 @@ var require_pdf_worker4 = __commonJS({
|
|
|
200805
200805
|
return Dict2;
|
|
200806
200806
|
})();
|
|
200807
200807
|
var Ref = (function RefClosure() {
|
|
200808
|
-
function Ref2(
|
|
200809
|
-
this.num =
|
|
200808
|
+
function Ref2(num3, gen) {
|
|
200809
|
+
this.num = num3;
|
|
200810
200810
|
this.gen = gen;
|
|
200811
200811
|
}
|
|
200812
200812
|
Ref2.prototype = {
|
|
@@ -201015,14 +201015,14 @@ var require_pdf_worker4 = __commonJS({
|
|
|
201015
201015
|
}
|
|
201016
201016
|
}
|
|
201017
201017
|
if (Number.isInteger(buf1)) {
|
|
201018
|
-
var
|
|
201018
|
+
var num3 = buf1;
|
|
201019
201019
|
if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
|
|
201020
|
-
var ref = new _primitives.Ref(
|
|
201020
|
+
var ref = new _primitives.Ref(num3, this.buf1);
|
|
201021
201021
|
this.shift();
|
|
201022
201022
|
this.shift();
|
|
201023
201023
|
return ref;
|
|
201024
201024
|
}
|
|
201025
|
-
return
|
|
201025
|
+
return num3;
|
|
201026
201026
|
}
|
|
201027
201027
|
if ((0, _util.isString)(buf1)) {
|
|
201028
201028
|
var str3 = buf1;
|
|
@@ -209768,14 +209768,14 @@ var require_pdf_worker4 = __commonJS({
|
|
|
209768
209768
|
this.eff = dict.get("EFF") || this.stmf;
|
|
209769
209769
|
}
|
|
209770
209770
|
}
|
|
209771
|
-
function buildObjectKey(
|
|
209771
|
+
function buildObjectKey(num3, gen, encryptionKey, isAes) {
|
|
209772
209772
|
var key = new Uint8Array(encryptionKey.length + 9), i, n2;
|
|
209773
209773
|
for (i = 0, n2 = encryptionKey.length; i < n2; ++i) {
|
|
209774
209774
|
key[i] = encryptionKey[i];
|
|
209775
209775
|
}
|
|
209776
|
-
key[i++] =
|
|
209777
|
-
key[i++] =
|
|
209778
|
-
key[i++] =
|
|
209776
|
+
key[i++] = num3 & 255;
|
|
209777
|
+
key[i++] = num3 >> 8 & 255;
|
|
209778
|
+
key[i++] = num3 >> 16 & 255;
|
|
209779
209779
|
key[i++] = gen & 255;
|
|
209780
209780
|
key[i++] = gen >> 8 & 255;
|
|
209781
209781
|
if (isAes) {
|
|
@@ -209787,7 +209787,7 @@ var require_pdf_worker4 = __commonJS({
|
|
|
209787
209787
|
var hash2 = calculateMD5(key, 0, i);
|
|
209788
209788
|
return hash2.subarray(0, Math.min(encryptionKey.length + 5, 16));
|
|
209789
209789
|
}
|
|
209790
|
-
function buildCipherConstructor(cf, name,
|
|
209790
|
+
function buildCipherConstructor(cf, name, num3, gen, key) {
|
|
209791
209791
|
if (!(0, _primitives.isName)(name)) {
|
|
209792
209792
|
throw new _util.FormatError("Invalid crypt filter name.");
|
|
209793
209793
|
}
|
|
@@ -209803,12 +209803,12 @@ var require_pdf_worker4 = __commonJS({
|
|
|
209803
209803
|
}
|
|
209804
209804
|
if (cfm.name === "V2") {
|
|
209805
209805
|
return function cipherTransformFactoryBuildCipherConstructorV2() {
|
|
209806
|
-
return new ARCFourCipher(buildObjectKey(
|
|
209806
|
+
return new ARCFourCipher(buildObjectKey(num3, gen, key, false));
|
|
209807
209807
|
};
|
|
209808
209808
|
}
|
|
209809
209809
|
if (cfm.name === "AESV2") {
|
|
209810
209810
|
return function cipherTransformFactoryBuildCipherConstructorAESV2() {
|
|
209811
|
-
return new AES128Cipher(buildObjectKey(
|
|
209811
|
+
return new AES128Cipher(buildObjectKey(num3, gen, key, true));
|
|
209812
209812
|
};
|
|
209813
209813
|
}
|
|
209814
209814
|
if (cfm.name === "AESV3") {
|
|
@@ -209819,11 +209819,11 @@ var require_pdf_worker4 = __commonJS({
|
|
|
209819
209819
|
throw new _util.FormatError("Unknown crypto method");
|
|
209820
209820
|
}
|
|
209821
209821
|
CipherTransformFactory2.prototype = {
|
|
209822
|
-
createCipherTransform: function CipherTransformFactory_createCipherTransform(
|
|
209822
|
+
createCipherTransform: function CipherTransformFactory_createCipherTransform(num3, gen) {
|
|
209823
209823
|
if (this.algorithm === 4 || this.algorithm === 5) {
|
|
209824
|
-
return new CipherTransform(buildCipherConstructor(this.cf, this.stmf,
|
|
209824
|
+
return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num3, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num3, gen, this.encryptionKey));
|
|
209825
209825
|
}
|
|
209826
|
-
var key = buildObjectKey(
|
|
209826
|
+
var key = buildObjectKey(num3, gen, this.encryptionKey, false);
|
|
209827
209827
|
var cipherConstructor = function buildCipherCipherConstructor() {
|
|
209828
209828
|
return new ARCFourCipher(key);
|
|
209829
209829
|
};
|
|
@@ -215078,11 +215078,11 @@ var require_pdf_worker4 = __commonJS({
|
|
|
215078
215078
|
var n2 = this.readNumber();
|
|
215079
215079
|
return n2 & 1 ? ~(n2 >>> 1) : n2 >>> 1;
|
|
215080
215080
|
},
|
|
215081
|
-
readHex: function readHex(
|
|
215082
|
-
|
|
215081
|
+
readHex: function readHex(num3, size) {
|
|
215082
|
+
num3.set(this.buffer.subarray(this.pos, this.pos + size + 1));
|
|
215083
215083
|
this.pos += size + 1;
|
|
215084
215084
|
},
|
|
215085
|
-
readHexNumber: function readHexNumber(
|
|
215085
|
+
readHexNumber: function readHexNumber(num3, size) {
|
|
215086
215086
|
var last;
|
|
215087
215087
|
var stack = this.tmpBuf, sp = 0;
|
|
215088
215088
|
do {
|
|
@@ -215099,19 +215099,19 @@ var require_pdf_worker4 = __commonJS({
|
|
|
215099
215099
|
buffer = stack[--sp] << bufferSize | buffer;
|
|
215100
215100
|
bufferSize += 7;
|
|
215101
215101
|
}
|
|
215102
|
-
|
|
215102
|
+
num3[i] = buffer & 255;
|
|
215103
215103
|
i--;
|
|
215104
215104
|
buffer >>= 8;
|
|
215105
215105
|
bufferSize -= 8;
|
|
215106
215106
|
}
|
|
215107
215107
|
},
|
|
215108
|
-
readHexSigned: function readHexSigned(
|
|
215109
|
-
this.readHexNumber(
|
|
215110
|
-
var sign =
|
|
215108
|
+
readHexSigned: function readHexSigned(num3, size) {
|
|
215109
|
+
this.readHexNumber(num3, size);
|
|
215110
|
+
var sign = num3[size] & 1 ? 255 : 0;
|
|
215111
215111
|
var c = 0;
|
|
215112
215112
|
for (var i = 0; i <= size; i++) {
|
|
215113
|
-
c = (c & 1) << 8 |
|
|
215114
|
-
|
|
215113
|
+
c = (c & 1) << 8 | num3[i];
|
|
215114
|
+
num3[i] = c >> 1 ^ sign;
|
|
215115
215115
|
}
|
|
215116
215116
|
},
|
|
215117
215117
|
readString: function readString() {
|
|
@@ -215733,15 +215733,15 @@ var require_pdf_worker4 = __commonJS({
|
|
|
215733
215733
|
return IdentityToUnicodeMap2;
|
|
215734
215734
|
})();
|
|
215735
215735
|
var OpenTypeFileBuilder = (function OpenTypeFileBuilderClosure() {
|
|
215736
|
-
function writeInt16(dest, offset,
|
|
215737
|
-
dest[offset] =
|
|
215738
|
-
dest[offset + 1] =
|
|
215736
|
+
function writeInt16(dest, offset, num3) {
|
|
215737
|
+
dest[offset] = num3 >> 8 & 255;
|
|
215738
|
+
dest[offset + 1] = num3 & 255;
|
|
215739
215739
|
}
|
|
215740
|
-
function writeInt32(dest, offset,
|
|
215741
|
-
dest[offset] =
|
|
215742
|
-
dest[offset + 1] =
|
|
215743
|
-
dest[offset + 2] =
|
|
215744
|
-
dest[offset + 3] =
|
|
215740
|
+
function writeInt32(dest, offset, num3) {
|
|
215741
|
+
dest[offset] = num3 >> 24 & 255;
|
|
215742
|
+
dest[offset + 1] = num3 >> 16 & 255;
|
|
215743
|
+
dest[offset + 2] = num3 >> 8 & 255;
|
|
215744
|
+
dest[offset + 3] = num3 & 255;
|
|
215745
215745
|
}
|
|
215746
215746
|
function writeData(dest, offset, data) {
|
|
215747
215747
|
var i, ii;
|
|
@@ -219203,12 +219203,12 @@ var require_pdf_worker4 = __commonJS({
|
|
|
219203
219203
|
}
|
|
219204
219204
|
return this.encodeFloat(value);
|
|
219205
219205
|
},
|
|
219206
|
-
encodeFloat: function CFFCompiler_encodeFloat(
|
|
219207
|
-
var value =
|
|
219206
|
+
encodeFloat: function CFFCompiler_encodeFloat(num3) {
|
|
219207
|
+
var value = num3.toString();
|
|
219208
219208
|
var m2 = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
|
|
219209
219209
|
if (m2) {
|
|
219210
219210
|
var epsilon = parseFloat("1e" + ((m2[2] ? +m2[2] : 0) + m2[1].length));
|
|
219211
|
-
value = (Math.round(
|
|
219211
|
+
value = (Math.round(num3 * epsilon) / epsilon).toString();
|
|
219212
219212
|
}
|
|
219213
219213
|
var nibbles = "";
|
|
219214
219214
|
var i, ii;
|
|
@@ -227704,9 +227704,9 @@ var require_pdf_worker4 = __commonJS({
|
|
|
227704
227704
|
error40 = true;
|
|
227705
227705
|
break;
|
|
227706
227706
|
}
|
|
227707
|
-
var
|
|
227707
|
+
var num22 = this.stack.pop();
|
|
227708
227708
|
var num1 = this.stack.pop();
|
|
227709
|
-
this.stack.push(num1 /
|
|
227709
|
+
this.stack.push(num1 / num22);
|
|
227710
227710
|
break;
|
|
227711
227711
|
case (12 << 8) + 16:
|
|
227712
227712
|
if (this.stack.length < 2) {
|
|
@@ -232883,51 +232883,51 @@ var require_pdf_worker4 = __commonJS({
|
|
|
232883
232883
|
return this.parts.join("");
|
|
232884
232884
|
}
|
|
232885
232885
|
};
|
|
232886
|
-
function buildAddOperation(num1,
|
|
232887
|
-
if (
|
|
232886
|
+
function buildAddOperation(num1, num22) {
|
|
232887
|
+
if (num22.type === "literal" && num22.number === 0) {
|
|
232888
232888
|
return num1;
|
|
232889
232889
|
}
|
|
232890
232890
|
if (num1.type === "literal" && num1.number === 0) {
|
|
232891
|
-
return
|
|
232891
|
+
return num22;
|
|
232892
232892
|
}
|
|
232893
|
-
if (
|
|
232894
|
-
return new AstLiteral(num1.number +
|
|
232893
|
+
if (num22.type === "literal" && num1.type === "literal") {
|
|
232894
|
+
return new AstLiteral(num1.number + num22.number);
|
|
232895
232895
|
}
|
|
232896
|
-
return new AstBinaryOperation("+", num1,
|
|
232896
|
+
return new AstBinaryOperation("+", num1, num22, num1.min + num22.min, num1.max + num22.max);
|
|
232897
232897
|
}
|
|
232898
|
-
function buildMulOperation(num1,
|
|
232899
|
-
if (
|
|
232900
|
-
if (
|
|
232898
|
+
function buildMulOperation(num1, num22) {
|
|
232899
|
+
if (num22.type === "literal") {
|
|
232900
|
+
if (num22.number === 0) {
|
|
232901
232901
|
return new AstLiteral(0);
|
|
232902
|
-
} else if (
|
|
232902
|
+
} else if (num22.number === 1) {
|
|
232903
232903
|
return num1;
|
|
232904
232904
|
} else if (num1.type === "literal") {
|
|
232905
|
-
return new AstLiteral(num1.number *
|
|
232905
|
+
return new AstLiteral(num1.number * num22.number);
|
|
232906
232906
|
}
|
|
232907
232907
|
}
|
|
232908
232908
|
if (num1.type === "literal") {
|
|
232909
232909
|
if (num1.number === 0) {
|
|
232910
232910
|
return new AstLiteral(0);
|
|
232911
232911
|
} else if (num1.number === 1) {
|
|
232912
|
-
return
|
|
232912
|
+
return num22;
|
|
232913
232913
|
}
|
|
232914
232914
|
}
|
|
232915
|
-
var min = Math.min(num1.min *
|
|
232916
|
-
var max = Math.max(num1.min *
|
|
232917
|
-
return new AstBinaryOperation("*", num1,
|
|
232915
|
+
var min = Math.min(num1.min * num22.min, num1.min * num22.max, num1.max * num22.min, num1.max * num22.max);
|
|
232916
|
+
var max = Math.max(num1.min * num22.min, num1.min * num22.max, num1.max * num22.min, num1.max * num22.max);
|
|
232917
|
+
return new AstBinaryOperation("*", num1, num22, min, max);
|
|
232918
232918
|
}
|
|
232919
|
-
function buildSubOperation(num1,
|
|
232920
|
-
if (
|
|
232921
|
-
if (
|
|
232919
|
+
function buildSubOperation(num1, num22) {
|
|
232920
|
+
if (num22.type === "literal") {
|
|
232921
|
+
if (num22.number === 0) {
|
|
232922
232922
|
return num1;
|
|
232923
232923
|
} else if (num1.type === "literal") {
|
|
232924
|
-
return new AstLiteral(num1.number -
|
|
232924
|
+
return new AstLiteral(num1.number - num22.number);
|
|
232925
232925
|
}
|
|
232926
232926
|
}
|
|
232927
|
-
if (
|
|
232928
|
-
return
|
|
232927
|
+
if (num22.type === "binary" && num22.op === "-" && num1.type === "literal" && num1.number === 1 && num22.arg1.type === "literal" && num22.arg1.number === 1) {
|
|
232928
|
+
return num22.arg2;
|
|
232929
232929
|
}
|
|
232930
|
-
return new AstBinaryOperation("-", num1,
|
|
232930
|
+
return new AstBinaryOperation("-", num1, num22, num1.min - num22.max, num1.max - num22.min);
|
|
232931
232931
|
}
|
|
232932
232932
|
function buildMinOperation(num1, max) {
|
|
232933
232933
|
if (num1.min >= max) {
|
|
@@ -232947,7 +232947,7 @@ var require_pdf_worker4 = __commonJS({
|
|
|
232947
232947
|
var inputSize = domain2.length >> 1, outputSize = range.length >> 1;
|
|
232948
232948
|
var lastRegister = 0;
|
|
232949
232949
|
var n2, j;
|
|
232950
|
-
var num1,
|
|
232950
|
+
var num1, num22, ast1, ast2, tmpVar, item;
|
|
232951
232951
|
for (i = 0; i < inputSize; i++) {
|
|
232952
232952
|
stack.push(new AstArgument(i, domain2[i * 2], domain2[i * 2 + 1]));
|
|
232953
232953
|
}
|
|
@@ -232962,9 +232962,9 @@ var require_pdf_worker4 = __commonJS({
|
|
|
232962
232962
|
if (stack.length < 2) {
|
|
232963
232963
|
return null;
|
|
232964
232964
|
}
|
|
232965
|
-
|
|
232965
|
+
num22 = stack.pop();
|
|
232966
232966
|
num1 = stack.pop();
|
|
232967
|
-
stack.push(buildAddOperation(num1,
|
|
232967
|
+
stack.push(buildAddOperation(num1, num22));
|
|
232968
232968
|
break;
|
|
232969
232969
|
case "cvr":
|
|
232970
232970
|
if (stack.length < 1) {
|
|
@@ -232975,17 +232975,17 @@ var require_pdf_worker4 = __commonJS({
|
|
|
232975
232975
|
if (stack.length < 2) {
|
|
232976
232976
|
return null;
|
|
232977
232977
|
}
|
|
232978
|
-
|
|
232978
|
+
num22 = stack.pop();
|
|
232979
232979
|
num1 = stack.pop();
|
|
232980
|
-
stack.push(buildMulOperation(num1,
|
|
232980
|
+
stack.push(buildMulOperation(num1, num22));
|
|
232981
232981
|
break;
|
|
232982
232982
|
case "sub":
|
|
232983
232983
|
if (stack.length < 2) {
|
|
232984
232984
|
return null;
|
|
232985
232985
|
}
|
|
232986
|
-
|
|
232986
|
+
num22 = stack.pop();
|
|
232987
232987
|
num1 = stack.pop();
|
|
232988
|
-
stack.push(buildSubOperation(num1,
|
|
232988
|
+
stack.push(buildSubOperation(num1, num22));
|
|
232989
232989
|
break;
|
|
232990
232990
|
case "exch":
|
|
232991
232991
|
if (stack.length < 2) {
|
|
@@ -233047,12 +233047,12 @@ var require_pdf_worker4 = __commonJS({
|
|
|
233047
233047
|
if (stack.length < 2) {
|
|
233048
233048
|
return null;
|
|
233049
233049
|
}
|
|
233050
|
-
|
|
233050
|
+
num22 = stack.pop();
|
|
233051
233051
|
num1 = stack.pop();
|
|
233052
|
-
if (
|
|
233052
|
+
if (num22.type !== "literal" || num1.type !== "literal") {
|
|
233053
233053
|
return null;
|
|
233054
233054
|
}
|
|
233055
|
-
j =
|
|
233055
|
+
j = num22.number;
|
|
233056
233056
|
n2 = num1.number;
|
|
233057
233057
|
if (n2 <= 0 || !Number.isInteger(n2) || !Number.isInteger(j) || stack.length < n2) {
|
|
233058
233058
|
return null;
|
|
@@ -253364,26 +253364,26 @@ var require_permessage_deflate = __commonJS({
|
|
|
253364
253364
|
value = value[0];
|
|
253365
253365
|
if (key === "client_max_window_bits") {
|
|
253366
253366
|
if (value !== true) {
|
|
253367
|
-
const
|
|
253368
|
-
if (!Number.isInteger(
|
|
253367
|
+
const num3 = +value;
|
|
253368
|
+
if (!Number.isInteger(num3) || num3 < 8 || num3 > 15) {
|
|
253369
253369
|
throw new TypeError(
|
|
253370
253370
|
`Invalid value for parameter "${key}": ${value}`
|
|
253371
253371
|
);
|
|
253372
253372
|
}
|
|
253373
|
-
value =
|
|
253373
|
+
value = num3;
|
|
253374
253374
|
} else if (!this._isServer) {
|
|
253375
253375
|
throw new TypeError(
|
|
253376
253376
|
`Invalid value for parameter "${key}": ${value}`
|
|
253377
253377
|
);
|
|
253378
253378
|
}
|
|
253379
253379
|
} else if (key === "server_max_window_bits") {
|
|
253380
|
-
const
|
|
253381
|
-
if (!Number.isInteger(
|
|
253380
|
+
const num3 = +value;
|
|
253381
|
+
if (!Number.isInteger(num3) || num3 < 8 || num3 > 15) {
|
|
253382
253382
|
throw new TypeError(
|
|
253383
253383
|
`Invalid value for parameter "${key}": ${value}`
|
|
253384
253384
|
);
|
|
253385
253385
|
}
|
|
253386
|
-
value =
|
|
253386
|
+
value = num3;
|
|
253387
253387
|
} else if (key === "client_no_context_takeover" || key === "server_no_context_takeover") {
|
|
253388
253388
|
if (value !== true) {
|
|
253389
253389
|
throw new TypeError(
|
|
@@ -254078,8 +254078,8 @@ var require_receiver = __commonJS({
|
|
|
254078
254078
|
return;
|
|
254079
254079
|
}
|
|
254080
254080
|
const buf = this.consume(8);
|
|
254081
|
-
const
|
|
254082
|
-
if (
|
|
254081
|
+
const num3 = buf.readUInt32BE(0);
|
|
254082
|
+
if (num3 > Math.pow(2, 53 - 32) - 1) {
|
|
254083
254083
|
const error40 = this.createError(
|
|
254084
254084
|
RangeError,
|
|
254085
254085
|
"Unsupported WebSocket frame: payload length > 2^53 - 1",
|
|
@@ -254090,7 +254090,7 @@ var require_receiver = __commonJS({
|
|
|
254090
254090
|
cb(error40);
|
|
254091
254091
|
return;
|
|
254092
254092
|
}
|
|
254093
|
-
this._payloadLength =
|
|
254093
|
+
this._payloadLength = num3 * Math.pow(2, 32) + buf.readUInt32BE(4);
|
|
254094
254094
|
this.haveLength(cb);
|
|
254095
254095
|
}
|
|
254096
254096
|
/**
|
|
@@ -259907,8 +259907,8 @@ var require_utils2 = __commonJS({
|
|
|
259907
259907
|
}
|
|
259908
259908
|
return output.join("");
|
|
259909
259909
|
}
|
|
259910
|
-
function normalizeComponentEncoding(component,
|
|
259911
|
-
const func =
|
|
259910
|
+
function normalizeComponentEncoding(component, esc3) {
|
|
259911
|
+
const func = esc3 !== true ? escape : unescape;
|
|
259912
259912
|
if (component.scheme !== void 0) {
|
|
259913
259913
|
component.scheme = func(component.scheme);
|
|
259914
259914
|
}
|
|
@@ -275710,29 +275710,29 @@ var require_nacl_fast = __commonJS({
|
|
|
275710
275710
|
return smlen;
|
|
275711
275711
|
}
|
|
275712
275712
|
function unpackneg(r, p) {
|
|
275713
|
-
var t = gf(), chk = gf(),
|
|
275713
|
+
var t = gf(), chk = gf(), num3 = gf(), den = gf(), den2 = gf(), den4 = gf(), den6 = gf();
|
|
275714
275714
|
set25519(r[2], gf1);
|
|
275715
275715
|
unpack25519(r[1], p);
|
|
275716
|
-
S(
|
|
275717
|
-
M(den,
|
|
275718
|
-
Z(
|
|
275716
|
+
S(num3, r[1]);
|
|
275717
|
+
M(den, num3, D);
|
|
275718
|
+
Z(num3, num3, r[2]);
|
|
275719
275719
|
A(den, r[2], den);
|
|
275720
275720
|
S(den2, den);
|
|
275721
275721
|
S(den4, den2);
|
|
275722
275722
|
M(den6, den4, den2);
|
|
275723
|
-
M(t, den6,
|
|
275723
|
+
M(t, den6, num3);
|
|
275724
275724
|
M(t, t, den);
|
|
275725
275725
|
pow2523(t, t);
|
|
275726
|
-
M(t, t,
|
|
275726
|
+
M(t, t, num3);
|
|
275727
275727
|
M(t, t, den);
|
|
275728
275728
|
M(t, t, den);
|
|
275729
275729
|
M(r[0], t, den);
|
|
275730
275730
|
S(chk, r[0]);
|
|
275731
275731
|
M(chk, chk, den);
|
|
275732
|
-
if (neq25519(chk,
|
|
275732
|
+
if (neq25519(chk, num3)) M(r[0], r[0], I);
|
|
275733
275733
|
S(chk, r[0]);
|
|
275734
275734
|
M(chk, chk, den);
|
|
275735
|
-
if (neq25519(chk,
|
|
275735
|
+
if (neq25519(chk, num3)) return -1;
|
|
275736
275736
|
if (par25519(r[0]) === p[31] >> 7) Z(r[0], gf0, r[0]);
|
|
275737
275737
|
M(r[3], r[0], r[1]);
|
|
275738
275738
|
return 0;
|
|
@@ -294386,12 +294386,12 @@ function strictParsePartialJson(s) {
|
|
|
294386
294386
|
}
|
|
294387
294387
|
}
|
|
294388
294388
|
if (numStr === "-") return -0;
|
|
294389
|
-
const
|
|
294390
|
-
if (Number.isNaN(
|
|
294389
|
+
const num3 = Number.parseFloat(numStr);
|
|
294390
|
+
if (Number.isNaN(num3)) {
|
|
294391
294391
|
pos = start;
|
|
294392
294392
|
throw new Error(`Invalid number '${numStr}' at position ${start}`);
|
|
294393
294393
|
}
|
|
294394
|
-
return
|
|
294394
|
+
return num3;
|
|
294395
294395
|
}
|
|
294396
294396
|
function parseValue() {
|
|
294397
294397
|
skipWhitespace();
|
|
@@ -328729,26 +328729,26 @@ var initializeSax = function() {
|
|
|
328729
328729
|
function parseEntity(parser) {
|
|
328730
328730
|
var entity = parser.entity;
|
|
328731
328731
|
var entityLC = entity.toLowerCase();
|
|
328732
|
-
var
|
|
328732
|
+
var num3;
|
|
328733
328733
|
var numStr = "";
|
|
328734
328734
|
if (parser.ENTITIES[entity]) return parser.ENTITIES[entity];
|
|
328735
328735
|
if (parser.ENTITIES[entityLC]) return parser.ENTITIES[entityLC];
|
|
328736
328736
|
entity = entityLC;
|
|
328737
328737
|
if (entity.charAt(0) === "#") if (entity.charAt(1) === "x") {
|
|
328738
328738
|
entity = entity.slice(2);
|
|
328739
|
-
|
|
328740
|
-
numStr =
|
|
328739
|
+
num3 = parseInt(entity, 16);
|
|
328740
|
+
numStr = num3.toString(16);
|
|
328741
328741
|
} else {
|
|
328742
328742
|
entity = entity.slice(1);
|
|
328743
|
-
|
|
328744
|
-
numStr =
|
|
328743
|
+
num3 = parseInt(entity, 10);
|
|
328744
|
+
numStr = num3.toString(10);
|
|
328745
328745
|
}
|
|
328746
328746
|
entity = entity.replace(/^0+/, "");
|
|
328747
|
-
if (isNaN(
|
|
328747
|
+
if (isNaN(num3) || numStr.toLowerCase() !== entity) {
|
|
328748
328748
|
strictFail(parser, "Invalid character entity");
|
|
328749
328749
|
return "&" + parser.entity + ";";
|
|
328750
328750
|
}
|
|
328751
|
-
return String.fromCodePoint(
|
|
328751
|
+
return String.fromCodePoint(num3);
|
|
328752
328752
|
}
|
|
328753
328753
|
function beginWhiteSpace(parser, c) {
|
|
328754
328754
|
if (c === "<") {
|
|
@@ -340704,9 +340704,9 @@ init_historyStoragePaths();
|
|
|
340704
340704
|
var AGENT_RUN_LEDGER_FILE_NAME = "gyshell-agent-runs.sqlite";
|
|
340705
340705
|
function extractUsageTokenBreakdown(usage) {
|
|
340706
340706
|
const u = usage ?? {};
|
|
340707
|
-
const
|
|
340708
|
-
const prompt =
|
|
340709
|
-
const completion =
|
|
340707
|
+
const num3 = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 ? Math.floor(v) : 0;
|
|
340708
|
+
const prompt = num3(u.prompt_tokens) || num3(u.input_tokens) || num3(u.promptTokens) || num3(u.inputTokens);
|
|
340709
|
+
const completion = num3(u.completion_tokens) || num3(u.output_tokens) || num3(u.completionTokens) || num3(u.outputTokens);
|
|
340710
340710
|
return { promptTokens: prompt, completionTokens: completion };
|
|
340711
340711
|
}
|
|
340712
340712
|
function normalizeModelId(model) {
|
|
@@ -345393,6 +345393,18 @@ function classifyTarget(tab, defaultClass) {
|
|
|
345393
345393
|
if (tab.remoteOs === "unix") return "linux";
|
|
345394
345394
|
return defaultClass ?? "linux";
|
|
345395
345395
|
}
|
|
345396
|
+
function isCmdShellTarget(tab) {
|
|
345397
|
+
const t = (tab.type ?? "").toLowerCase();
|
|
345398
|
+
return t === "winrm";
|
|
345399
|
+
}
|
|
345400
|
+
function wrapWindowsFactForCmdShell(cmd) {
|
|
345401
|
+
const c = cmd.trim();
|
|
345402
|
+
if (/^hostname$/i.test(c)) return c;
|
|
345403
|
+
const isPowerShell = c.startsWith("$") || c.startsWith("[") || c.startsWith("(") || /^(Get|Set|New|Invoke|Measure|Select|Where|ForEach|Write|Read|Test|Convert|Out|Start|Stop)-/i.test(c) || /::/.test(c);
|
|
345404
|
+
if (!isPowerShell) return c;
|
|
345405
|
+
const escaped = c.replace(/"/g, '\\"');
|
|
345406
|
+
return `powershell -NoProfile -Command "${escaped}"`;
|
|
345407
|
+
}
|
|
345396
345408
|
async function collectFacts(args, context2) {
|
|
345397
345409
|
const { sessionId, messageId, sendEvent, terminalService } = context2;
|
|
345398
345410
|
let targetTabs;
|
|
@@ -345429,7 +345441,10 @@ async function collectFacts(args, context2) {
|
|
|
345429
345441
|
const perTarget = await Promise.allSettled(
|
|
345430
345442
|
targetTabs.map(async (tab) => {
|
|
345431
345443
|
const klass = classifyTarget(tab, args.defaultClass);
|
|
345432
|
-
|
|
345444
|
+
let commands = FACT_TEMPLATES[klass] ?? FACT_TEMPLATES.linux;
|
|
345445
|
+
if (klass === "windows" && isCmdShellTarget(tab)) {
|
|
345446
|
+
commands = commands.map(wrapWindowsFactForCmdShell);
|
|
345447
|
+
}
|
|
345433
345448
|
const facts = {};
|
|
345434
345449
|
for (let i = 0; i < commands.length; i++) {
|
|
345435
345450
|
const cmd = commands[i];
|
|
@@ -347458,8 +347473,8 @@ async function manageOncall(args, context2) {
|
|
|
347458
347473
|
out = `Page ${args.pageId} resolved.`;
|
|
347459
347474
|
}
|
|
347460
347475
|
} else {
|
|
347461
|
-
const
|
|
347462
|
-
out =
|
|
347476
|
+
const esc3 = await s.tick();
|
|
347477
|
+
out = esc3.length ? `Escalated ${esc3.length} page(s).` : "No pages needed escalation.";
|
|
347463
347478
|
}
|
|
347464
347479
|
} catch (e) {
|
|
347465
347480
|
out = `on-call error: ${e instanceof Error ? e.message : String(e)}`;
|
|
@@ -366775,25 +366790,90 @@ var import_websocket = __toESM(require_websocket(), 1);
|
|
|
366775
366790
|
var import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
366776
366791
|
|
|
366777
366792
|
// ../../packages/backend/src/services/Gateway/WebSocketGatewayAdapter.ts
|
|
366793
|
+
var import_node_module4 = require("node:module");
|
|
366794
|
+
var import_meta6 = {};
|
|
366795
|
+
var nodeRequire = (0, import_node_module4.createRequire)(
|
|
366796
|
+
typeof __filename !== "undefined" ? __filename : import_meta6.url
|
|
366797
|
+
);
|
|
366778
366798
|
var WebSocketRpcError = class extends Error {
|
|
366779
366799
|
constructor(code, message) {
|
|
366780
366800
|
super(message);
|
|
366781
366801
|
this.code = code;
|
|
366782
366802
|
}
|
|
366783
366803
|
};
|
|
366784
|
-
function createDefaultWebSocketServerFactory() {
|
|
366804
|
+
function createDefaultWebSocketServerFactory(httpRoutes) {
|
|
366785
366805
|
return ({ host, port }) => {
|
|
366786
|
-
|
|
366787
|
-
|
|
366788
|
-
|
|
366806
|
+
if (!httpRoutes || httpRoutes.length === 0) {
|
|
366807
|
+
return new import_websocket_server.default({
|
|
366808
|
+
host,
|
|
366809
|
+
port
|
|
366810
|
+
});
|
|
366811
|
+
}
|
|
366812
|
+
const wss = new import_websocket_server.default({ noServer: true });
|
|
366813
|
+
const routes = httpRoutes;
|
|
366814
|
+
const http2 = nodeRequire("node:http");
|
|
366815
|
+
const httpServer = http2.createServer(
|
|
366816
|
+
(req, res) => {
|
|
366817
|
+
void (async () => {
|
|
366818
|
+
let pathname = "/";
|
|
366819
|
+
try {
|
|
366820
|
+
pathname = new URL(
|
|
366821
|
+
req.url ?? "/",
|
|
366822
|
+
`http://${String(req.headers.host ?? "localhost")}`
|
|
366823
|
+
).pathname;
|
|
366824
|
+
} catch {
|
|
366825
|
+
}
|
|
366826
|
+
const route = routes.find((r) => r.path === pathname);
|
|
366827
|
+
if (!route) {
|
|
366828
|
+
res.writeHead(404, { "content-type": "text/plain; charset=utf-8" });
|
|
366829
|
+
res.end("not found");
|
|
366830
|
+
return;
|
|
366831
|
+
}
|
|
366832
|
+
try {
|
|
366833
|
+
await route.handler(
|
|
366834
|
+
req,
|
|
366835
|
+
res
|
|
366836
|
+
);
|
|
366837
|
+
} catch (e) {
|
|
366838
|
+
if (!res.headersSent) {
|
|
366839
|
+
res.writeHead(500, { "content-type": "text/plain; charset=utf-8" });
|
|
366840
|
+
}
|
|
366841
|
+
res.end(e instanceof Error ? e.message : String(e));
|
|
366842
|
+
}
|
|
366843
|
+
})();
|
|
366844
|
+
}
|
|
366845
|
+
);
|
|
366846
|
+
httpServer.on("upgrade", (req, socket, head) => {
|
|
366847
|
+
wss.handleUpgrade(req, socket, head, (ws) => {
|
|
366848
|
+
wss.emit("connection", ws, req);
|
|
366849
|
+
});
|
|
366789
366850
|
});
|
|
366851
|
+
httpServer.listen(port, host);
|
|
366852
|
+
const facade = {
|
|
366853
|
+
on(event, listener) {
|
|
366854
|
+
if (event === "connection") {
|
|
366855
|
+
wss.on("connection", listener);
|
|
366856
|
+
} else {
|
|
366857
|
+
httpServer.on("error", listener);
|
|
366858
|
+
}
|
|
366859
|
+
},
|
|
366860
|
+
close(callback) {
|
|
366861
|
+
wss.close(() => {
|
|
366862
|
+
httpServer.close(() => callback?.());
|
|
366863
|
+
});
|
|
366864
|
+
},
|
|
366865
|
+
// Expose the bound address so tests (and callers using port 0) can
|
|
366866
|
+
// discover the ephemeral port. Not part of IWebSocketServerLike.
|
|
366867
|
+
address: () => httpServer.address()
|
|
366868
|
+
};
|
|
366869
|
+
return facade;
|
|
366790
366870
|
};
|
|
366791
366871
|
}
|
|
366792
366872
|
var WebSocketGatewayAdapter = class {
|
|
366793
366873
|
constructor(gateway, options) {
|
|
366794
366874
|
this.gateway = gateway;
|
|
366795
366875
|
this.options = options;
|
|
366796
|
-
this.serverFactory = options.serverFactory ?? createDefaultWebSocketServerFactory();
|
|
366876
|
+
this.serverFactory = options.serverFactory ?? createDefaultWebSocketServerFactory(options.httpRoutes);
|
|
366797
366877
|
this.logger = options.logger ?? console;
|
|
366798
366878
|
}
|
|
366799
366879
|
server = null;
|
|
@@ -367001,13 +367081,13 @@ var WebSocketGatewayAdapter = class {
|
|
|
367001
367081
|
parseIpv4ToNum(ipStr) {
|
|
367002
367082
|
const parts = ipStr.split(".");
|
|
367003
367083
|
if (parts.length !== 4) return null;
|
|
367004
|
-
let
|
|
367084
|
+
let num3 = 0;
|
|
367005
367085
|
for (const part of parts) {
|
|
367006
367086
|
const n2 = parseInt(part, 10);
|
|
367007
367087
|
if (isNaN(n2) || n2 < 0 || n2 > 255) return null;
|
|
367008
|
-
|
|
367088
|
+
num3 = num3 * 256 + n2 >>> 0;
|
|
367009
367089
|
}
|
|
367010
|
-
return
|
|
367090
|
+
return num3;
|
|
367011
367091
|
}
|
|
367012
367092
|
isIpv4InCidr(ipNum, cidr) {
|
|
367013
367093
|
const slashIdx = cidr.indexOf("/");
|
|
@@ -379302,7 +379382,7 @@ function createTriggerRuntime(deps) {
|
|
|
379302
379382
|
}
|
|
379303
379383
|
|
|
379304
379384
|
// ../../packages/backend/src/services/observability.ts
|
|
379305
|
-
var
|
|
379385
|
+
var import_node_module5 = require("node:module");
|
|
379306
379386
|
var import_node_path27 = __toESM(require("node:path"), 1);
|
|
379307
379387
|
|
|
379308
379388
|
// ../../packages/backend/src/services/sre/metricsLedger.ts
|
|
@@ -379380,13 +379460,13 @@ var MetricsLedger = class {
|
|
|
379380
379460
|
const n2 = xs.length;
|
|
379381
379461
|
const meanX = xs.reduce((a, b) => a + b, 0) / n2;
|
|
379382
379462
|
const meanY = ys.reduce((a, b) => a + b, 0) / n2;
|
|
379383
|
-
let
|
|
379463
|
+
let num3 = 0, den = 0;
|
|
379384
379464
|
for (let i = 0; i < n2; i += 1) {
|
|
379385
|
-
|
|
379465
|
+
num3 += (xs[i] - meanX) * (ys[i] - meanY);
|
|
379386
379466
|
den += (xs[i] - meanX) * (xs[i] - meanX);
|
|
379387
379467
|
}
|
|
379388
379468
|
if (den === 0) return void 0;
|
|
379389
|
-
return
|
|
379469
|
+
return num3 / den;
|
|
379390
379470
|
}
|
|
379391
379471
|
/** Days until a metric crosses a threshold given the current value + slope.
|
|
379392
379472
|
* Returns undefined when not computable (no slope, flat, or moving away). */
|
|
@@ -385502,7 +385582,7 @@ var LiveDashboardHub = class {
|
|
|
385502
385582
|
};
|
|
385503
385583
|
|
|
385504
385584
|
// ../../packages/backend/src/services/observability.ts
|
|
385505
|
-
var
|
|
385585
|
+
var import_meta7 = {};
|
|
385506
385586
|
function makeLineReader(onChunk) {
|
|
385507
385587
|
let buffer = "";
|
|
385508
385588
|
const waiters = [];
|
|
@@ -385720,7 +385800,7 @@ function createObservability(deps) {
|
|
|
385720
385800
|
const monitorStatus = new MonitorStatusService(deps.resourceMonitorService, deps.terminalService);
|
|
385721
385801
|
const policyEngine = new AgtPolicyEngine({
|
|
385722
385802
|
loadPolicy: async () => {
|
|
385723
|
-
const req = (0,
|
|
385803
|
+
const req = (0, import_node_module5.createRequire)(typeof __filename !== "undefined" ? __filename : import_meta7.url);
|
|
385724
385804
|
const fs22 = req("node:fs");
|
|
385725
385805
|
const path32 = req("node:path");
|
|
385726
385806
|
const policyPath = path32.join(".", "policy.yaml");
|
|
@@ -385763,16 +385843,16 @@ function createObservability(deps) {
|
|
|
385763
385843
|
reviewMode: deps.reviewMode ?? "strict"
|
|
385764
385844
|
});
|
|
385765
385845
|
const pluginScanRoot = (process.env.GYBACKEND_DATA_DIR ?? "./.gybackend-data") + "/plugins";
|
|
385766
|
-
const bundlePluginRoot = typeof __filename !== "undefined" ? import_node_path27.default.join(import_node_path27.default.dirname(__filename), "..", "..", "plugins") : new URL("../../plugins/",
|
|
385846
|
+
const bundlePluginRoot = typeof __filename !== "undefined" ? import_node_path27.default.join(import_node_path27.default.dirname(__filename), "..", "..", "plugins") : new URL("../../plugins/", import_meta7.url).pathname;
|
|
385767
385847
|
const scanRoots = [pluginScanRoot, "./plugins"];
|
|
385768
385848
|
try {
|
|
385769
|
-
const req = (0,
|
|
385849
|
+
const req = (0, import_node_module5.createRequire)(typeof __filename !== "undefined" ? __filename : import_meta7.url);
|
|
385770
385850
|
const fs22 = req("node:fs");
|
|
385771
385851
|
if (fs22.existsSync(bundlePluginRoot)) scanRoots.push(bundlePluginRoot);
|
|
385772
385852
|
} catch {
|
|
385773
385853
|
}
|
|
385774
385854
|
try {
|
|
385775
|
-
const req = (0,
|
|
385855
|
+
const req = (0, import_node_module5.createRequire)(typeof __filename !== "undefined" ? __filename : import_meta7.url);
|
|
385776
385856
|
const fs22 = req("node:fs");
|
|
385777
385857
|
const path32 = req("node:path");
|
|
385778
385858
|
const resourcesPath = process.resourcesPath;
|
|
@@ -386230,6 +386310,295 @@ function createObservability(deps) {
|
|
|
386230
386310
|
};
|
|
386231
386311
|
}
|
|
386232
386312
|
|
|
386313
|
+
// ../../packages/backend/src/services/dashboard/renderDashboardHtml.ts
|
|
386314
|
+
function esc2(s) {
|
|
386315
|
+
return String(s ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
386316
|
+
}
|
|
386317
|
+
function pct(v) {
|
|
386318
|
+
return typeof v === "number" ? `${v.toFixed(1)}%` : "\u2014";
|
|
386319
|
+
}
|
|
386320
|
+
function num2(v, d = 1) {
|
|
386321
|
+
return typeof v === "number" ? v.toFixed(d) : "\u2014";
|
|
386322
|
+
}
|
|
386323
|
+
function stateBadge(state) {
|
|
386324
|
+
const c = state === "up" ? "ok" : state === "degraded" ? "warn" : state === "down" ? "bad" : "mute";
|
|
386325
|
+
return `<span class="badge ${c}">${esc2(state)}</span>`;
|
|
386326
|
+
}
|
|
386327
|
+
function sevBadge(sev) {
|
|
386328
|
+
const c = sev === "sev1" || sev === "sev2" ? "bad" : sev === "sev3" ? "warn" : "mute";
|
|
386329
|
+
return `<span class="badge ${c}">${esc2(sev)}</span>`;
|
|
386330
|
+
}
|
|
386331
|
+
function burnClass(burning) {
|
|
386332
|
+
return burning ? "bad" : "ok";
|
|
386333
|
+
}
|
|
386334
|
+
function renderDashboardHtml(state, opts = {}) {
|
|
386335
|
+
const title = opts.title ?? "RTerm \xB7 Unified Dashboard";
|
|
386336
|
+
const refresh = opts.refreshSeconds ?? 10;
|
|
386337
|
+
const dataUrl = opts.dataUrl ?? "";
|
|
386338
|
+
const live = opts.live === true;
|
|
386339
|
+
const hostRows = state.hosts.map((h) => {
|
|
386340
|
+
const g = h.golden;
|
|
386341
|
+
const up = state.uptime.find((u) => u.target.name === h.host);
|
|
386342
|
+
return `<tr>
|
|
386343
|
+
<td class="host">${esc2(h.host)}</td>
|
|
386344
|
+
<td>${up ? stateBadge(up.state) : '<span class="badge mute">\u2014</span>'}</td>
|
|
386345
|
+
<td>${pct(g?.cpuPercent)}</td>
|
|
386346
|
+
<td>${pct(g?.memPercent)}</td>
|
|
386347
|
+
<td>${pct(g?.diskPercentMax)}</td>
|
|
386348
|
+
<td>${num2(g?.cpuTrendPerDay, 2)}/d</td>
|
|
386349
|
+
<td>${g?.diskDaysToFull !== void 0 ? num2(g.diskDaysToFull, 1) + "d" : "\u2014"}</td>
|
|
386350
|
+
</tr>`;
|
|
386351
|
+
}).join("\n");
|
|
386352
|
+
const sloRows = state.slos.map((e) => {
|
|
386353
|
+
const sli = e.sli !== void 0 ? `${(e.sli * 100).toFixed(2)}%` : "\u2014";
|
|
386354
|
+
const burn = e.burnRate !== void 0 ? `${e.burnRate.toFixed(2)}x` : "\u2014";
|
|
386355
|
+
const budget = e.errorBudgetRemaining !== void 0 ? `${(e.errorBudgetRemaining * 100).toFixed(0)}%` : "\u2014";
|
|
386356
|
+
return `<tr class="${e.fastBurning ? "row-bad" : ""}">
|
|
386357
|
+
<td class="host">${esc2(e.sloId)}</td>
|
|
386358
|
+
<td>${sli}</td><td>${burn}</td><td>${budget}</td>
|
|
386359
|
+
<td><span class="badge ${burnClass(e.fastBurning)}">${e.fastBurning ? "FAST-BURNING" : "healthy"}</span></td>
|
|
386360
|
+
</tr>`;
|
|
386361
|
+
}).join("\n");
|
|
386362
|
+
const upRows = state.uptime.map((u) => `<tr>
|
|
386363
|
+
<td class="host">${esc2(u.target.name)}</td>
|
|
386364
|
+
<td>${stateBadge(u.state)}</td>
|
|
386365
|
+
<td>${u.consecutiveFailures}</td>
|
|
386366
|
+
<td>${u.lastLatencyMs !== void 0 ? u.lastLatencyMs + "ms" : "\u2014"}</td>
|
|
386367
|
+
<td>${esc2(u.lastError ?? "")}</td>
|
|
386368
|
+
</tr>`).join("\n");
|
|
386369
|
+
const incRows = state.incidents.map((i) => `<tr>
|
|
386370
|
+
<td class="host">${esc2(i.title)}</td>
|
|
386371
|
+
<td>${sevBadge(i.severity)}</td>
|
|
386372
|
+
<td><span class="badge ${i.status === "open" ? "bad" : i.status === "mitigated" ? "warn" : "ok"}">${esc2(i.status)}</span></td>
|
|
386373
|
+
<td>${esc2(i.affected.join(", ") || "\u2014")}</td>
|
|
386374
|
+
<td class="dim">${esc2((i.rca ?? "").slice(0, 120))}</td>
|
|
386375
|
+
</tr>`).join("\n");
|
|
386376
|
+
const apmSvcRows = state.apm.bottleneckServices.map((s) => `<tr>
|
|
386377
|
+
<td class="host">${esc2(s.service)}</td>
|
|
386378
|
+
<td>${s.spanCount}</td>
|
|
386379
|
+
<td>${s.errorCount}</td>
|
|
386380
|
+
<td>${(s.errorRate * 100).toFixed(1)}%</td>
|
|
386381
|
+
<td>${s.p95Ms !== void 0 ? num2(s.p95Ms, 0) + "ms" : "\u2014"}</td>
|
|
386382
|
+
</tr>`).join("\n");
|
|
386383
|
+
const apmTraceRows = state.apm.slowestTraces.map((t) => `<tr>
|
|
386384
|
+
<td class="host dim">${esc2(t.traceId.slice(0, 16))}</td>
|
|
386385
|
+
<td>${esc2(t.rootService)}</td>
|
|
386386
|
+
<td>${t.spanCount}</td>
|
|
386387
|
+
<td>${num2(t.totalDurationMs, 0)}ms</td>
|
|
386388
|
+
<td>${t.hasError ? '<span class="badge bad">error</span>' : '<span class="badge ok">ok</span>'}</td>
|
|
386389
|
+
</tr>`).join("\n");
|
|
386390
|
+
const demRows = state.dem.slowestPages.map((p) => `<tr>
|
|
386391
|
+
<td class="host">${esc2(p.page)}</td>
|
|
386392
|
+
<td>${p.sessions}</td>
|
|
386393
|
+
<td>${p.p75LcpMs !== void 0 ? num2(p.p75LcpMs, 0) + "ms" : "\u2014"}</td>
|
|
386394
|
+
<td>${p.p75InpMs !== void 0 ? num2(p.p75InpMs, 0) + "ms" : "\u2014"}</td>
|
|
386395
|
+
<td>${(p.errorRate * 100).toFixed(1)}%</td>
|
|
386396
|
+
</tr>`).join("\n");
|
|
386397
|
+
const clusterRows = state.clusters.map((c) => `<tr>
|
|
386398
|
+
<td class="host">${esc2(c.context)}</td>
|
|
386399
|
+
<td>${c.runningPods}/${c.totalPods}</td>
|
|
386400
|
+
<td>${c.notReadyPods}</td>
|
|
386401
|
+
<td>${c.crashLoopPods}</td>
|
|
386402
|
+
<td>${c.totalRestarts}</td>
|
|
386403
|
+
<td>${c.nodesReady}/${c.nodesTotal}</td>
|
|
386404
|
+
</tr>`).join("\n");
|
|
386405
|
+
const capRows = state.capacity.map((c) => `<tr class="${c.daysToFull !== void 0 && c.daysToFull < 30 ? "row-bad" : ""}">
|
|
386406
|
+
<td class="host">${esc2(c.host)}</td>
|
|
386407
|
+
<td>${pct(c.diskPercent)}</td>
|
|
386408
|
+
<td>${c.daysToFull !== void 0 ? num2(c.daysToFull, 1) + " days" : "\u2014"}</td>
|
|
386409
|
+
</tr>`).join("\n");
|
|
386410
|
+
const section = (id, label, rows, emptyMsg) => live ? `<section><h2>${label}</h2><div id="${id}">${rows ? `<table>${rows}</table>` : `<p class="empty">${esc2(emptyMsg)}</p>`}</div></section>` : rows ? `<section id="${id}"><h2>${label}</h2><table>${rows}</table></section>` : `<section id="${id}"><h2>${label}</h2><p class="empty">${esc2(emptyMsg)}</p></section>`;
|
|
386411
|
+
return `<!DOCTYPE html>
|
|
386412
|
+
<html lang="en">
|
|
386413
|
+
<head>
|
|
386414
|
+
<meta charset="utf-8">
|
|
386415
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
386416
|
+
${refresh > 0 && !live ? `<meta http-equiv="refresh" content="${refresh}">` : ""}
|
|
386417
|
+
<title>${esc2(title)}</title>
|
|
386418
|
+
<style>
|
|
386419
|
+
:root {
|
|
386420
|
+
--bg: #070a12; --panel: #0d1322; --panel2: #0a0f1b; --border: rgba(148,178,255,0.12);
|
|
386421
|
+
--fg: rgba(244,247,255,0.96); --muted: rgba(160,174,215,0.6);
|
|
386422
|
+
--accent: #4fd8e8; --accent2: #8b7bff; --ok: #3ddc97; --warn: #ffc44d; --bad: #ff5d7e;
|
|
386423
|
+
}
|
|
386424
|
+
* { box-sizing: border-box; }
|
|
386425
|
+
body { margin: 0; background: var(--bg); color: var(--fg); font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial; font-size: 13px;
|
|
386426
|
+
background-image: radial-gradient(1100px 700px at 6% -12%, rgba(79,216,232,0.08), transparent 60%), radial-gradient(1000px 680px at 104% -6%, rgba(139,123,255,0.07), transparent 56%); }
|
|
386427
|
+
header { padding: 18px 26px; border-bottom: 1px solid var(--border); display: flex; align-items: baseline; gap: 14px; position: sticky; top: 0; background: rgba(7,10,18,0.85); backdrop-filter: blur(10px); z-index: 5; }
|
|
386428
|
+
header h1 { font-size: 17px; font-weight: 700; margin: 0; background: linear-gradient(100deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
|
|
386429
|
+
header .sub { color: var(--muted); font-size: 11px; }
|
|
386430
|
+
header .live { margin-left: auto; font-size: 11px; color: var(--ok); display: flex; align-items: center; gap: 6px; }
|
|
386431
|
+
header .live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
|
|
386432
|
+
main { padding: 18px 26px 40px; max-width: 1280px; margin: 0 auto; }
|
|
386433
|
+
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
|
|
386434
|
+
section { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; box-shadow: 0 12px 30px rgba(0,0,0,0.35); }
|
|
386435
|
+
section h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 10px; font-weight: 700; }
|
|
386436
|
+
table { width: 100%; border-collapse: collapse; font-size: 12px; }
|
|
386437
|
+
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; padding: 4px 8px 6px 0; border-bottom: 1px solid var(--border); }
|
|
386438
|
+
td { padding: 6px 8px 6px 0; border-bottom: 1px solid rgba(148,178,255,0.07); color: var(--fg); }
|
|
386439
|
+
tr:last-child td { border-bottom: none; }
|
|
386440
|
+
.host { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 11.5px; }
|
|
386441
|
+
.dim { color: var(--muted); }
|
|
386442
|
+
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
|
|
386443
|
+
.badge.ok { background: rgba(61,220,151,0.14); color: var(--ok); }
|
|
386444
|
+
.badge.warn { background: rgba(255,196,77,0.14); color: var(--warn); }
|
|
386445
|
+
.badge.bad { background: rgba(255,93,126,0.16); color: var(--bad); }
|
|
386446
|
+
.badge.mute { background: rgba(160,174,215,0.12); color: var(--muted); }
|
|
386447
|
+
.row-bad td { background: rgba(255,93,126,0.05); }
|
|
386448
|
+
.empty { color: var(--muted); font-size: 12px; padding: 8px 0; }
|
|
386449
|
+
.span2 { grid-column: span 2; }
|
|
386450
|
+
footer { color: var(--muted); font-size: 11px; padding: 14px 26px 30px; }
|
|
386451
|
+
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } .span2 { grid-column: span 1; } }
|
|
386452
|
+
</style>
|
|
386453
|
+
</head>
|
|
386454
|
+
<body>
|
|
386455
|
+
<header>
|
|
386456
|
+
<h1>RTerm \xB7 Unified Dashboard</h1>
|
|
386457
|
+
<span class="sub">${esc2(title)}</span>
|
|
386458
|
+
<span class="live" id="live-indicator">LIVE \xB7 updated ${esc2(new Date(state.at).toISOString().slice(11, 19))} UTC</span>
|
|
386459
|
+
</header>
|
|
386460
|
+
<main>
|
|
386461
|
+
<div class="grid">
|
|
386462
|
+
<section class="span2">
|
|
386463
|
+
<h2>Fleet health</h2>
|
|
386464
|
+
<div id="fleet">
|
|
386465
|
+
<table>
|
|
386466
|
+
<tr><th>host</th><th>state</th><th>cpu</th><th>mem</th><th>disk</th><th>cpu trend</th><th>disk full in</th></tr>
|
|
386467
|
+
${hostRows || '<tr><td class="empty">No hosts reporting yet.</td></tr>'}
|
|
386468
|
+
</table>
|
|
386469
|
+
</div>
|
|
386470
|
+
</section>
|
|
386471
|
+
|
|
386472
|
+
${section("slo", "SLO board", sloRows ? `<tr><th>slo</th><th>sli</th><th>burn rate</th><th>budget</th><th>status</th></tr>${sloRows}` : "", "No SLOs defined yet.")}
|
|
386473
|
+
${section("uptime", "Uptime", upRows ? `<tr><th>host</th><th>state</th><th>failures</th><th>latency</th><th>error</th></tr>${upRows}` : "", "No watchdog targets yet.")}
|
|
386474
|
+
${section("incidents", "Open incidents", incRows ? `<tr><th>incident</th><th>sev</th><th>status</th><th>affected</th><th>rca</th></tr>${incRows}` : "", "No open incidents.")}
|
|
386475
|
+
${section("apm-svc", "APM \xB7 bottleneck services", apmSvcRows ? `<tr><th>service</th><th>spans</th><th>errors</th><th>error rate</th><th>p95</th></tr>${apmSvcRows}` : "", "No APM spans ingested yet.")}
|
|
386476
|
+
${section("apm-trace", "APM \xB7 slowest traces", apmTraceRows ? `<tr><th>trace</th><th>root</th><th>spans</th><th>duration</th><th>status</th></tr>${apmTraceRows}` : "", "No traces yet.")}
|
|
386477
|
+
${section("dem", "DEM \xB7 slowest pages (Core Web Vitals)", demRows ? `<tr><th>page</th><th>sessions</th><th>p75 lcp</th><th>p75 inp</th><th>error rate</th></tr>${demRows}` : "", "No RUM sessions yet.")}
|
|
386478
|
+
${section("clusters", "Kubernetes / cloud clusters", clusterRows ? `<tr><th>context</th><th>pods</th><th>not ready</th><th>crashloop</th><th>restarts</th><th>nodes</th></tr>${clusterRows}` : "", "No clusters reporting yet.")}
|
|
386479
|
+
${section("capacity", "Capacity forecast", capRows ? `<tr><th>host</th><th>disk</th><th>full in</th></tr>${capRows}` : "", "No capacity data yet.")}
|
|
386480
|
+
</div>
|
|
386481
|
+
</main>
|
|
386482
|
+
<footer>
|
|
386483
|
+
RTerm Unified Dashboard \xB7 ${state.hosts.length} hosts \xB7 ${state.slos.length} SLOs \xB7 ${state.incidents.length} open incidents
|
|
386484
|
+
${refresh > 0 && !live ? `\xB7 auto-refresh ${refresh}s` : ""}
|
|
386485
|
+
${dataUrl ? `\xB7 data: ${esc2(dataUrl)}` : ""}
|
|
386486
|
+
</footer>
|
|
386487
|
+
${live ? liveDashboardClientScript(dataUrl || "/dashboard/json") : ""}
|
|
386488
|
+
</body>
|
|
386489
|
+
</html>`;
|
|
386490
|
+
}
|
|
386491
|
+
function liveDashboardClientScript(jsonUrl) {
|
|
386492
|
+
return `<script>
|
|
386493
|
+
(function () {
|
|
386494
|
+
'use strict';
|
|
386495
|
+
var JSON_URL = ${JSON.stringify(jsonUrl)};
|
|
386496
|
+
var wsUrl = (location.protocol === 'https:' ? 'wss://' : 'ws://') + location.host + '/';
|
|
386497
|
+
var indicator = document.getElementById('live-indicator');
|
|
386498
|
+
var pollTimer = null;
|
|
386499
|
+
var rpcId = 0;
|
|
386500
|
+
|
|
386501
|
+
function esc(s) { return String(s == null ? '' : s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'); }
|
|
386502
|
+
function pct(v) { return typeof v === 'number' ? v.toFixed(1) + '%' : '\\u2014'; }
|
|
386503
|
+
function num(v, d) { return typeof v === 'number' ? v.toFixed(d == null ? 1 : d) : '\\u2014'; }
|
|
386504
|
+
function badge(state) {
|
|
386505
|
+
var c = state === 'up' ? 'ok' : state === 'degraded' ? 'warn' : state === 'down' ? 'bad' : 'mute';
|
|
386506
|
+
return '<span class="badge ' + c + '">' + esc(state) + '</span>';
|
|
386507
|
+
}
|
|
386508
|
+
function sev(sev) {
|
|
386509
|
+
var c = sev === 'sev1' || sev === 'sev2' ? 'bad' : sev === 'sev3' ? 'warn' : 'mute';
|
|
386510
|
+
return '<span class="badge ' + c + '">' + esc(sev) + '</span>';
|
|
386511
|
+
}
|
|
386512
|
+
function setSection(id, tableHtml, emptyMsg) {
|
|
386513
|
+
var el = document.getElementById(id);
|
|
386514
|
+
if (el) el.innerHTML = tableHtml || '<p class="empty">' + esc(emptyMsg) + '</p>';
|
|
386515
|
+
}
|
|
386516
|
+
function render(s) {
|
|
386517
|
+
if (!s || typeof s !== 'object') return;
|
|
386518
|
+
var hostRows = (s.hosts || []).map(function (h) {
|
|
386519
|
+
var g = h.golden || {};
|
|
386520
|
+
var up = (s.uptime || []).find(function (u) { return u.target && u.target.name === h.host; });
|
|
386521
|
+
return '<tr><td class="host">' + esc(h.host) + '</td><td>' + (up ? badge(up.state) : '<span class="badge mute">\\u2014</span>') + '</td><td>' + pct(g.cpuPercent) + '</td><td>' + pct(g.memPercent) + '</td><td>' + pct(g.diskPercentMax) + '</td><td>' + num(g.cpuTrendPerDay, 2) + '/d</td><td>' + (g.diskDaysToFull !== undefined ? num(g.diskDaysToFull, 1) + 'd' : '\\u2014') + '</td></tr>';
|
|
386522
|
+
}).join('');
|
|
386523
|
+
setSection('fleet', '<table><tr><th>host</th><th>state</th><th>cpu</th><th>mem</th><th>disk</th><th>cpu trend</th><th>disk full in</th></tr>' + hostRows + '</table>', 'No hosts reporting yet.');
|
|
386524
|
+
|
|
386525
|
+
var sloRows = (s.slos || []).map(function (e) {
|
|
386526
|
+
return '<tr class="' + (e.fastBurning ? 'row-bad' : '') + '"><td class="host">' + esc(e.sloId) + '</td><td>' + (e.sli !== undefined ? (e.sli * 100).toFixed(2) + '%' : '\\u2014') + '</td><td>' + (e.burnRate !== undefined ? e.burnRate.toFixed(2) + 'x' : '\\u2014') + '</td><td>' + (e.errorBudgetRemaining !== undefined ? (e.errorBudgetRemaining * 100).toFixed(0) + '%' : '\\u2014') + '</td><td><span class="badge ' + (e.fastBurning ? 'bad' : 'ok') + '">' + (e.fastBurning ? 'FAST-BURNING' : 'healthy') + '</span></td></tr>';
|
|
386527
|
+
}).join('');
|
|
386528
|
+
setSection('slo', sloRows ? '<table><tr><th>slo</th><th>sli</th><th>burn rate</th><th>budget</th><th>status</th></tr>' + sloRows + '</table>' : '', 'No SLOs defined yet.');
|
|
386529
|
+
|
|
386530
|
+
var upRows = (s.uptime || []).map(function (u) {
|
|
386531
|
+
return '<tr><td class="host">' + esc(u.target && u.target.name) + '</td><td>' + badge(u.state) + '</td><td>' + u.consecutiveFailures + '</td><td>' + (u.lastLatencyMs !== undefined ? u.lastLatencyMs + 'ms' : '\\u2014') + '</td><td>' + esc(u.lastError || '') + '</td></tr>';
|
|
386532
|
+
}).join('');
|
|
386533
|
+
setSection('uptime', upRows ? '<table><tr><th>host</th><th>state</th><th>failures</th><th>latency</th><th>error</th></tr>' + upRows + '</table>' : '', 'No watchdog targets yet.');
|
|
386534
|
+
|
|
386535
|
+
var incRows = (s.incidents || []).map(function (i) {
|
|
386536
|
+
return '<tr><td class="host">' + esc(i.title) + '</td><td>' + sev(i.severity) + '</td><td><span class="badge ' + (i.status === 'open' ? 'bad' : i.status === 'mitigated' ? 'warn' : 'ok') + '">' + esc(i.status) + '</span></td><td>' + esc((i.affected || []).join(', ') || '\\u2014') + '</td><td class="dim">' + esc((i.rca || '').slice(0, 120)) + '</td></tr>';
|
|
386537
|
+
}).join('');
|
|
386538
|
+
setSection('incidents', incRows ? '<table><tr><th>incident</th><th>sev</th><th>status</th><th>affected</th><th>rca</th></tr>' + incRows + '</table>' : '', 'No open incidents.');
|
|
386539
|
+
|
|
386540
|
+
var apmSvc = ((s.apm && s.apm.bottleneckServices) || []).map(function (x) {
|
|
386541
|
+
return '<tr><td class="host">' + esc(x.service) + '</td><td>' + x.spanCount + '</td><td>' + x.errorCount + '</td><td>' + (x.errorRate * 100).toFixed(1) + '%</td><td>' + (x.p95Ms !== undefined ? num(x.p95Ms, 0) + 'ms' : '\\u2014') + '</td></tr>';
|
|
386542
|
+
}).join('');
|
|
386543
|
+
setSection('apm-svc', apmSvc ? '<table><tr><th>service</th><th>spans</th><th>errors</th><th>error rate</th><th>p95</th></tr>' + apmSvc + '</table>' : '', 'No APM spans ingested yet.');
|
|
386544
|
+
|
|
386545
|
+
var apmTr = ((s.apm && s.apm.slowestTraces) || []).map(function (t) {
|
|
386546
|
+
return '<tr><td class="host dim">' + esc(String(t.traceId).slice(0, 16)) + '</td><td>' + esc(t.rootService) + '</td><td>' + t.spanCount + '</td><td>' + num(t.totalDurationMs, 0) + 'ms</td><td>' + (t.hasError ? '<span class="badge bad">error</span>' : '<span class="badge ok">ok</span>') + '</td></tr>';
|
|
386547
|
+
}).join('');
|
|
386548
|
+
setSection('apm-trace', apmTr ? '<table><tr><th>trace</th><th>root</th><th>spans</th><th>duration</th><th>status</th></tr>' + apmTr + '</table>' : '', 'No traces yet.');
|
|
386549
|
+
|
|
386550
|
+
var demRows = ((s.dem && s.dem.slowestPages) || []).map(function (p) {
|
|
386551
|
+
return '<tr><td class="host">' + esc(p.page) + '</td><td>' + p.sessions + '</td><td>' + (p.p75LcpMs !== undefined ? num(p.p75LcpMs, 0) + 'ms' : '\\u2014') + '</td><td>' + (p.p75InpMs !== undefined ? num(p.p75InpMs, 0) + 'ms' : '\\u2014') + '</td><td>' + (p.errorRate * 100).toFixed(1) + '%</td></tr>';
|
|
386552
|
+
}).join('');
|
|
386553
|
+
setSection('dem', demRows ? '<table><tr><th>page</th><th>sessions</th><th>p75 lcp</th><th>p75 inp</th><th>error rate</th></tr>' + demRows + '</table>' : '', 'No RUM sessions yet.');
|
|
386554
|
+
|
|
386555
|
+
var clRows = (s.clusters || []).map(function (c) {
|
|
386556
|
+
return '<tr><td class="host">' + esc(c.context) + '</td><td>' + c.runningPods + '/' + c.totalPods + '</td><td>' + c.notReadyPods + '</td><td>' + c.crashLoopPods + '</td><td>' + c.totalRestarts + '</td><td>' + c.nodesReady + '/' + c.nodesTotal + '</td></tr>';
|
|
386557
|
+
}).join('');
|
|
386558
|
+
setSection('clusters', clRows ? '<table><tr><th>context</th><th>pods</th><th>not ready</th><th>crashloop</th><th>restarts</th><th>nodes</th></tr>' + clRows + '</table>' : '', 'No clusters reporting yet.');
|
|
386559
|
+
|
|
386560
|
+
var capRows = (s.capacity || []).map(function (c) {
|
|
386561
|
+
return '<tr class="' + (c.daysToFull !== undefined && c.daysToFull < 30 ? 'row-bad' : '') + '"><td class="host">' + esc(c.host) + '</td><td>' + pct(c.diskPercent) + '</td><td>' + (c.daysToFull !== undefined ? num(c.daysToFull, 1) + ' days' : '\\u2014') + '</td></tr>';
|
|
386562
|
+
}).join('');
|
|
386563
|
+
setSection('capacity', capRows ? '<table><tr><th>host</th><th>disk</th><th>full in</th></tr>' + capRows + '</table>' : '', 'No capacity data yet.');
|
|
386564
|
+
|
|
386565
|
+
if (indicator) {
|
|
386566
|
+
var t = new Date(s.at || Date.now()).toISOString().slice(11, 19);
|
|
386567
|
+
indicator.textContent = 'LIVE \\u00b7 updated ' + t + ' UTC';
|
|
386568
|
+
}
|
|
386569
|
+
}
|
|
386570
|
+
|
|
386571
|
+
function startPolling() {
|
|
386572
|
+
if (pollTimer) return;
|
|
386573
|
+
pollTimer = setInterval(function () {
|
|
386574
|
+
fetch(JSON_URL).then(function (r) { return r.json(); }).then(render).catch(function () {});
|
|
386575
|
+
}, 5000);
|
|
386576
|
+
}
|
|
386577
|
+
|
|
386578
|
+
function connect() {
|
|
386579
|
+
var ws;
|
|
386580
|
+
try { ws = new WebSocket(wsUrl); } catch (e) { startPolling(); return; }
|
|
386581
|
+
ws.onopen = function () {
|
|
386582
|
+
rpcId += 1;
|
|
386583
|
+
ws.send(JSON.stringify({ type: 'gateway:rpc', id: 'dash-' + rpcId, method: 'observability:liveDashboardSubscribe', params: {} }));
|
|
386584
|
+
if (pollTimer) { clearInterval(pollTimer); pollTimer = null; }
|
|
386585
|
+
};
|
|
386586
|
+
ws.onmessage = function (ev) {
|
|
386587
|
+
var msg;
|
|
386588
|
+
try { msg = JSON.parse(ev.data); } catch (e) { return; }
|
|
386589
|
+
if (msg && msg.type === 'gateway:event' && msg.event === 'observability:dashboard' && msg.data) render(msg.data);
|
|
386590
|
+
};
|
|
386591
|
+
ws.onclose = function () { startPolling(); setTimeout(connect, 5000); };
|
|
386592
|
+
ws.onerror = function () { try { ws.close(); } catch (e) {} };
|
|
386593
|
+
}
|
|
386594
|
+
connect();
|
|
386595
|
+
})();
|
|
386596
|
+
</script>`;
|
|
386597
|
+
}
|
|
386598
|
+
function renderLiveDashboardHtml(state, opts = {}) {
|
|
386599
|
+
return renderDashboardHtml(state, { ...opts, live: true, refreshSeconds: 0 });
|
|
386600
|
+
}
|
|
386601
|
+
|
|
386233
386602
|
// ../../packages/backend/src/services/ResourceMonitorService.ts
|
|
386234
386603
|
var import_os2 = __toESM(require("os"), 1);
|
|
386235
386604
|
var DEFAULT_POLL_INTERVAL_MS = 2e3;
|
|
@@ -388335,6 +388704,27 @@ async function startGyBackend() {
|
|
|
388335
388704
|
gatewayService.broadcastRaw("skills:updated", result.skills);
|
|
388336
388705
|
gatewayService.broadcastRaw("memory:updated", result.memory);
|
|
388337
388706
|
};
|
|
388707
|
+
const dashboardHttpAuthorized = async (req) => {
|
|
388708
|
+
const remote = String(req.socket?.remoteAddress ?? "");
|
|
388709
|
+
if (/^(127\.|::1|::ffff:127\.)/.test(remote) || remote === "" || remote === "localhost") {
|
|
388710
|
+
return true;
|
|
388711
|
+
}
|
|
388712
|
+
const authz = typeof req.headers.authorization === "string" ? req.headers.authorization : "";
|
|
388713
|
+
const bearer = /^Bearer\s+(.+)$/i.exec(authz)?.[1]?.trim();
|
|
388714
|
+
const headerTok = typeof req.headers["x-access-token"] === "string" ? String(req.headers["x-access-token"]).trim() : "";
|
|
388715
|
+
let queryTok = "";
|
|
388716
|
+
try {
|
|
388717
|
+
queryTok = new URL(req.url ?? "/", "http://localhost").searchParams.get("access_token")?.trim() ?? "";
|
|
388718
|
+
} catch {
|
|
388719
|
+
}
|
|
388720
|
+
const token = bearer || headerTok || queryTok;
|
|
388721
|
+
if (!token) return false;
|
|
388722
|
+
try {
|
|
388723
|
+
return await accessTokenService.verifyToken(token);
|
|
388724
|
+
} catch {
|
|
388725
|
+
return false;
|
|
388726
|
+
}
|
|
388727
|
+
};
|
|
388338
388728
|
const wsGatewayControlService = new WebSocketGatewayControlService({
|
|
388339
388729
|
createAdapter: (host, port, ipFilter) => new WebSocketGatewayAdapter(gatewayService, {
|
|
388340
388730
|
host,
|
|
@@ -388344,6 +388734,43 @@ async function startGyBackend() {
|
|
|
388344
388734
|
allowLocalhostWithoutToken: true
|
|
388345
388735
|
},
|
|
388346
388736
|
ipFilter,
|
|
388737
|
+
// Browser dashboard on the SAME port as the WS gateway: /dashboard serves
|
|
388738
|
+
// a live page (WS push via observability:liveDashboardSubscribe, with a
|
|
388739
|
+
// /dashboard/json polling fallback). Auth mirrors the WS gateway —
|
|
388740
|
+
// loopback open, remote needs a valid access token.
|
|
388741
|
+
httpRoutes: [
|
|
388742
|
+
{
|
|
388743
|
+
path: "/dashboard",
|
|
388744
|
+
handler: async (req, res) => {
|
|
388745
|
+
if (!await dashboardHttpAuthorized(req)) {
|
|
388746
|
+
res.writeHead(401, { "content-type": "text/plain; charset=utf-8" });
|
|
388747
|
+
res.end("missing/invalid access token");
|
|
388748
|
+
return;
|
|
388749
|
+
}
|
|
388750
|
+
const state = await observability.dashboard.state();
|
|
388751
|
+
res.writeHead(200, { "content-type": "text/html; charset=utf-8" });
|
|
388752
|
+
res.end(
|
|
388753
|
+
renderLiveDashboardHtml(state, {
|
|
388754
|
+
title: "RTerm \xB7 Unified Dashboard",
|
|
388755
|
+
dataUrl: "/dashboard/json"
|
|
388756
|
+
})
|
|
388757
|
+
);
|
|
388758
|
+
}
|
|
388759
|
+
},
|
|
388760
|
+
{
|
|
388761
|
+
path: "/dashboard/json",
|
|
388762
|
+
handler: async (req, res) => {
|
|
388763
|
+
if (!await dashboardHttpAuthorized(req)) {
|
|
388764
|
+
res.writeHead(401, { "content-type": "text/plain; charset=utf-8" });
|
|
388765
|
+
res.end("missing/invalid access token");
|
|
388766
|
+
return;
|
|
388767
|
+
}
|
|
388768
|
+
const state = await observability.dashboard.state();
|
|
388769
|
+
res.writeHead(200, { "content-type": "application/json; charset=utf-8" });
|
|
388770
|
+
res.end(JSON.stringify(state));
|
|
388771
|
+
}
|
|
388772
|
+
}
|
|
388773
|
+
],
|
|
388347
388774
|
terminalBridge: {
|
|
388348
388775
|
listTerminals: () => terminalService.getDisplayTerminals().map((terminal) => ({
|
|
388349
388776
|
id: terminal.id,
|
|
@@ -388738,6 +389165,9 @@ async function startGyBackend() {
|
|
|
388738
389165
|
console.log(
|
|
388739
389166
|
`[gybackend] WebSocket RPC endpoint: ws://${wsState.host}:${wsState.port}`
|
|
388740
389167
|
);
|
|
389168
|
+
console.log(
|
|
389169
|
+
`[gybackend] Live dashboard: http://${wsState.host}:${wsState.port}/dashboard`
|
|
389170
|
+
);
|
|
388741
389171
|
} else {
|
|
388742
389172
|
console.log("[gybackend] WebSocket RPC endpoint: disabled");
|
|
388743
389173
|
}
|