@vitessce/dev 2.0.0-beta.0 → 2.0.0-beta.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/dist/{deflate.498f1fff.mjs → deflate.fd6a2bf5.mjs} +1 -1
- package/dist/{index.3e7f200a.mjs → index.879a4eb2.mjs} +2160 -500
- package/dist/index.js +1 -0
- package/dist/index.mjs +3 -1
- package/dist/index.umd.js +2153 -493
- package/dist/{jpeg.76899aba.mjs → jpeg.da6a1ce7.mjs} +1 -1
- package/dist/{lerc.b63a936e.mjs → lerc.f650c15f.mjs} +1 -1
- package/dist/{lzw.7a63ed8b.mjs → lzw.a7b59c9a.mjs} +1 -1
- package/dist/{packbits.f5da2e5e.mjs → packbits.948b00a6.mjs} +1 -1
- package/dist/{raw.b6ef11f5.mjs → raw.f81790cb.mjs} +1 -1
- package/dist/{webimage.7e22bbfd.mjs → webimage.a23de56d.mjs} +1 -1
- package/package.json +5 -4
package/dist/index.umd.js
CHANGED
|
@@ -856,6 +856,25 @@ ${oldObj[prop][1]}`);
|
|
|
856
856
|
const maxSize = maxHeapSize || 2 ** 31 - 1;
|
|
857
857
|
return totalBytes < maxSize && height2 <= 2048 && depthDownsampled <= 2048 && width2 <= 2048 && depthDownsampled > 1;
|
|
858
858
|
};
|
|
859
|
+
const VALUE_TRANSFORM_OPTIONS = [
|
|
860
|
+
{ name: "None", value: null },
|
|
861
|
+
{ name: "Log", value: "log1p" },
|
|
862
|
+
{ name: "ArcSinh", value: "arcsinh" }
|
|
863
|
+
];
|
|
864
|
+
function getValueTransformFunction(featureValueTransform, coefficient) {
|
|
865
|
+
let transformFunction;
|
|
866
|
+
switch (featureValueTransform) {
|
|
867
|
+
case "log1p":
|
|
868
|
+
transformFunction = (v) => Math.log(1 + v * coefficient);
|
|
869
|
+
break;
|
|
870
|
+
case "arcsinh":
|
|
871
|
+
transformFunction = (v) => Math.asinh(v * coefficient);
|
|
872
|
+
break;
|
|
873
|
+
default:
|
|
874
|
+
transformFunction = (v) => v;
|
|
875
|
+
}
|
|
876
|
+
return transformFunction;
|
|
877
|
+
}
|
|
859
878
|
var commonjsGlobal$1 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
860
879
|
function getDefaultExportFromCjs$1(x2) {
|
|
861
880
|
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
@@ -881,477 +900,6 @@ ${oldObj[prop][1]}`);
|
|
|
881
900
|
});
|
|
882
901
|
return a2;
|
|
883
902
|
}
|
|
884
|
-
var lzString = { exports: {} };
|
|
885
|
-
(function(module3) {
|
|
886
|
-
var LZString = function() {
|
|
887
|
-
var f2 = String.fromCharCode;
|
|
888
|
-
var keyStrBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
889
|
-
var keyStrUriSafe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$";
|
|
890
|
-
var baseReverseDic = {};
|
|
891
|
-
function getBaseValue(alphabet, character) {
|
|
892
|
-
if (!baseReverseDic[alphabet]) {
|
|
893
|
-
baseReverseDic[alphabet] = {};
|
|
894
|
-
for (var i2 = 0; i2 < alphabet.length; i2++) {
|
|
895
|
-
baseReverseDic[alphabet][alphabet.charAt(i2)] = i2;
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
return baseReverseDic[alphabet][character];
|
|
899
|
-
}
|
|
900
|
-
var LZString2 = {
|
|
901
|
-
compressToBase64: function(input) {
|
|
902
|
-
if (input == null)
|
|
903
|
-
return "";
|
|
904
|
-
var res = LZString2._compress(input, 6, function(a2) {
|
|
905
|
-
return keyStrBase64.charAt(a2);
|
|
906
|
-
});
|
|
907
|
-
switch (res.length % 4) {
|
|
908
|
-
default:
|
|
909
|
-
case 0:
|
|
910
|
-
return res;
|
|
911
|
-
case 1:
|
|
912
|
-
return res + "===";
|
|
913
|
-
case 2:
|
|
914
|
-
return res + "==";
|
|
915
|
-
case 3:
|
|
916
|
-
return res + "=";
|
|
917
|
-
}
|
|
918
|
-
},
|
|
919
|
-
decompressFromBase64: function(input) {
|
|
920
|
-
if (input == null)
|
|
921
|
-
return "";
|
|
922
|
-
if (input == "")
|
|
923
|
-
return null;
|
|
924
|
-
return LZString2._decompress(input.length, 32, function(index2) {
|
|
925
|
-
return getBaseValue(keyStrBase64, input.charAt(index2));
|
|
926
|
-
});
|
|
927
|
-
},
|
|
928
|
-
compressToUTF16: function(input) {
|
|
929
|
-
if (input == null)
|
|
930
|
-
return "";
|
|
931
|
-
return LZString2._compress(input, 15, function(a2) {
|
|
932
|
-
return f2(a2 + 32);
|
|
933
|
-
}) + " ";
|
|
934
|
-
},
|
|
935
|
-
decompressFromUTF16: function(compressed) {
|
|
936
|
-
if (compressed == null)
|
|
937
|
-
return "";
|
|
938
|
-
if (compressed == "")
|
|
939
|
-
return null;
|
|
940
|
-
return LZString2._decompress(compressed.length, 16384, function(index2) {
|
|
941
|
-
return compressed.charCodeAt(index2) - 32;
|
|
942
|
-
});
|
|
943
|
-
},
|
|
944
|
-
compressToUint8Array: function(uncompressed) {
|
|
945
|
-
var compressed = LZString2.compress(uncompressed);
|
|
946
|
-
var buf = new Uint8Array(compressed.length * 2);
|
|
947
|
-
for (var i2 = 0, TotalLen = compressed.length; i2 < TotalLen; i2++) {
|
|
948
|
-
var current_value = compressed.charCodeAt(i2);
|
|
949
|
-
buf[i2 * 2] = current_value >>> 8;
|
|
950
|
-
buf[i2 * 2 + 1] = current_value % 256;
|
|
951
|
-
}
|
|
952
|
-
return buf;
|
|
953
|
-
},
|
|
954
|
-
decompressFromUint8Array: function(compressed) {
|
|
955
|
-
if (compressed === null || compressed === void 0) {
|
|
956
|
-
return LZString2.decompress(compressed);
|
|
957
|
-
} else {
|
|
958
|
-
var buf = new Array(compressed.length / 2);
|
|
959
|
-
for (var i2 = 0, TotalLen = buf.length; i2 < TotalLen; i2++) {
|
|
960
|
-
buf[i2] = compressed[i2 * 2] * 256 + compressed[i2 * 2 + 1];
|
|
961
|
-
}
|
|
962
|
-
var result = [];
|
|
963
|
-
buf.forEach(function(c2) {
|
|
964
|
-
result.push(f2(c2));
|
|
965
|
-
});
|
|
966
|
-
return LZString2.decompress(result.join(""));
|
|
967
|
-
}
|
|
968
|
-
},
|
|
969
|
-
compressToEncodedURIComponent: function(input) {
|
|
970
|
-
if (input == null)
|
|
971
|
-
return "";
|
|
972
|
-
return LZString2._compress(input, 6, function(a2) {
|
|
973
|
-
return keyStrUriSafe.charAt(a2);
|
|
974
|
-
});
|
|
975
|
-
},
|
|
976
|
-
decompressFromEncodedURIComponent: function(input) {
|
|
977
|
-
if (input == null)
|
|
978
|
-
return "";
|
|
979
|
-
if (input == "")
|
|
980
|
-
return null;
|
|
981
|
-
input = input.replace(/ /g, "+");
|
|
982
|
-
return LZString2._decompress(input.length, 32, function(index2) {
|
|
983
|
-
return getBaseValue(keyStrUriSafe, input.charAt(index2));
|
|
984
|
-
});
|
|
985
|
-
},
|
|
986
|
-
compress: function(uncompressed) {
|
|
987
|
-
return LZString2._compress(uncompressed, 16, function(a2) {
|
|
988
|
-
return f2(a2);
|
|
989
|
-
});
|
|
990
|
-
},
|
|
991
|
-
_compress: function(uncompressed, bitsPerChar, getCharFromInt) {
|
|
992
|
-
if (uncompressed == null)
|
|
993
|
-
return "";
|
|
994
|
-
var i2, value2, context_dictionary = {}, context_dictionaryToCreate = {}, context_c = "", context_wc = "", context_w = "", context_enlargeIn = 2, context_dictSize = 3, context_numBits = 2, context_data = [], context_data_val = 0, context_data_position = 0, ii;
|
|
995
|
-
for (ii = 0; ii < uncompressed.length; ii += 1) {
|
|
996
|
-
context_c = uncompressed.charAt(ii);
|
|
997
|
-
if (!Object.prototype.hasOwnProperty.call(context_dictionary, context_c)) {
|
|
998
|
-
context_dictionary[context_c] = context_dictSize++;
|
|
999
|
-
context_dictionaryToCreate[context_c] = true;
|
|
1000
|
-
}
|
|
1001
|
-
context_wc = context_w + context_c;
|
|
1002
|
-
if (Object.prototype.hasOwnProperty.call(context_dictionary, context_wc)) {
|
|
1003
|
-
context_w = context_wc;
|
|
1004
|
-
} else {
|
|
1005
|
-
if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {
|
|
1006
|
-
if (context_w.charCodeAt(0) < 256) {
|
|
1007
|
-
for (i2 = 0; i2 < context_numBits; i2++) {
|
|
1008
|
-
context_data_val = context_data_val << 1;
|
|
1009
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
1010
|
-
context_data_position = 0;
|
|
1011
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
1012
|
-
context_data_val = 0;
|
|
1013
|
-
} else {
|
|
1014
|
-
context_data_position++;
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
value2 = context_w.charCodeAt(0);
|
|
1018
|
-
for (i2 = 0; i2 < 8; i2++) {
|
|
1019
|
-
context_data_val = context_data_val << 1 | value2 & 1;
|
|
1020
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
1021
|
-
context_data_position = 0;
|
|
1022
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
1023
|
-
context_data_val = 0;
|
|
1024
|
-
} else {
|
|
1025
|
-
context_data_position++;
|
|
1026
|
-
}
|
|
1027
|
-
value2 = value2 >> 1;
|
|
1028
|
-
}
|
|
1029
|
-
} else {
|
|
1030
|
-
value2 = 1;
|
|
1031
|
-
for (i2 = 0; i2 < context_numBits; i2++) {
|
|
1032
|
-
context_data_val = context_data_val << 1 | value2;
|
|
1033
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
1034
|
-
context_data_position = 0;
|
|
1035
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
1036
|
-
context_data_val = 0;
|
|
1037
|
-
} else {
|
|
1038
|
-
context_data_position++;
|
|
1039
|
-
}
|
|
1040
|
-
value2 = 0;
|
|
1041
|
-
}
|
|
1042
|
-
value2 = context_w.charCodeAt(0);
|
|
1043
|
-
for (i2 = 0; i2 < 16; i2++) {
|
|
1044
|
-
context_data_val = context_data_val << 1 | value2 & 1;
|
|
1045
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
1046
|
-
context_data_position = 0;
|
|
1047
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
1048
|
-
context_data_val = 0;
|
|
1049
|
-
} else {
|
|
1050
|
-
context_data_position++;
|
|
1051
|
-
}
|
|
1052
|
-
value2 = value2 >> 1;
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
context_enlargeIn--;
|
|
1056
|
-
if (context_enlargeIn == 0) {
|
|
1057
|
-
context_enlargeIn = Math.pow(2, context_numBits);
|
|
1058
|
-
context_numBits++;
|
|
1059
|
-
}
|
|
1060
|
-
delete context_dictionaryToCreate[context_w];
|
|
1061
|
-
} else {
|
|
1062
|
-
value2 = context_dictionary[context_w];
|
|
1063
|
-
for (i2 = 0; i2 < context_numBits; i2++) {
|
|
1064
|
-
context_data_val = context_data_val << 1 | value2 & 1;
|
|
1065
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
1066
|
-
context_data_position = 0;
|
|
1067
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
1068
|
-
context_data_val = 0;
|
|
1069
|
-
} else {
|
|
1070
|
-
context_data_position++;
|
|
1071
|
-
}
|
|
1072
|
-
value2 = value2 >> 1;
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
context_enlargeIn--;
|
|
1076
|
-
if (context_enlargeIn == 0) {
|
|
1077
|
-
context_enlargeIn = Math.pow(2, context_numBits);
|
|
1078
|
-
context_numBits++;
|
|
1079
|
-
}
|
|
1080
|
-
context_dictionary[context_wc] = context_dictSize++;
|
|
1081
|
-
context_w = String(context_c);
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
if (context_w !== "") {
|
|
1085
|
-
if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {
|
|
1086
|
-
if (context_w.charCodeAt(0) < 256) {
|
|
1087
|
-
for (i2 = 0; i2 < context_numBits; i2++) {
|
|
1088
|
-
context_data_val = context_data_val << 1;
|
|
1089
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
1090
|
-
context_data_position = 0;
|
|
1091
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
1092
|
-
context_data_val = 0;
|
|
1093
|
-
} else {
|
|
1094
|
-
context_data_position++;
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
value2 = context_w.charCodeAt(0);
|
|
1098
|
-
for (i2 = 0; i2 < 8; i2++) {
|
|
1099
|
-
context_data_val = context_data_val << 1 | value2 & 1;
|
|
1100
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
1101
|
-
context_data_position = 0;
|
|
1102
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
1103
|
-
context_data_val = 0;
|
|
1104
|
-
} else {
|
|
1105
|
-
context_data_position++;
|
|
1106
|
-
}
|
|
1107
|
-
value2 = value2 >> 1;
|
|
1108
|
-
}
|
|
1109
|
-
} else {
|
|
1110
|
-
value2 = 1;
|
|
1111
|
-
for (i2 = 0; i2 < context_numBits; i2++) {
|
|
1112
|
-
context_data_val = context_data_val << 1 | value2;
|
|
1113
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
1114
|
-
context_data_position = 0;
|
|
1115
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
1116
|
-
context_data_val = 0;
|
|
1117
|
-
} else {
|
|
1118
|
-
context_data_position++;
|
|
1119
|
-
}
|
|
1120
|
-
value2 = 0;
|
|
1121
|
-
}
|
|
1122
|
-
value2 = context_w.charCodeAt(0);
|
|
1123
|
-
for (i2 = 0; i2 < 16; i2++) {
|
|
1124
|
-
context_data_val = context_data_val << 1 | value2 & 1;
|
|
1125
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
1126
|
-
context_data_position = 0;
|
|
1127
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
1128
|
-
context_data_val = 0;
|
|
1129
|
-
} else {
|
|
1130
|
-
context_data_position++;
|
|
1131
|
-
}
|
|
1132
|
-
value2 = value2 >> 1;
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
context_enlargeIn--;
|
|
1136
|
-
if (context_enlargeIn == 0) {
|
|
1137
|
-
context_enlargeIn = Math.pow(2, context_numBits);
|
|
1138
|
-
context_numBits++;
|
|
1139
|
-
}
|
|
1140
|
-
delete context_dictionaryToCreate[context_w];
|
|
1141
|
-
} else {
|
|
1142
|
-
value2 = context_dictionary[context_w];
|
|
1143
|
-
for (i2 = 0; i2 < context_numBits; i2++) {
|
|
1144
|
-
context_data_val = context_data_val << 1 | value2 & 1;
|
|
1145
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
1146
|
-
context_data_position = 0;
|
|
1147
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
1148
|
-
context_data_val = 0;
|
|
1149
|
-
} else {
|
|
1150
|
-
context_data_position++;
|
|
1151
|
-
}
|
|
1152
|
-
value2 = value2 >> 1;
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
context_enlargeIn--;
|
|
1156
|
-
if (context_enlargeIn == 0) {
|
|
1157
|
-
context_enlargeIn = Math.pow(2, context_numBits);
|
|
1158
|
-
context_numBits++;
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
value2 = 2;
|
|
1162
|
-
for (i2 = 0; i2 < context_numBits; i2++) {
|
|
1163
|
-
context_data_val = context_data_val << 1 | value2 & 1;
|
|
1164
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
1165
|
-
context_data_position = 0;
|
|
1166
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
1167
|
-
context_data_val = 0;
|
|
1168
|
-
} else {
|
|
1169
|
-
context_data_position++;
|
|
1170
|
-
}
|
|
1171
|
-
value2 = value2 >> 1;
|
|
1172
|
-
}
|
|
1173
|
-
while (true) {
|
|
1174
|
-
context_data_val = context_data_val << 1;
|
|
1175
|
-
if (context_data_position == bitsPerChar - 1) {
|
|
1176
|
-
context_data.push(getCharFromInt(context_data_val));
|
|
1177
|
-
break;
|
|
1178
|
-
} else
|
|
1179
|
-
context_data_position++;
|
|
1180
|
-
}
|
|
1181
|
-
return context_data.join("");
|
|
1182
|
-
},
|
|
1183
|
-
decompress: function(compressed) {
|
|
1184
|
-
if (compressed == null)
|
|
1185
|
-
return "";
|
|
1186
|
-
if (compressed == "")
|
|
1187
|
-
return null;
|
|
1188
|
-
return LZString2._decompress(compressed.length, 32768, function(index2) {
|
|
1189
|
-
return compressed.charCodeAt(index2);
|
|
1190
|
-
});
|
|
1191
|
-
},
|
|
1192
|
-
_decompress: function(length2, resetValue, getNextValue) {
|
|
1193
|
-
var dictionary = [], enlargeIn = 4, dictSize = 4, numBits = 3, entry2 = "", result = [], i2, w2, bits, resb, maxpower, power, c2, data2 = { val: getNextValue(0), position: resetValue, index: 1 };
|
|
1194
|
-
for (i2 = 0; i2 < 3; i2 += 1) {
|
|
1195
|
-
dictionary[i2] = i2;
|
|
1196
|
-
}
|
|
1197
|
-
bits = 0;
|
|
1198
|
-
maxpower = Math.pow(2, 2);
|
|
1199
|
-
power = 1;
|
|
1200
|
-
while (power != maxpower) {
|
|
1201
|
-
resb = data2.val & data2.position;
|
|
1202
|
-
data2.position >>= 1;
|
|
1203
|
-
if (data2.position == 0) {
|
|
1204
|
-
data2.position = resetValue;
|
|
1205
|
-
data2.val = getNextValue(data2.index++);
|
|
1206
|
-
}
|
|
1207
|
-
bits |= (resb > 0 ? 1 : 0) * power;
|
|
1208
|
-
power <<= 1;
|
|
1209
|
-
}
|
|
1210
|
-
switch (bits) {
|
|
1211
|
-
case 0:
|
|
1212
|
-
bits = 0;
|
|
1213
|
-
maxpower = Math.pow(2, 8);
|
|
1214
|
-
power = 1;
|
|
1215
|
-
while (power != maxpower) {
|
|
1216
|
-
resb = data2.val & data2.position;
|
|
1217
|
-
data2.position >>= 1;
|
|
1218
|
-
if (data2.position == 0) {
|
|
1219
|
-
data2.position = resetValue;
|
|
1220
|
-
data2.val = getNextValue(data2.index++);
|
|
1221
|
-
}
|
|
1222
|
-
bits |= (resb > 0 ? 1 : 0) * power;
|
|
1223
|
-
power <<= 1;
|
|
1224
|
-
}
|
|
1225
|
-
c2 = f2(bits);
|
|
1226
|
-
break;
|
|
1227
|
-
case 1:
|
|
1228
|
-
bits = 0;
|
|
1229
|
-
maxpower = Math.pow(2, 16);
|
|
1230
|
-
power = 1;
|
|
1231
|
-
while (power != maxpower) {
|
|
1232
|
-
resb = data2.val & data2.position;
|
|
1233
|
-
data2.position >>= 1;
|
|
1234
|
-
if (data2.position == 0) {
|
|
1235
|
-
data2.position = resetValue;
|
|
1236
|
-
data2.val = getNextValue(data2.index++);
|
|
1237
|
-
}
|
|
1238
|
-
bits |= (resb > 0 ? 1 : 0) * power;
|
|
1239
|
-
power <<= 1;
|
|
1240
|
-
}
|
|
1241
|
-
c2 = f2(bits);
|
|
1242
|
-
break;
|
|
1243
|
-
case 2:
|
|
1244
|
-
return "";
|
|
1245
|
-
}
|
|
1246
|
-
dictionary[3] = c2;
|
|
1247
|
-
w2 = c2;
|
|
1248
|
-
result.push(c2);
|
|
1249
|
-
while (true) {
|
|
1250
|
-
if (data2.index > length2) {
|
|
1251
|
-
return "";
|
|
1252
|
-
}
|
|
1253
|
-
bits = 0;
|
|
1254
|
-
maxpower = Math.pow(2, numBits);
|
|
1255
|
-
power = 1;
|
|
1256
|
-
while (power != maxpower) {
|
|
1257
|
-
resb = data2.val & data2.position;
|
|
1258
|
-
data2.position >>= 1;
|
|
1259
|
-
if (data2.position == 0) {
|
|
1260
|
-
data2.position = resetValue;
|
|
1261
|
-
data2.val = getNextValue(data2.index++);
|
|
1262
|
-
}
|
|
1263
|
-
bits |= (resb > 0 ? 1 : 0) * power;
|
|
1264
|
-
power <<= 1;
|
|
1265
|
-
}
|
|
1266
|
-
switch (c2 = bits) {
|
|
1267
|
-
case 0:
|
|
1268
|
-
bits = 0;
|
|
1269
|
-
maxpower = Math.pow(2, 8);
|
|
1270
|
-
power = 1;
|
|
1271
|
-
while (power != maxpower) {
|
|
1272
|
-
resb = data2.val & data2.position;
|
|
1273
|
-
data2.position >>= 1;
|
|
1274
|
-
if (data2.position == 0) {
|
|
1275
|
-
data2.position = resetValue;
|
|
1276
|
-
data2.val = getNextValue(data2.index++);
|
|
1277
|
-
}
|
|
1278
|
-
bits |= (resb > 0 ? 1 : 0) * power;
|
|
1279
|
-
power <<= 1;
|
|
1280
|
-
}
|
|
1281
|
-
dictionary[dictSize++] = f2(bits);
|
|
1282
|
-
c2 = dictSize - 1;
|
|
1283
|
-
enlargeIn--;
|
|
1284
|
-
break;
|
|
1285
|
-
case 1:
|
|
1286
|
-
bits = 0;
|
|
1287
|
-
maxpower = Math.pow(2, 16);
|
|
1288
|
-
power = 1;
|
|
1289
|
-
while (power != maxpower) {
|
|
1290
|
-
resb = data2.val & data2.position;
|
|
1291
|
-
data2.position >>= 1;
|
|
1292
|
-
if (data2.position == 0) {
|
|
1293
|
-
data2.position = resetValue;
|
|
1294
|
-
data2.val = getNextValue(data2.index++);
|
|
1295
|
-
}
|
|
1296
|
-
bits |= (resb > 0 ? 1 : 0) * power;
|
|
1297
|
-
power <<= 1;
|
|
1298
|
-
}
|
|
1299
|
-
dictionary[dictSize++] = f2(bits);
|
|
1300
|
-
c2 = dictSize - 1;
|
|
1301
|
-
enlargeIn--;
|
|
1302
|
-
break;
|
|
1303
|
-
case 2:
|
|
1304
|
-
return result.join("");
|
|
1305
|
-
}
|
|
1306
|
-
if (enlargeIn == 0) {
|
|
1307
|
-
enlargeIn = Math.pow(2, numBits);
|
|
1308
|
-
numBits++;
|
|
1309
|
-
}
|
|
1310
|
-
if (dictionary[c2]) {
|
|
1311
|
-
entry2 = dictionary[c2];
|
|
1312
|
-
} else {
|
|
1313
|
-
if (c2 === dictSize) {
|
|
1314
|
-
entry2 = w2 + w2.charAt(0);
|
|
1315
|
-
} else {
|
|
1316
|
-
return null;
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
result.push(entry2);
|
|
1320
|
-
dictionary[dictSize++] = w2 + entry2.charAt(0);
|
|
1321
|
-
enlargeIn--;
|
|
1322
|
-
w2 = entry2;
|
|
1323
|
-
if (enlargeIn == 0) {
|
|
1324
|
-
enlargeIn = Math.pow(2, numBits);
|
|
1325
|
-
numBits++;
|
|
1326
|
-
}
|
|
1327
|
-
}
|
|
1328
|
-
}
|
|
1329
|
-
};
|
|
1330
|
-
return LZString2;
|
|
1331
|
-
}();
|
|
1332
|
-
if (module3 != null) {
|
|
1333
|
-
module3.exports = LZString;
|
|
1334
|
-
}
|
|
1335
|
-
})(lzString);
|
|
1336
|
-
const VALUE_TRANSFORM_OPTIONS = [
|
|
1337
|
-
{ name: "None", value: null },
|
|
1338
|
-
{ name: "Log", value: "log1p" },
|
|
1339
|
-
{ name: "ArcSinh", value: "arcsinh" }
|
|
1340
|
-
];
|
|
1341
|
-
function getValueTransformFunction(featureValueTransform, coefficient) {
|
|
1342
|
-
let transformFunction;
|
|
1343
|
-
switch (featureValueTransform) {
|
|
1344
|
-
case "log1p":
|
|
1345
|
-
transformFunction = (v) => Math.log(1 + v * coefficient);
|
|
1346
|
-
break;
|
|
1347
|
-
case "arcsinh":
|
|
1348
|
-
transformFunction = (v) => Math.asinh(v * coefficient);
|
|
1349
|
-
break;
|
|
1350
|
-
default:
|
|
1351
|
-
transformFunction = (v) => v;
|
|
1352
|
-
}
|
|
1353
|
-
return transformFunction;
|
|
1354
|
-
}
|
|
1355
903
|
var rngBrowser = { exports: {} };
|
|
1356
904
|
var getRandomValues$1 = typeof crypto != "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto != "undefined" && typeof window.msCrypto.getRandomValues == "function" && msCrypto.getRandomValues.bind(msCrypto);
|
|
1357
905
|
if (getRandomValues$1) {
|
|
@@ -60040,7 +59588,7 @@ If these are plugin file types, ensure that they have been properly registered.`
|
|
|
60040
59588
|
var CARRIAGE_RETURN = "\r".charCodeAt(0);
|
|
60041
59589
|
var TAB = " ".charCodeAt(0);
|
|
60042
59590
|
var STRING_BUFFER_SIZE = 64 * 1024;
|
|
60043
|
-
function
|
|
59591
|
+
function Parser2() {
|
|
60044
59592
|
this.tState = START;
|
|
60045
59593
|
this.value = void 0;
|
|
60046
59594
|
this.string = void 0;
|
|
@@ -60057,7 +59605,7 @@ If these are plugin file types, ensure that they have been properly registered.`
|
|
|
60057
59605
|
this.temp_buffs = { "2": new Buffer2(2), "3": new Buffer2(3), "4": new Buffer2(4) };
|
|
60058
59606
|
this.offset = -1;
|
|
60059
59607
|
}
|
|
60060
|
-
|
|
59608
|
+
Parser2.toknam = function(code) {
|
|
60061
59609
|
var keys3 = Object.keys(C3);
|
|
60062
59610
|
for (var i2 = 0, l2 = keys3.length; i2 < l2; i2++) {
|
|
60063
59611
|
var key2 = keys3[i2];
|
|
@@ -60067,13 +59615,13 @@ If these are plugin file types, ensure that they have been properly registered.`
|
|
|
60067
59615
|
}
|
|
60068
59616
|
return code && "0x" + code.toString(16);
|
|
60069
59617
|
};
|
|
60070
|
-
var proto2 =
|
|
59618
|
+
var proto2 = Parser2.prototype;
|
|
60071
59619
|
proto2.onError = function(err2) {
|
|
60072
59620
|
throw err2;
|
|
60073
59621
|
};
|
|
60074
59622
|
proto2.charError = function(buffer2, i2) {
|
|
60075
59623
|
this.tState = STOP;
|
|
60076
|
-
this.onError(new Error("Unexpected " + JSON.stringify(String.fromCharCode(buffer2[i2])) + " at position " + i2 + " in state " +
|
|
59624
|
+
this.onError(new Error("Unexpected " + JSON.stringify(String.fromCharCode(buffer2[i2])) + " at position " + i2 + " in state " + Parser2.toknam(this.tState)));
|
|
60077
59625
|
};
|
|
60078
59626
|
proto2.appendStringChar = function(char) {
|
|
60079
59627
|
if (this.stringBufferOffset >= STRING_BUFFER_SIZE) {
|
|
@@ -60159,7 +59707,7 @@ If these are plugin file types, ensure that they have been properly registered.`
|
|
|
60159
59707
|
i2 = i2 + j2 - 1;
|
|
60160
59708
|
} else if (this.bytes_remaining === 0 && n3 >= 128) {
|
|
60161
59709
|
if (n3 <= 193 || n3 > 244) {
|
|
60162
|
-
return this.onError(new Error("Invalid UTF-8 character at position " + i2 + " in state " +
|
|
59710
|
+
return this.onError(new Error("Invalid UTF-8 character at position " + i2 + " in state " + Parser2.toknam(this.tState)));
|
|
60163
59711
|
}
|
|
60164
59712
|
if (n3 >= 194 && n3 <= 223)
|
|
60165
59713
|
this.bytes_in_sequence = 2;
|
|
@@ -60357,7 +59905,7 @@ If these are plugin file types, ensure that they have been properly registered.`
|
|
|
60357
59905
|
};
|
|
60358
59906
|
proto2.parseError = function(token, value2) {
|
|
60359
59907
|
this.tState = STOP;
|
|
60360
|
-
this.onError(new Error("Unexpected " +
|
|
59908
|
+
this.onError(new Error("Unexpected " + Parser2.toknam(token) + (value2 ? "(" + JSON.stringify(value2) + ")" : "") + " in state " + Parser2.toknam(this.state)));
|
|
60361
59909
|
};
|
|
60362
59910
|
proto2.push = function() {
|
|
60363
59911
|
this.stack.push({ value: this.value, key: this.key, mode: this.mode });
|
|
@@ -60455,8 +60003,8 @@ If these are plugin file types, ensure that they have been properly registered.`
|
|
|
60455
60003
|
return this.parseError(token, value2);
|
|
60456
60004
|
}
|
|
60457
60005
|
};
|
|
60458
|
-
|
|
60459
|
-
var jsonparse =
|
|
60006
|
+
Parser2.C = C3;
|
|
60007
|
+
var jsonparse = Parser2;
|
|
60460
60008
|
var Transform$12 = Stream.Transform;
|
|
60461
60009
|
var JSON2CSVTransform = /* @__PURE__ */ function(_Transform) {
|
|
60462
60010
|
_inherits2(JSON2CSVTransform2, _Transform);
|
|
@@ -184582,7 +184130,7 @@ attribute float isSelected;
|
|
|
184582
184130
|
"attrValueProcessor",
|
|
184583
184131
|
"rootNodeName"
|
|
184584
184132
|
];
|
|
184585
|
-
function
|
|
184133
|
+
function Parser2(options) {
|
|
184586
184134
|
this.options = buildOptions2(options, defaultOptions2, props2);
|
|
184587
184135
|
if (this.options.ignoreAttributes || this.options.attrNodeName) {
|
|
184588
184136
|
this.isAttribute = function() {
|
|
@@ -184623,7 +184171,7 @@ attribute float isSelected;
|
|
|
184623
184171
|
this.buildTextValNode = buildTextValNode;
|
|
184624
184172
|
this.buildObjectNode = buildObjectNode;
|
|
184625
184173
|
}
|
|
184626
|
-
|
|
184174
|
+
Parser2.prototype.parse = function(jObj) {
|
|
184627
184175
|
if (Array.isArray(jObj) && this.options.rootNodeName && this.options.rootNodeName.length > 1) {
|
|
184628
184176
|
jObj = {
|
|
184629
184177
|
[this.options.rootNodeName]: jObj
|
|
@@ -184631,7 +184179,7 @@ attribute float isSelected;
|
|
|
184631
184179
|
}
|
|
184632
184180
|
return this.j2x(jObj, 0).val;
|
|
184633
184181
|
};
|
|
184634
|
-
|
|
184182
|
+
Parser2.prototype.j2x = function(jObj, level) {
|
|
184635
184183
|
let attrStr = "";
|
|
184636
184184
|
let val = "";
|
|
184637
184185
|
for (let key2 in jObj) {
|
|
@@ -184763,7 +184311,7 @@ attribute float isSelected;
|
|
|
184763
184311
|
function isCDATA(name2) {
|
|
184764
184312
|
return name2 === this.options.cdataTagName;
|
|
184765
184313
|
}
|
|
184766
|
-
json2xml =
|
|
184314
|
+
json2xml = Parser2;
|
|
184767
184315
|
return json2xml;
|
|
184768
184316
|
}
|
|
184769
184317
|
(function(exports3) {
|
|
@@ -210765,7 +210313,8 @@ void main() {
|
|
|
210765
210313
|
const [width2, height2, deckRef] = useDeckCanvasSize();
|
|
210766
210314
|
const [obsLabelsTypes, obsLabelsData] = useMultiObsLabels(coordinationScopes, obsType, loaders, dataset, addUrl2);
|
|
210767
210315
|
const hasExpressionData = useHasLoader(loaders, dataset, DataType$3.OBS_FEATURE_MATRIX, { obsType, featureType, featureValueType });
|
|
210768
|
-
const
|
|
210316
|
+
const hasSegmentationsData = useHasLoader(loaders, dataset, DataType$3.OBS_SEGMENTATIONS, { obsType });
|
|
210317
|
+
const hasLocationsData = useHasLoader(loaders, dataset, DataType$3.OBS_LOCATIONS, { obsType });
|
|
210769
210318
|
const hasImageData = useHasLoader(loaders, dataset, DataType$3.IMAGE, {});
|
|
210770
210319
|
const [{ obsIndex: obsLocationsIndex, obsLocations }, obsLocationsStatus] = useObsLocationsData(loaders, dataset, addUrl2, false, { setSpatialPointLayer: setMoleculesLayer }, { spatialPointLayer: moleculesLayer }, { obsType: "molecule" });
|
|
210771
210320
|
const [{ obsLabels: obsLocationsLabels }, obsLabelsStatus] = useObsLabelsData(loaders, dataset, addUrl2, false, {}, {}, { obsType: "molecule" });
|
|
@@ -210887,7 +210436,7 @@ void main() {
|
|
|
210887
210436
|
locationsCount
|
|
210888
210437
|
});
|
|
210889
210438
|
const getExpressionValue = useExpressionValueGetter({
|
|
210890
|
-
instanceObsIndex: obsSegmentationsIndex,
|
|
210439
|
+
instanceObsIndex: obsSegmentationsIndex ? obsSegmentationsIndex : obsCentroidsIndex,
|
|
210891
210440
|
matrixObsIndex,
|
|
210892
210441
|
expressionData
|
|
210893
210442
|
});
|
|
@@ -210897,7 +210446,7 @@ void main() {
|
|
|
210897
210446
|
const canShow3DOptions = canLoad3DLayers && !((disable3d == null ? void 0 : disable3d.length) === imageLayerLoaders.length) && !globalDisable3d;
|
|
210898
210447
|
const options = React$i.useMemo(() => {
|
|
210899
210448
|
if (canShow3DOptions || hasExpressionData) {
|
|
210900
|
-
return jsx(SpatialOptions, { observationsLabel, cellColorEncoding, setCellColorEncoding, setSpatialAxisFixed, spatialAxisFixed, use3d, geneExpressionColormap, setGeneExpressionColormap, geneExpressionColormapRange, setGeneExpressionColormapRange, canShowExpressionOptions: hasExpressionData, canShowColorEncodingOption:
|
|
210449
|
+
return jsx(SpatialOptions, { observationsLabel, cellColorEncoding, setCellColorEncoding, setSpatialAxisFixed, spatialAxisFixed, use3d, geneExpressionColormap, setGeneExpressionColormap, geneExpressionColormapRange, setGeneExpressionColormapRange, canShowExpressionOptions: hasExpressionData, canShowColorEncodingOption: (hasLocationsData || hasSegmentationsData) && hasExpressionData, canShow3DOptions });
|
|
210901
210450
|
}
|
|
210902
210451
|
return null;
|
|
210903
210452
|
}, [
|
|
@@ -210906,7 +210455,8 @@ void main() {
|
|
|
210906
210455
|
geneExpressionColormap,
|
|
210907
210456
|
geneExpressionColormapRange,
|
|
210908
210457
|
setGeneExpressionColormap,
|
|
210909
|
-
|
|
210458
|
+
hasLocationsData,
|
|
210459
|
+
hasSegmentationsData,
|
|
210910
210460
|
hasExpressionData,
|
|
210911
210461
|
observationsLabel,
|
|
210912
210462
|
setCellColorEncoding,
|
|
@@ -210916,11 +210466,11 @@ void main() {
|
|
|
210916
210466
|
use3d
|
|
210917
210467
|
]);
|
|
210918
210468
|
React$i.useEffect(() => {
|
|
210919
|
-
if (!
|
|
210469
|
+
if (!hasSegmentationsData && cellsLayer && !obsSegmentations && !obsSegmentationsIndex && obsCentroids && obsCentroidsIndex) {
|
|
210920
210470
|
console.warn("Rendering cell segmentation diamonds for backwards compatibility.");
|
|
210921
210471
|
}
|
|
210922
210472
|
}, [
|
|
210923
|
-
|
|
210473
|
+
hasSegmentationsData,
|
|
210924
210474
|
cellsLayer,
|
|
210925
210475
|
obsSegmentations,
|
|
210926
210476
|
obsSegmentationsIndex,
|
|
@@ -210935,7 +210485,7 @@ void main() {
|
|
|
210935
210485
|
rotationZ,
|
|
210936
210486
|
rotationOrbit,
|
|
210937
210487
|
orbitAxis
|
|
210938
|
-
}, setViewState, imageLayerDefs: imageLayers, obsSegmentationsLayerDefs: cellsLayer, obsLocationsLayerDefs: moleculesLayer, neighborhoodLayerDefs: neighborhoodsLayer, obsLocationsIndex, obsSegmentationsIndex, obsLocations, obsLocationsLabels, obsLocationsFeatureIndex, hasSegmentations:
|
|
210488
|
+
}, setViewState, imageLayerDefs: imageLayers, obsSegmentationsLayerDefs: cellsLayer, obsLocationsLayerDefs: moleculesLayer, neighborhoodLayerDefs: neighborhoodsLayer, obsLocationsIndex, obsSegmentationsIndex, obsLocations, obsLocationsLabels, obsLocationsFeatureIndex, hasSegmentations: hasSegmentationsData, obsSegmentations, obsSegmentationsType, obsCentroids, obsCentroidsIndex, cellFilter, cellSelection, cellHighlight, cellColors, neighborhoods, imageLayerLoaders, setCellFilter, setCellSelection: setCellSelectionProp, setCellHighlight, setMoleculeHighlight, setComponentHover: () => {
|
|
210939
210489
|
setComponentHover(uuid);
|
|
210940
210490
|
}, updateViewInfo: setComponentViewInfo, imageLayerCallbacks, segmentationLayerCallbacks, spatialAxisFixed, geneExpressionColormap, geneExpressionColormapRange, expressionData: shiftedExpressionDataForBitmask, cellColorEncoding, getExpressionValue, theme }), !disableTooltip && jsx(SpatialTooltipSubscriber, { parentUuid: uuid, obsHighlight: cellHighlight, width: width2, height: height2, getObsInfo })] });
|
|
210941
210491
|
}
|
|
@@ -272249,7 +271799,7 @@ void main() {
|
|
|
272249
271799
|
orient: "left",
|
|
272250
271800
|
scale: "yscale",
|
|
272251
271801
|
zindex: 1,
|
|
272252
|
-
title: featureValueTransformName ? [`${featureValueTransformName}-Transformed`, `Normalized ${capitalize$2(featureValueType)} Values`] : `Normalized ${capitalize$2(featureValueType)} Values`
|
|
271802
|
+
title: featureValueTransformName && featureValueTransformName !== "None" ? [`${featureValueTransformName}-Transformed`, `Normalized ${capitalize$2(featureValueType)} Values`] : `Normalized ${capitalize$2(featureValueType)} Values`
|
|
272253
271803
|
},
|
|
272254
271804
|
{
|
|
272255
271805
|
orient: "bottom",
|
|
@@ -272413,15 +271963,17 @@ void main() {
|
|
|
272413
271963
|
const [urls2, addUrl2] = useUrls(loaders, dataset);
|
|
272414
271964
|
const transformOptions = VALUE_TRANSFORM_OPTIONS;
|
|
272415
271965
|
const [expressionData, loadedFeatureSelection, featureSelectionStatus] = useFeatureSelection(loaders, dataset, false, geneSelection, { obsType, featureType, featureValueType });
|
|
271966
|
+
const [{ featureLabelsMap }, featureLabelsStatus] = useFeatureLabelsData(loaders, dataset, addUrl2, false, {}, {}, { featureType });
|
|
272416
271967
|
const [{ obsIndex }, matrixIndicesStatus] = useObsFeatureMatrixIndices(loaders, dataset, addUrl2, false, { obsType, featureType, featureValueType });
|
|
272417
271968
|
const [{ obsSets: cellSets }, obsSetsStatus] = useObsSetsData(loaders, dataset, addUrl2, true, {}, {}, { obsType });
|
|
272418
271969
|
const isReady = useReady([
|
|
272419
271970
|
featureSelectionStatus,
|
|
272420
271971
|
matrixIndicesStatus,
|
|
272421
|
-
obsSetsStatus
|
|
271972
|
+
obsSetsStatus,
|
|
271973
|
+
featureLabelsStatus
|
|
272422
271974
|
]);
|
|
272423
271975
|
const [expressionArr, setArr, expressionMax] = useExpressionByCellSet(expressionData, obsIndex, cellSets, additionalCellSets, geneSelection, cellSetSelection, cellSetColor, featureValueTransform, featureValueTransformCoefficient, theme);
|
|
272424
|
-
const firstGeneSelected = geneSelection && geneSelection.length >= 1 ? geneSelection[0] : null;
|
|
271976
|
+
const firstGeneSelected = geneSelection && geneSelection.length >= 1 ? (featureLabelsMap == null ? void 0 : featureLabelsMap.get(geneSelection[0])) || geneSelection[0] : null;
|
|
272425
271977
|
const selectedTransformName = (_a3 = transformOptions.find((o2) => o2.value === featureValueTransform)) == null ? void 0 : _a3.name;
|
|
272426
271978
|
return jsx(TitleInfo, { title: `Expression by ${capitalize$2(obsType)} Set${firstGeneSelected ? ` (${firstGeneSelected})` : ""}`, removeGridComponent, urls: urls2, theme, isReady, options: jsx(CellSetExpressionPlotOptions, { featureValueTransform, setFeatureValueTransform, featureValueTransformCoefficient, setFeatureValueTransformCoefficient, transformOptions }), children: jsx("div", { ref: containerRef, className: classes.vegaContainer, children: expressionArr ? jsx(CellSetExpressionPlot, { domainMax: expressionMax, colors: setArr, data: expressionArr, theme, width: width2, height: height2, obsType, featureValueType, featureValueTransformName: selectedTransformName }) : jsxs("span", { children: ["Select a ", featureType, "."] }) }) });
|
|
272427
271979
|
}
|
|
@@ -275169,6 +274721,2112 @@ void main() {
|
|
|
275169
274721
|
}, []);
|
|
275170
274722
|
return ready ? jsx(VitS, { ...props2 }) : null;
|
|
275171
274723
|
}
|
|
274724
|
+
const BROWSER_ALIASES_MAP = {
|
|
274725
|
+
"Amazon Silk": "amazon_silk",
|
|
274726
|
+
"Android Browser": "android",
|
|
274727
|
+
Bada: "bada",
|
|
274728
|
+
BlackBerry: "blackberry",
|
|
274729
|
+
Chrome: "chrome",
|
|
274730
|
+
Chromium: "chromium",
|
|
274731
|
+
Electron: "electron",
|
|
274732
|
+
Epiphany: "epiphany",
|
|
274733
|
+
Firefox: "firefox",
|
|
274734
|
+
Focus: "focus",
|
|
274735
|
+
Generic: "generic",
|
|
274736
|
+
"Google Search": "google_search",
|
|
274737
|
+
Googlebot: "googlebot",
|
|
274738
|
+
"Internet Explorer": "ie",
|
|
274739
|
+
"K-Meleon": "k_meleon",
|
|
274740
|
+
Maxthon: "maxthon",
|
|
274741
|
+
"Microsoft Edge": "edge",
|
|
274742
|
+
"MZ Browser": "mz",
|
|
274743
|
+
"NAVER Whale Browser": "naver",
|
|
274744
|
+
Opera: "opera",
|
|
274745
|
+
"Opera Coast": "opera_coast",
|
|
274746
|
+
PhantomJS: "phantomjs",
|
|
274747
|
+
Puffin: "puffin",
|
|
274748
|
+
QupZilla: "qupzilla",
|
|
274749
|
+
QQ: "qq",
|
|
274750
|
+
QQLite: "qqlite",
|
|
274751
|
+
Safari: "safari",
|
|
274752
|
+
Sailfish: "sailfish",
|
|
274753
|
+
"Samsung Internet for Android": "samsung_internet",
|
|
274754
|
+
SeaMonkey: "seamonkey",
|
|
274755
|
+
Sleipnir: "sleipnir",
|
|
274756
|
+
Swing: "swing",
|
|
274757
|
+
Tizen: "tizen",
|
|
274758
|
+
"UC Browser": "uc",
|
|
274759
|
+
Vivaldi: "vivaldi",
|
|
274760
|
+
"WebOS Browser": "webos",
|
|
274761
|
+
WeChat: "wechat",
|
|
274762
|
+
"Yandex Browser": "yandex",
|
|
274763
|
+
Roku: "roku"
|
|
274764
|
+
};
|
|
274765
|
+
const BROWSER_MAP = {
|
|
274766
|
+
amazon_silk: "Amazon Silk",
|
|
274767
|
+
android: "Android Browser",
|
|
274768
|
+
bada: "Bada",
|
|
274769
|
+
blackberry: "BlackBerry",
|
|
274770
|
+
chrome: "Chrome",
|
|
274771
|
+
chromium: "Chromium",
|
|
274772
|
+
electron: "Electron",
|
|
274773
|
+
epiphany: "Epiphany",
|
|
274774
|
+
firefox: "Firefox",
|
|
274775
|
+
focus: "Focus",
|
|
274776
|
+
generic: "Generic",
|
|
274777
|
+
googlebot: "Googlebot",
|
|
274778
|
+
google_search: "Google Search",
|
|
274779
|
+
ie: "Internet Explorer",
|
|
274780
|
+
k_meleon: "K-Meleon",
|
|
274781
|
+
maxthon: "Maxthon",
|
|
274782
|
+
edge: "Microsoft Edge",
|
|
274783
|
+
mz: "MZ Browser",
|
|
274784
|
+
naver: "NAVER Whale Browser",
|
|
274785
|
+
opera: "Opera",
|
|
274786
|
+
opera_coast: "Opera Coast",
|
|
274787
|
+
phantomjs: "PhantomJS",
|
|
274788
|
+
puffin: "Puffin",
|
|
274789
|
+
qupzilla: "QupZilla",
|
|
274790
|
+
qq: "QQ Browser",
|
|
274791
|
+
qqlite: "QQ Browser Lite",
|
|
274792
|
+
safari: "Safari",
|
|
274793
|
+
sailfish: "Sailfish",
|
|
274794
|
+
samsung_internet: "Samsung Internet for Android",
|
|
274795
|
+
seamonkey: "SeaMonkey",
|
|
274796
|
+
sleipnir: "Sleipnir",
|
|
274797
|
+
swing: "Swing",
|
|
274798
|
+
tizen: "Tizen",
|
|
274799
|
+
uc: "UC Browser",
|
|
274800
|
+
vivaldi: "Vivaldi",
|
|
274801
|
+
webos: "WebOS Browser",
|
|
274802
|
+
wechat: "WeChat",
|
|
274803
|
+
yandex: "Yandex Browser"
|
|
274804
|
+
};
|
|
274805
|
+
const PLATFORMS_MAP = {
|
|
274806
|
+
tablet: "tablet",
|
|
274807
|
+
mobile: "mobile",
|
|
274808
|
+
desktop: "desktop",
|
|
274809
|
+
tv: "tv"
|
|
274810
|
+
};
|
|
274811
|
+
const OS_MAP = {
|
|
274812
|
+
WindowsPhone: "Windows Phone",
|
|
274813
|
+
Windows: "Windows",
|
|
274814
|
+
MacOS: "macOS",
|
|
274815
|
+
iOS: "iOS",
|
|
274816
|
+
Android: "Android",
|
|
274817
|
+
WebOS: "WebOS",
|
|
274818
|
+
BlackBerry: "BlackBerry",
|
|
274819
|
+
Bada: "Bada",
|
|
274820
|
+
Tizen: "Tizen",
|
|
274821
|
+
Linux: "Linux",
|
|
274822
|
+
ChromeOS: "Chrome OS",
|
|
274823
|
+
PlayStation4: "PlayStation 4",
|
|
274824
|
+
Roku: "Roku"
|
|
274825
|
+
};
|
|
274826
|
+
const ENGINE_MAP = {
|
|
274827
|
+
EdgeHTML: "EdgeHTML",
|
|
274828
|
+
Blink: "Blink",
|
|
274829
|
+
Trident: "Trident",
|
|
274830
|
+
Presto: "Presto",
|
|
274831
|
+
Gecko: "Gecko",
|
|
274832
|
+
WebKit: "WebKit"
|
|
274833
|
+
};
|
|
274834
|
+
class Utils {
|
|
274835
|
+
static getFirstMatch(regexp, ua) {
|
|
274836
|
+
const match2 = ua.match(regexp);
|
|
274837
|
+
return match2 && match2.length > 0 && match2[1] || "";
|
|
274838
|
+
}
|
|
274839
|
+
static getSecondMatch(regexp, ua) {
|
|
274840
|
+
const match2 = ua.match(regexp);
|
|
274841
|
+
return match2 && match2.length > 1 && match2[2] || "";
|
|
274842
|
+
}
|
|
274843
|
+
static matchAndReturnConst(regexp, ua, _const2) {
|
|
274844
|
+
if (regexp.test(ua)) {
|
|
274845
|
+
return _const2;
|
|
274846
|
+
}
|
|
274847
|
+
return void 0;
|
|
274848
|
+
}
|
|
274849
|
+
static getWindowsVersionName(version2) {
|
|
274850
|
+
switch (version2) {
|
|
274851
|
+
case "NT":
|
|
274852
|
+
return "NT";
|
|
274853
|
+
case "XP":
|
|
274854
|
+
return "XP";
|
|
274855
|
+
case "NT 5.0":
|
|
274856
|
+
return "2000";
|
|
274857
|
+
case "NT 5.1":
|
|
274858
|
+
return "XP";
|
|
274859
|
+
case "NT 5.2":
|
|
274860
|
+
return "2003";
|
|
274861
|
+
case "NT 6.0":
|
|
274862
|
+
return "Vista";
|
|
274863
|
+
case "NT 6.1":
|
|
274864
|
+
return "7";
|
|
274865
|
+
case "NT 6.2":
|
|
274866
|
+
return "8";
|
|
274867
|
+
case "NT 6.3":
|
|
274868
|
+
return "8.1";
|
|
274869
|
+
case "NT 10.0":
|
|
274870
|
+
return "10";
|
|
274871
|
+
default:
|
|
274872
|
+
return void 0;
|
|
274873
|
+
}
|
|
274874
|
+
}
|
|
274875
|
+
static getMacOSVersionName(version2) {
|
|
274876
|
+
const v = version2.split(".").splice(0, 2).map((s2) => parseInt(s2, 10) || 0);
|
|
274877
|
+
v.push(0);
|
|
274878
|
+
if (v[0] !== 10)
|
|
274879
|
+
return void 0;
|
|
274880
|
+
switch (v[1]) {
|
|
274881
|
+
case 5:
|
|
274882
|
+
return "Leopard";
|
|
274883
|
+
case 6:
|
|
274884
|
+
return "Snow Leopard";
|
|
274885
|
+
case 7:
|
|
274886
|
+
return "Lion";
|
|
274887
|
+
case 8:
|
|
274888
|
+
return "Mountain Lion";
|
|
274889
|
+
case 9:
|
|
274890
|
+
return "Mavericks";
|
|
274891
|
+
case 10:
|
|
274892
|
+
return "Yosemite";
|
|
274893
|
+
case 11:
|
|
274894
|
+
return "El Capitan";
|
|
274895
|
+
case 12:
|
|
274896
|
+
return "Sierra";
|
|
274897
|
+
case 13:
|
|
274898
|
+
return "High Sierra";
|
|
274899
|
+
case 14:
|
|
274900
|
+
return "Mojave";
|
|
274901
|
+
case 15:
|
|
274902
|
+
return "Catalina";
|
|
274903
|
+
default:
|
|
274904
|
+
return void 0;
|
|
274905
|
+
}
|
|
274906
|
+
}
|
|
274907
|
+
static getAndroidVersionName(version2) {
|
|
274908
|
+
const v = version2.split(".").splice(0, 2).map((s2) => parseInt(s2, 10) || 0);
|
|
274909
|
+
v.push(0);
|
|
274910
|
+
if (v[0] === 1 && v[1] < 5)
|
|
274911
|
+
return void 0;
|
|
274912
|
+
if (v[0] === 1 && v[1] < 6)
|
|
274913
|
+
return "Cupcake";
|
|
274914
|
+
if (v[0] === 1 && v[1] >= 6)
|
|
274915
|
+
return "Donut";
|
|
274916
|
+
if (v[0] === 2 && v[1] < 2)
|
|
274917
|
+
return "Eclair";
|
|
274918
|
+
if (v[0] === 2 && v[1] === 2)
|
|
274919
|
+
return "Froyo";
|
|
274920
|
+
if (v[0] === 2 && v[1] > 2)
|
|
274921
|
+
return "Gingerbread";
|
|
274922
|
+
if (v[0] === 3)
|
|
274923
|
+
return "Honeycomb";
|
|
274924
|
+
if (v[0] === 4 && v[1] < 1)
|
|
274925
|
+
return "Ice Cream Sandwich";
|
|
274926
|
+
if (v[0] === 4 && v[1] < 4)
|
|
274927
|
+
return "Jelly Bean";
|
|
274928
|
+
if (v[0] === 4 && v[1] >= 4)
|
|
274929
|
+
return "KitKat";
|
|
274930
|
+
if (v[0] === 5)
|
|
274931
|
+
return "Lollipop";
|
|
274932
|
+
if (v[0] === 6)
|
|
274933
|
+
return "Marshmallow";
|
|
274934
|
+
if (v[0] === 7)
|
|
274935
|
+
return "Nougat";
|
|
274936
|
+
if (v[0] === 8)
|
|
274937
|
+
return "Oreo";
|
|
274938
|
+
if (v[0] === 9)
|
|
274939
|
+
return "Pie";
|
|
274940
|
+
return void 0;
|
|
274941
|
+
}
|
|
274942
|
+
static getVersionPrecision(version2) {
|
|
274943
|
+
return version2.split(".").length;
|
|
274944
|
+
}
|
|
274945
|
+
static compareVersions(versionA, versionB, isLoose = false) {
|
|
274946
|
+
const versionAPrecision = Utils.getVersionPrecision(versionA);
|
|
274947
|
+
const versionBPrecision = Utils.getVersionPrecision(versionB);
|
|
274948
|
+
let precision = Math.max(versionAPrecision, versionBPrecision);
|
|
274949
|
+
let lastPrecision = 0;
|
|
274950
|
+
const chunks = Utils.map([versionA, versionB], (version2) => {
|
|
274951
|
+
const delta = precision - Utils.getVersionPrecision(version2);
|
|
274952
|
+
const _version = version2 + new Array(delta + 1).join(".0");
|
|
274953
|
+
return Utils.map(_version.split("."), (chunk) => new Array(20 - chunk.length).join("0") + chunk).reverse();
|
|
274954
|
+
});
|
|
274955
|
+
if (isLoose) {
|
|
274956
|
+
lastPrecision = precision - Math.min(versionAPrecision, versionBPrecision);
|
|
274957
|
+
}
|
|
274958
|
+
precision -= 1;
|
|
274959
|
+
while (precision >= lastPrecision) {
|
|
274960
|
+
if (chunks[0][precision] > chunks[1][precision]) {
|
|
274961
|
+
return 1;
|
|
274962
|
+
}
|
|
274963
|
+
if (chunks[0][precision] === chunks[1][precision]) {
|
|
274964
|
+
if (precision === lastPrecision) {
|
|
274965
|
+
return 0;
|
|
274966
|
+
}
|
|
274967
|
+
precision -= 1;
|
|
274968
|
+
} else if (chunks[0][precision] < chunks[1][precision]) {
|
|
274969
|
+
return -1;
|
|
274970
|
+
}
|
|
274971
|
+
}
|
|
274972
|
+
return void 0;
|
|
274973
|
+
}
|
|
274974
|
+
static map(arr, iterator2) {
|
|
274975
|
+
const result = [];
|
|
274976
|
+
let i2;
|
|
274977
|
+
if (Array.prototype.map) {
|
|
274978
|
+
return Array.prototype.map.call(arr, iterator2);
|
|
274979
|
+
}
|
|
274980
|
+
for (i2 = 0; i2 < arr.length; i2 += 1) {
|
|
274981
|
+
result.push(iterator2(arr[i2]));
|
|
274982
|
+
}
|
|
274983
|
+
return result;
|
|
274984
|
+
}
|
|
274985
|
+
static find(arr, predicate) {
|
|
274986
|
+
let i2;
|
|
274987
|
+
let l2;
|
|
274988
|
+
if (Array.prototype.find) {
|
|
274989
|
+
return Array.prototype.find.call(arr, predicate);
|
|
274990
|
+
}
|
|
274991
|
+
for (i2 = 0, l2 = arr.length; i2 < l2; i2 += 1) {
|
|
274992
|
+
const value2 = arr[i2];
|
|
274993
|
+
if (predicate(value2, i2)) {
|
|
274994
|
+
return value2;
|
|
274995
|
+
}
|
|
274996
|
+
}
|
|
274997
|
+
return void 0;
|
|
274998
|
+
}
|
|
274999
|
+
static assign(obj, ...assigners) {
|
|
275000
|
+
const result = obj;
|
|
275001
|
+
let i2;
|
|
275002
|
+
let l2;
|
|
275003
|
+
if (Object.assign) {
|
|
275004
|
+
return Object.assign(obj, ...assigners);
|
|
275005
|
+
}
|
|
275006
|
+
for (i2 = 0, l2 = assigners.length; i2 < l2; i2 += 1) {
|
|
275007
|
+
const assigner = assigners[i2];
|
|
275008
|
+
if (typeof assigner === "object" && assigner !== null) {
|
|
275009
|
+
const keys2 = Object.keys(assigner);
|
|
275010
|
+
keys2.forEach((key2) => {
|
|
275011
|
+
result[key2] = assigner[key2];
|
|
275012
|
+
});
|
|
275013
|
+
}
|
|
275014
|
+
}
|
|
275015
|
+
return obj;
|
|
275016
|
+
}
|
|
275017
|
+
static getBrowserAlias(browserName) {
|
|
275018
|
+
return BROWSER_ALIASES_MAP[browserName];
|
|
275019
|
+
}
|
|
275020
|
+
static getBrowserTypeByAlias(browserAlias) {
|
|
275021
|
+
return BROWSER_MAP[browserAlias] || "";
|
|
275022
|
+
}
|
|
275023
|
+
}
|
|
275024
|
+
const commonVersionIdentifier = /version\/(\d+(\.?_?\d+)+)/i;
|
|
275025
|
+
const browsersList = [
|
|
275026
|
+
{
|
|
275027
|
+
test: [/googlebot/i],
|
|
275028
|
+
describe(ua) {
|
|
275029
|
+
const browser2 = {
|
|
275030
|
+
name: "Googlebot"
|
|
275031
|
+
};
|
|
275032
|
+
const version2 = Utils.getFirstMatch(/googlebot\/(\d+(\.\d+))/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
|
275033
|
+
if (version2) {
|
|
275034
|
+
browser2.version = version2;
|
|
275035
|
+
}
|
|
275036
|
+
return browser2;
|
|
275037
|
+
}
|
|
275038
|
+
},
|
|
275039
|
+
{
|
|
275040
|
+
test: [/opera/i],
|
|
275041
|
+
describe(ua) {
|
|
275042
|
+
const browser2 = {
|
|
275043
|
+
name: "Opera"
|
|
275044
|
+
};
|
|
275045
|
+
const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
|
275046
|
+
if (version2) {
|
|
275047
|
+
browser2.version = version2;
|
|
275048
|
+
}
|
|
275049
|
+
return browser2;
|
|
275050
|
+
}
|
|
275051
|
+
},
|
|
275052
|
+
{
|
|
275053
|
+
test: [/opr\/|opios/i],
|
|
275054
|
+
describe(ua) {
|
|
275055
|
+
const browser2 = {
|
|
275056
|
+
name: "Opera"
|
|
275057
|
+
};
|
|
275058
|
+
const version2 = Utils.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
|
275059
|
+
if (version2) {
|
|
275060
|
+
browser2.version = version2;
|
|
275061
|
+
}
|
|
275062
|
+
return browser2;
|
|
275063
|
+
}
|
|
275064
|
+
},
|
|
275065
|
+
{
|
|
275066
|
+
test: [/SamsungBrowser/i],
|
|
275067
|
+
describe(ua) {
|
|
275068
|
+
const browser2 = {
|
|
275069
|
+
name: "Samsung Internet for Android"
|
|
275070
|
+
};
|
|
275071
|
+
const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
|
275072
|
+
if (version2) {
|
|
275073
|
+
browser2.version = version2;
|
|
275074
|
+
}
|
|
275075
|
+
return browser2;
|
|
275076
|
+
}
|
|
275077
|
+
},
|
|
275078
|
+
{
|
|
275079
|
+
test: [/Whale/i],
|
|
275080
|
+
describe(ua) {
|
|
275081
|
+
const browser2 = {
|
|
275082
|
+
name: "NAVER Whale Browser"
|
|
275083
|
+
};
|
|
275084
|
+
const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i, ua);
|
|
275085
|
+
if (version2) {
|
|
275086
|
+
browser2.version = version2;
|
|
275087
|
+
}
|
|
275088
|
+
return browser2;
|
|
275089
|
+
}
|
|
275090
|
+
},
|
|
275091
|
+
{
|
|
275092
|
+
test: [/MZBrowser/i],
|
|
275093
|
+
describe(ua) {
|
|
275094
|
+
const browser2 = {
|
|
275095
|
+
name: "MZ Browser"
|
|
275096
|
+
};
|
|
275097
|
+
const version2 = Utils.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
|
275098
|
+
if (version2) {
|
|
275099
|
+
browser2.version = version2;
|
|
275100
|
+
}
|
|
275101
|
+
return browser2;
|
|
275102
|
+
}
|
|
275103
|
+
},
|
|
275104
|
+
{
|
|
275105
|
+
test: [/focus/i],
|
|
275106
|
+
describe(ua) {
|
|
275107
|
+
const browser2 = {
|
|
275108
|
+
name: "Focus"
|
|
275109
|
+
};
|
|
275110
|
+
const version2 = Utils.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
|
275111
|
+
if (version2) {
|
|
275112
|
+
browser2.version = version2;
|
|
275113
|
+
}
|
|
275114
|
+
return browser2;
|
|
275115
|
+
}
|
|
275116
|
+
},
|
|
275117
|
+
{
|
|
275118
|
+
test: [/swing/i],
|
|
275119
|
+
describe(ua) {
|
|
275120
|
+
const browser2 = {
|
|
275121
|
+
name: "Swing"
|
|
275122
|
+
};
|
|
275123
|
+
const version2 = Utils.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
|
275124
|
+
if (version2) {
|
|
275125
|
+
browser2.version = version2;
|
|
275126
|
+
}
|
|
275127
|
+
return browser2;
|
|
275128
|
+
}
|
|
275129
|
+
},
|
|
275130
|
+
{
|
|
275131
|
+
test: [/coast/i],
|
|
275132
|
+
describe(ua) {
|
|
275133
|
+
const browser2 = {
|
|
275134
|
+
name: "Opera Coast"
|
|
275135
|
+
};
|
|
275136
|
+
const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
|
275137
|
+
if (version2) {
|
|
275138
|
+
browser2.version = version2;
|
|
275139
|
+
}
|
|
275140
|
+
return browser2;
|
|
275141
|
+
}
|
|
275142
|
+
},
|
|
275143
|
+
{
|
|
275144
|
+
test: [/opt\/\d+(?:.?_?\d+)+/i],
|
|
275145
|
+
describe(ua) {
|
|
275146
|
+
const browser2 = {
|
|
275147
|
+
name: "Opera Touch"
|
|
275148
|
+
};
|
|
275149
|
+
const version2 = Utils.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
|
275150
|
+
if (version2) {
|
|
275151
|
+
browser2.version = version2;
|
|
275152
|
+
}
|
|
275153
|
+
return browser2;
|
|
275154
|
+
}
|
|
275155
|
+
},
|
|
275156
|
+
{
|
|
275157
|
+
test: [/yabrowser/i],
|
|
275158
|
+
describe(ua) {
|
|
275159
|
+
const browser2 = {
|
|
275160
|
+
name: "Yandex Browser"
|
|
275161
|
+
};
|
|
275162
|
+
const version2 = Utils.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
|
275163
|
+
if (version2) {
|
|
275164
|
+
browser2.version = version2;
|
|
275165
|
+
}
|
|
275166
|
+
return browser2;
|
|
275167
|
+
}
|
|
275168
|
+
},
|
|
275169
|
+
{
|
|
275170
|
+
test: [/ucbrowser/i],
|
|
275171
|
+
describe(ua) {
|
|
275172
|
+
const browser2 = {
|
|
275173
|
+
name: "UC Browser"
|
|
275174
|
+
};
|
|
275175
|
+
const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
|
275176
|
+
if (version2) {
|
|
275177
|
+
browser2.version = version2;
|
|
275178
|
+
}
|
|
275179
|
+
return browser2;
|
|
275180
|
+
}
|
|
275181
|
+
},
|
|
275182
|
+
{
|
|
275183
|
+
test: [/Maxthon|mxios/i],
|
|
275184
|
+
describe(ua) {
|
|
275185
|
+
const browser2 = {
|
|
275186
|
+
name: "Maxthon"
|
|
275187
|
+
};
|
|
275188
|
+
const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
|
275189
|
+
if (version2) {
|
|
275190
|
+
browser2.version = version2;
|
|
275191
|
+
}
|
|
275192
|
+
return browser2;
|
|
275193
|
+
}
|
|
275194
|
+
},
|
|
275195
|
+
{
|
|
275196
|
+
test: [/epiphany/i],
|
|
275197
|
+
describe(ua) {
|
|
275198
|
+
const browser2 = {
|
|
275199
|
+
name: "Epiphany"
|
|
275200
|
+
};
|
|
275201
|
+
const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
|
275202
|
+
if (version2) {
|
|
275203
|
+
browser2.version = version2;
|
|
275204
|
+
}
|
|
275205
|
+
return browser2;
|
|
275206
|
+
}
|
|
275207
|
+
},
|
|
275208
|
+
{
|
|
275209
|
+
test: [/puffin/i],
|
|
275210
|
+
describe(ua) {
|
|
275211
|
+
const browser2 = {
|
|
275212
|
+
name: "Puffin"
|
|
275213
|
+
};
|
|
275214
|
+
const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
|
275215
|
+
if (version2) {
|
|
275216
|
+
browser2.version = version2;
|
|
275217
|
+
}
|
|
275218
|
+
return browser2;
|
|
275219
|
+
}
|
|
275220
|
+
},
|
|
275221
|
+
{
|
|
275222
|
+
test: [/sleipnir/i],
|
|
275223
|
+
describe(ua) {
|
|
275224
|
+
const browser2 = {
|
|
275225
|
+
name: "Sleipnir"
|
|
275226
|
+
};
|
|
275227
|
+
const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
|
275228
|
+
if (version2) {
|
|
275229
|
+
browser2.version = version2;
|
|
275230
|
+
}
|
|
275231
|
+
return browser2;
|
|
275232
|
+
}
|
|
275233
|
+
},
|
|
275234
|
+
{
|
|
275235
|
+
test: [/k-meleon/i],
|
|
275236
|
+
describe(ua) {
|
|
275237
|
+
const browser2 = {
|
|
275238
|
+
name: "K-Meleon"
|
|
275239
|
+
};
|
|
275240
|
+
const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
|
275241
|
+
if (version2) {
|
|
275242
|
+
browser2.version = version2;
|
|
275243
|
+
}
|
|
275244
|
+
return browser2;
|
|
275245
|
+
}
|
|
275246
|
+
},
|
|
275247
|
+
{
|
|
275248
|
+
test: [/micromessenger/i],
|
|
275249
|
+
describe(ua) {
|
|
275250
|
+
const browser2 = {
|
|
275251
|
+
name: "WeChat"
|
|
275252
|
+
};
|
|
275253
|
+
const version2 = Utils.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
|
275254
|
+
if (version2) {
|
|
275255
|
+
browser2.version = version2;
|
|
275256
|
+
}
|
|
275257
|
+
return browser2;
|
|
275258
|
+
}
|
|
275259
|
+
},
|
|
275260
|
+
{
|
|
275261
|
+
test: [/qqbrowser/i],
|
|
275262
|
+
describe(ua) {
|
|
275263
|
+
const browser2 = {
|
|
275264
|
+
name: /qqbrowserlite/i.test(ua) ? "QQ Browser Lite" : "QQ Browser"
|
|
275265
|
+
};
|
|
275266
|
+
const version2 = Utils.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
|
275267
|
+
if (version2) {
|
|
275268
|
+
browser2.version = version2;
|
|
275269
|
+
}
|
|
275270
|
+
return browser2;
|
|
275271
|
+
}
|
|
275272
|
+
},
|
|
275273
|
+
{
|
|
275274
|
+
test: [/msie|trident/i],
|
|
275275
|
+
describe(ua) {
|
|
275276
|
+
const browser2 = {
|
|
275277
|
+
name: "Internet Explorer"
|
|
275278
|
+
};
|
|
275279
|
+
const version2 = Utils.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i, ua);
|
|
275280
|
+
if (version2) {
|
|
275281
|
+
browser2.version = version2;
|
|
275282
|
+
}
|
|
275283
|
+
return browser2;
|
|
275284
|
+
}
|
|
275285
|
+
},
|
|
275286
|
+
{
|
|
275287
|
+
test: [/\sedg\//i],
|
|
275288
|
+
describe(ua) {
|
|
275289
|
+
const browser2 = {
|
|
275290
|
+
name: "Microsoft Edge"
|
|
275291
|
+
};
|
|
275292
|
+
const version2 = Utils.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i, ua);
|
|
275293
|
+
if (version2) {
|
|
275294
|
+
browser2.version = version2;
|
|
275295
|
+
}
|
|
275296
|
+
return browser2;
|
|
275297
|
+
}
|
|
275298
|
+
},
|
|
275299
|
+
{
|
|
275300
|
+
test: [/edg([ea]|ios)/i],
|
|
275301
|
+
describe(ua) {
|
|
275302
|
+
const browser2 = {
|
|
275303
|
+
name: "Microsoft Edge"
|
|
275304
|
+
};
|
|
275305
|
+
const version2 = Utils.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i, ua);
|
|
275306
|
+
if (version2) {
|
|
275307
|
+
browser2.version = version2;
|
|
275308
|
+
}
|
|
275309
|
+
return browser2;
|
|
275310
|
+
}
|
|
275311
|
+
},
|
|
275312
|
+
{
|
|
275313
|
+
test: [/vivaldi/i],
|
|
275314
|
+
describe(ua) {
|
|
275315
|
+
const browser2 = {
|
|
275316
|
+
name: "Vivaldi"
|
|
275317
|
+
};
|
|
275318
|
+
const version2 = Utils.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i, ua);
|
|
275319
|
+
if (version2) {
|
|
275320
|
+
browser2.version = version2;
|
|
275321
|
+
}
|
|
275322
|
+
return browser2;
|
|
275323
|
+
}
|
|
275324
|
+
},
|
|
275325
|
+
{
|
|
275326
|
+
test: [/seamonkey/i],
|
|
275327
|
+
describe(ua) {
|
|
275328
|
+
const browser2 = {
|
|
275329
|
+
name: "SeaMonkey"
|
|
275330
|
+
};
|
|
275331
|
+
const version2 = Utils.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i, ua);
|
|
275332
|
+
if (version2) {
|
|
275333
|
+
browser2.version = version2;
|
|
275334
|
+
}
|
|
275335
|
+
return browser2;
|
|
275336
|
+
}
|
|
275337
|
+
},
|
|
275338
|
+
{
|
|
275339
|
+
test: [/sailfish/i],
|
|
275340
|
+
describe(ua) {
|
|
275341
|
+
const browser2 = {
|
|
275342
|
+
name: "Sailfish"
|
|
275343
|
+
};
|
|
275344
|
+
const version2 = Utils.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i, ua);
|
|
275345
|
+
if (version2) {
|
|
275346
|
+
browser2.version = version2;
|
|
275347
|
+
}
|
|
275348
|
+
return browser2;
|
|
275349
|
+
}
|
|
275350
|
+
},
|
|
275351
|
+
{
|
|
275352
|
+
test: [/silk/i],
|
|
275353
|
+
describe(ua) {
|
|
275354
|
+
const browser2 = {
|
|
275355
|
+
name: "Amazon Silk"
|
|
275356
|
+
};
|
|
275357
|
+
const version2 = Utils.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i, ua);
|
|
275358
|
+
if (version2) {
|
|
275359
|
+
browser2.version = version2;
|
|
275360
|
+
}
|
|
275361
|
+
return browser2;
|
|
275362
|
+
}
|
|
275363
|
+
},
|
|
275364
|
+
{
|
|
275365
|
+
test: [/phantom/i],
|
|
275366
|
+
describe(ua) {
|
|
275367
|
+
const browser2 = {
|
|
275368
|
+
name: "PhantomJS"
|
|
275369
|
+
};
|
|
275370
|
+
const version2 = Utils.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i, ua);
|
|
275371
|
+
if (version2) {
|
|
275372
|
+
browser2.version = version2;
|
|
275373
|
+
}
|
|
275374
|
+
return browser2;
|
|
275375
|
+
}
|
|
275376
|
+
},
|
|
275377
|
+
{
|
|
275378
|
+
test: [/slimerjs/i],
|
|
275379
|
+
describe(ua) {
|
|
275380
|
+
const browser2 = {
|
|
275381
|
+
name: "SlimerJS"
|
|
275382
|
+
};
|
|
275383
|
+
const version2 = Utils.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i, ua);
|
|
275384
|
+
if (version2) {
|
|
275385
|
+
browser2.version = version2;
|
|
275386
|
+
}
|
|
275387
|
+
return browser2;
|
|
275388
|
+
}
|
|
275389
|
+
},
|
|
275390
|
+
{
|
|
275391
|
+
test: [/blackberry|\bbb\d+/i, /rim\stablet/i],
|
|
275392
|
+
describe(ua) {
|
|
275393
|
+
const browser2 = {
|
|
275394
|
+
name: "BlackBerry"
|
|
275395
|
+
};
|
|
275396
|
+
const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i, ua);
|
|
275397
|
+
if (version2) {
|
|
275398
|
+
browser2.version = version2;
|
|
275399
|
+
}
|
|
275400
|
+
return browser2;
|
|
275401
|
+
}
|
|
275402
|
+
},
|
|
275403
|
+
{
|
|
275404
|
+
test: [/(web|hpw)[o0]s/i],
|
|
275405
|
+
describe(ua) {
|
|
275406
|
+
const browser2 = {
|
|
275407
|
+
name: "WebOS Browser"
|
|
275408
|
+
};
|
|
275409
|
+
const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i, ua);
|
|
275410
|
+
if (version2) {
|
|
275411
|
+
browser2.version = version2;
|
|
275412
|
+
}
|
|
275413
|
+
return browser2;
|
|
275414
|
+
}
|
|
275415
|
+
},
|
|
275416
|
+
{
|
|
275417
|
+
test: [/bada/i],
|
|
275418
|
+
describe(ua) {
|
|
275419
|
+
const browser2 = {
|
|
275420
|
+
name: "Bada"
|
|
275421
|
+
};
|
|
275422
|
+
const version2 = Utils.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i, ua);
|
|
275423
|
+
if (version2) {
|
|
275424
|
+
browser2.version = version2;
|
|
275425
|
+
}
|
|
275426
|
+
return browser2;
|
|
275427
|
+
}
|
|
275428
|
+
},
|
|
275429
|
+
{
|
|
275430
|
+
test: [/tizen/i],
|
|
275431
|
+
describe(ua) {
|
|
275432
|
+
const browser2 = {
|
|
275433
|
+
name: "Tizen"
|
|
275434
|
+
};
|
|
275435
|
+
const version2 = Utils.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
|
275436
|
+
if (version2) {
|
|
275437
|
+
browser2.version = version2;
|
|
275438
|
+
}
|
|
275439
|
+
return browser2;
|
|
275440
|
+
}
|
|
275441
|
+
},
|
|
275442
|
+
{
|
|
275443
|
+
test: [/qupzilla/i],
|
|
275444
|
+
describe(ua) {
|
|
275445
|
+
const browser2 = {
|
|
275446
|
+
name: "QupZilla"
|
|
275447
|
+
};
|
|
275448
|
+
const version2 = Utils.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
|
275449
|
+
if (version2) {
|
|
275450
|
+
browser2.version = version2;
|
|
275451
|
+
}
|
|
275452
|
+
return browser2;
|
|
275453
|
+
}
|
|
275454
|
+
},
|
|
275455
|
+
{
|
|
275456
|
+
test: [/firefox|iceweasel|fxios/i],
|
|
275457
|
+
describe(ua) {
|
|
275458
|
+
const browser2 = {
|
|
275459
|
+
name: "Firefox"
|
|
275460
|
+
};
|
|
275461
|
+
const version2 = Utils.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
|
275462
|
+
if (version2) {
|
|
275463
|
+
browser2.version = version2;
|
|
275464
|
+
}
|
|
275465
|
+
return browser2;
|
|
275466
|
+
}
|
|
275467
|
+
},
|
|
275468
|
+
{
|
|
275469
|
+
test: [/electron/i],
|
|
275470
|
+
describe(ua) {
|
|
275471
|
+
const browser2 = {
|
|
275472
|
+
name: "Electron"
|
|
275473
|
+
};
|
|
275474
|
+
const version2 = Utils.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i, ua);
|
|
275475
|
+
if (version2) {
|
|
275476
|
+
browser2.version = version2;
|
|
275477
|
+
}
|
|
275478
|
+
return browser2;
|
|
275479
|
+
}
|
|
275480
|
+
},
|
|
275481
|
+
{
|
|
275482
|
+
test: [/MiuiBrowser/i],
|
|
275483
|
+
describe(ua) {
|
|
275484
|
+
const browser2 = {
|
|
275485
|
+
name: "Miui"
|
|
275486
|
+
};
|
|
275487
|
+
const version2 = Utils.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
|
275488
|
+
if (version2) {
|
|
275489
|
+
browser2.version = version2;
|
|
275490
|
+
}
|
|
275491
|
+
return browser2;
|
|
275492
|
+
}
|
|
275493
|
+
},
|
|
275494
|
+
{
|
|
275495
|
+
test: [/chromium/i],
|
|
275496
|
+
describe(ua) {
|
|
275497
|
+
const browser2 = {
|
|
275498
|
+
name: "Chromium"
|
|
275499
|
+
};
|
|
275500
|
+
const version2 = Utils.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
|
275501
|
+
if (version2) {
|
|
275502
|
+
browser2.version = version2;
|
|
275503
|
+
}
|
|
275504
|
+
return browser2;
|
|
275505
|
+
}
|
|
275506
|
+
},
|
|
275507
|
+
{
|
|
275508
|
+
test: [/chrome|crios|crmo/i],
|
|
275509
|
+
describe(ua) {
|
|
275510
|
+
const browser2 = {
|
|
275511
|
+
name: "Chrome"
|
|
275512
|
+
};
|
|
275513
|
+
const version2 = Utils.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i, ua);
|
|
275514
|
+
if (version2) {
|
|
275515
|
+
browser2.version = version2;
|
|
275516
|
+
}
|
|
275517
|
+
return browser2;
|
|
275518
|
+
}
|
|
275519
|
+
},
|
|
275520
|
+
{
|
|
275521
|
+
test: [/GSA/i],
|
|
275522
|
+
describe(ua) {
|
|
275523
|
+
const browser2 = {
|
|
275524
|
+
name: "Google Search"
|
|
275525
|
+
};
|
|
275526
|
+
const version2 = Utils.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i, ua);
|
|
275527
|
+
if (version2) {
|
|
275528
|
+
browser2.version = version2;
|
|
275529
|
+
}
|
|
275530
|
+
return browser2;
|
|
275531
|
+
}
|
|
275532
|
+
},
|
|
275533
|
+
{
|
|
275534
|
+
test(parser2) {
|
|
275535
|
+
const notLikeAndroid = !parser2.test(/like android/i);
|
|
275536
|
+
const butAndroid = parser2.test(/android/i);
|
|
275537
|
+
return notLikeAndroid && butAndroid;
|
|
275538
|
+
},
|
|
275539
|
+
describe(ua) {
|
|
275540
|
+
const browser2 = {
|
|
275541
|
+
name: "Android Browser"
|
|
275542
|
+
};
|
|
275543
|
+
const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua);
|
|
275544
|
+
if (version2) {
|
|
275545
|
+
browser2.version = version2;
|
|
275546
|
+
}
|
|
275547
|
+
return browser2;
|
|
275548
|
+
}
|
|
275549
|
+
},
|
|
275550
|
+
{
|
|
275551
|
+
test: [/playstation 4/i],
|
|
275552
|
+
describe(ua) {
|
|
275553
|
+
const browser2 = {
|
|
275554
|
+
name: "PlayStation 4"
|
|
275555
|
+
};
|
|
275556
|
+
const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua);
|
|
275557
|
+
if (version2) {
|
|
275558
|
+
browser2.version = version2;
|
|
275559
|
+
}
|
|
275560
|
+
return browser2;
|
|
275561
|
+
}
|
|
275562
|
+
},
|
|
275563
|
+
{
|
|
275564
|
+
test: [/safari|applewebkit/i],
|
|
275565
|
+
describe(ua) {
|
|
275566
|
+
const browser2 = {
|
|
275567
|
+
name: "Safari"
|
|
275568
|
+
};
|
|
275569
|
+
const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua);
|
|
275570
|
+
if (version2) {
|
|
275571
|
+
browser2.version = version2;
|
|
275572
|
+
}
|
|
275573
|
+
return browser2;
|
|
275574
|
+
}
|
|
275575
|
+
},
|
|
275576
|
+
{
|
|
275577
|
+
test: [/.*/i],
|
|
275578
|
+
describe(ua) {
|
|
275579
|
+
const regexpWithoutDeviceSpec = /^(.*)\/(.*) /;
|
|
275580
|
+
const regexpWithDeviceSpec = /^(.*)\/(.*)[ \t]\((.*)/;
|
|
275581
|
+
const hasDeviceSpec = ua.search("\\(") !== -1;
|
|
275582
|
+
const regexp = hasDeviceSpec ? regexpWithDeviceSpec : regexpWithoutDeviceSpec;
|
|
275583
|
+
return {
|
|
275584
|
+
name: Utils.getFirstMatch(regexp, ua),
|
|
275585
|
+
version: Utils.getSecondMatch(regexp, ua)
|
|
275586
|
+
};
|
|
275587
|
+
}
|
|
275588
|
+
}
|
|
275589
|
+
];
|
|
275590
|
+
const osParsersList = [
|
|
275591
|
+
{
|
|
275592
|
+
test: [/Roku\/DVP/],
|
|
275593
|
+
describe(ua) {
|
|
275594
|
+
const version2 = Utils.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i, ua);
|
|
275595
|
+
return {
|
|
275596
|
+
name: OS_MAP.Roku,
|
|
275597
|
+
version: version2
|
|
275598
|
+
};
|
|
275599
|
+
}
|
|
275600
|
+
},
|
|
275601
|
+
{
|
|
275602
|
+
test: [/windows phone/i],
|
|
275603
|
+
describe(ua) {
|
|
275604
|
+
const version2 = Utils.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i, ua);
|
|
275605
|
+
return {
|
|
275606
|
+
name: OS_MAP.WindowsPhone,
|
|
275607
|
+
version: version2
|
|
275608
|
+
};
|
|
275609
|
+
}
|
|
275610
|
+
},
|
|
275611
|
+
{
|
|
275612
|
+
test: [/windows /i],
|
|
275613
|
+
describe(ua) {
|
|
275614
|
+
const version2 = Utils.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i, ua);
|
|
275615
|
+
const versionName = Utils.getWindowsVersionName(version2);
|
|
275616
|
+
return {
|
|
275617
|
+
name: OS_MAP.Windows,
|
|
275618
|
+
version: version2,
|
|
275619
|
+
versionName
|
|
275620
|
+
};
|
|
275621
|
+
}
|
|
275622
|
+
},
|
|
275623
|
+
{
|
|
275624
|
+
test: [/Macintosh(.*?) FxiOS(.*?)\//],
|
|
275625
|
+
describe(ua) {
|
|
275626
|
+
const result = {
|
|
275627
|
+
name: OS_MAP.iOS
|
|
275628
|
+
};
|
|
275629
|
+
const version2 = Utils.getSecondMatch(/(Version\/)(\d[\d.]+)/, ua);
|
|
275630
|
+
if (version2) {
|
|
275631
|
+
result.version = version2;
|
|
275632
|
+
}
|
|
275633
|
+
return result;
|
|
275634
|
+
}
|
|
275635
|
+
},
|
|
275636
|
+
{
|
|
275637
|
+
test: [/macintosh/i],
|
|
275638
|
+
describe(ua) {
|
|
275639
|
+
const version2 = Utils.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i, ua).replace(/[_\s]/g, ".");
|
|
275640
|
+
const versionName = Utils.getMacOSVersionName(version2);
|
|
275641
|
+
const os = {
|
|
275642
|
+
name: OS_MAP.MacOS,
|
|
275643
|
+
version: version2
|
|
275644
|
+
};
|
|
275645
|
+
if (versionName) {
|
|
275646
|
+
os.versionName = versionName;
|
|
275647
|
+
}
|
|
275648
|
+
return os;
|
|
275649
|
+
}
|
|
275650
|
+
},
|
|
275651
|
+
{
|
|
275652
|
+
test: [/(ipod|iphone|ipad)/i],
|
|
275653
|
+
describe(ua) {
|
|
275654
|
+
const version2 = Utils.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i, ua).replace(/[_\s]/g, ".");
|
|
275655
|
+
return {
|
|
275656
|
+
name: OS_MAP.iOS,
|
|
275657
|
+
version: version2
|
|
275658
|
+
};
|
|
275659
|
+
}
|
|
275660
|
+
},
|
|
275661
|
+
{
|
|
275662
|
+
test(parser2) {
|
|
275663
|
+
const notLikeAndroid = !parser2.test(/like android/i);
|
|
275664
|
+
const butAndroid = parser2.test(/android/i);
|
|
275665
|
+
return notLikeAndroid && butAndroid;
|
|
275666
|
+
},
|
|
275667
|
+
describe(ua) {
|
|
275668
|
+
const version2 = Utils.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i, ua);
|
|
275669
|
+
const versionName = Utils.getAndroidVersionName(version2);
|
|
275670
|
+
const os = {
|
|
275671
|
+
name: OS_MAP.Android,
|
|
275672
|
+
version: version2
|
|
275673
|
+
};
|
|
275674
|
+
if (versionName) {
|
|
275675
|
+
os.versionName = versionName;
|
|
275676
|
+
}
|
|
275677
|
+
return os;
|
|
275678
|
+
}
|
|
275679
|
+
},
|
|
275680
|
+
{
|
|
275681
|
+
test: [/(web|hpw)[o0]s/i],
|
|
275682
|
+
describe(ua) {
|
|
275683
|
+
const version2 = Utils.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i, ua);
|
|
275684
|
+
const os = {
|
|
275685
|
+
name: OS_MAP.WebOS
|
|
275686
|
+
};
|
|
275687
|
+
if (version2 && version2.length) {
|
|
275688
|
+
os.version = version2;
|
|
275689
|
+
}
|
|
275690
|
+
return os;
|
|
275691
|
+
}
|
|
275692
|
+
},
|
|
275693
|
+
{
|
|
275694
|
+
test: [/blackberry|\bbb\d+/i, /rim\stablet/i],
|
|
275695
|
+
describe(ua) {
|
|
275696
|
+
const version2 = Utils.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i, ua) || Utils.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i, ua) || Utils.getFirstMatch(/\bbb(\d+)/i, ua);
|
|
275697
|
+
return {
|
|
275698
|
+
name: OS_MAP.BlackBerry,
|
|
275699
|
+
version: version2
|
|
275700
|
+
};
|
|
275701
|
+
}
|
|
275702
|
+
},
|
|
275703
|
+
{
|
|
275704
|
+
test: [/bada/i],
|
|
275705
|
+
describe(ua) {
|
|
275706
|
+
const version2 = Utils.getFirstMatch(/bada\/(\d+(\.\d+)*)/i, ua);
|
|
275707
|
+
return {
|
|
275708
|
+
name: OS_MAP.Bada,
|
|
275709
|
+
version: version2
|
|
275710
|
+
};
|
|
275711
|
+
}
|
|
275712
|
+
},
|
|
275713
|
+
{
|
|
275714
|
+
test: [/tizen/i],
|
|
275715
|
+
describe(ua) {
|
|
275716
|
+
const version2 = Utils.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i, ua);
|
|
275717
|
+
return {
|
|
275718
|
+
name: OS_MAP.Tizen,
|
|
275719
|
+
version: version2
|
|
275720
|
+
};
|
|
275721
|
+
}
|
|
275722
|
+
},
|
|
275723
|
+
{
|
|
275724
|
+
test: [/linux/i],
|
|
275725
|
+
describe() {
|
|
275726
|
+
return {
|
|
275727
|
+
name: OS_MAP.Linux
|
|
275728
|
+
};
|
|
275729
|
+
}
|
|
275730
|
+
},
|
|
275731
|
+
{
|
|
275732
|
+
test: [/CrOS/],
|
|
275733
|
+
describe() {
|
|
275734
|
+
return {
|
|
275735
|
+
name: OS_MAP.ChromeOS
|
|
275736
|
+
};
|
|
275737
|
+
}
|
|
275738
|
+
},
|
|
275739
|
+
{
|
|
275740
|
+
test: [/PlayStation 4/],
|
|
275741
|
+
describe(ua) {
|
|
275742
|
+
const version2 = Utils.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i, ua);
|
|
275743
|
+
return {
|
|
275744
|
+
name: OS_MAP.PlayStation4,
|
|
275745
|
+
version: version2
|
|
275746
|
+
};
|
|
275747
|
+
}
|
|
275748
|
+
}
|
|
275749
|
+
];
|
|
275750
|
+
const platformParsersList = [
|
|
275751
|
+
{
|
|
275752
|
+
test: [/googlebot/i],
|
|
275753
|
+
describe() {
|
|
275754
|
+
return {
|
|
275755
|
+
type: "bot",
|
|
275756
|
+
vendor: "Google"
|
|
275757
|
+
};
|
|
275758
|
+
}
|
|
275759
|
+
},
|
|
275760
|
+
{
|
|
275761
|
+
test: [/huawei/i],
|
|
275762
|
+
describe(ua) {
|
|
275763
|
+
const model = Utils.getFirstMatch(/(can-l01)/i, ua) && "Nova";
|
|
275764
|
+
const platform = {
|
|
275765
|
+
type: PLATFORMS_MAP.mobile,
|
|
275766
|
+
vendor: "Huawei"
|
|
275767
|
+
};
|
|
275768
|
+
if (model) {
|
|
275769
|
+
platform.model = model;
|
|
275770
|
+
}
|
|
275771
|
+
return platform;
|
|
275772
|
+
}
|
|
275773
|
+
},
|
|
275774
|
+
{
|
|
275775
|
+
test: [/nexus\s*(?:7|8|9|10).*/i],
|
|
275776
|
+
describe() {
|
|
275777
|
+
return {
|
|
275778
|
+
type: PLATFORMS_MAP.tablet,
|
|
275779
|
+
vendor: "Nexus"
|
|
275780
|
+
};
|
|
275781
|
+
}
|
|
275782
|
+
},
|
|
275783
|
+
{
|
|
275784
|
+
test: [/ipad/i],
|
|
275785
|
+
describe() {
|
|
275786
|
+
return {
|
|
275787
|
+
type: PLATFORMS_MAP.tablet,
|
|
275788
|
+
vendor: "Apple",
|
|
275789
|
+
model: "iPad"
|
|
275790
|
+
};
|
|
275791
|
+
}
|
|
275792
|
+
},
|
|
275793
|
+
{
|
|
275794
|
+
test: [/Macintosh(.*?) FxiOS(.*?)\//],
|
|
275795
|
+
describe() {
|
|
275796
|
+
return {
|
|
275797
|
+
type: PLATFORMS_MAP.tablet,
|
|
275798
|
+
vendor: "Apple",
|
|
275799
|
+
model: "iPad"
|
|
275800
|
+
};
|
|
275801
|
+
}
|
|
275802
|
+
},
|
|
275803
|
+
{
|
|
275804
|
+
test: [/kftt build/i],
|
|
275805
|
+
describe() {
|
|
275806
|
+
return {
|
|
275807
|
+
type: PLATFORMS_MAP.tablet,
|
|
275808
|
+
vendor: "Amazon",
|
|
275809
|
+
model: "Kindle Fire HD 7"
|
|
275810
|
+
};
|
|
275811
|
+
}
|
|
275812
|
+
},
|
|
275813
|
+
{
|
|
275814
|
+
test: [/silk/i],
|
|
275815
|
+
describe() {
|
|
275816
|
+
return {
|
|
275817
|
+
type: PLATFORMS_MAP.tablet,
|
|
275818
|
+
vendor: "Amazon"
|
|
275819
|
+
};
|
|
275820
|
+
}
|
|
275821
|
+
},
|
|
275822
|
+
{
|
|
275823
|
+
test: [/tablet(?! pc)/i],
|
|
275824
|
+
describe() {
|
|
275825
|
+
return {
|
|
275826
|
+
type: PLATFORMS_MAP.tablet
|
|
275827
|
+
};
|
|
275828
|
+
}
|
|
275829
|
+
},
|
|
275830
|
+
{
|
|
275831
|
+
test(parser2) {
|
|
275832
|
+
const iDevice = parser2.test(/ipod|iphone/i);
|
|
275833
|
+
const likeIDevice = parser2.test(/like (ipod|iphone)/i);
|
|
275834
|
+
return iDevice && !likeIDevice;
|
|
275835
|
+
},
|
|
275836
|
+
describe(ua) {
|
|
275837
|
+
const model = Utils.getFirstMatch(/(ipod|iphone)/i, ua);
|
|
275838
|
+
return {
|
|
275839
|
+
type: PLATFORMS_MAP.mobile,
|
|
275840
|
+
vendor: "Apple",
|
|
275841
|
+
model
|
|
275842
|
+
};
|
|
275843
|
+
}
|
|
275844
|
+
},
|
|
275845
|
+
{
|
|
275846
|
+
test: [/nexus\s*[0-6].*/i, /galaxy nexus/i],
|
|
275847
|
+
describe() {
|
|
275848
|
+
return {
|
|
275849
|
+
type: PLATFORMS_MAP.mobile,
|
|
275850
|
+
vendor: "Nexus"
|
|
275851
|
+
};
|
|
275852
|
+
}
|
|
275853
|
+
},
|
|
275854
|
+
{
|
|
275855
|
+
test: [/[^-]mobi/i],
|
|
275856
|
+
describe() {
|
|
275857
|
+
return {
|
|
275858
|
+
type: PLATFORMS_MAP.mobile
|
|
275859
|
+
};
|
|
275860
|
+
}
|
|
275861
|
+
},
|
|
275862
|
+
{
|
|
275863
|
+
test(parser2) {
|
|
275864
|
+
return parser2.getBrowserName(true) === "blackberry";
|
|
275865
|
+
},
|
|
275866
|
+
describe() {
|
|
275867
|
+
return {
|
|
275868
|
+
type: PLATFORMS_MAP.mobile,
|
|
275869
|
+
vendor: "BlackBerry"
|
|
275870
|
+
};
|
|
275871
|
+
}
|
|
275872
|
+
},
|
|
275873
|
+
{
|
|
275874
|
+
test(parser2) {
|
|
275875
|
+
return parser2.getBrowserName(true) === "bada";
|
|
275876
|
+
},
|
|
275877
|
+
describe() {
|
|
275878
|
+
return {
|
|
275879
|
+
type: PLATFORMS_MAP.mobile
|
|
275880
|
+
};
|
|
275881
|
+
}
|
|
275882
|
+
},
|
|
275883
|
+
{
|
|
275884
|
+
test(parser2) {
|
|
275885
|
+
return parser2.getBrowserName() === "windows phone";
|
|
275886
|
+
},
|
|
275887
|
+
describe() {
|
|
275888
|
+
return {
|
|
275889
|
+
type: PLATFORMS_MAP.mobile,
|
|
275890
|
+
vendor: "Microsoft"
|
|
275891
|
+
};
|
|
275892
|
+
}
|
|
275893
|
+
},
|
|
275894
|
+
{
|
|
275895
|
+
test(parser2) {
|
|
275896
|
+
const osMajorVersion = Number(String(parser2.getOSVersion()).split(".")[0]);
|
|
275897
|
+
return parser2.getOSName(true) === "android" && osMajorVersion >= 3;
|
|
275898
|
+
},
|
|
275899
|
+
describe() {
|
|
275900
|
+
return {
|
|
275901
|
+
type: PLATFORMS_MAP.tablet
|
|
275902
|
+
};
|
|
275903
|
+
}
|
|
275904
|
+
},
|
|
275905
|
+
{
|
|
275906
|
+
test(parser2) {
|
|
275907
|
+
return parser2.getOSName(true) === "android";
|
|
275908
|
+
},
|
|
275909
|
+
describe() {
|
|
275910
|
+
return {
|
|
275911
|
+
type: PLATFORMS_MAP.mobile
|
|
275912
|
+
};
|
|
275913
|
+
}
|
|
275914
|
+
},
|
|
275915
|
+
{
|
|
275916
|
+
test(parser2) {
|
|
275917
|
+
return parser2.getOSName(true) === "macos";
|
|
275918
|
+
},
|
|
275919
|
+
describe() {
|
|
275920
|
+
return {
|
|
275921
|
+
type: PLATFORMS_MAP.desktop,
|
|
275922
|
+
vendor: "Apple"
|
|
275923
|
+
};
|
|
275924
|
+
}
|
|
275925
|
+
},
|
|
275926
|
+
{
|
|
275927
|
+
test(parser2) {
|
|
275928
|
+
return parser2.getOSName(true) === "windows";
|
|
275929
|
+
},
|
|
275930
|
+
describe() {
|
|
275931
|
+
return {
|
|
275932
|
+
type: PLATFORMS_MAP.desktop
|
|
275933
|
+
};
|
|
275934
|
+
}
|
|
275935
|
+
},
|
|
275936
|
+
{
|
|
275937
|
+
test(parser2) {
|
|
275938
|
+
return parser2.getOSName(true) === "linux";
|
|
275939
|
+
},
|
|
275940
|
+
describe() {
|
|
275941
|
+
return {
|
|
275942
|
+
type: PLATFORMS_MAP.desktop
|
|
275943
|
+
};
|
|
275944
|
+
}
|
|
275945
|
+
},
|
|
275946
|
+
{
|
|
275947
|
+
test(parser2) {
|
|
275948
|
+
return parser2.getOSName(true) === "playstation 4";
|
|
275949
|
+
},
|
|
275950
|
+
describe() {
|
|
275951
|
+
return {
|
|
275952
|
+
type: PLATFORMS_MAP.tv
|
|
275953
|
+
};
|
|
275954
|
+
}
|
|
275955
|
+
},
|
|
275956
|
+
{
|
|
275957
|
+
test(parser2) {
|
|
275958
|
+
return parser2.getOSName(true) === "roku";
|
|
275959
|
+
},
|
|
275960
|
+
describe() {
|
|
275961
|
+
return {
|
|
275962
|
+
type: PLATFORMS_MAP.tv
|
|
275963
|
+
};
|
|
275964
|
+
}
|
|
275965
|
+
}
|
|
275966
|
+
];
|
|
275967
|
+
const enginesParsersList = [
|
|
275968
|
+
{
|
|
275969
|
+
test(parser2) {
|
|
275970
|
+
return parser2.getBrowserName(true) === "microsoft edge";
|
|
275971
|
+
},
|
|
275972
|
+
describe(ua) {
|
|
275973
|
+
const isBlinkBased = /\sedg\//i.test(ua);
|
|
275974
|
+
if (isBlinkBased) {
|
|
275975
|
+
return {
|
|
275976
|
+
name: ENGINE_MAP.Blink
|
|
275977
|
+
};
|
|
275978
|
+
}
|
|
275979
|
+
const version2 = Utils.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, ua);
|
|
275980
|
+
return {
|
|
275981
|
+
name: ENGINE_MAP.EdgeHTML,
|
|
275982
|
+
version: version2
|
|
275983
|
+
};
|
|
275984
|
+
}
|
|
275985
|
+
},
|
|
275986
|
+
{
|
|
275987
|
+
test: [/trident/i],
|
|
275988
|
+
describe(ua) {
|
|
275989
|
+
const engine = {
|
|
275990
|
+
name: ENGINE_MAP.Trident
|
|
275991
|
+
};
|
|
275992
|
+
const version2 = Utils.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i, ua);
|
|
275993
|
+
if (version2) {
|
|
275994
|
+
engine.version = version2;
|
|
275995
|
+
}
|
|
275996
|
+
return engine;
|
|
275997
|
+
}
|
|
275998
|
+
},
|
|
275999
|
+
{
|
|
276000
|
+
test(parser2) {
|
|
276001
|
+
return parser2.test(/presto/i);
|
|
276002
|
+
},
|
|
276003
|
+
describe(ua) {
|
|
276004
|
+
const engine = {
|
|
276005
|
+
name: ENGINE_MAP.Presto
|
|
276006
|
+
};
|
|
276007
|
+
const version2 = Utils.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i, ua);
|
|
276008
|
+
if (version2) {
|
|
276009
|
+
engine.version = version2;
|
|
276010
|
+
}
|
|
276011
|
+
return engine;
|
|
276012
|
+
}
|
|
276013
|
+
},
|
|
276014
|
+
{
|
|
276015
|
+
test(parser2) {
|
|
276016
|
+
const isGecko = parser2.test(/gecko/i);
|
|
276017
|
+
const likeGecko = parser2.test(/like gecko/i);
|
|
276018
|
+
return isGecko && !likeGecko;
|
|
276019
|
+
},
|
|
276020
|
+
describe(ua) {
|
|
276021
|
+
const engine = {
|
|
276022
|
+
name: ENGINE_MAP.Gecko
|
|
276023
|
+
};
|
|
276024
|
+
const version2 = Utils.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, ua);
|
|
276025
|
+
if (version2) {
|
|
276026
|
+
engine.version = version2;
|
|
276027
|
+
}
|
|
276028
|
+
return engine;
|
|
276029
|
+
}
|
|
276030
|
+
},
|
|
276031
|
+
{
|
|
276032
|
+
test: [/(apple)?webkit\/537\.36/i],
|
|
276033
|
+
describe() {
|
|
276034
|
+
return {
|
|
276035
|
+
name: ENGINE_MAP.Blink
|
|
276036
|
+
};
|
|
276037
|
+
}
|
|
276038
|
+
},
|
|
276039
|
+
{
|
|
276040
|
+
test: [/(apple)?webkit/i],
|
|
276041
|
+
describe(ua) {
|
|
276042
|
+
const engine = {
|
|
276043
|
+
name: ENGINE_MAP.WebKit
|
|
276044
|
+
};
|
|
276045
|
+
const version2 = Utils.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, ua);
|
|
276046
|
+
if (version2) {
|
|
276047
|
+
engine.version = version2;
|
|
276048
|
+
}
|
|
276049
|
+
return engine;
|
|
276050
|
+
}
|
|
276051
|
+
}
|
|
276052
|
+
];
|
|
276053
|
+
class Parser {
|
|
276054
|
+
constructor(UA, skipParsing = false) {
|
|
276055
|
+
if (UA === void 0 || UA === null || UA === "") {
|
|
276056
|
+
throw new Error("UserAgent parameter can't be empty");
|
|
276057
|
+
}
|
|
276058
|
+
this._ua = UA;
|
|
276059
|
+
this.parsedResult = {};
|
|
276060
|
+
if (skipParsing !== true) {
|
|
276061
|
+
this.parse();
|
|
276062
|
+
}
|
|
276063
|
+
}
|
|
276064
|
+
getUA() {
|
|
276065
|
+
return this._ua;
|
|
276066
|
+
}
|
|
276067
|
+
test(regex2) {
|
|
276068
|
+
return regex2.test(this._ua);
|
|
276069
|
+
}
|
|
276070
|
+
parseBrowser() {
|
|
276071
|
+
this.parsedResult.browser = {};
|
|
276072
|
+
const browserDescriptor = Utils.find(browsersList, (_browser) => {
|
|
276073
|
+
if (typeof _browser.test === "function") {
|
|
276074
|
+
return _browser.test(this);
|
|
276075
|
+
}
|
|
276076
|
+
if (_browser.test instanceof Array) {
|
|
276077
|
+
return _browser.test.some((condition) => this.test(condition));
|
|
276078
|
+
}
|
|
276079
|
+
throw new Error("Browser's test function is not valid");
|
|
276080
|
+
});
|
|
276081
|
+
if (browserDescriptor) {
|
|
276082
|
+
this.parsedResult.browser = browserDescriptor.describe(this.getUA());
|
|
276083
|
+
}
|
|
276084
|
+
return this.parsedResult.browser;
|
|
276085
|
+
}
|
|
276086
|
+
getBrowser() {
|
|
276087
|
+
if (this.parsedResult.browser) {
|
|
276088
|
+
return this.parsedResult.browser;
|
|
276089
|
+
}
|
|
276090
|
+
return this.parseBrowser();
|
|
276091
|
+
}
|
|
276092
|
+
getBrowserName(toLowerCase) {
|
|
276093
|
+
if (toLowerCase) {
|
|
276094
|
+
return String(this.getBrowser().name).toLowerCase() || "";
|
|
276095
|
+
}
|
|
276096
|
+
return this.getBrowser().name || "";
|
|
276097
|
+
}
|
|
276098
|
+
getBrowserVersion() {
|
|
276099
|
+
return this.getBrowser().version;
|
|
276100
|
+
}
|
|
276101
|
+
getOS() {
|
|
276102
|
+
if (this.parsedResult.os) {
|
|
276103
|
+
return this.parsedResult.os;
|
|
276104
|
+
}
|
|
276105
|
+
return this.parseOS();
|
|
276106
|
+
}
|
|
276107
|
+
parseOS() {
|
|
276108
|
+
this.parsedResult.os = {};
|
|
276109
|
+
const os = Utils.find(osParsersList, (_os) => {
|
|
276110
|
+
if (typeof _os.test === "function") {
|
|
276111
|
+
return _os.test(this);
|
|
276112
|
+
}
|
|
276113
|
+
if (_os.test instanceof Array) {
|
|
276114
|
+
return _os.test.some((condition) => this.test(condition));
|
|
276115
|
+
}
|
|
276116
|
+
throw new Error("Browser's test function is not valid");
|
|
276117
|
+
});
|
|
276118
|
+
if (os) {
|
|
276119
|
+
this.parsedResult.os = os.describe(this.getUA());
|
|
276120
|
+
}
|
|
276121
|
+
return this.parsedResult.os;
|
|
276122
|
+
}
|
|
276123
|
+
getOSName(toLowerCase) {
|
|
276124
|
+
const { name: name2 } = this.getOS();
|
|
276125
|
+
if (toLowerCase) {
|
|
276126
|
+
return String(name2).toLowerCase() || "";
|
|
276127
|
+
}
|
|
276128
|
+
return name2 || "";
|
|
276129
|
+
}
|
|
276130
|
+
getOSVersion() {
|
|
276131
|
+
return this.getOS().version;
|
|
276132
|
+
}
|
|
276133
|
+
getPlatform() {
|
|
276134
|
+
if (this.parsedResult.platform) {
|
|
276135
|
+
return this.parsedResult.platform;
|
|
276136
|
+
}
|
|
276137
|
+
return this.parsePlatform();
|
|
276138
|
+
}
|
|
276139
|
+
getPlatformType(toLowerCase = false) {
|
|
276140
|
+
const { type: type2 } = this.getPlatform();
|
|
276141
|
+
if (toLowerCase) {
|
|
276142
|
+
return String(type2).toLowerCase() || "";
|
|
276143
|
+
}
|
|
276144
|
+
return type2 || "";
|
|
276145
|
+
}
|
|
276146
|
+
parsePlatform() {
|
|
276147
|
+
this.parsedResult.platform = {};
|
|
276148
|
+
const platform = Utils.find(platformParsersList, (_platform) => {
|
|
276149
|
+
if (typeof _platform.test === "function") {
|
|
276150
|
+
return _platform.test(this);
|
|
276151
|
+
}
|
|
276152
|
+
if (_platform.test instanceof Array) {
|
|
276153
|
+
return _platform.test.some((condition) => this.test(condition));
|
|
276154
|
+
}
|
|
276155
|
+
throw new Error("Browser's test function is not valid");
|
|
276156
|
+
});
|
|
276157
|
+
if (platform) {
|
|
276158
|
+
this.parsedResult.platform = platform.describe(this.getUA());
|
|
276159
|
+
}
|
|
276160
|
+
return this.parsedResult.platform;
|
|
276161
|
+
}
|
|
276162
|
+
getEngine() {
|
|
276163
|
+
if (this.parsedResult.engine) {
|
|
276164
|
+
return this.parsedResult.engine;
|
|
276165
|
+
}
|
|
276166
|
+
return this.parseEngine();
|
|
276167
|
+
}
|
|
276168
|
+
getEngineName(toLowerCase) {
|
|
276169
|
+
if (toLowerCase) {
|
|
276170
|
+
return String(this.getEngine().name).toLowerCase() || "";
|
|
276171
|
+
}
|
|
276172
|
+
return this.getEngine().name || "";
|
|
276173
|
+
}
|
|
276174
|
+
parseEngine() {
|
|
276175
|
+
this.parsedResult.engine = {};
|
|
276176
|
+
const engine = Utils.find(enginesParsersList, (_engine) => {
|
|
276177
|
+
if (typeof _engine.test === "function") {
|
|
276178
|
+
return _engine.test(this);
|
|
276179
|
+
}
|
|
276180
|
+
if (_engine.test instanceof Array) {
|
|
276181
|
+
return _engine.test.some((condition) => this.test(condition));
|
|
276182
|
+
}
|
|
276183
|
+
throw new Error("Browser's test function is not valid");
|
|
276184
|
+
});
|
|
276185
|
+
if (engine) {
|
|
276186
|
+
this.parsedResult.engine = engine.describe(this.getUA());
|
|
276187
|
+
}
|
|
276188
|
+
return this.parsedResult.engine;
|
|
276189
|
+
}
|
|
276190
|
+
parse() {
|
|
276191
|
+
this.parseBrowser();
|
|
276192
|
+
this.parseOS();
|
|
276193
|
+
this.parsePlatform();
|
|
276194
|
+
this.parseEngine();
|
|
276195
|
+
return this;
|
|
276196
|
+
}
|
|
276197
|
+
getResult() {
|
|
276198
|
+
return Utils.assign({}, this.parsedResult);
|
|
276199
|
+
}
|
|
276200
|
+
satisfies(checkTree) {
|
|
276201
|
+
const platformsAndOSes = {};
|
|
276202
|
+
let platformsAndOSCounter = 0;
|
|
276203
|
+
const browsers = {};
|
|
276204
|
+
let browsersCounter = 0;
|
|
276205
|
+
const allDefinitions = Object.keys(checkTree);
|
|
276206
|
+
allDefinitions.forEach((key2) => {
|
|
276207
|
+
const currentDefinition = checkTree[key2];
|
|
276208
|
+
if (typeof currentDefinition === "string") {
|
|
276209
|
+
browsers[key2] = currentDefinition;
|
|
276210
|
+
browsersCounter += 1;
|
|
276211
|
+
} else if (typeof currentDefinition === "object") {
|
|
276212
|
+
platformsAndOSes[key2] = currentDefinition;
|
|
276213
|
+
platformsAndOSCounter += 1;
|
|
276214
|
+
}
|
|
276215
|
+
});
|
|
276216
|
+
if (platformsAndOSCounter > 0) {
|
|
276217
|
+
const platformsAndOSNames = Object.keys(platformsAndOSes);
|
|
276218
|
+
const OSMatchingDefinition = Utils.find(platformsAndOSNames, (name2) => this.isOS(name2));
|
|
276219
|
+
if (OSMatchingDefinition) {
|
|
276220
|
+
const osResult = this.satisfies(platformsAndOSes[OSMatchingDefinition]);
|
|
276221
|
+
if (osResult !== void 0) {
|
|
276222
|
+
return osResult;
|
|
276223
|
+
}
|
|
276224
|
+
}
|
|
276225
|
+
const platformMatchingDefinition = Utils.find(
|
|
276226
|
+
platformsAndOSNames,
|
|
276227
|
+
(name2) => this.isPlatform(name2)
|
|
276228
|
+
);
|
|
276229
|
+
if (platformMatchingDefinition) {
|
|
276230
|
+
const platformResult = this.satisfies(platformsAndOSes[platformMatchingDefinition]);
|
|
276231
|
+
if (platformResult !== void 0) {
|
|
276232
|
+
return platformResult;
|
|
276233
|
+
}
|
|
276234
|
+
}
|
|
276235
|
+
}
|
|
276236
|
+
if (browsersCounter > 0) {
|
|
276237
|
+
const browserNames = Object.keys(browsers);
|
|
276238
|
+
const matchingDefinition = Utils.find(browserNames, (name2) => this.isBrowser(name2, true));
|
|
276239
|
+
if (matchingDefinition !== void 0) {
|
|
276240
|
+
return this.compareVersion(browsers[matchingDefinition]);
|
|
276241
|
+
}
|
|
276242
|
+
}
|
|
276243
|
+
return void 0;
|
|
276244
|
+
}
|
|
276245
|
+
isBrowser(browserName, includingAlias = false) {
|
|
276246
|
+
const defaultBrowserName = this.getBrowserName().toLowerCase();
|
|
276247
|
+
let browserNameLower = browserName.toLowerCase();
|
|
276248
|
+
const alias = Utils.getBrowserTypeByAlias(browserNameLower);
|
|
276249
|
+
if (includingAlias && alias) {
|
|
276250
|
+
browserNameLower = alias.toLowerCase();
|
|
276251
|
+
}
|
|
276252
|
+
return browserNameLower === defaultBrowserName;
|
|
276253
|
+
}
|
|
276254
|
+
compareVersion(version2) {
|
|
276255
|
+
let expectedResults = [0];
|
|
276256
|
+
let comparableVersion = version2;
|
|
276257
|
+
let isLoose = false;
|
|
276258
|
+
const currentBrowserVersion = this.getBrowserVersion();
|
|
276259
|
+
if (typeof currentBrowserVersion !== "string") {
|
|
276260
|
+
return void 0;
|
|
276261
|
+
}
|
|
276262
|
+
if (version2[0] === ">" || version2[0] === "<") {
|
|
276263
|
+
comparableVersion = version2.substr(1);
|
|
276264
|
+
if (version2[1] === "=") {
|
|
276265
|
+
isLoose = true;
|
|
276266
|
+
comparableVersion = version2.substr(2);
|
|
276267
|
+
} else {
|
|
276268
|
+
expectedResults = [];
|
|
276269
|
+
}
|
|
276270
|
+
if (version2[0] === ">") {
|
|
276271
|
+
expectedResults.push(1);
|
|
276272
|
+
} else {
|
|
276273
|
+
expectedResults.push(-1);
|
|
276274
|
+
}
|
|
276275
|
+
} else if (version2[0] === "=") {
|
|
276276
|
+
comparableVersion = version2.substr(1);
|
|
276277
|
+
} else if (version2[0] === "~") {
|
|
276278
|
+
isLoose = true;
|
|
276279
|
+
comparableVersion = version2.substr(1);
|
|
276280
|
+
}
|
|
276281
|
+
return expectedResults.indexOf(
|
|
276282
|
+
Utils.compareVersions(currentBrowserVersion, comparableVersion, isLoose)
|
|
276283
|
+
) > -1;
|
|
276284
|
+
}
|
|
276285
|
+
isOS(osName) {
|
|
276286
|
+
return this.getOSName(true) === String(osName).toLowerCase();
|
|
276287
|
+
}
|
|
276288
|
+
isPlatform(platformType) {
|
|
276289
|
+
return this.getPlatformType(true) === String(platformType).toLowerCase();
|
|
276290
|
+
}
|
|
276291
|
+
isEngine(engineName) {
|
|
276292
|
+
return this.getEngineName(true) === String(engineName).toLowerCase();
|
|
276293
|
+
}
|
|
276294
|
+
is(anything, includingAlias = false) {
|
|
276295
|
+
return this.isBrowser(anything, includingAlias) || this.isOS(anything) || this.isPlatform(anything);
|
|
276296
|
+
}
|
|
276297
|
+
some(anythings = []) {
|
|
276298
|
+
return anythings.some((anything) => this.is(anything));
|
|
276299
|
+
}
|
|
276300
|
+
}
|
|
276301
|
+
/*!
|
|
276302
|
+
* Bowser - a browser detector
|
|
276303
|
+
* https://github.com/lancedikson/bowser
|
|
276304
|
+
* MIT License | (c) Dustin Diaz 2012-2015
|
|
276305
|
+
* MIT License | (c) Denis Demchenko 2015-2019
|
|
276306
|
+
*/
|
|
276307
|
+
class Bowser {
|
|
276308
|
+
static getParser(UA, skipParsing = false) {
|
|
276309
|
+
if (typeof UA !== "string") {
|
|
276310
|
+
throw new Error("UserAgent should be a string");
|
|
276311
|
+
}
|
|
276312
|
+
return new Parser(UA, skipParsing);
|
|
276313
|
+
}
|
|
276314
|
+
static parse(UA) {
|
|
276315
|
+
return new Parser(UA).getResult();
|
|
276316
|
+
}
|
|
276317
|
+
static get BROWSER_MAP() {
|
|
276318
|
+
return BROWSER_MAP;
|
|
276319
|
+
}
|
|
276320
|
+
static get ENGINE_MAP() {
|
|
276321
|
+
return ENGINE_MAP;
|
|
276322
|
+
}
|
|
276323
|
+
static get OS_MAP() {
|
|
276324
|
+
return OS_MAP;
|
|
276325
|
+
}
|
|
276326
|
+
static get PLATFORMS_MAP() {
|
|
276327
|
+
return PLATFORMS_MAP;
|
|
276328
|
+
}
|
|
276329
|
+
}
|
|
276330
|
+
var lzString = { exports: {} };
|
|
276331
|
+
(function(module3) {
|
|
276332
|
+
var LZString = function() {
|
|
276333
|
+
var f2 = String.fromCharCode;
|
|
276334
|
+
var keyStrBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
276335
|
+
var keyStrUriSafe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$";
|
|
276336
|
+
var baseReverseDic = {};
|
|
276337
|
+
function getBaseValue(alphabet, character) {
|
|
276338
|
+
if (!baseReverseDic[alphabet]) {
|
|
276339
|
+
baseReverseDic[alphabet] = {};
|
|
276340
|
+
for (var i2 = 0; i2 < alphabet.length; i2++) {
|
|
276341
|
+
baseReverseDic[alphabet][alphabet.charAt(i2)] = i2;
|
|
276342
|
+
}
|
|
276343
|
+
}
|
|
276344
|
+
return baseReverseDic[alphabet][character];
|
|
276345
|
+
}
|
|
276346
|
+
var LZString2 = {
|
|
276347
|
+
compressToBase64: function(input) {
|
|
276348
|
+
if (input == null)
|
|
276349
|
+
return "";
|
|
276350
|
+
var res = LZString2._compress(input, 6, function(a2) {
|
|
276351
|
+
return keyStrBase64.charAt(a2);
|
|
276352
|
+
});
|
|
276353
|
+
switch (res.length % 4) {
|
|
276354
|
+
default:
|
|
276355
|
+
case 0:
|
|
276356
|
+
return res;
|
|
276357
|
+
case 1:
|
|
276358
|
+
return res + "===";
|
|
276359
|
+
case 2:
|
|
276360
|
+
return res + "==";
|
|
276361
|
+
case 3:
|
|
276362
|
+
return res + "=";
|
|
276363
|
+
}
|
|
276364
|
+
},
|
|
276365
|
+
decompressFromBase64: function(input) {
|
|
276366
|
+
if (input == null)
|
|
276367
|
+
return "";
|
|
276368
|
+
if (input == "")
|
|
276369
|
+
return null;
|
|
276370
|
+
return LZString2._decompress(input.length, 32, function(index2) {
|
|
276371
|
+
return getBaseValue(keyStrBase64, input.charAt(index2));
|
|
276372
|
+
});
|
|
276373
|
+
},
|
|
276374
|
+
compressToUTF16: function(input) {
|
|
276375
|
+
if (input == null)
|
|
276376
|
+
return "";
|
|
276377
|
+
return LZString2._compress(input, 15, function(a2) {
|
|
276378
|
+
return f2(a2 + 32);
|
|
276379
|
+
}) + " ";
|
|
276380
|
+
},
|
|
276381
|
+
decompressFromUTF16: function(compressed) {
|
|
276382
|
+
if (compressed == null)
|
|
276383
|
+
return "";
|
|
276384
|
+
if (compressed == "")
|
|
276385
|
+
return null;
|
|
276386
|
+
return LZString2._decompress(compressed.length, 16384, function(index2) {
|
|
276387
|
+
return compressed.charCodeAt(index2) - 32;
|
|
276388
|
+
});
|
|
276389
|
+
},
|
|
276390
|
+
compressToUint8Array: function(uncompressed) {
|
|
276391
|
+
var compressed = LZString2.compress(uncompressed);
|
|
276392
|
+
var buf = new Uint8Array(compressed.length * 2);
|
|
276393
|
+
for (var i2 = 0, TotalLen = compressed.length; i2 < TotalLen; i2++) {
|
|
276394
|
+
var current_value = compressed.charCodeAt(i2);
|
|
276395
|
+
buf[i2 * 2] = current_value >>> 8;
|
|
276396
|
+
buf[i2 * 2 + 1] = current_value % 256;
|
|
276397
|
+
}
|
|
276398
|
+
return buf;
|
|
276399
|
+
},
|
|
276400
|
+
decompressFromUint8Array: function(compressed) {
|
|
276401
|
+
if (compressed === null || compressed === void 0) {
|
|
276402
|
+
return LZString2.decompress(compressed);
|
|
276403
|
+
} else {
|
|
276404
|
+
var buf = new Array(compressed.length / 2);
|
|
276405
|
+
for (var i2 = 0, TotalLen = buf.length; i2 < TotalLen; i2++) {
|
|
276406
|
+
buf[i2] = compressed[i2 * 2] * 256 + compressed[i2 * 2 + 1];
|
|
276407
|
+
}
|
|
276408
|
+
var result = [];
|
|
276409
|
+
buf.forEach(function(c2) {
|
|
276410
|
+
result.push(f2(c2));
|
|
276411
|
+
});
|
|
276412
|
+
return LZString2.decompress(result.join(""));
|
|
276413
|
+
}
|
|
276414
|
+
},
|
|
276415
|
+
compressToEncodedURIComponent: function(input) {
|
|
276416
|
+
if (input == null)
|
|
276417
|
+
return "";
|
|
276418
|
+
return LZString2._compress(input, 6, function(a2) {
|
|
276419
|
+
return keyStrUriSafe.charAt(a2);
|
|
276420
|
+
});
|
|
276421
|
+
},
|
|
276422
|
+
decompressFromEncodedURIComponent: function(input) {
|
|
276423
|
+
if (input == null)
|
|
276424
|
+
return "";
|
|
276425
|
+
if (input == "")
|
|
276426
|
+
return null;
|
|
276427
|
+
input = input.replace(/ /g, "+");
|
|
276428
|
+
return LZString2._decompress(input.length, 32, function(index2) {
|
|
276429
|
+
return getBaseValue(keyStrUriSafe, input.charAt(index2));
|
|
276430
|
+
});
|
|
276431
|
+
},
|
|
276432
|
+
compress: function(uncompressed) {
|
|
276433
|
+
return LZString2._compress(uncompressed, 16, function(a2) {
|
|
276434
|
+
return f2(a2);
|
|
276435
|
+
});
|
|
276436
|
+
},
|
|
276437
|
+
_compress: function(uncompressed, bitsPerChar, getCharFromInt) {
|
|
276438
|
+
if (uncompressed == null)
|
|
276439
|
+
return "";
|
|
276440
|
+
var i2, value2, context_dictionary = {}, context_dictionaryToCreate = {}, context_c = "", context_wc = "", context_w = "", context_enlargeIn = 2, context_dictSize = 3, context_numBits = 2, context_data = [], context_data_val = 0, context_data_position = 0, ii;
|
|
276441
|
+
for (ii = 0; ii < uncompressed.length; ii += 1) {
|
|
276442
|
+
context_c = uncompressed.charAt(ii);
|
|
276443
|
+
if (!Object.prototype.hasOwnProperty.call(context_dictionary, context_c)) {
|
|
276444
|
+
context_dictionary[context_c] = context_dictSize++;
|
|
276445
|
+
context_dictionaryToCreate[context_c] = true;
|
|
276446
|
+
}
|
|
276447
|
+
context_wc = context_w + context_c;
|
|
276448
|
+
if (Object.prototype.hasOwnProperty.call(context_dictionary, context_wc)) {
|
|
276449
|
+
context_w = context_wc;
|
|
276450
|
+
} else {
|
|
276451
|
+
if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {
|
|
276452
|
+
if (context_w.charCodeAt(0) < 256) {
|
|
276453
|
+
for (i2 = 0; i2 < context_numBits; i2++) {
|
|
276454
|
+
context_data_val = context_data_val << 1;
|
|
276455
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
276456
|
+
context_data_position = 0;
|
|
276457
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
276458
|
+
context_data_val = 0;
|
|
276459
|
+
} else {
|
|
276460
|
+
context_data_position++;
|
|
276461
|
+
}
|
|
276462
|
+
}
|
|
276463
|
+
value2 = context_w.charCodeAt(0);
|
|
276464
|
+
for (i2 = 0; i2 < 8; i2++) {
|
|
276465
|
+
context_data_val = context_data_val << 1 | value2 & 1;
|
|
276466
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
276467
|
+
context_data_position = 0;
|
|
276468
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
276469
|
+
context_data_val = 0;
|
|
276470
|
+
} else {
|
|
276471
|
+
context_data_position++;
|
|
276472
|
+
}
|
|
276473
|
+
value2 = value2 >> 1;
|
|
276474
|
+
}
|
|
276475
|
+
} else {
|
|
276476
|
+
value2 = 1;
|
|
276477
|
+
for (i2 = 0; i2 < context_numBits; i2++) {
|
|
276478
|
+
context_data_val = context_data_val << 1 | value2;
|
|
276479
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
276480
|
+
context_data_position = 0;
|
|
276481
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
276482
|
+
context_data_val = 0;
|
|
276483
|
+
} else {
|
|
276484
|
+
context_data_position++;
|
|
276485
|
+
}
|
|
276486
|
+
value2 = 0;
|
|
276487
|
+
}
|
|
276488
|
+
value2 = context_w.charCodeAt(0);
|
|
276489
|
+
for (i2 = 0; i2 < 16; i2++) {
|
|
276490
|
+
context_data_val = context_data_val << 1 | value2 & 1;
|
|
276491
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
276492
|
+
context_data_position = 0;
|
|
276493
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
276494
|
+
context_data_val = 0;
|
|
276495
|
+
} else {
|
|
276496
|
+
context_data_position++;
|
|
276497
|
+
}
|
|
276498
|
+
value2 = value2 >> 1;
|
|
276499
|
+
}
|
|
276500
|
+
}
|
|
276501
|
+
context_enlargeIn--;
|
|
276502
|
+
if (context_enlargeIn == 0) {
|
|
276503
|
+
context_enlargeIn = Math.pow(2, context_numBits);
|
|
276504
|
+
context_numBits++;
|
|
276505
|
+
}
|
|
276506
|
+
delete context_dictionaryToCreate[context_w];
|
|
276507
|
+
} else {
|
|
276508
|
+
value2 = context_dictionary[context_w];
|
|
276509
|
+
for (i2 = 0; i2 < context_numBits; i2++) {
|
|
276510
|
+
context_data_val = context_data_val << 1 | value2 & 1;
|
|
276511
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
276512
|
+
context_data_position = 0;
|
|
276513
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
276514
|
+
context_data_val = 0;
|
|
276515
|
+
} else {
|
|
276516
|
+
context_data_position++;
|
|
276517
|
+
}
|
|
276518
|
+
value2 = value2 >> 1;
|
|
276519
|
+
}
|
|
276520
|
+
}
|
|
276521
|
+
context_enlargeIn--;
|
|
276522
|
+
if (context_enlargeIn == 0) {
|
|
276523
|
+
context_enlargeIn = Math.pow(2, context_numBits);
|
|
276524
|
+
context_numBits++;
|
|
276525
|
+
}
|
|
276526
|
+
context_dictionary[context_wc] = context_dictSize++;
|
|
276527
|
+
context_w = String(context_c);
|
|
276528
|
+
}
|
|
276529
|
+
}
|
|
276530
|
+
if (context_w !== "") {
|
|
276531
|
+
if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {
|
|
276532
|
+
if (context_w.charCodeAt(0) < 256) {
|
|
276533
|
+
for (i2 = 0; i2 < context_numBits; i2++) {
|
|
276534
|
+
context_data_val = context_data_val << 1;
|
|
276535
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
276536
|
+
context_data_position = 0;
|
|
276537
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
276538
|
+
context_data_val = 0;
|
|
276539
|
+
} else {
|
|
276540
|
+
context_data_position++;
|
|
276541
|
+
}
|
|
276542
|
+
}
|
|
276543
|
+
value2 = context_w.charCodeAt(0);
|
|
276544
|
+
for (i2 = 0; i2 < 8; i2++) {
|
|
276545
|
+
context_data_val = context_data_val << 1 | value2 & 1;
|
|
276546
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
276547
|
+
context_data_position = 0;
|
|
276548
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
276549
|
+
context_data_val = 0;
|
|
276550
|
+
} else {
|
|
276551
|
+
context_data_position++;
|
|
276552
|
+
}
|
|
276553
|
+
value2 = value2 >> 1;
|
|
276554
|
+
}
|
|
276555
|
+
} else {
|
|
276556
|
+
value2 = 1;
|
|
276557
|
+
for (i2 = 0; i2 < context_numBits; i2++) {
|
|
276558
|
+
context_data_val = context_data_val << 1 | value2;
|
|
276559
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
276560
|
+
context_data_position = 0;
|
|
276561
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
276562
|
+
context_data_val = 0;
|
|
276563
|
+
} else {
|
|
276564
|
+
context_data_position++;
|
|
276565
|
+
}
|
|
276566
|
+
value2 = 0;
|
|
276567
|
+
}
|
|
276568
|
+
value2 = context_w.charCodeAt(0);
|
|
276569
|
+
for (i2 = 0; i2 < 16; i2++) {
|
|
276570
|
+
context_data_val = context_data_val << 1 | value2 & 1;
|
|
276571
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
276572
|
+
context_data_position = 0;
|
|
276573
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
276574
|
+
context_data_val = 0;
|
|
276575
|
+
} else {
|
|
276576
|
+
context_data_position++;
|
|
276577
|
+
}
|
|
276578
|
+
value2 = value2 >> 1;
|
|
276579
|
+
}
|
|
276580
|
+
}
|
|
276581
|
+
context_enlargeIn--;
|
|
276582
|
+
if (context_enlargeIn == 0) {
|
|
276583
|
+
context_enlargeIn = Math.pow(2, context_numBits);
|
|
276584
|
+
context_numBits++;
|
|
276585
|
+
}
|
|
276586
|
+
delete context_dictionaryToCreate[context_w];
|
|
276587
|
+
} else {
|
|
276588
|
+
value2 = context_dictionary[context_w];
|
|
276589
|
+
for (i2 = 0; i2 < context_numBits; i2++) {
|
|
276590
|
+
context_data_val = context_data_val << 1 | value2 & 1;
|
|
276591
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
276592
|
+
context_data_position = 0;
|
|
276593
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
276594
|
+
context_data_val = 0;
|
|
276595
|
+
} else {
|
|
276596
|
+
context_data_position++;
|
|
276597
|
+
}
|
|
276598
|
+
value2 = value2 >> 1;
|
|
276599
|
+
}
|
|
276600
|
+
}
|
|
276601
|
+
context_enlargeIn--;
|
|
276602
|
+
if (context_enlargeIn == 0) {
|
|
276603
|
+
context_enlargeIn = Math.pow(2, context_numBits);
|
|
276604
|
+
context_numBits++;
|
|
276605
|
+
}
|
|
276606
|
+
}
|
|
276607
|
+
value2 = 2;
|
|
276608
|
+
for (i2 = 0; i2 < context_numBits; i2++) {
|
|
276609
|
+
context_data_val = context_data_val << 1 | value2 & 1;
|
|
276610
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
276611
|
+
context_data_position = 0;
|
|
276612
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
276613
|
+
context_data_val = 0;
|
|
276614
|
+
} else {
|
|
276615
|
+
context_data_position++;
|
|
276616
|
+
}
|
|
276617
|
+
value2 = value2 >> 1;
|
|
276618
|
+
}
|
|
276619
|
+
while (true) {
|
|
276620
|
+
context_data_val = context_data_val << 1;
|
|
276621
|
+
if (context_data_position == bitsPerChar - 1) {
|
|
276622
|
+
context_data.push(getCharFromInt(context_data_val));
|
|
276623
|
+
break;
|
|
276624
|
+
} else
|
|
276625
|
+
context_data_position++;
|
|
276626
|
+
}
|
|
276627
|
+
return context_data.join("");
|
|
276628
|
+
},
|
|
276629
|
+
decompress: function(compressed) {
|
|
276630
|
+
if (compressed == null)
|
|
276631
|
+
return "";
|
|
276632
|
+
if (compressed == "")
|
|
276633
|
+
return null;
|
|
276634
|
+
return LZString2._decompress(compressed.length, 32768, function(index2) {
|
|
276635
|
+
return compressed.charCodeAt(index2);
|
|
276636
|
+
});
|
|
276637
|
+
},
|
|
276638
|
+
_decompress: function(length2, resetValue, getNextValue) {
|
|
276639
|
+
var dictionary = [], enlargeIn = 4, dictSize = 4, numBits = 3, entry2 = "", result = [], i2, w2, bits, resb, maxpower, power, c2, data2 = { val: getNextValue(0), position: resetValue, index: 1 };
|
|
276640
|
+
for (i2 = 0; i2 < 3; i2 += 1) {
|
|
276641
|
+
dictionary[i2] = i2;
|
|
276642
|
+
}
|
|
276643
|
+
bits = 0;
|
|
276644
|
+
maxpower = Math.pow(2, 2);
|
|
276645
|
+
power = 1;
|
|
276646
|
+
while (power != maxpower) {
|
|
276647
|
+
resb = data2.val & data2.position;
|
|
276648
|
+
data2.position >>= 1;
|
|
276649
|
+
if (data2.position == 0) {
|
|
276650
|
+
data2.position = resetValue;
|
|
276651
|
+
data2.val = getNextValue(data2.index++);
|
|
276652
|
+
}
|
|
276653
|
+
bits |= (resb > 0 ? 1 : 0) * power;
|
|
276654
|
+
power <<= 1;
|
|
276655
|
+
}
|
|
276656
|
+
switch (bits) {
|
|
276657
|
+
case 0:
|
|
276658
|
+
bits = 0;
|
|
276659
|
+
maxpower = Math.pow(2, 8);
|
|
276660
|
+
power = 1;
|
|
276661
|
+
while (power != maxpower) {
|
|
276662
|
+
resb = data2.val & data2.position;
|
|
276663
|
+
data2.position >>= 1;
|
|
276664
|
+
if (data2.position == 0) {
|
|
276665
|
+
data2.position = resetValue;
|
|
276666
|
+
data2.val = getNextValue(data2.index++);
|
|
276667
|
+
}
|
|
276668
|
+
bits |= (resb > 0 ? 1 : 0) * power;
|
|
276669
|
+
power <<= 1;
|
|
276670
|
+
}
|
|
276671
|
+
c2 = f2(bits);
|
|
276672
|
+
break;
|
|
276673
|
+
case 1:
|
|
276674
|
+
bits = 0;
|
|
276675
|
+
maxpower = Math.pow(2, 16);
|
|
276676
|
+
power = 1;
|
|
276677
|
+
while (power != maxpower) {
|
|
276678
|
+
resb = data2.val & data2.position;
|
|
276679
|
+
data2.position >>= 1;
|
|
276680
|
+
if (data2.position == 0) {
|
|
276681
|
+
data2.position = resetValue;
|
|
276682
|
+
data2.val = getNextValue(data2.index++);
|
|
276683
|
+
}
|
|
276684
|
+
bits |= (resb > 0 ? 1 : 0) * power;
|
|
276685
|
+
power <<= 1;
|
|
276686
|
+
}
|
|
276687
|
+
c2 = f2(bits);
|
|
276688
|
+
break;
|
|
276689
|
+
case 2:
|
|
276690
|
+
return "";
|
|
276691
|
+
}
|
|
276692
|
+
dictionary[3] = c2;
|
|
276693
|
+
w2 = c2;
|
|
276694
|
+
result.push(c2);
|
|
276695
|
+
while (true) {
|
|
276696
|
+
if (data2.index > length2) {
|
|
276697
|
+
return "";
|
|
276698
|
+
}
|
|
276699
|
+
bits = 0;
|
|
276700
|
+
maxpower = Math.pow(2, numBits);
|
|
276701
|
+
power = 1;
|
|
276702
|
+
while (power != maxpower) {
|
|
276703
|
+
resb = data2.val & data2.position;
|
|
276704
|
+
data2.position >>= 1;
|
|
276705
|
+
if (data2.position == 0) {
|
|
276706
|
+
data2.position = resetValue;
|
|
276707
|
+
data2.val = getNextValue(data2.index++);
|
|
276708
|
+
}
|
|
276709
|
+
bits |= (resb > 0 ? 1 : 0) * power;
|
|
276710
|
+
power <<= 1;
|
|
276711
|
+
}
|
|
276712
|
+
switch (c2 = bits) {
|
|
276713
|
+
case 0:
|
|
276714
|
+
bits = 0;
|
|
276715
|
+
maxpower = Math.pow(2, 8);
|
|
276716
|
+
power = 1;
|
|
276717
|
+
while (power != maxpower) {
|
|
276718
|
+
resb = data2.val & data2.position;
|
|
276719
|
+
data2.position >>= 1;
|
|
276720
|
+
if (data2.position == 0) {
|
|
276721
|
+
data2.position = resetValue;
|
|
276722
|
+
data2.val = getNextValue(data2.index++);
|
|
276723
|
+
}
|
|
276724
|
+
bits |= (resb > 0 ? 1 : 0) * power;
|
|
276725
|
+
power <<= 1;
|
|
276726
|
+
}
|
|
276727
|
+
dictionary[dictSize++] = f2(bits);
|
|
276728
|
+
c2 = dictSize - 1;
|
|
276729
|
+
enlargeIn--;
|
|
276730
|
+
break;
|
|
276731
|
+
case 1:
|
|
276732
|
+
bits = 0;
|
|
276733
|
+
maxpower = Math.pow(2, 16);
|
|
276734
|
+
power = 1;
|
|
276735
|
+
while (power != maxpower) {
|
|
276736
|
+
resb = data2.val & data2.position;
|
|
276737
|
+
data2.position >>= 1;
|
|
276738
|
+
if (data2.position == 0) {
|
|
276739
|
+
data2.position = resetValue;
|
|
276740
|
+
data2.val = getNextValue(data2.index++);
|
|
276741
|
+
}
|
|
276742
|
+
bits |= (resb > 0 ? 1 : 0) * power;
|
|
276743
|
+
power <<= 1;
|
|
276744
|
+
}
|
|
276745
|
+
dictionary[dictSize++] = f2(bits);
|
|
276746
|
+
c2 = dictSize - 1;
|
|
276747
|
+
enlargeIn--;
|
|
276748
|
+
break;
|
|
276749
|
+
case 2:
|
|
276750
|
+
return result.join("");
|
|
276751
|
+
}
|
|
276752
|
+
if (enlargeIn == 0) {
|
|
276753
|
+
enlargeIn = Math.pow(2, numBits);
|
|
276754
|
+
numBits++;
|
|
276755
|
+
}
|
|
276756
|
+
if (dictionary[c2]) {
|
|
276757
|
+
entry2 = dictionary[c2];
|
|
276758
|
+
} else {
|
|
276759
|
+
if (c2 === dictSize) {
|
|
276760
|
+
entry2 = w2 + w2.charAt(0);
|
|
276761
|
+
} else {
|
|
276762
|
+
return null;
|
|
276763
|
+
}
|
|
276764
|
+
}
|
|
276765
|
+
result.push(entry2);
|
|
276766
|
+
dictionary[dictSize++] = w2 + entry2.charAt(0);
|
|
276767
|
+
enlargeIn--;
|
|
276768
|
+
w2 = entry2;
|
|
276769
|
+
if (enlargeIn == 0) {
|
|
276770
|
+
enlargeIn = Math.pow(2, numBits);
|
|
276771
|
+
numBits++;
|
|
276772
|
+
}
|
|
276773
|
+
}
|
|
276774
|
+
}
|
|
276775
|
+
};
|
|
276776
|
+
return LZString2;
|
|
276777
|
+
}();
|
|
276778
|
+
if (module3 != null) {
|
|
276779
|
+
module3.exports = LZString;
|
|
276780
|
+
}
|
|
276781
|
+
})(lzString);
|
|
276782
|
+
const CURRENT_VERSION = "0.0.1";
|
|
276783
|
+
const VITESSCE_CONF_QUERY_STRING = "vitessce_conf";
|
|
276784
|
+
const VERSION_QUERY_STRING = "vitessce_conf_version";
|
|
276785
|
+
const LENGTH_QUERY_STRING = "vitessce_conf_length";
|
|
276786
|
+
function sniffBrowser() {
|
|
276787
|
+
const { browser: browser2 } = Bowser.parse(window.navigator.userAgent);
|
|
276788
|
+
return browser2.name;
|
|
276789
|
+
}
|
|
276790
|
+
const MAX_BROWSER_URL_LENGTHS = {
|
|
276791
|
+
Chrome: 32779,
|
|
276792
|
+
"Internet Explorer": 2047,
|
|
276793
|
+
Edge: 2047,
|
|
276794
|
+
Safari: 65e3,
|
|
276795
|
+
Firefox: 65e3
|
|
276796
|
+
};
|
|
276797
|
+
class CompressedConfLengthError {
|
|
276798
|
+
constructor(message) {
|
|
276799
|
+
this.message = message;
|
|
276800
|
+
}
|
|
276801
|
+
}
|
|
276802
|
+
function encodeConfInUrl({ conf, onOverMaximumUrlLength = () => {
|
|
276803
|
+
} }) {
|
|
276804
|
+
const compressedConf = lzString.exports.compressToEncodedURIComponent(JSON.stringify(conf));
|
|
276805
|
+
const newParams = `${LENGTH_QUERY_STRING}=${compressedConf.length}&${VERSION_QUERY_STRING}=${CURRENT_VERSION}&${VITESSCE_CONF_QUERY_STRING}=${compressedConf}`;
|
|
276806
|
+
const browser2 = sniffBrowser();
|
|
276807
|
+
const maxLength = MAX_BROWSER_URL_LENGTHS[browser2];
|
|
276808
|
+
if (newParams.length > maxLength) {
|
|
276809
|
+
const willWorkOn = Object.entries(MAX_BROWSER_URL_LENGTHS).filter((entry2) => entry2[1] > newParams.length).map((entry2) => entry2[0]);
|
|
276810
|
+
const message = `Configuration is ${compressedConf.length} characters; max URL for ${browser2} is ${maxLength}: it will work on ${willWorkOn.join(", ") || "no browser"}.`;
|
|
276811
|
+
console.error(message);
|
|
276812
|
+
onOverMaximumUrlLength({ message, willWorkOn });
|
|
276813
|
+
}
|
|
276814
|
+
return newParams;
|
|
276815
|
+
}
|
|
276816
|
+
function decodeURLParamsToConf(queryString) {
|
|
276817
|
+
const params2 = new URLSearchParams(queryString.replace("#", "&"));
|
|
276818
|
+
const compressedConfString = params2.get(VITESSCE_CONF_QUERY_STRING);
|
|
276819
|
+
const expectedConfLength = Number(params2.get(LENGTH_QUERY_STRING));
|
|
276820
|
+
if (expectedConfLength !== compressedConfString.length) {
|
|
276821
|
+
throw new CompressedConfLengthError(`Compressed conf length (${compressedConfString.length}) != expected (${expectedConfLength}). URL truncated?`);
|
|
276822
|
+
}
|
|
276823
|
+
const version2 = params2.get(VERSION_QUERY_STRING);
|
|
276824
|
+
if (version2 === CURRENT_VERSION) {
|
|
276825
|
+
const conf = JSON.parse(lzString.exports.decompressFromEncodedURIComponent(compressedConfString));
|
|
276826
|
+
return conf;
|
|
276827
|
+
}
|
|
276828
|
+
throw new Error("Unrecognized URL Param Version");
|
|
276829
|
+
}
|
|
275172
276830
|
class RawDecoder extends BaseDecoder {
|
|
275173
276831
|
decodeBlock(buffer2) {
|
|
275174
276832
|
return buffer2;
|
|
@@ -282088,6 +283746,8 @@ void main() {
|
|
|
282088
283746
|
exports2.ViewType = ViewType;
|
|
282089
283747
|
exports2.Vitessce = Vitessce;
|
|
282090
283748
|
exports2.VitessceConfig = VitessceConfig;
|
|
283749
|
+
exports2.decodeURLParamsToConf = decodeURLParamsToConf;
|
|
283750
|
+
exports2.encodeConfInUrl = encodeConfInUrl;
|
|
282091
283751
|
exports2.hconcat = hconcat;
|
|
282092
283752
|
exports2.vconcat = vconcat;
|
|
282093
283753
|
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|