@thunderid/browser 0.6.1 → 0.8.0
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/cjs/index.cjs +705 -199
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +695 -200
- package/dist/index.js.map +1 -1
- package/dist/utils/SPACryptoUtils.d.ts.map +1 -1
- package/dist/utils/anonymousAnimalIcons.generated.d.ts +26 -0
- package/dist/utils/anonymousAnimalIcons.generated.d.ts.map +1 -0
- package/dist/utils/anonymousEntityIcons.generated.d.ts +26 -0
- package/dist/utils/anonymousEntityIcons.generated.d.ts.map +1 -0
- package/dist/utils/extractAvatarParamsFromUri.d.ts +61 -0
- package/dist/utils/extractAvatarParamsFromUri.d.ts.map +1 -0
- package/dist/utils/generateAvatarDataUri.d.ts +65 -0
- package/dist/utils/generateAvatarDataUri.d.ts.map +1 -0
- package/dist/utils/hashStr.d.ts +30 -0
- package/dist/utils/hashStr.d.ts.map +1 -0
- package/dist/utils/isAvatarUri.d.ts +34 -0
- package/dist/utils/isAvatarUri.d.ts.map +1 -0
- package/dist/utils/pickAnonymousAvatarName.d.ts +36 -0
- package/dist/utils/pickAnonymousAvatarName.d.ts.map +1 -0
- package/dist/utils/pickAnonymousEntityName.d.ts +37 -0
- package/dist/utils/pickAnonymousEntityName.d.ts.map +1 -0
- package/dist/utils/resolveLogoUri.d.ts +55 -0
- package/dist/utils/resolveLogoUri.d.ts.map +1 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1138,7 +1138,7 @@ var require_base64_js = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/b
|
|
|
1138
1138
|
//#region ../../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js
|
|
1139
1139
|
var require_ieee754 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js": ((exports) => {
|
|
1140
1140
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
1141
|
-
exports.read = function(buffer
|
|
1141
|
+
exports.read = function(buffer, offset, isLE, mLen, nBytes) {
|
|
1142
1142
|
var e, m;
|
|
1143
1143
|
var eLen = nBytes * 8 - mLen - 1;
|
|
1144
1144
|
var eMax = (1 << eLen) - 1;
|
|
@@ -1146,16 +1146,16 @@ var require_ieee754 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/iee
|
|
|
1146
1146
|
var nBits = -7;
|
|
1147
1147
|
var i$1 = isLE ? nBytes - 1 : 0;
|
|
1148
1148
|
var d = isLE ? -1 : 1;
|
|
1149
|
-
var s = buffer
|
|
1149
|
+
var s = buffer[offset + i$1];
|
|
1150
1150
|
i$1 += d;
|
|
1151
1151
|
e = s & (1 << -nBits) - 1;
|
|
1152
1152
|
s >>= -nBits;
|
|
1153
1153
|
nBits += eLen;
|
|
1154
|
-
for (; nBits > 0; e = e * 256 + buffer
|
|
1154
|
+
for (; nBits > 0; e = e * 256 + buffer[offset + i$1], i$1 += d, nBits -= 8);
|
|
1155
1155
|
m = e & (1 << -nBits) - 1;
|
|
1156
1156
|
e >>= -nBits;
|
|
1157
1157
|
nBits += mLen;
|
|
1158
|
-
for (; nBits > 0; m = m * 256 + buffer
|
|
1158
|
+
for (; nBits > 0; m = m * 256 + buffer[offset + i$1], i$1 += d, nBits -= 8);
|
|
1159
1159
|
if (e === 0) e = 1 - eBias;
|
|
1160
1160
|
else if (e === eMax) return m ? NaN : (s ? -1 : 1) * Infinity;
|
|
1161
1161
|
else {
|
|
@@ -1164,7 +1164,7 @@ var require_ieee754 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/iee
|
|
|
1164
1164
|
}
|
|
1165
1165
|
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
|
|
1166
1166
|
};
|
|
1167
|
-
exports.write = function(buffer
|
|
1167
|
+
exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
|
|
1168
1168
|
var e, m, c;
|
|
1169
1169
|
var eLen = nBytes * 8 - mLen - 1;
|
|
1170
1170
|
var eMax = (1 << eLen) - 1;
|
|
@@ -1200,11 +1200,11 @@ var require_ieee754 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/iee
|
|
|
1200
1200
|
e = 0;
|
|
1201
1201
|
}
|
|
1202
1202
|
}
|
|
1203
|
-
for (; mLen >= 8; buffer
|
|
1203
|
+
for (; mLen >= 8; buffer[offset + i$1] = m & 255, i$1 += d, m /= 256, mLen -= 8);
|
|
1204
1204
|
e = e << mLen | m;
|
|
1205
1205
|
eLen += mLen;
|
|
1206
|
-
for (; eLen > 0; buffer
|
|
1207
|
-
buffer
|
|
1206
|
+
for (; eLen > 0; buffer[offset + i$1] = e & 255, i$1 += d, e /= 256, eLen -= 8);
|
|
1207
|
+
buffer[offset + i$1 - d] |= s * 128;
|
|
1208
1208
|
};
|
|
1209
1209
|
}) });
|
|
1210
1210
|
|
|
@@ -1214,7 +1214,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1214
1214
|
const base64 = require_base64_js();
|
|
1215
1215
|
const ieee754 = require_ieee754();
|
|
1216
1216
|
const customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
|
|
1217
|
-
exports.Buffer = Buffer$
|
|
1217
|
+
exports.Buffer = Buffer$2;
|
|
1218
1218
|
exports.SlowBuffer = SlowBuffer;
|
|
1219
1219
|
exports.INSPECT_MAX_BYTES = 50;
|
|
1220
1220
|
const K_MAX_LENGTH = 2147483647;
|
|
@@ -1233,8 +1233,8 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1233
1233
|
* (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
|
|
1234
1234
|
* for __proto__ and has a buggy typed array implementation.
|
|
1235
1235
|
*/
|
|
1236
|
-
Buffer$
|
|
1237
|
-
if (!Buffer$
|
|
1236
|
+
Buffer$2.TYPED_ARRAY_SUPPORT = typedArraySupport();
|
|
1237
|
+
if (!Buffer$2.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");
|
|
1238
1238
|
function typedArraySupport() {
|
|
1239
1239
|
try {
|
|
1240
1240
|
const arr = new Uint8Array(1);
|
|
@@ -1248,24 +1248,24 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1248
1248
|
return false;
|
|
1249
1249
|
}
|
|
1250
1250
|
}
|
|
1251
|
-
Object.defineProperty(Buffer$
|
|
1251
|
+
Object.defineProperty(Buffer$2.prototype, "parent", {
|
|
1252
1252
|
enumerable: true,
|
|
1253
1253
|
get: function() {
|
|
1254
|
-
if (!Buffer$
|
|
1254
|
+
if (!Buffer$2.isBuffer(this)) return void 0;
|
|
1255
1255
|
return this.buffer;
|
|
1256
1256
|
}
|
|
1257
1257
|
});
|
|
1258
|
-
Object.defineProperty(Buffer$
|
|
1258
|
+
Object.defineProperty(Buffer$2.prototype, "offset", {
|
|
1259
1259
|
enumerable: true,
|
|
1260
1260
|
get: function() {
|
|
1261
|
-
if (!Buffer$
|
|
1261
|
+
if (!Buffer$2.isBuffer(this)) return void 0;
|
|
1262
1262
|
return this.byteOffset;
|
|
1263
1263
|
}
|
|
1264
1264
|
});
|
|
1265
1265
|
function createBuffer(length) {
|
|
1266
1266
|
if (length > K_MAX_LENGTH) throw new RangeError("The value \"" + length + "\" is invalid for option \"size\"");
|
|
1267
1267
|
const buf = new Uint8Array(length);
|
|
1268
|
-
Object.setPrototypeOf(buf, Buffer$
|
|
1268
|
+
Object.setPrototypeOf(buf, Buffer$2.prototype);
|
|
1269
1269
|
return buf;
|
|
1270
1270
|
}
|
|
1271
1271
|
/**
|
|
@@ -1277,14 +1277,14 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1277
1277
|
*
|
|
1278
1278
|
* The `Uint8Array` prototype remains unmodified.
|
|
1279
1279
|
*/
|
|
1280
|
-
function Buffer$
|
|
1280
|
+
function Buffer$2(arg, encodingOrOffset, length) {
|
|
1281
1281
|
if (typeof arg === "number") {
|
|
1282
1282
|
if (typeof encodingOrOffset === "string") throw new TypeError("The \"string\" argument must be of type string. Received type number");
|
|
1283
1283
|
return allocUnsafe(arg);
|
|
1284
1284
|
}
|
|
1285
1285
|
return from(arg, encodingOrOffset, length);
|
|
1286
1286
|
}
|
|
1287
|
-
Buffer$
|
|
1287
|
+
Buffer$2.poolSize = 8192;
|
|
1288
1288
|
function from(value, encodingOrOffset, length) {
|
|
1289
1289
|
if (typeof value === "string") return fromString(value, encodingOrOffset);
|
|
1290
1290
|
if (ArrayBuffer.isView(value)) return fromArrayView(value);
|
|
@@ -1293,10 +1293,10 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1293
1293
|
if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) return fromArrayBuffer(value, encodingOrOffset, length);
|
|
1294
1294
|
if (typeof value === "number") throw new TypeError("The \"value\" argument must not be of type number. Received type number");
|
|
1295
1295
|
const valueOf = value.valueOf && value.valueOf();
|
|
1296
|
-
if (valueOf != null && valueOf !== value) return Buffer$
|
|
1296
|
+
if (valueOf != null && valueOf !== value) return Buffer$2.from(valueOf, encodingOrOffset, length);
|
|
1297
1297
|
const b = fromObject(value);
|
|
1298
1298
|
if (b) return b;
|
|
1299
|
-
if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") return Buffer$
|
|
1299
|
+
if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") return Buffer$2.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length);
|
|
1300
1300
|
throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);
|
|
1301
1301
|
}
|
|
1302
1302
|
/**
|
|
@@ -1307,11 +1307,11 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1307
1307
|
* Buffer.from(buffer)
|
|
1308
1308
|
* Buffer.from(arrayBuffer[, byteOffset[, length]])
|
|
1309
1309
|
**/
|
|
1310
|
-
Buffer$
|
|
1310
|
+
Buffer$2.from = function(value, encodingOrOffset, length) {
|
|
1311
1311
|
return from(value, encodingOrOffset, length);
|
|
1312
1312
|
};
|
|
1313
|
-
Object.setPrototypeOf(Buffer$
|
|
1314
|
-
Object.setPrototypeOf(Buffer$
|
|
1313
|
+
Object.setPrototypeOf(Buffer$2.prototype, Uint8Array.prototype);
|
|
1314
|
+
Object.setPrototypeOf(Buffer$2, Uint8Array);
|
|
1315
1315
|
function assertSize(size) {
|
|
1316
1316
|
if (typeof size !== "number") throw new TypeError("\"size\" argument must be of type number");
|
|
1317
1317
|
else if (size < 0) throw new RangeError("The value \"" + size + "\" is invalid for option \"size\"");
|
|
@@ -1326,7 +1326,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1326
1326
|
* Creates a new filled Buffer instance.
|
|
1327
1327
|
* alloc(size[, fill[, encoding]])
|
|
1328
1328
|
**/
|
|
1329
|
-
Buffer$
|
|
1329
|
+
Buffer$2.alloc = function(size, fill, encoding) {
|
|
1330
1330
|
return alloc(size, fill, encoding);
|
|
1331
1331
|
};
|
|
1332
1332
|
function allocUnsafe(size) {
|
|
@@ -1336,18 +1336,18 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1336
1336
|
/**
|
|
1337
1337
|
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
|
|
1338
1338
|
* */
|
|
1339
|
-
Buffer$
|
|
1339
|
+
Buffer$2.allocUnsafe = function(size) {
|
|
1340
1340
|
return allocUnsafe(size);
|
|
1341
1341
|
};
|
|
1342
1342
|
/**
|
|
1343
1343
|
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
|
1344
1344
|
*/
|
|
1345
|
-
Buffer$
|
|
1345
|
+
Buffer$2.allocUnsafeSlow = function(size) {
|
|
1346
1346
|
return allocUnsafe(size);
|
|
1347
1347
|
};
|
|
1348
1348
|
function fromString(string, encoding) {
|
|
1349
1349
|
if (typeof encoding !== "string" || encoding === "") encoding = "utf8";
|
|
1350
|
-
if (!Buffer$
|
|
1350
|
+
if (!Buffer$2.isEncoding(encoding)) throw new TypeError("Unknown encoding: " + encoding);
|
|
1351
1351
|
const length = byteLength(string, encoding) | 0;
|
|
1352
1352
|
let buf = createBuffer(length);
|
|
1353
1353
|
const actual = buf.write(string, encoding);
|
|
@@ -1374,11 +1374,11 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1374
1374
|
if (byteOffset === void 0 && length === void 0) buf = new Uint8Array(array);
|
|
1375
1375
|
else if (length === void 0) buf = new Uint8Array(array, byteOffset);
|
|
1376
1376
|
else buf = new Uint8Array(array, byteOffset, length);
|
|
1377
|
-
Object.setPrototypeOf(buf, Buffer$
|
|
1377
|
+
Object.setPrototypeOf(buf, Buffer$2.prototype);
|
|
1378
1378
|
return buf;
|
|
1379
1379
|
}
|
|
1380
1380
|
function fromObject(obj) {
|
|
1381
|
-
if (Buffer$
|
|
1381
|
+
if (Buffer$2.isBuffer(obj)) {
|
|
1382
1382
|
const len$1 = checked(obj.length) | 0;
|
|
1383
1383
|
const buf = createBuffer(len$1);
|
|
1384
1384
|
if (buf.length === 0) return buf;
|
|
@@ -1397,15 +1397,15 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1397
1397
|
}
|
|
1398
1398
|
function SlowBuffer(length) {
|
|
1399
1399
|
if (+length != length) length = 0;
|
|
1400
|
-
return Buffer$
|
|
1400
|
+
return Buffer$2.alloc(+length);
|
|
1401
1401
|
}
|
|
1402
|
-
Buffer$
|
|
1403
|
-
return b != null && b._isBuffer === true && b !== Buffer$
|
|
1402
|
+
Buffer$2.isBuffer = function isBuffer(b) {
|
|
1403
|
+
return b != null && b._isBuffer === true && b !== Buffer$2.prototype;
|
|
1404
1404
|
};
|
|
1405
|
-
Buffer$
|
|
1406
|
-
if (isInstance(a, Uint8Array)) a = Buffer$
|
|
1407
|
-
if (isInstance(b, Uint8Array)) b = Buffer$
|
|
1408
|
-
if (!Buffer$
|
|
1405
|
+
Buffer$2.compare = function compare(a, b) {
|
|
1406
|
+
if (isInstance(a, Uint8Array)) a = Buffer$2.from(a, a.offset, a.byteLength);
|
|
1407
|
+
if (isInstance(b, Uint8Array)) b = Buffer$2.from(b, b.offset, b.byteLength);
|
|
1408
|
+
if (!Buffer$2.isBuffer(a) || !Buffer$2.isBuffer(b)) throw new TypeError("The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array");
|
|
1409
1409
|
if (a === b) return 0;
|
|
1410
1410
|
let x = a.length;
|
|
1411
1411
|
let y = b.length;
|
|
@@ -1418,7 +1418,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1418
1418
|
if (y < x) return 1;
|
|
1419
1419
|
return 0;
|
|
1420
1420
|
};
|
|
1421
|
-
Buffer$
|
|
1421
|
+
Buffer$2.isEncoding = function isEncoding(encoding) {
|
|
1422
1422
|
switch (String(encoding).toLowerCase()) {
|
|
1423
1423
|
case "hex":
|
|
1424
1424
|
case "utf8":
|
|
@@ -1434,30 +1434,30 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1434
1434
|
default: return false;
|
|
1435
1435
|
}
|
|
1436
1436
|
};
|
|
1437
|
-
Buffer$
|
|
1437
|
+
Buffer$2.concat = function concat(list, length) {
|
|
1438
1438
|
if (!Array.isArray(list)) throw new TypeError("\"list\" argument must be an Array of Buffers");
|
|
1439
|
-
if (list.length === 0) return Buffer$
|
|
1439
|
+
if (list.length === 0) return Buffer$2.alloc(0);
|
|
1440
1440
|
let i$1;
|
|
1441
1441
|
if (length === void 0) {
|
|
1442
1442
|
length = 0;
|
|
1443
1443
|
for (i$1 = 0; i$1 < list.length; ++i$1) length += list[i$1].length;
|
|
1444
1444
|
}
|
|
1445
|
-
const buffer
|
|
1445
|
+
const buffer = Buffer$2.allocUnsafe(length);
|
|
1446
1446
|
let pos = 0;
|
|
1447
1447
|
for (i$1 = 0; i$1 < list.length; ++i$1) {
|
|
1448
1448
|
let buf = list[i$1];
|
|
1449
|
-
if (isInstance(buf, Uint8Array)) if (pos + buf.length > buffer
|
|
1450
|
-
if (!Buffer$
|
|
1451
|
-
buf.copy(buffer
|
|
1452
|
-
} else Uint8Array.prototype.set.call(buffer
|
|
1453
|
-
else if (!Buffer$
|
|
1454
|
-
else buf.copy(buffer
|
|
1449
|
+
if (isInstance(buf, Uint8Array)) if (pos + buf.length > buffer.length) {
|
|
1450
|
+
if (!Buffer$2.isBuffer(buf)) buf = Buffer$2.from(buf);
|
|
1451
|
+
buf.copy(buffer, pos);
|
|
1452
|
+
} else Uint8Array.prototype.set.call(buffer, buf, pos);
|
|
1453
|
+
else if (!Buffer$2.isBuffer(buf)) throw new TypeError("\"list\" argument must be an Array of Buffers");
|
|
1454
|
+
else buf.copy(buffer, pos);
|
|
1455
1455
|
pos += buf.length;
|
|
1456
1456
|
}
|
|
1457
|
-
return buffer
|
|
1457
|
+
return buffer;
|
|
1458
1458
|
};
|
|
1459
1459
|
function byteLength(string, encoding) {
|
|
1460
|
-
if (Buffer$
|
|
1460
|
+
if (Buffer$2.isBuffer(string)) return string.length;
|
|
1461
1461
|
if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) return string.byteLength;
|
|
1462
1462
|
if (typeof string !== "string") throw new TypeError("The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type " + typeof string);
|
|
1463
1463
|
const len$1 = string.length;
|
|
@@ -1482,7 +1482,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1482
1482
|
loweredCase = true;
|
|
1483
1483
|
}
|
|
1484
1484
|
}
|
|
1485
|
-
Buffer$
|
|
1485
|
+
Buffer$2.byteLength = byteLength;
|
|
1486
1486
|
function slowToString(encoding, start, end) {
|
|
1487
1487
|
let loweredCase = false;
|
|
1488
1488
|
if (start === void 0 || start < 0) start = 0;
|
|
@@ -1511,19 +1511,19 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1511
1511
|
loweredCase = true;
|
|
1512
1512
|
}
|
|
1513
1513
|
}
|
|
1514
|
-
Buffer$
|
|
1514
|
+
Buffer$2.prototype._isBuffer = true;
|
|
1515
1515
|
function swap(b, n, m) {
|
|
1516
1516
|
const i$1 = b[n];
|
|
1517
1517
|
b[n] = b[m];
|
|
1518
1518
|
b[m] = i$1;
|
|
1519
1519
|
}
|
|
1520
|
-
Buffer$
|
|
1520
|
+
Buffer$2.prototype.swap16 = function swap16() {
|
|
1521
1521
|
const len$1 = this.length;
|
|
1522
1522
|
if (len$1 % 2 !== 0) throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
1523
1523
|
for (let i$1 = 0; i$1 < len$1; i$1 += 2) swap(this, i$1, i$1 + 1);
|
|
1524
1524
|
return this;
|
|
1525
1525
|
};
|
|
1526
|
-
Buffer$
|
|
1526
|
+
Buffer$2.prototype.swap32 = function swap32() {
|
|
1527
1527
|
const len$1 = this.length;
|
|
1528
1528
|
if (len$1 % 4 !== 0) throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
1529
1529
|
for (let i$1 = 0; i$1 < len$1; i$1 += 4) {
|
|
@@ -1532,7 +1532,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1532
1532
|
}
|
|
1533
1533
|
return this;
|
|
1534
1534
|
};
|
|
1535
|
-
Buffer$
|
|
1535
|
+
Buffer$2.prototype.swap64 = function swap64() {
|
|
1536
1536
|
const len$1 = this.length;
|
|
1537
1537
|
if (len$1 % 8 !== 0) throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
1538
1538
|
for (let i$1 = 0; i$1 < len$1; i$1 += 8) {
|
|
@@ -1543,29 +1543,29 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1543
1543
|
}
|
|
1544
1544
|
return this;
|
|
1545
1545
|
};
|
|
1546
|
-
Buffer$
|
|
1546
|
+
Buffer$2.prototype.toString = function toString() {
|
|
1547
1547
|
const length = this.length;
|
|
1548
1548
|
if (length === 0) return "";
|
|
1549
1549
|
if (arguments.length === 0) return utf8Slice(this, 0, length);
|
|
1550
1550
|
return slowToString.apply(this, arguments);
|
|
1551
1551
|
};
|
|
1552
|
-
Buffer$
|
|
1553
|
-
Buffer$
|
|
1554
|
-
if (!Buffer$
|
|
1552
|
+
Buffer$2.prototype.toLocaleString = Buffer$2.prototype.toString;
|
|
1553
|
+
Buffer$2.prototype.equals = function equals(b) {
|
|
1554
|
+
if (!Buffer$2.isBuffer(b)) throw new TypeError("Argument must be a Buffer");
|
|
1555
1555
|
if (this === b) return true;
|
|
1556
|
-
return Buffer$
|
|
1556
|
+
return Buffer$2.compare(this, b) === 0;
|
|
1557
1557
|
};
|
|
1558
|
-
Buffer$
|
|
1558
|
+
Buffer$2.prototype.inspect = function inspect() {
|
|
1559
1559
|
let str = "";
|
|
1560
1560
|
const max = exports.INSPECT_MAX_BYTES;
|
|
1561
1561
|
str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
|
|
1562
1562
|
if (this.length > max) str += " ... ";
|
|
1563
1563
|
return "<Buffer " + str + ">";
|
|
1564
1564
|
};
|
|
1565
|
-
if (customInspectSymbol) Buffer$
|
|
1566
|
-
Buffer$
|
|
1567
|
-
if (isInstance(target, Uint8Array)) target = Buffer$
|
|
1568
|
-
if (!Buffer$
|
|
1565
|
+
if (customInspectSymbol) Buffer$2.prototype[customInspectSymbol] = Buffer$2.prototype.inspect;
|
|
1566
|
+
Buffer$2.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
|
|
1567
|
+
if (isInstance(target, Uint8Array)) target = Buffer$2.from(target, target.offset, target.byteLength);
|
|
1568
|
+
if (!Buffer$2.isBuffer(target)) throw new TypeError("The \"target\" argument must be one of type Buffer or Uint8Array. Received type " + typeof target);
|
|
1569
1569
|
if (start === void 0) start = 0;
|
|
1570
1570
|
if (end === void 0) end = target ? target.length : 0;
|
|
1571
1571
|
if (thisStart === void 0) thisStart = 0;
|
|
@@ -1593,29 +1593,29 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1593
1593
|
if (y < x) return 1;
|
|
1594
1594
|
return 0;
|
|
1595
1595
|
};
|
|
1596
|
-
function bidirectionalIndexOf(buffer
|
|
1597
|
-
if (buffer
|
|
1596
|
+
function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
|
|
1597
|
+
if (buffer.length === 0) return -1;
|
|
1598
1598
|
if (typeof byteOffset === "string") {
|
|
1599
1599
|
encoding = byteOffset;
|
|
1600
1600
|
byteOffset = 0;
|
|
1601
1601
|
} else if (byteOffset > 2147483647) byteOffset = 2147483647;
|
|
1602
1602
|
else if (byteOffset < -2147483648) byteOffset = -2147483648;
|
|
1603
1603
|
byteOffset = +byteOffset;
|
|
1604
|
-
if (numberIsNaN(byteOffset)) byteOffset = dir ? 0 : buffer
|
|
1605
|
-
if (byteOffset < 0) byteOffset = buffer
|
|
1606
|
-
if (byteOffset >= buffer
|
|
1607
|
-
else byteOffset = buffer
|
|
1604
|
+
if (numberIsNaN(byteOffset)) byteOffset = dir ? 0 : buffer.length - 1;
|
|
1605
|
+
if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
|
|
1606
|
+
if (byteOffset >= buffer.length) if (dir) return -1;
|
|
1607
|
+
else byteOffset = buffer.length - 1;
|
|
1608
1608
|
else if (byteOffset < 0) if (dir) byteOffset = 0;
|
|
1609
1609
|
else return -1;
|
|
1610
|
-
if (typeof val === "string") val = Buffer$
|
|
1611
|
-
if (Buffer$
|
|
1610
|
+
if (typeof val === "string") val = Buffer$2.from(val, encoding);
|
|
1611
|
+
if (Buffer$2.isBuffer(val)) {
|
|
1612
1612
|
if (val.length === 0) return -1;
|
|
1613
|
-
return arrayIndexOf(buffer
|
|
1613
|
+
return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
|
|
1614
1614
|
} else if (typeof val === "number") {
|
|
1615
1615
|
val = val & 255;
|
|
1616
|
-
if (typeof Uint8Array.prototype.indexOf === "function") if (dir) return Uint8Array.prototype.indexOf.call(buffer
|
|
1617
|
-
else return Uint8Array.prototype.lastIndexOf.call(buffer
|
|
1618
|
-
return arrayIndexOf(buffer
|
|
1616
|
+
if (typeof Uint8Array.prototype.indexOf === "function") if (dir) return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
|
|
1617
|
+
else return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
|
|
1618
|
+
return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
|
|
1619
1619
|
}
|
|
1620
1620
|
throw new TypeError("val must be string, number or Buffer");
|
|
1621
1621
|
}
|
|
@@ -1660,13 +1660,13 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1660
1660
|
}
|
|
1661
1661
|
return -1;
|
|
1662
1662
|
}
|
|
1663
|
-
Buffer$
|
|
1663
|
+
Buffer$2.prototype.includes = function includes(val, byteOffset, encoding) {
|
|
1664
1664
|
return this.indexOf(val, byteOffset, encoding) !== -1;
|
|
1665
1665
|
};
|
|
1666
|
-
Buffer$
|
|
1666
|
+
Buffer$2.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
|
|
1667
1667
|
return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
|
|
1668
1668
|
};
|
|
1669
|
-
Buffer$
|
|
1669
|
+
Buffer$2.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
|
|
1670
1670
|
return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
|
|
1671
1671
|
};
|
|
1672
1672
|
function hexWrite(buf, string, offset, length) {
|
|
@@ -1699,7 +1699,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1699
1699
|
function ucs2Write(buf, string, offset, length) {
|
|
1700
1700
|
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
|
|
1701
1701
|
}
|
|
1702
|
-
Buffer$
|
|
1702
|
+
Buffer$2.prototype.write = function write(string, offset, length, encoding) {
|
|
1703
1703
|
if (offset === void 0) {
|
|
1704
1704
|
encoding = "utf8";
|
|
1705
1705
|
length = this.length;
|
|
@@ -1741,7 +1741,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1741
1741
|
loweredCase = true;
|
|
1742
1742
|
}
|
|
1743
1743
|
};
|
|
1744
|
-
Buffer$
|
|
1744
|
+
Buffer$2.prototype.toJSON = function toJSON() {
|
|
1745
1745
|
return {
|
|
1746
1746
|
type: "Buffer",
|
|
1747
1747
|
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
@@ -1838,7 +1838,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1838
1838
|
for (let i$1 = 0; i$1 < bytes.length - 1; i$1 += 2) res += String.fromCharCode(bytes[i$1] + bytes[i$1 + 1] * 256);
|
|
1839
1839
|
return res;
|
|
1840
1840
|
}
|
|
1841
|
-
Buffer$
|
|
1841
|
+
Buffer$2.prototype.slice = function slice(start, end) {
|
|
1842
1842
|
const len$1 = this.length;
|
|
1843
1843
|
start = ~~start;
|
|
1844
1844
|
end = end === void 0 ? len$1 : ~~end;
|
|
@@ -1852,14 +1852,14 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1852
1852
|
} else if (end > len$1) end = len$1;
|
|
1853
1853
|
if (end < start) end = start;
|
|
1854
1854
|
const newBuf = this.subarray(start, end);
|
|
1855
|
-
Object.setPrototypeOf(newBuf, Buffer$
|
|
1855
|
+
Object.setPrototypeOf(newBuf, Buffer$2.prototype);
|
|
1856
1856
|
return newBuf;
|
|
1857
1857
|
};
|
|
1858
1858
|
function checkOffset(offset, ext, length) {
|
|
1859
1859
|
if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
|
|
1860
1860
|
if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
|
|
1861
1861
|
}
|
|
1862
|
-
Buffer$
|
|
1862
|
+
Buffer$2.prototype.readUintLE = Buffer$2.prototype.readUIntLE = function readUIntLE(offset, byteLength$2, noAssert) {
|
|
1863
1863
|
offset = offset >>> 0;
|
|
1864
1864
|
byteLength$2 = byteLength$2 >>> 0;
|
|
1865
1865
|
if (!noAssert) checkOffset(offset, byteLength$2, this.length);
|
|
@@ -1869,7 +1869,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1869
1869
|
while (++i$1 < byteLength$2 && (mul *= 256)) val += this[offset + i$1] * mul;
|
|
1870
1870
|
return val;
|
|
1871
1871
|
};
|
|
1872
|
-
Buffer$
|
|
1872
|
+
Buffer$2.prototype.readUintBE = Buffer$2.prototype.readUIntBE = function readUIntBE(offset, byteLength$2, noAssert) {
|
|
1873
1873
|
offset = offset >>> 0;
|
|
1874
1874
|
byteLength$2 = byteLength$2 >>> 0;
|
|
1875
1875
|
if (!noAssert) checkOffset(offset, byteLength$2, this.length);
|
|
@@ -1878,32 +1878,32 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1878
1878
|
while (byteLength$2 > 0 && (mul *= 256)) val += this[offset + --byteLength$2] * mul;
|
|
1879
1879
|
return val;
|
|
1880
1880
|
};
|
|
1881
|
-
Buffer$
|
|
1881
|
+
Buffer$2.prototype.readUint8 = Buffer$2.prototype.readUInt8 = function readUInt8(offset, noAssert) {
|
|
1882
1882
|
offset = offset >>> 0;
|
|
1883
1883
|
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
1884
1884
|
return this[offset];
|
|
1885
1885
|
};
|
|
1886
|
-
Buffer$
|
|
1886
|
+
Buffer$2.prototype.readUint16LE = Buffer$2.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
|
|
1887
1887
|
offset = offset >>> 0;
|
|
1888
1888
|
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1889
1889
|
return this[offset] | this[offset + 1] << 8;
|
|
1890
1890
|
};
|
|
1891
|
-
Buffer$
|
|
1891
|
+
Buffer$2.prototype.readUint16BE = Buffer$2.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
|
|
1892
1892
|
offset = offset >>> 0;
|
|
1893
1893
|
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1894
1894
|
return this[offset] << 8 | this[offset + 1];
|
|
1895
1895
|
};
|
|
1896
|
-
Buffer$
|
|
1896
|
+
Buffer$2.prototype.readUint32LE = Buffer$2.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
|
|
1897
1897
|
offset = offset >>> 0;
|
|
1898
1898
|
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1899
1899
|
return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
|
|
1900
1900
|
};
|
|
1901
|
-
Buffer$
|
|
1901
|
+
Buffer$2.prototype.readUint32BE = Buffer$2.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
|
|
1902
1902
|
offset = offset >>> 0;
|
|
1903
1903
|
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1904
1904
|
return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
|
|
1905
1905
|
};
|
|
1906
|
-
Buffer$
|
|
1906
|
+
Buffer$2.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {
|
|
1907
1907
|
offset = offset >>> 0;
|
|
1908
1908
|
validateNumber(offset, "offset");
|
|
1909
1909
|
const first = this[offset];
|
|
@@ -1913,7 +1913,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1913
1913
|
const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24;
|
|
1914
1914
|
return BigInt(lo) + (BigInt(hi) << BigInt(32));
|
|
1915
1915
|
});
|
|
1916
|
-
Buffer$
|
|
1916
|
+
Buffer$2.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) {
|
|
1917
1917
|
offset = offset >>> 0;
|
|
1918
1918
|
validateNumber(offset, "offset");
|
|
1919
1919
|
const first = this[offset];
|
|
@@ -1923,7 +1923,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1923
1923
|
const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last;
|
|
1924
1924
|
return (BigInt(hi) << BigInt(32)) + BigInt(lo);
|
|
1925
1925
|
});
|
|
1926
|
-
Buffer$
|
|
1926
|
+
Buffer$2.prototype.readIntLE = function readIntLE(offset, byteLength$2, noAssert) {
|
|
1927
1927
|
offset = offset >>> 0;
|
|
1928
1928
|
byteLength$2 = byteLength$2 >>> 0;
|
|
1929
1929
|
if (!noAssert) checkOffset(offset, byteLength$2, this.length);
|
|
@@ -1935,7 +1935,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1935
1935
|
if (val >= mul) val -= Math.pow(2, 8 * byteLength$2);
|
|
1936
1936
|
return val;
|
|
1937
1937
|
};
|
|
1938
|
-
Buffer$
|
|
1938
|
+
Buffer$2.prototype.readIntBE = function readIntBE(offset, byteLength$2, noAssert) {
|
|
1939
1939
|
offset = offset >>> 0;
|
|
1940
1940
|
byteLength$2 = byteLength$2 >>> 0;
|
|
1941
1941
|
if (!noAssert) checkOffset(offset, byteLength$2, this.length);
|
|
@@ -1947,35 +1947,35 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1947
1947
|
if (val >= mul) val -= Math.pow(2, 8 * byteLength$2);
|
|
1948
1948
|
return val;
|
|
1949
1949
|
};
|
|
1950
|
-
Buffer$
|
|
1950
|
+
Buffer$2.prototype.readInt8 = function readInt8(offset, noAssert) {
|
|
1951
1951
|
offset = offset >>> 0;
|
|
1952
1952
|
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
1953
1953
|
if (!(this[offset] & 128)) return this[offset];
|
|
1954
1954
|
return (255 - this[offset] + 1) * -1;
|
|
1955
1955
|
};
|
|
1956
|
-
Buffer$
|
|
1956
|
+
Buffer$2.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
|
|
1957
1957
|
offset = offset >>> 0;
|
|
1958
1958
|
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1959
1959
|
const val = this[offset] | this[offset + 1] << 8;
|
|
1960
1960
|
return val & 32768 ? val | 4294901760 : val;
|
|
1961
1961
|
};
|
|
1962
|
-
Buffer$
|
|
1962
|
+
Buffer$2.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
|
|
1963
1963
|
offset = offset >>> 0;
|
|
1964
1964
|
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1965
1965
|
const val = this[offset + 1] | this[offset] << 8;
|
|
1966
1966
|
return val & 32768 ? val | 4294901760 : val;
|
|
1967
1967
|
};
|
|
1968
|
-
Buffer$
|
|
1968
|
+
Buffer$2.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
|
|
1969
1969
|
offset = offset >>> 0;
|
|
1970
1970
|
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1971
1971
|
return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
|
|
1972
1972
|
};
|
|
1973
|
-
Buffer$
|
|
1973
|
+
Buffer$2.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
|
|
1974
1974
|
offset = offset >>> 0;
|
|
1975
1975
|
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1976
1976
|
return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
|
|
1977
1977
|
};
|
|
1978
|
-
Buffer$
|
|
1978
|
+
Buffer$2.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) {
|
|
1979
1979
|
offset = offset >>> 0;
|
|
1980
1980
|
validateNumber(offset, "offset");
|
|
1981
1981
|
const first = this[offset];
|
|
@@ -1984,7 +1984,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1984
1984
|
const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24);
|
|
1985
1985
|
return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24);
|
|
1986
1986
|
});
|
|
1987
|
-
Buffer$
|
|
1987
|
+
Buffer$2.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) {
|
|
1988
1988
|
offset = offset >>> 0;
|
|
1989
1989
|
validateNumber(offset, "offset");
|
|
1990
1990
|
const first = this[offset];
|
|
@@ -1993,32 +1993,32 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
1993
1993
|
const val = (first << 24) + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
|
|
1994
1994
|
return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last);
|
|
1995
1995
|
});
|
|
1996
|
-
Buffer$
|
|
1996
|
+
Buffer$2.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
|
|
1997
1997
|
offset = offset >>> 0;
|
|
1998
1998
|
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1999
1999
|
return ieee754.read(this, offset, true, 23, 4);
|
|
2000
2000
|
};
|
|
2001
|
-
Buffer$
|
|
2001
|
+
Buffer$2.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
|
|
2002
2002
|
offset = offset >>> 0;
|
|
2003
2003
|
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2004
2004
|
return ieee754.read(this, offset, false, 23, 4);
|
|
2005
2005
|
};
|
|
2006
|
-
Buffer$
|
|
2006
|
+
Buffer$2.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
|
|
2007
2007
|
offset = offset >>> 0;
|
|
2008
2008
|
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
2009
2009
|
return ieee754.read(this, offset, true, 52, 8);
|
|
2010
2010
|
};
|
|
2011
|
-
Buffer$
|
|
2011
|
+
Buffer$2.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
|
|
2012
2012
|
offset = offset >>> 0;
|
|
2013
2013
|
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
2014
2014
|
return ieee754.read(this, offset, false, 52, 8);
|
|
2015
2015
|
};
|
|
2016
2016
|
function checkInt(buf, value, offset, ext, max, min) {
|
|
2017
|
-
if (!Buffer$
|
|
2017
|
+
if (!Buffer$2.isBuffer(buf)) throw new TypeError("\"buffer\" argument must be a Buffer instance");
|
|
2018
2018
|
if (value > max || value < min) throw new RangeError("\"value\" argument is out of bounds");
|
|
2019
2019
|
if (offset + ext > buf.length) throw new RangeError("Index out of range");
|
|
2020
2020
|
}
|
|
2021
|
-
Buffer$
|
|
2021
|
+
Buffer$2.prototype.writeUintLE = Buffer$2.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength$2, noAssert) {
|
|
2022
2022
|
value = +value;
|
|
2023
2023
|
offset = offset >>> 0;
|
|
2024
2024
|
byteLength$2 = byteLength$2 >>> 0;
|
|
@@ -2032,7 +2032,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2032
2032
|
while (++i$1 < byteLength$2 && (mul *= 256)) this[offset + i$1] = value / mul & 255;
|
|
2033
2033
|
return offset + byteLength$2;
|
|
2034
2034
|
};
|
|
2035
|
-
Buffer$
|
|
2035
|
+
Buffer$2.prototype.writeUintBE = Buffer$2.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength$2, noAssert) {
|
|
2036
2036
|
value = +value;
|
|
2037
2037
|
offset = offset >>> 0;
|
|
2038
2038
|
byteLength$2 = byteLength$2 >>> 0;
|
|
@@ -2046,14 +2046,14 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2046
2046
|
while (--i$1 >= 0 && (mul *= 256)) this[offset + i$1] = value / mul & 255;
|
|
2047
2047
|
return offset + byteLength$2;
|
|
2048
2048
|
};
|
|
2049
|
-
Buffer$
|
|
2049
|
+
Buffer$2.prototype.writeUint8 = Buffer$2.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
|
|
2050
2050
|
value = +value;
|
|
2051
2051
|
offset = offset >>> 0;
|
|
2052
2052
|
if (!noAssert) checkInt(this, value, offset, 1, 255, 0);
|
|
2053
2053
|
this[offset] = value & 255;
|
|
2054
2054
|
return offset + 1;
|
|
2055
2055
|
};
|
|
2056
|
-
Buffer$
|
|
2056
|
+
Buffer$2.prototype.writeUint16LE = Buffer$2.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
|
|
2057
2057
|
value = +value;
|
|
2058
2058
|
offset = offset >>> 0;
|
|
2059
2059
|
if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
|
|
@@ -2061,7 +2061,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2061
2061
|
this[offset + 1] = value >>> 8;
|
|
2062
2062
|
return offset + 2;
|
|
2063
2063
|
};
|
|
2064
|
-
Buffer$
|
|
2064
|
+
Buffer$2.prototype.writeUint16BE = Buffer$2.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
|
|
2065
2065
|
value = +value;
|
|
2066
2066
|
offset = offset >>> 0;
|
|
2067
2067
|
if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
|
|
@@ -2069,7 +2069,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2069
2069
|
this[offset + 1] = value & 255;
|
|
2070
2070
|
return offset + 2;
|
|
2071
2071
|
};
|
|
2072
|
-
Buffer$
|
|
2072
|
+
Buffer$2.prototype.writeUint32LE = Buffer$2.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
|
|
2073
2073
|
value = +value;
|
|
2074
2074
|
offset = offset >>> 0;
|
|
2075
2075
|
if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
|
|
@@ -2079,7 +2079,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2079
2079
|
this[offset] = value & 255;
|
|
2080
2080
|
return offset + 4;
|
|
2081
2081
|
};
|
|
2082
|
-
Buffer$
|
|
2082
|
+
Buffer$2.prototype.writeUint32BE = Buffer$2.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
|
|
2083
2083
|
value = +value;
|
|
2084
2084
|
offset = offset >>> 0;
|
|
2085
2085
|
if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
|
|
@@ -2129,13 +2129,13 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2129
2129
|
buf[offset] = hi;
|
|
2130
2130
|
return offset + 8;
|
|
2131
2131
|
}
|
|
2132
|
-
Buffer$
|
|
2132
|
+
Buffer$2.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) {
|
|
2133
2133
|
return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
2134
2134
|
});
|
|
2135
|
-
Buffer$
|
|
2135
|
+
Buffer$2.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) {
|
|
2136
2136
|
return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
2137
2137
|
});
|
|
2138
|
-
Buffer$
|
|
2138
|
+
Buffer$2.prototype.writeIntLE = function writeIntLE(value, offset, byteLength$2, noAssert) {
|
|
2139
2139
|
value = +value;
|
|
2140
2140
|
offset = offset >>> 0;
|
|
2141
2141
|
if (!noAssert) {
|
|
@@ -2152,7 +2152,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2152
2152
|
}
|
|
2153
2153
|
return offset + byteLength$2;
|
|
2154
2154
|
};
|
|
2155
|
-
Buffer$
|
|
2155
|
+
Buffer$2.prototype.writeIntBE = function writeIntBE(value, offset, byteLength$2, noAssert) {
|
|
2156
2156
|
value = +value;
|
|
2157
2157
|
offset = offset >>> 0;
|
|
2158
2158
|
if (!noAssert) {
|
|
@@ -2169,7 +2169,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2169
2169
|
}
|
|
2170
2170
|
return offset + byteLength$2;
|
|
2171
2171
|
};
|
|
2172
|
-
Buffer$
|
|
2172
|
+
Buffer$2.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
|
|
2173
2173
|
value = +value;
|
|
2174
2174
|
offset = offset >>> 0;
|
|
2175
2175
|
if (!noAssert) checkInt(this, value, offset, 1, 127, -128);
|
|
@@ -2177,7 +2177,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2177
2177
|
this[offset] = value & 255;
|
|
2178
2178
|
return offset + 1;
|
|
2179
2179
|
};
|
|
2180
|
-
Buffer$
|
|
2180
|
+
Buffer$2.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
|
|
2181
2181
|
value = +value;
|
|
2182
2182
|
offset = offset >>> 0;
|
|
2183
2183
|
if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
|
|
@@ -2185,7 +2185,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2185
2185
|
this[offset + 1] = value >>> 8;
|
|
2186
2186
|
return offset + 2;
|
|
2187
2187
|
};
|
|
2188
|
-
Buffer$
|
|
2188
|
+
Buffer$2.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
|
|
2189
2189
|
value = +value;
|
|
2190
2190
|
offset = offset >>> 0;
|
|
2191
2191
|
if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
|
|
@@ -2193,7 +2193,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2193
2193
|
this[offset + 1] = value & 255;
|
|
2194
2194
|
return offset + 2;
|
|
2195
2195
|
};
|
|
2196
|
-
Buffer$
|
|
2196
|
+
Buffer$2.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
|
|
2197
2197
|
value = +value;
|
|
2198
2198
|
offset = offset >>> 0;
|
|
2199
2199
|
if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
@@ -2203,7 +2203,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2203
2203
|
this[offset + 3] = value >>> 24;
|
|
2204
2204
|
return offset + 4;
|
|
2205
2205
|
};
|
|
2206
|
-
Buffer$
|
|
2206
|
+
Buffer$2.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
|
|
2207
2207
|
value = +value;
|
|
2208
2208
|
offset = offset >>> 0;
|
|
2209
2209
|
if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
@@ -2214,10 +2214,10 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2214
2214
|
this[offset + 3] = value & 255;
|
|
2215
2215
|
return offset + 4;
|
|
2216
2216
|
};
|
|
2217
|
-
Buffer$
|
|
2217
|
+
Buffer$2.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) {
|
|
2218
2218
|
return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
2219
2219
|
});
|
|
2220
|
-
Buffer$
|
|
2220
|
+
Buffer$2.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) {
|
|
2221
2221
|
return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
2222
2222
|
});
|
|
2223
2223
|
function checkIEEE754(buf, value, offset, ext, max, min) {
|
|
@@ -2231,10 +2231,10 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2231
2231
|
ieee754.write(buf, value, offset, littleEndian, 23, 4);
|
|
2232
2232
|
return offset + 4;
|
|
2233
2233
|
}
|
|
2234
|
-
Buffer$
|
|
2234
|
+
Buffer$2.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
|
|
2235
2235
|
return writeFloat(this, value, offset, true, noAssert);
|
|
2236
2236
|
};
|
|
2237
|
-
Buffer$
|
|
2237
|
+
Buffer$2.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
|
|
2238
2238
|
return writeFloat(this, value, offset, false, noAssert);
|
|
2239
2239
|
};
|
|
2240
2240
|
function writeDouble(buf, value, offset, littleEndian, noAssert) {
|
|
@@ -2244,14 +2244,14 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2244
2244
|
ieee754.write(buf, value, offset, littleEndian, 52, 8);
|
|
2245
2245
|
return offset + 8;
|
|
2246
2246
|
}
|
|
2247
|
-
Buffer$
|
|
2247
|
+
Buffer$2.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
|
|
2248
2248
|
return writeDouble(this, value, offset, true, noAssert);
|
|
2249
2249
|
};
|
|
2250
|
-
Buffer$
|
|
2250
|
+
Buffer$2.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
|
|
2251
2251
|
return writeDouble(this, value, offset, false, noAssert);
|
|
2252
2252
|
};
|
|
2253
|
-
Buffer$
|
|
2254
|
-
if (!Buffer$
|
|
2253
|
+
Buffer$2.prototype.copy = function copy(target, targetStart, start, end) {
|
|
2254
|
+
if (!Buffer$2.isBuffer(target)) throw new TypeError("argument should be a Buffer");
|
|
2255
2255
|
if (!start) start = 0;
|
|
2256
2256
|
if (!end && end !== 0) end = this.length;
|
|
2257
2257
|
if (targetStart >= target.length) targetStart = target.length;
|
|
@@ -2269,7 +2269,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2269
2269
|
else Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart);
|
|
2270
2270
|
return len$1;
|
|
2271
2271
|
};
|
|
2272
|
-
Buffer$
|
|
2272
|
+
Buffer$2.prototype.fill = function fill(val, start, end, encoding) {
|
|
2273
2273
|
if (typeof val === "string") {
|
|
2274
2274
|
if (typeof start === "string") {
|
|
2275
2275
|
encoding = start;
|
|
@@ -2280,7 +2280,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2280
2280
|
end = this.length;
|
|
2281
2281
|
}
|
|
2282
2282
|
if (encoding !== void 0 && typeof encoding !== "string") throw new TypeError("encoding must be a string");
|
|
2283
|
-
if (typeof encoding === "string" && !Buffer$
|
|
2283
|
+
if (typeof encoding === "string" && !Buffer$2.isEncoding(encoding)) throw new TypeError("Unknown encoding: " + encoding);
|
|
2284
2284
|
if (val.length === 1) {
|
|
2285
2285
|
const code$1 = val.charCodeAt(0);
|
|
2286
2286
|
if (encoding === "utf8" && code$1 < 128 || encoding === "latin1") val = code$1;
|
|
@@ -2295,7 +2295,7 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2295
2295
|
let i$1;
|
|
2296
2296
|
if (typeof val === "number") for (i$1 = start; i$1 < end; ++i$1) this[i$1] = val;
|
|
2297
2297
|
else {
|
|
2298
|
-
const bytes = Buffer$
|
|
2298
|
+
const bytes = Buffer$2.isBuffer(val) ? val : Buffer$2.from(val, encoding);
|
|
2299
2299
|
const len$1 = bytes.length;
|
|
2300
2300
|
if (len$1 === 0) throw new TypeError("The value \"" + val + "\" is invalid for argument \"value\"");
|
|
2301
2301
|
for (i$1 = 0; i$1 < end - start; ++i$1) this[i$1 + start] = bytes[i$1 % len$1];
|
|
@@ -2490,75 +2490,10 @@ var require_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/buff
|
|
|
2490
2490
|
}
|
|
2491
2491
|
}) });
|
|
2492
2492
|
|
|
2493
|
-
//#endregion
|
|
2494
|
-
//#region ../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js
|
|
2495
|
-
var require_safe_buffer = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js": ((exports, module) => {
|
|
2496
|
-
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
2497
|
-
var buffer = require_buffer();
|
|
2498
|
-
var Buffer$3 = buffer.Buffer;
|
|
2499
|
-
function copyProps(src, dst) {
|
|
2500
|
-
for (var key in src) dst[key] = src[key];
|
|
2501
|
-
}
|
|
2502
|
-
if (Buffer$3.from && Buffer$3.alloc && Buffer$3.allocUnsafe && Buffer$3.allocUnsafeSlow) module.exports = buffer;
|
|
2503
|
-
else {
|
|
2504
|
-
copyProps(buffer, exports);
|
|
2505
|
-
exports.Buffer = SafeBuffer;
|
|
2506
|
-
}
|
|
2507
|
-
function SafeBuffer(arg, encodingOrOffset, length) {
|
|
2508
|
-
return Buffer$3(arg, encodingOrOffset, length);
|
|
2509
|
-
}
|
|
2510
|
-
SafeBuffer.prototype = Object.create(Buffer$3.prototype);
|
|
2511
|
-
copyProps(Buffer$3, SafeBuffer);
|
|
2512
|
-
SafeBuffer.from = function(arg, encodingOrOffset, length) {
|
|
2513
|
-
if (typeof arg === "number") throw new TypeError("Argument must not be a number");
|
|
2514
|
-
return Buffer$3(arg, encodingOrOffset, length);
|
|
2515
|
-
};
|
|
2516
|
-
SafeBuffer.alloc = function(size, fill, encoding) {
|
|
2517
|
-
if (typeof size !== "number") throw new TypeError("Argument must be a number");
|
|
2518
|
-
var buf = Buffer$3(size);
|
|
2519
|
-
if (fill !== void 0) if (typeof encoding === "string") buf.fill(fill, encoding);
|
|
2520
|
-
else buf.fill(fill);
|
|
2521
|
-
else buf.fill(0);
|
|
2522
|
-
return buf;
|
|
2523
|
-
};
|
|
2524
|
-
SafeBuffer.allocUnsafe = function(size) {
|
|
2525
|
-
if (typeof size !== "number") throw new TypeError("Argument must be a number");
|
|
2526
|
-
return Buffer$3(size);
|
|
2527
|
-
};
|
|
2528
|
-
SafeBuffer.allocUnsafeSlow = function(size) {
|
|
2529
|
-
if (typeof size !== "number") throw new TypeError("Argument must be a number");
|
|
2530
|
-
return buffer.SlowBuffer(size);
|
|
2531
|
-
};
|
|
2532
|
-
}) });
|
|
2533
|
-
|
|
2534
|
-
//#endregion
|
|
2535
|
-
//#region ../../node_modules/.pnpm/randombytes@2.1.0/node_modules/randombytes/browser.js
|
|
2536
|
-
var require_browser = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/randombytes@2.1.0/node_modules/randombytes/browser.js": ((exports, module) => {
|
|
2537
|
-
var MAX_BYTES = 65536;
|
|
2538
|
-
var MAX_UINT32 = 4294967295;
|
|
2539
|
-
function oldBrowser() {
|
|
2540
|
-
throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11");
|
|
2541
|
-
}
|
|
2542
|
-
var Buffer$2 = require_safe_buffer().Buffer;
|
|
2543
|
-
var crypto = globalThis.crypto || globalThis.msCrypto;
|
|
2544
|
-
if (crypto && crypto.getRandomValues) module.exports = randomBytes;
|
|
2545
|
-
else module.exports = oldBrowser;
|
|
2546
|
-
function randomBytes(size, cb) {
|
|
2547
|
-
if (size > MAX_UINT32) throw new RangeError("requested too many random bytes");
|
|
2548
|
-
var bytes = Buffer$2.allocUnsafe(size);
|
|
2549
|
-
if (size > 0) if (size > MAX_BYTES) for (var generated = 0; generated < size; generated += MAX_BYTES) crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES));
|
|
2550
|
-
else crypto.getRandomValues(bytes);
|
|
2551
|
-
if (typeof cb === "function") return process.nextTick(function() {
|
|
2552
|
-
cb(null, bytes);
|
|
2553
|
-
});
|
|
2554
|
-
return bytes;
|
|
2555
|
-
}
|
|
2556
|
-
}) });
|
|
2557
|
-
|
|
2558
2493
|
//#endregion
|
|
2559
2494
|
//#region src/utils/SPACryptoUtils.ts
|
|
2560
2495
|
var import_buffer = /* @__PURE__ */ __toESM(require_buffer(), 1);
|
|
2561
|
-
|
|
2496
|
+
const MAX_RANDOM_VALUES_BYTES = 65536;
|
|
2562
2497
|
/**
|
|
2563
2498
|
* Browser-side `Crypto` implementation using native Web Crypto APIs and `jose` for JWT verification.
|
|
2564
2499
|
*/
|
|
@@ -2597,7 +2532,9 @@ var SPACryptoUtils = class {
|
|
|
2597
2532
|
* @returns A `Buffer` of random bytes.
|
|
2598
2533
|
*/
|
|
2599
2534
|
generateRandomBytes(length) {
|
|
2600
|
-
|
|
2535
|
+
const bytes = new Uint8Array(length);
|
|
2536
|
+
for (let offset = 0; offset < length; offset += MAX_RANDOM_VALUES_BYTES) crypto.getRandomValues(bytes.subarray(offset, offset + MAX_RANDOM_VALUES_BYTES));
|
|
2537
|
+
return import_buffer.Buffer.from(bytes);
|
|
2601
2538
|
}
|
|
2602
2539
|
/**
|
|
2603
2540
|
* Verifies a JWT against a JWK using `jose`.
|
|
@@ -3362,6 +3299,564 @@ const resolveEmojiUrisInHtml = (html) => {
|
|
|
3362
3299
|
};
|
|
3363
3300
|
var resolveEmojiUrisInHtml_default = resolveEmojiUrisInHtml;
|
|
3364
3301
|
|
|
3302
|
+
//#endregion
|
|
3303
|
+
//#region src/utils/isAvatarUri.ts
|
|
3304
|
+
/**
|
|
3305
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
3306
|
+
*
|
|
3307
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
3308
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
3309
|
+
* in compliance with the License.
|
|
3310
|
+
* You may obtain a copy of the License at
|
|
3311
|
+
*
|
|
3312
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3313
|
+
*
|
|
3314
|
+
* Unless required by applicable law or agreed to in writing,
|
|
3315
|
+
* software distributed under the License is distributed on an
|
|
3316
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
3317
|
+
* KIND, either express or implied. See the License for the
|
|
3318
|
+
* specific language governing permissions and limitations
|
|
3319
|
+
* under the License.
|
|
3320
|
+
*/
|
|
3321
|
+
const AVATAR_URI_SCHEME = "avatar:";
|
|
3322
|
+
/**
|
|
3323
|
+
* Checks whether a given URI uses the `avatar:` scheme
|
|
3324
|
+
* (e.g. `"avatar:style=rounded,text=Acme,colors=2"`).
|
|
3325
|
+
*
|
|
3326
|
+
* @param uri - The URI string to check.
|
|
3327
|
+
* @returns `true` if the URI starts with `"avatar:"`, `false` otherwise.
|
|
3328
|
+
*
|
|
3329
|
+
* @example
|
|
3330
|
+
* ```typescript
|
|
3331
|
+
* isAvatarUri("avatar:style=circle,text=Acme,colors=0"); // true
|
|
3332
|
+
* isAvatarUri("emoji:🐯"); // false
|
|
3333
|
+
* ```
|
|
3334
|
+
*/
|
|
3335
|
+
const isAvatarUri = (uri) => typeof uri === "string" && uri.startsWith(AVATAR_URI_SCHEME);
|
|
3336
|
+
var isAvatarUri_default = isAvatarUri;
|
|
3337
|
+
|
|
3338
|
+
//#endregion
|
|
3339
|
+
//#region src/utils/extractAvatarParamsFromUri.ts
|
|
3340
|
+
const DEFAULT_PARAMS = {
|
|
3341
|
+
colors: 0,
|
|
3342
|
+
content: "",
|
|
3343
|
+
shape: "rounded",
|
|
3344
|
+
variant: "two_letter"
|
|
3345
|
+
};
|
|
3346
|
+
/**
|
|
3347
|
+
* Parses the comma-separated `key=value` pairs of an `avatar:` URI, e.g.
|
|
3348
|
+
* `"avatar:shape=circle,variant=two_letter,content=BM,colors=2,bg=#FF5733"`.
|
|
3349
|
+
*
|
|
3350
|
+
* @param uri - A URI string in the form `"avatar:shape=...,variant=...,content=...,colors=...,bg=..."`.
|
|
3351
|
+
* @returns The parsed avatar parameters, falling back to defaults for any missing/invalid field.
|
|
3352
|
+
*
|
|
3353
|
+
* @example
|
|
3354
|
+
* ```typescript
|
|
3355
|
+
* extractAvatarParamsFromUri("avatar:shape=circle,variant=anonymous_animal,content=jackalope");
|
|
3356
|
+
* // { shape: "circle", variant: "anonymous_animal", content: "jackalope", colors: 0 }
|
|
3357
|
+
* ```
|
|
3358
|
+
*/
|
|
3359
|
+
const extractAvatarParamsFromUri = (uri) => {
|
|
3360
|
+
if (!isAvatarUri_default(uri)) return { ...DEFAULT_PARAMS };
|
|
3361
|
+
const raw = uri.slice(AVATAR_URI_SCHEME.length);
|
|
3362
|
+
const params = {};
|
|
3363
|
+
raw.split(",").forEach((pair) => {
|
|
3364
|
+
const [key, ...rest] = pair.split("=");
|
|
3365
|
+
if (key) params[key.trim()] = rest.join("=").trim();
|
|
3366
|
+
});
|
|
3367
|
+
const shape = ["circle", "rounded"].includes(params["shape"]) ? params["shape"] : DEFAULT_PARAMS.shape;
|
|
3368
|
+
const variant = [
|
|
3369
|
+
"anonymous_animal",
|
|
3370
|
+
"anonymous_entity",
|
|
3371
|
+
"blank",
|
|
3372
|
+
"one_letter",
|
|
3373
|
+
"two_letter"
|
|
3374
|
+
].includes(params["variant"]) ? params["variant"] : DEFAULT_PARAMS.variant;
|
|
3375
|
+
const colors = Number.parseInt(params["colors"], 10);
|
|
3376
|
+
return {
|
|
3377
|
+
...params["bg"] ? { bg: params["bg"] } : {},
|
|
3378
|
+
colors: Number.isFinite(colors) ? colors : DEFAULT_PARAMS.colors,
|
|
3379
|
+
content: params["content"] ?? DEFAULT_PARAMS.content,
|
|
3380
|
+
shape,
|
|
3381
|
+
variant
|
|
3382
|
+
};
|
|
3383
|
+
};
|
|
3384
|
+
var extractAvatarParamsFromUri_default = extractAvatarParamsFromUri;
|
|
3385
|
+
|
|
3386
|
+
//#endregion
|
|
3387
|
+
//#region src/utils/anonymousAnimalIcons.generated.ts
|
|
3388
|
+
const ANONYMOUS_ANIMAL_ICONS = {
|
|
3389
|
+
capybara: {
|
|
3390
|
+
color: "#8A6A2E",
|
|
3391
|
+
markup: "<ellipse cx=\"50\" cy=\"58\" rx=\"30\" ry=\"20\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"24\" cy=\"50\" rx=\"5\" ry=\"5\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"76\" cy=\"50\" rx=\"5\" ry=\"5\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"50\" cy=\"70\" rx=\"14\" ry=\"10\" fill=\"#FFFFFF\"/>\n<circle cx=\"36\" cy=\"56\" r=\"3\" fill=\"%COLOR%\"/>\n<circle cx=\"64\" cy=\"56\" r=\"3\" fill=\"%COLOR%\"/>"
|
|
3392
|
+
},
|
|
3393
|
+
chameleon: {
|
|
3394
|
+
color: "#C23B7A",
|
|
3395
|
+
markup: "<path d=\"M30 60 Q20 55 25 45 Q35 35 45 42 L55 35 Q65 25 72 35 Q78 42 68 48 L55 55 Q60 65 45 68 Q32 70 30 60 Z\" fill=\"#FFFFFF\"/>\n<circle cx=\"60\" cy=\"35\" r=\"9\" fill=\"#FFFFFF\"/>\n<circle cx=\"60\" cy=\"35\" r=\"3\" fill=\"%COLOR%\"/>\n<path d=\"M25 62 Q15 65 12 78\" stroke=\"#FFFFFF\" stroke-width=\"5\" fill=\"none\" stroke-linecap=\"round\"/>"
|
|
3396
|
+
},
|
|
3397
|
+
chinchilla: {
|
|
3398
|
+
color: "#5B6BC0",
|
|
3399
|
+
markup: "<circle cx=\"30\" cy=\"34\" r=\"14\" fill=\"#FFFFFF\"/>\n<circle cx=\"70\" cy=\"34\" r=\"14\" fill=\"#FFFFFF\"/>\n<circle cx=\"30\" cy=\"34\" r=\"7\" fill=\"%COLOR%\"/>\n<circle cx=\"70\" cy=\"34\" r=\"7\" fill=\"%COLOR%\"/>\n<circle cx=\"50\" cy=\"58\" r=\"26\" fill=\"#FFFFFF\"/>\n<circle cx=\"38\" cy=\"55\" r=\"3.5\" fill=\"%COLOR%\"/>\n<circle cx=\"62\" cy=\"55\" r=\"3.5\" fill=\"%COLOR%\"/>\n<circle cx=\"50\" cy=\"65\" r=\"4\" fill=\"%COLOR%\"/>"
|
|
3400
|
+
},
|
|
3401
|
+
chipmunk: {
|
|
3402
|
+
color: "#B5522C",
|
|
3403
|
+
markup: "<circle cx=\"50\" cy=\"52\" r=\"22\" fill=\"#FFFFFF\"/>\n<path d=\"M28 34 L22 16 L38 28 Z\" fill=\"#FFFFFF\"/>\n<path d=\"M72 34 L78 16 L62 28 Z\" fill=\"#FFFFFF\"/>\n<circle cx=\"30\" cy=\"60\" r=\"8\" fill=\"#FFFFFF\"/>\n<circle cx=\"70\" cy=\"60\" r=\"8\" fill=\"#FFFFFF\"/>\n<path d=\"M50 75 Q70 70 78 85 Q65 95 50 88 Q35 95 22 85 Q30 70 50 75 Z\" fill=\"#FFFFFF\"/>\n<path d=\"M40 88 Q50 82 60 88\" stroke=\"%COLOR%\" stroke-width=\"3\" fill=\"none\"/>"
|
|
3404
|
+
},
|
|
3405
|
+
chupacabra: {
|
|
3406
|
+
color: "#4B7A3F",
|
|
3407
|
+
markup: "<path d=\"M20 50 L15 35 M28 42 L25 22 M38 38 L38 15 M50 36 L50 12 M62 38 L62 15 M72 42 L75 22 M80 50 L85 35\" stroke=\"#FFFFFF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n<ellipse cx=\"50\" cy=\"58\" rx=\"24\" ry=\"20\" fill=\"#FFFFFF\"/>\n<circle cx=\"38\" cy=\"52\" r=\"6\" fill=\"%COLOR%\"/>\n<circle cx=\"62\" cy=\"52\" r=\"6\" fill=\"%COLOR%\"/>\n<circle cx=\"38\" cy=\"52\" r=\"3\" fill=\"#FFFFFF\"/>\n<circle cx=\"62\" cy=\"52\" r=\"3\" fill=\"#FFFFFF\"/>"
|
|
3408
|
+
},
|
|
3409
|
+
dingo: {
|
|
3410
|
+
color: "#B5892C",
|
|
3411
|
+
markup: "<path d=\"M30 30 L22 10 L38 24 Z\" fill=\"#FFFFFF\"/>\n<path d=\"M70 30 L78 10 L62 24 Z\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"50\" cy=\"55\" rx=\"22\" ry=\"18\" fill=\"#FFFFFF\"/>\n<path d=\"M40 68 Q50 82 60 68 Q66 60 55 60 L45 60 Q34 60 40 68 Z\" fill=\"#FFFFFF\"/>"
|
|
3412
|
+
},
|
|
3413
|
+
dinosaur: {
|
|
3414
|
+
color: "#2E8F5B",
|
|
3415
|
+
markup: "<path d=\"M20 78 Q18 55 35 45 L38 25 L46 42 L55 30 L58 45 Q75 50 75 65 L78 78 Z\" fill=\"#FFFFFF\"/>\n<path d=\"M40 45 L45 30 L50 45 L57 33 L60 45\" stroke=\"#FFFFFF\" stroke-width=\"0\" fill=\"#FFFFFF\"/>\n<circle cx=\"42\" cy=\"40\" r=\"2.5\" fill=\"%COLOR%\"/>"
|
|
3416
|
+
},
|
|
3417
|
+
frog: {
|
|
3418
|
+
color: "#4FA33F",
|
|
3419
|
+
markup: "<circle cx=\"30\" cy=\"35\" r=\"14\" fill=\"#FFFFFF\"/>\n<circle cx=\"70\" cy=\"35\" r=\"14\" fill=\"#FFFFFF\"/>\n<circle cx=\"30\" cy=\"35\" r=\"6\" fill=\"%COLOR%\"/>\n<circle cx=\"70\" cy=\"35\" r=\"6\" fill=\"%COLOR%\"/>\n<ellipse cx=\"50\" cy=\"62\" rx=\"32\" ry=\"22\" fill=\"#FFFFFF\"/>\n<path d=\"M25 65 Q50 78 75 65\" stroke=\"%COLOR%\" stroke-width=\"4\" fill=\"none\" stroke-linecap=\"round\"/>"
|
|
3420
|
+
},
|
|
3421
|
+
giraffe: {
|
|
3422
|
+
color: "#C99A2E",
|
|
3423
|
+
markup: "<path d=\"M42 90 L38 40 Q37 20 48 15 L55 15 Q62 20 58 28 Q52 30 52 38 L58 40 L54 90 Z\" fill=\"#FFFFFF\"/>\n<circle cx=\"47\" cy=\"14\" r=\"3\" fill=\"#FFFFFF\"/>\n<circle cx=\"58\" cy=\"14\" r=\"3\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"30\" cy=\"55\" rx=\"4\" ry=\"6\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"44\" cy=\"70\" rx=\"4\" ry=\"6\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"60\" cy=\"50\" rx=\"4\" ry=\"6\" fill=\"#FFFFFF\"/>"
|
|
3424
|
+
},
|
|
3425
|
+
hedgehog: {
|
|
3426
|
+
color: "#8A9A3B",
|
|
3427
|
+
markup: "<path d=\"M20 55 L10 40 M25 42 L18 25 M35 33 L30 15 M50 30 L48 10 M65 33 L70 15 M75 42 L82 25 M80 55 L90 40\" stroke=\"#FFFFFF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n<circle cx=\"50\" cy=\"60\" r=\"26\" fill=\"#FFFFFF\"/>\n<path d=\"M50 60 Q30 90 20 75 Q30 70 34 60 Z\" fill=\"#FFFFFF\"/>\n<circle cx=\"30\" cy=\"56\" r=\"3.5\" fill=\"%COLOR%\"/>"
|
|
3428
|
+
},
|
|
3429
|
+
hippo: {
|
|
3430
|
+
color: "#5B7A9E",
|
|
3431
|
+
markup: "<ellipse cx=\"50\" cy=\"52\" rx=\"34\" ry=\"24\" fill=\"#FFFFFF\"/>\n<circle cx=\"30\" cy=\"30\" r=\"7\" fill=\"#FFFFFF\"/>\n<circle cx=\"70\" cy=\"30\" r=\"7\" fill=\"#FFFFFF\"/>\n<circle cx=\"34\" cy=\"42\" r=\"3.5\" fill=\"%COLOR%\"/>\n<circle cx=\"66\" cy=\"42\" r=\"3.5\" fill=\"%COLOR%\"/>\n<ellipse cx=\"50\" cy=\"70\" rx=\"20\" ry=\"10\" fill=\"#FFFFFF\"/>\n<path d=\"M35 70 Q50 78 65 70\" stroke=\"%COLOR%\" stroke-width=\"3\" fill=\"none\"/>"
|
|
3432
|
+
},
|
|
3433
|
+
jackal: {
|
|
3434
|
+
color: "#D6822C",
|
|
3435
|
+
markup: "<path d=\"M28 32 L18 8 L40 26 Z\" fill=\"#FFFFFF\"/>\n<path d=\"M72 32 L82 8 L60 26 Z\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"50\" cy=\"55\" rx=\"20\" ry=\"17\" fill=\"#FFFFFF\"/>\n<path d=\"M42 66 Q50 82 58 66 Q64 58 52 58 L48 58 Q36 58 42 66 Z\" fill=\"#FFFFFF\"/>"
|
|
3436
|
+
},
|
|
3437
|
+
jackalope: {
|
|
3438
|
+
color: "#2E9E9E",
|
|
3439
|
+
markup: "<path d=\"M35 20 L28 5 M35 20 L38 8\" stroke=\"#FFFFFF\" stroke-width=\"4\" stroke-linecap=\"round\" fill=\"none\"/>\n<path d=\"M65 20 L72 5 M65 20 L62 8\" stroke=\"#FFFFFF\" stroke-width=\"4\" stroke-linecap=\"round\" fill=\"none\"/>\n<ellipse cx=\"40\" cy=\"35\" rx=\"7\" ry=\"16\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"60\" cy=\"35\" rx=\"7\" ry=\"16\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"50\" cy=\"62\" rx=\"22\" ry=\"20\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"50\" cy=\"78\" rx=\"10\" ry=\"7\" fill=\"#FFFFFF\"/>"
|
|
3440
|
+
},
|
|
3441
|
+
mink: {
|
|
3442
|
+
color: "#3B7DD8",
|
|
3443
|
+
markup: "<ellipse cx=\"50\" cy=\"55\" rx=\"24\" ry=\"16\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"24\" cy=\"46\" rx=\"6\" ry=\"6\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"76\" cy=\"46\" rx=\"6\" ry=\"6\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"18\" cy=\"60\" rx=\"10\" ry=\"7\" fill=\"#FFFFFF\"/>\n<circle cx=\"12\" cy=\"60\" r=\"2.5\" fill=\"%COLOR%\"/>"
|
|
3444
|
+
},
|
|
3445
|
+
otter: {
|
|
3446
|
+
color: "#E8622C",
|
|
3447
|
+
markup: "<circle cx=\"50\" cy=\"55\" r=\"24\" fill=\"#FFFFFF\"/>\n<circle cx=\"30\" cy=\"38\" r=\"7\" fill=\"#FFFFFF\"/>\n<circle cx=\"70\" cy=\"38\" r=\"7\" fill=\"#FFFFFF\"/>\n<circle cx=\"38\" cy=\"52\" r=\"4\" fill=\"%COLOR%\"/>\n<circle cx=\"62\" cy=\"52\" r=\"4\" fill=\"%COLOR%\"/>\n<circle cx=\"50\" cy=\"62\" r=\"5\" fill=\"%COLOR%\"/>\n<path d=\"M30 68 L15 65 M30 71 L14 71 M30 74 L15 77 M70 68 L85 65 M70 71 L86 71 M70 74 L85 77\" stroke=\"#FFFFFF\" stroke-width=\"3\" stroke-linecap=\"round\"/>"
|
|
3448
|
+
},
|
|
3449
|
+
platypus: {
|
|
3450
|
+
color: "#C23B7A",
|
|
3451
|
+
markup: "<ellipse cx=\"55\" cy=\"55\" rx=\"22\" ry=\"18\" fill=\"#FFFFFF\"/>\n<path d=\"M18 52 Q10 55 18 62 Q35 68 42 55 Q35 45 18 52 Z\" fill=\"#FFFFFF\"/>"
|
|
3452
|
+
},
|
|
3453
|
+
quagga: {
|
|
3454
|
+
color: "#D6455C",
|
|
3455
|
+
markup: "<path d=\"M25 70 L30 30 Q35 20 45 22 L60 25 Q68 27 72 35 L75 55 L68 70 Z\" fill=\"#FFFFFF\"/>\n<path d=\"M35 25 L20 10 M42 22 L34 6\" stroke=\"#FFFFFF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n<rect x=\"33\" y=\"30\" width=\"6\" height=\"10\" fill=\"%COLOR%\"/>\n<rect x=\"45\" y=\"32\" width=\"6\" height=\"12\" fill=\"%COLOR%\"/>\n<rect x=\"57\" y=\"35\" width=\"6\" height=\"12\" fill=\"%COLOR%\"/>"
|
|
3456
|
+
},
|
|
3457
|
+
raccoon: {
|
|
3458
|
+
color: "#E0348E",
|
|
3459
|
+
markup: "<circle cx=\"50\" cy=\"55\" r=\"24\" fill=\"#FFFFFF\"/>\n<path d=\"M25 35 L18 15 L38 28 Z\" fill=\"#FFFFFF\"/>\n<path d=\"M75 35 L82 15 L62 28 Z\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"36\" cy=\"52\" rx=\"9\" ry=\"6\" fill=\"%COLOR%\"/>\n<ellipse cx=\"64\" cy=\"52\" rx=\"9\" ry=\"6\" fill=\"%COLOR%\"/>\n<circle cx=\"50\" cy=\"63\" r=\"4\" fill=\"%COLOR%\"/>"
|
|
3460
|
+
},
|
|
3461
|
+
skunk: {
|
|
3462
|
+
color: "#7B3F9E",
|
|
3463
|
+
markup: "<circle cx=\"38\" cy=\"55\" r=\"18\" fill=\"#FFFFFF\"/>\n<path d=\"M50 45 Q85 30 85 65 Q85 90 55 82 Q78 68 65 55 Q60 48 50 45 Z\" fill=\"#FFFFFF\"/>\n<path d=\"M55 45 Q80 35 80 65\" stroke=\"%COLOR%\" stroke-width=\"4\" fill=\"none\" stroke-linecap=\"round\"/>\n<ellipse cx=\"24\" cy=\"48\" rx=\"4\" ry=\"5\" fill=\"%COLOR%\"/>"
|
|
3464
|
+
}
|
|
3465
|
+
};
|
|
3466
|
+
|
|
3467
|
+
//#endregion
|
|
3468
|
+
//#region src/utils/anonymousEntityIcons.generated.ts
|
|
3469
|
+
const ANONYMOUS_ENTITY_ICONS = {
|
|
3470
|
+
anchor: {
|
|
3471
|
+
color: "#D6455C",
|
|
3472
|
+
markup: "<circle cx=\"50\" cy=\"18\" r=\"8\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"6\"/>\n<rect x=\"46\" y=\"26\" width=\"8\" height=\"50\" fill=\"#FFFFFF\"/>\n<path d=\"M20 55 Q20 80 50 82 Q80 80 80 55\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"7\"/>\n<rect x=\"28\" y=\"42\" width=\"44\" height=\"7\" fill=\"#FFFFFF\"/>"
|
|
3473
|
+
},
|
|
3474
|
+
antenna: {
|
|
3475
|
+
color: "#8A9A3B",
|
|
3476
|
+
markup: "<rect x=\"46\" y=\"45\" width=\"8\" height=\"40\" fill=\"#FFFFFF\"/>\n<circle cx=\"50\" cy=\"35\" r=\"7\" fill=\"#FFFFFF\"/>\n<path d=\"M35 30 Q50 10 65 30 M28 40 Q50 8 72 40\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"5\" stroke-linecap=\"round\"/>"
|
|
3477
|
+
},
|
|
3478
|
+
anvil: {
|
|
3479
|
+
color: "#B5522C",
|
|
3480
|
+
markup: "<rect x=\"20\" y=\"30\" width=\"60\" height=\"14\" rx=\"3\" fill=\"#FFFFFF\"/>\n<polygon points=\"35,44 65,44 58,60 42,60\" fill=\"#FFFFFF\"/>\n<rect x=\"42\" y=\"60\" width=\"16\" height=\"10\" fill=\"#FFFFFF\"/>\n<rect x=\"30\" y=\"70\" width=\"40\" height=\"12\" rx=\"3\" fill=\"#FFFFFF\"/>"
|
|
3481
|
+
},
|
|
3482
|
+
arch: {
|
|
3483
|
+
color: "#E0348E",
|
|
3484
|
+
markup: "<path d=\"M20 85 L20 50 Q20 15 50 15 Q80 15 80 50 L80 85 Z\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"10\"/>"
|
|
3485
|
+
},
|
|
3486
|
+
bridge: {
|
|
3487
|
+
color: "#B5892C",
|
|
3488
|
+
markup: "<path d=\"M10 55 Q50 20 90 55\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"7\"/>\n<rect x=\"10\" y=\"55\" width=\"80\" height=\"8\" fill=\"#FFFFFF\"/>\n<rect x=\"20\" y=\"63\" width=\"6\" height=\"18\" fill=\"#FFFFFF\"/>\n<rect x=\"74\" y=\"63\" width=\"6\" height=\"18\" fill=\"#FFFFFF\"/>"
|
|
3489
|
+
},
|
|
3490
|
+
chevron: {
|
|
3491
|
+
color: "#C99A2E",
|
|
3492
|
+
markup: "<polygon points=\"15,30 50,30 85,60 50,60\" fill=\"#FFFFFF\"/>\n<polygon points=\"15,55 50,55 85,85 50,85\" fill=\"#FFFFFF\" opacity=\"0.55\"/>"
|
|
3493
|
+
},
|
|
3494
|
+
circuit_node: {
|
|
3495
|
+
color: "#5B7A9E",
|
|
3496
|
+
markup: "<circle cx=\"50\" cy=\"50\" r=\"10\" fill=\"#FFFFFF\"/>\n<circle cx=\"20\" cy=\"20\" r=\"7\" fill=\"#FFFFFF\"/>\n<circle cx=\"80\" cy=\"20\" r=\"7\" fill=\"#FFFFFF\"/>\n<circle cx=\"20\" cy=\"80\" r=\"7\" fill=\"#FFFFFF\"/>\n<circle cx=\"80\" cy=\"80\" r=\"7\" fill=\"#FFFFFF\"/>\n<path d=\"M50 50 L20 20 M50 50 L80 20 M50 50 L20 80 M50 50 L80 80\" stroke=\"#FFFFFF\" stroke-width=\"5\"/>"
|
|
3497
|
+
},
|
|
3498
|
+
compass: {
|
|
3499
|
+
color: "#4FA33F",
|
|
3500
|
+
markup: "<circle cx=\"50\" cy=\"50\" r=\"34\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"6\"/>\n<polygon points=\"50,28 58,50 50,72 42,50\" fill=\"#FFFFFF\"/>"
|
|
3501
|
+
},
|
|
3502
|
+
cube: {
|
|
3503
|
+
color: "#2E9E9E",
|
|
3504
|
+
markup: "<polygon points=\"50,12 84,30 84,70 50,88 16,70 16,30\" fill=\"#FFFFFF\" opacity=\"0.35\"/>\n<polygon points=\"50,12 84,30 50,48 16,30\" fill=\"#FFFFFF\"/>\n<polygon points=\"50,48 84,30 84,70 50,88\" fill=\"#FFFFFF\" opacity=\"0.7\"/>"
|
|
3505
|
+
},
|
|
3506
|
+
diamond: {
|
|
3507
|
+
color: "#E8622C",
|
|
3508
|
+
markup: "<polygon points=\"50,12 82,50 50,88 18,50\" fill=\"#FFFFFF\"/>"
|
|
3509
|
+
},
|
|
3510
|
+
dome: {
|
|
3511
|
+
color: "#D6822C",
|
|
3512
|
+
markup: "<path d=\"M20 85 L20 55 Q20 20 50 20 Q80 20 80 55 L80 85 Z\" fill=\"#FFFFFF\"/>\n<rect x=\"46\" y=\"8\" width=\"8\" height=\"12\" fill=\"#FFFFFF\"/>\n<circle cx=\"50\" cy=\"6\" r=\"4\" fill=\"#FFFFFF\"/>"
|
|
3513
|
+
},
|
|
3514
|
+
gate: {
|
|
3515
|
+
color: "#3B7DD8",
|
|
3516
|
+
markup: "<path d=\"M22 85 L22 40 Q22 15 50 15 Q78 15 78 40 L78 85\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"12\"/>"
|
|
3517
|
+
},
|
|
3518
|
+
hexagon: {
|
|
3519
|
+
color: "#3B7DD8",
|
|
3520
|
+
markup: "<polygon points=\"50,15 82,33 82,67 50,85 18,67 18,33\" fill=\"#FFFFFF\"/>"
|
|
3521
|
+
},
|
|
3522
|
+
key: {
|
|
3523
|
+
color: "#C99A2E",
|
|
3524
|
+
markup: "<circle cx=\"30\" cy=\"35\" r=\"16\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"8\"/>\n<rect x=\"42\" y=\"46\" width=\"42\" height=\"9\" fill=\"#FFFFFF\"/>\n<rect x=\"66\" y=\"55\" width=\"9\" height=\"14\" fill=\"#FFFFFF\"/>\n<rect x=\"78\" y=\"55\" width=\"9\" height=\"20\" fill=\"#FFFFFF\"/>"
|
|
3525
|
+
},
|
|
3526
|
+
lighthouse: {
|
|
3527
|
+
color: "#D6455C",
|
|
3528
|
+
markup: "<polygon points=\"42,85 58,85 54,25 46,25\" fill=\"#FFFFFF\"/>\n<rect x=\"40\" y=\"15\" width=\"20\" height=\"12\" fill=\"#FFFFFF\"/>\n<polygon points=\"38,15 62,15 50,5\" fill=\"#FFFFFF\"/>\n<rect x=\"30\" y=\"85\" width=\"40\" height=\"6\" fill=\"#FFFFFF\"/>"
|
|
3529
|
+
},
|
|
3530
|
+
lock: {
|
|
3531
|
+
color: "#E0348E",
|
|
3532
|
+
markup: "<rect x=\"26\" y=\"45\" width=\"48\" height=\"38\" rx=\"6\" fill=\"#FFFFFF\"/>\n<path d=\"M34 45 L34 32 Q34 14 50 14 Q66 14 66 32 L66 45\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"8\"/>\n<circle cx=\"50\" cy=\"63\" r=\"6\" fill=\"%COLOR%\"/>"
|
|
3533
|
+
},
|
|
3534
|
+
obelisk: {
|
|
3535
|
+
color: "#5B6BC0",
|
|
3536
|
+
markup: "<polygon points=\"50,8 62,25 62,85 38,85 38,25\" fill=\"#FFFFFF\"/>"
|
|
3537
|
+
},
|
|
3538
|
+
octagon: {
|
|
3539
|
+
color: "#B5522C",
|
|
3540
|
+
markup: "<polygon points=\"35,15 65,15 85,35 85,65 65,85 35,85 15,65 15,35\" fill=\"#FFFFFF\"/>"
|
|
3541
|
+
},
|
|
3542
|
+
orbit_ring: {
|
|
3543
|
+
color: "#4FA33F",
|
|
3544
|
+
markup: "<circle cx=\"50\" cy=\"50\" r=\"10\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"50\" cy=\"50\" rx=\"38\" ry=\"16\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"5\" transform=\"rotate(-25 50 50)\"/>"
|
|
3545
|
+
},
|
|
3546
|
+
parallelogram: {
|
|
3547
|
+
color: "#2E8F5B",
|
|
3548
|
+
markup: "<polygon points=\"30,25 90,25 70,75 10,75\" fill=\"#FFFFFF\"/>"
|
|
3549
|
+
},
|
|
3550
|
+
pavilion: {
|
|
3551
|
+
color: "#4FA33F",
|
|
3552
|
+
markup: "<polygon points=\"50,12 90,45 10,45\" fill=\"#FFFFFF\"/>\n<rect x=\"20\" y=\"45\" width=\"60\" height=\"40\" fill=\"#FFFFFF\" opacity=\"0.6\"/>\n<rect x=\"44\" y=\"20\" width=\"6\" height=\"14\" fill=\"#FFFFFF\"/>"
|
|
3553
|
+
},
|
|
3554
|
+
pentagon: {
|
|
3555
|
+
color: "#7B3F9E",
|
|
3556
|
+
markup: "<polygon points=\"50,12 86,38 72,82 28,82 14,38\" fill=\"#FFFFFF\"/>"
|
|
3557
|
+
},
|
|
3558
|
+
plus_facet: {
|
|
3559
|
+
color: "#E0348E",
|
|
3560
|
+
markup: "<polygon points=\"38,12 62,12 62,38 88,38 88,62 62,62 62,88 38,88 38,62 12,62 12,38 38,38\" fill=\"#FFFFFF\"/>"
|
|
3561
|
+
},
|
|
3562
|
+
silo: {
|
|
3563
|
+
color: "#8A6A2E",
|
|
3564
|
+
markup: "<rect x=\"30\" y=\"35\" width=\"40\" height=\"50\" fill=\"#FFFFFF\"/>\n<ellipse cx=\"50\" cy=\"35\" rx=\"20\" ry=\"10\" fill=\"#FFFFFF\"/>\n<path d=\"M35 20 Q50 5 65 20\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"6\" stroke-linecap=\"round\"/>"
|
|
3565
|
+
},
|
|
3566
|
+
spiral: {
|
|
3567
|
+
color: "#8A9A3B",
|
|
3568
|
+
markup: "<path d=\"M50 50 m-30 0 a30 30 0 1 1 60 0 a22 22 0 1 1 -44 0 a14 14 0 1 1 28 0 a6 6 0 1 1 -12 0\" fill=\"none\" stroke=\"#FFFFFF\" stroke-width=\"6\" stroke-linecap=\"round\"/>"
|
|
3569
|
+
},
|
|
3570
|
+
spire: {
|
|
3571
|
+
color: "#7B3F9E",
|
|
3572
|
+
markup: "<polygon points=\"50,8 62,50 38,50\" fill=\"#FFFFFF\"/>\n<rect x=\"30\" y=\"50\" width=\"40\" height=\"35\" fill=\"#FFFFFF\"/>"
|
|
3573
|
+
},
|
|
3574
|
+
star: {
|
|
3575
|
+
color: "#5B6BC0",
|
|
3576
|
+
markup: "<polygon points=\"50,10 61,38 90,38 66,56 75,86 50,68 25,86 34,56 10,38 39,38\" fill=\"#FFFFFF\"/>"
|
|
3577
|
+
},
|
|
3578
|
+
tower: {
|
|
3579
|
+
color: "#C23B7A",
|
|
3580
|
+
markup: "<rect x=\"38\" y=\"20\" width=\"24\" height=\"65\" fill=\"#FFFFFF\"/>\n<polygon points=\"50,8 62,20 38,20\" fill=\"#FFFFFF\"/>\n<rect x=\"44\" y=\"32\" width=\"6\" height=\"8\" fill=\"%COLOR%\"/>\n<rect x=\"44\" y=\"48\" width=\"6\" height=\"8\" fill=\"%COLOR%\"/>\n<rect x=\"44\" y=\"64\" width=\"6\" height=\"8\" fill=\"%COLOR%\"/>"
|
|
3581
|
+
},
|
|
3582
|
+
townhouse: {
|
|
3583
|
+
color: "#5B7A9E",
|
|
3584
|
+
markup: "<polygon points=\"50,15 82,35 82,85 18,85 18,35\" fill=\"#FFFFFF\"/>\n<rect x=\"42\" y=\"60\" width=\"16\" height=\"25\" fill=\"%COLOR%\"/>\n<rect x=\"26\" y=\"45\" width=\"10\" height=\"10\" fill=\"%COLOR%\"/>\n<rect x=\"64\" y=\"45\" width=\"10\" height=\"10\" fill=\"%COLOR%\"/>"
|
|
3585
|
+
},
|
|
3586
|
+
triangle_stack: {
|
|
3587
|
+
color: "#D6455C",
|
|
3588
|
+
markup: "<polygon points=\"50,15 78,60 22,60\" fill=\"#FFFFFF\"/>\n<polygon points=\"50,42 90,88 10,88\" fill=\"#FFFFFF\" opacity=\"0.55\"/>"
|
|
3589
|
+
},
|
|
3590
|
+
turbine: {
|
|
3591
|
+
color: "#7B3F9E",
|
|
3592
|
+
markup: "<circle cx=\"50\" cy=\"50\" r=\"9\" fill=\"#FFFFFF\"/>\n<path d=\"M50 50 Q20 40 20 15 Q50 25 50 50 Q80 40 80 15 Q50 25 50 50 Q80 60 80 85 Q50 75 50 50 Q20 60 20 85 Q50 75 50 50\" fill=\"#FFFFFF\"/>"
|
|
3593
|
+
},
|
|
3594
|
+
valve: {
|
|
3595
|
+
color: "#D68A2C",
|
|
3596
|
+
markup: "<circle cx=\"50\" cy=\"50\" r=\"12\" fill=\"#FFFFFF\"/>\n<path d=\"M50 20 L50 32 M50 68 L50 80 M20 50 L32 50 M68 50 L80 50 M30 30 L38 38 M62 62 L70 70 M70 30 L62 38 M38 62 L30 70\" stroke=\"#FFFFFF\" stroke-width=\"6\" stroke-linecap=\"round\"/>"
|
|
3597
|
+
},
|
|
3598
|
+
windmill: {
|
|
3599
|
+
color: "#2E9E9E",
|
|
3600
|
+
markup: "<polygon points=\"46,85 54,85 52,25 48,25\" fill=\"#FFFFFF\"/>\n<circle cx=\"50\" cy=\"25\" r=\"5\" fill=\"#FFFFFF\"/>\n<path d=\"M50 25 L25 10 M50 25 L75 10 M50 25 L25 40 M50 25 L75 40\" stroke=\"#FFFFFF\" stroke-width=\"6\" stroke-linecap=\"round\"/>"
|
|
3601
|
+
}
|
|
3602
|
+
};
|
|
3603
|
+
|
|
3604
|
+
//#endregion
|
|
3605
|
+
//#region src/utils/hashStr.ts
|
|
3606
|
+
/**
|
|
3607
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
3608
|
+
*
|
|
3609
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
3610
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
3611
|
+
* in compliance with the License.
|
|
3612
|
+
* You may obtain a copy of the License at
|
|
3613
|
+
*
|
|
3614
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3615
|
+
*
|
|
3616
|
+
* Unless required by applicable law or agreed to in writing,
|
|
3617
|
+
* software distributed under the License is distributed on an
|
|
3618
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
3619
|
+
* KIND, either express or implied. See the License for the
|
|
3620
|
+
* specific language governing permissions and limitations
|
|
3621
|
+
* under the License.
|
|
3622
|
+
*/
|
|
3623
|
+
/**
|
|
3624
|
+
* 32-bit unsigned polynomial hash (`h = h*31 + charCode`), used to deterministically derive
|
|
3625
|
+
* avatar colors/icons from a seed string. Shared by every avatar util that needs the same
|
|
3626
|
+
* hash so seeds map identically across them.
|
|
3627
|
+
*
|
|
3628
|
+
* @example
|
|
3629
|
+
* ```typescript
|
|
3630
|
+
* hashStr('session-abc123');
|
|
3631
|
+
* ```
|
|
3632
|
+
*/
|
|
3633
|
+
const hashStr = (str) => {
|
|
3634
|
+
let h = 0;
|
|
3635
|
+
for (let i$1 = 0; i$1 < str.length; i$1++) h = h * 31 + str.charCodeAt(i$1) >>> 0;
|
|
3636
|
+
return h;
|
|
3637
|
+
};
|
|
3638
|
+
var hashStr_default = hashStr;
|
|
3639
|
+
|
|
3640
|
+
//#endregion
|
|
3641
|
+
//#region src/utils/pickAnonymousAvatarName.ts
|
|
3642
|
+
const ANONYMOUS_AVATAR_NAMES = Object.keys(ANONYMOUS_ANIMAL_ICONS).sort();
|
|
3643
|
+
/**
|
|
3644
|
+
* Deterministically picks one of the curated anonymous-avatar animal keys for a given seed
|
|
3645
|
+
* (e.g. a session or device identifier), so the same seed always maps to the same avatar.
|
|
3646
|
+
*
|
|
3647
|
+
* Use this to derive the `content` value for an `avatar:variant=anonymous_animal` spec —
|
|
3648
|
+
* the spec parser itself does no hashing, it just looks up whatever key it's given.
|
|
3649
|
+
*
|
|
3650
|
+
* @param seed - Seed text the pick is derived from. Falls back to a random pick when omitted.
|
|
3651
|
+
* @returns An anonymous animal key (e.g. `"otter"`) usable as `avatar:` spec's `content` param.
|
|
3652
|
+
*
|
|
3653
|
+
* @example
|
|
3654
|
+
* ```typescript
|
|
3655
|
+
* pickAnonymousAvatarName('session-abc123'); // "otter"
|
|
3656
|
+
* `avatar:variant=anonymous_animal,content=${pickAnonymousAvatarName(sessionId)}`;
|
|
3657
|
+
* ```
|
|
3658
|
+
*/
|
|
3659
|
+
const pickAnonymousAvatarName = (seed) => {
|
|
3660
|
+
return ANONYMOUS_AVATAR_NAMES[seed ? hashStr_default(seed) % ANONYMOUS_AVATAR_NAMES.length : Math.floor(Math.random() * ANONYMOUS_AVATAR_NAMES.length)];
|
|
3661
|
+
};
|
|
3662
|
+
var pickAnonymousAvatarName_default = pickAnonymousAvatarName;
|
|
3663
|
+
|
|
3664
|
+
//#endregion
|
|
3665
|
+
//#region src/utils/pickAnonymousEntityName.ts
|
|
3666
|
+
const ANONYMOUS_ENTITY_NAMES = Object.keys(ANONYMOUS_ENTITY_ICONS).sort();
|
|
3667
|
+
/**
|
|
3668
|
+
* Deterministically picks one of the curated anonymous-entity icon keys for a given seed
|
|
3669
|
+
* (e.g. an application, organization, or resource server identifier), so the same seed
|
|
3670
|
+
* always maps to the same icon.
|
|
3671
|
+
*
|
|
3672
|
+
* Use this to derive the `content` value for an `avatar:variant=anonymous_entity` spec —
|
|
3673
|
+
* the spec parser itself does no hashing, it just looks up whatever key it's given.
|
|
3674
|
+
*
|
|
3675
|
+
* @param seed - Seed text the pick is derived from. Falls back to a random pick when omitted.
|
|
3676
|
+
* @returns An anonymous entity key (e.g. `"hexagon"`) usable as `avatar:` spec's `content` param.
|
|
3677
|
+
*
|
|
3678
|
+
* @example
|
|
3679
|
+
* ```typescript
|
|
3680
|
+
* pickAnonymousEntityName('app-abc123'); // "hexagon"
|
|
3681
|
+
* `avatar:variant=anonymous_entity,content=${pickAnonymousEntityName(appId)}`;
|
|
3682
|
+
* ```
|
|
3683
|
+
*/
|
|
3684
|
+
const pickAnonymousEntityName = (seed) => {
|
|
3685
|
+
return ANONYMOUS_ENTITY_NAMES[seed ? hashStr_default(seed) % ANONYMOUS_ENTITY_NAMES.length : Math.floor(Math.random() * ANONYMOUS_ENTITY_NAMES.length)];
|
|
3686
|
+
};
|
|
3687
|
+
var pickAnonymousEntityName_default = pickAnonymousEntityName;
|
|
3688
|
+
|
|
3689
|
+
//#endregion
|
|
3690
|
+
//#region src/utils/generateAvatarDataUri.ts
|
|
3691
|
+
const AVATAR_PALETTES = [
|
|
3692
|
+
["#FF7300", "#EF4223"],
|
|
3693
|
+
["#3688FF", "#1d5eb4"],
|
|
3694
|
+
["#5567D5", "#8B6FE8"],
|
|
3695
|
+
["#06b6d4", "#0891b2"],
|
|
3696
|
+
["#10b981", "#059669"],
|
|
3697
|
+
["#ec4899", "#be185d"],
|
|
3698
|
+
["#f59e0b", "#ea580c"],
|
|
3699
|
+
["#8b5cf6", "#6d28d9"],
|
|
3700
|
+
["#5CD1FF", "#3688FF"],
|
|
3701
|
+
["#ef4444", "#b91c1c"]
|
|
3702
|
+
];
|
|
3703
|
+
/**
|
|
3704
|
+
* Number of distinct gradient rotations `colors` cycles through for the `blank`,
|
|
3705
|
+
* `one_letter`, and `two_letter` variants. Callers that offer a "pick a background" UI
|
|
3706
|
+
* (e.g. a shuffleable swatch grid) can sample `colors` indices in `[0, AVATAR_GRADIENT_COUNT)`
|
|
3707
|
+
* without needing the actual palette values.
|
|
3708
|
+
*/
|
|
3709
|
+
const AVATAR_GRADIENT_COUNT = AVATAR_PALETTES.length;
|
|
3710
|
+
/**
|
|
3711
|
+
* Fills in `params.content` when the spec itself didn't carry one, deriving it from a raw
|
|
3712
|
+
* seed name (e.g. an app or user display name) — extracting initials for letter variants,
|
|
3713
|
+
* or hash-picking a curated animal key for `anonymous_animal`.
|
|
3714
|
+
*
|
|
3715
|
+
* Callers that already have a final `content` value (pre-computed initials, or an exact
|
|
3716
|
+
* animal key) should skip this and pass it directly instead.
|
|
3717
|
+
*
|
|
3718
|
+
* @param variant - The avatar variant `content` is being derived for.
|
|
3719
|
+
* @param seedText - A raw name/seed to derive `content` from.
|
|
3720
|
+
* @returns A ready-to-render `content` value.
|
|
3721
|
+
*
|
|
3722
|
+
* @example
|
|
3723
|
+
* ```typescript
|
|
3724
|
+
* deriveAvatarContent('two_letter', 'Jane Doe'); // "JD"
|
|
3725
|
+
* deriveAvatarContent('anonymous_animal', 'session-abc123'); // "otter"
|
|
3726
|
+
* deriveAvatarContent('anonymous_entity', 'app-abc123'); // "hexagon"
|
|
3727
|
+
* deriveAvatarContent('blank', 'Jane Doe'); // ""
|
|
3728
|
+
* ```
|
|
3729
|
+
*/
|
|
3730
|
+
const deriveAvatarContent = (variant, seedText) => {
|
|
3731
|
+
if (variant === "anonymous_animal") return pickAnonymousAvatarName_default(seedText || void 0);
|
|
3732
|
+
if (variant === "anonymous_entity") return pickAnonymousEntityName_default(seedText || void 0);
|
|
3733
|
+
if (variant === "blank") return "";
|
|
3734
|
+
const letterCount = variant === "one_letter" ? 1 : 2;
|
|
3735
|
+
return (seedText.match(/[A-Za-z0-9]/g) ?? ["A"]).slice(0, letterCount).join("").toUpperCase();
|
|
3736
|
+
};
|
|
3737
|
+
/**
|
|
3738
|
+
* Renders the 100x100 background shape, filled either with a gradient/flat-color reference.
|
|
3739
|
+
*/
|
|
3740
|
+
const shapeMarkup = (shape, fill) => shape === "circle" ? `<circle cx="50" cy="50" r="50" fill="${fill}"/>` : `<rect width="100" height="100" rx="22" fill="${fill}"/>`;
|
|
3741
|
+
/**
|
|
3742
|
+
* Renders a Vercel-style gradient avatar: a rounded/circle swatch, either bare (`blank`) or
|
|
3743
|
+
* topped with initials (`one_letter`/`two_letter`). `content` is assumed final (already the
|
|
3744
|
+
* initials to display, or empty for `blank`) — pass it through {@link deriveAvatarContent}
|
|
3745
|
+
* first if it needs deriving.
|
|
3746
|
+
*/
|
|
3747
|
+
const generateGradientAvatar = ({ shape, variant, content, colors, bg }) => {
|
|
3748
|
+
let background;
|
|
3749
|
+
let defs = "";
|
|
3750
|
+
if (bg) background = bg;
|
|
3751
|
+
else {
|
|
3752
|
+
const h = hashStr_default(content || "App");
|
|
3753
|
+
const [c1, c2] = AVATAR_PALETTES[((h + colors) % AVATAR_PALETTES.length + AVATAR_PALETTES.length) % AVATAR_PALETTES.length];
|
|
3754
|
+
defs = `<defs><linearGradient id="g" x1="0%" y1="0%" x2="100%" y2="100%" gradientTransform="rotate(${(((h >> 4) + colors * 37) % 360 + 360) % 360} 0.5 0.5)"><stop offset="0%" stop-color="${c1}"/><stop offset="100%" stop-color="${c2}"/></linearGradient></defs>`;
|
|
3755
|
+
background = "url(#g)";
|
|
3756
|
+
}
|
|
3757
|
+
let text = "";
|
|
3758
|
+
if (variant !== "blank") {
|
|
3759
|
+
const letterCount = variant === "one_letter" ? 1 : 2;
|
|
3760
|
+
const initials = (content || "A").toUpperCase().slice(0, letterCount);
|
|
3761
|
+
text = `<text x="50" y="64" font-family="Helvetica,Arial,sans-serif" font-weight="700" font-size="${letterCount === 1 ? 46 : 34}" text-anchor="middle" fill="#fff">${initials}</text>`;
|
|
3762
|
+
}
|
|
3763
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">${defs}${shapeMarkup(shape, background)}${text}</svg>`;
|
|
3764
|
+
return `data:image/svg+xml,${encodeURIComponent(svg)}`;
|
|
3765
|
+
};
|
|
3766
|
+
/**
|
|
3767
|
+
* Renders one of the curated anonymous-animal icons, applying the requested background
|
|
3768
|
+
* shape and (optionally) recoloring the whole icon with `bg`. `content` is assumed to
|
|
3769
|
+
* already be a valid animal key — pass it through {@link deriveAvatarContent} first if
|
|
3770
|
+
* it needs deriving, or if it might be invalid/empty.
|
|
3771
|
+
*/
|
|
3772
|
+
const generateAnonymousAnimalAvatar = ({ shape, content, bg }) => {
|
|
3773
|
+
const icon = ANONYMOUS_ANIMAL_ICONS[Object.prototype.hasOwnProperty.call(ANONYMOUS_ANIMAL_ICONS, content) ? content : pickAnonymousAvatarName_default()];
|
|
3774
|
+
const color = bg ?? icon.color;
|
|
3775
|
+
const markup = icon.markup.replaceAll("%COLOR%", color);
|
|
3776
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">${shapeMarkup(shape, color)}${markup}</svg>`;
|
|
3777
|
+
return `data:image/svg+xml,${encodeURIComponent(svg)}`;
|
|
3778
|
+
};
|
|
3779
|
+
/**
|
|
3780
|
+
* Renders one of the curated anonymous-entity icons (application/organization/resource-server
|
|
3781
|
+
* shapes), applying the requested background shape and (optionally) recoloring the whole icon
|
|
3782
|
+
* with `bg`. `content` is assumed to already be a valid entity key — pass it through
|
|
3783
|
+
* {@link deriveAvatarContent} first if it needs deriving, or if it might be invalid/empty.
|
|
3784
|
+
*/
|
|
3785
|
+
const generateAnonymousEntityAvatar = ({ shape, content, bg }) => {
|
|
3786
|
+
const icon = ANONYMOUS_ENTITY_ICONS[Object.prototype.hasOwnProperty.call(ANONYMOUS_ENTITY_ICONS, content) ? content : pickAnonymousEntityName_default()];
|
|
3787
|
+
const color = bg ?? icon.color;
|
|
3788
|
+
const markup = icon.markup.replaceAll("%COLOR%", color);
|
|
3789
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">${shapeMarkup(shape, color)}${markup}</svg>`;
|
|
3790
|
+
return `data:image/svg+xml,${encodeURIComponent(svg)}`;
|
|
3791
|
+
};
|
|
3792
|
+
/**
|
|
3793
|
+
* Generates an avatar image as an `svg+xml` data URI from a fully-resolved {@link AvatarParams}.
|
|
3794
|
+
* `params.content` is assumed final; use {@link deriveAvatarContent} first if it might be
|
|
3795
|
+
* empty or otherwise needs deriving from a raw seed name.
|
|
3796
|
+
*
|
|
3797
|
+
* @param params - Resolved avatar parameters (see {@link AvatarParams}).
|
|
3798
|
+
* @returns A `data:image/svg+xml,...` URI rendering the generated avatar.
|
|
3799
|
+
*
|
|
3800
|
+
* @example
|
|
3801
|
+
* ```typescript
|
|
3802
|
+
* generateAvatarDataUri({shape: 'circle', variant: 'two_letter', content: 'BM', colors: 2});
|
|
3803
|
+
* generateAvatarDataUri({shape: 'rounded', variant: 'anonymous_animal', content: 'jackalope'});
|
|
3804
|
+
* generateAvatarDataUri({shape: 'rounded', variant: 'anonymous_entity', content: 'hexagon'});
|
|
3805
|
+
* generateAvatarDataUri({shape: 'circle', variant: 'blank', content: '', colors: 5});
|
|
3806
|
+
* ```
|
|
3807
|
+
*/
|
|
3808
|
+
const generateAvatarDataUri = (params) => {
|
|
3809
|
+
if (params.variant === "anonymous_animal") return generateAnonymousAnimalAvatar(params);
|
|
3810
|
+
if (params.variant === "anonymous_entity") return generateAnonymousEntityAvatar(params);
|
|
3811
|
+
return generateGradientAvatar(params);
|
|
3812
|
+
};
|
|
3813
|
+
var generateAvatarDataUri_default = generateAvatarDataUri;
|
|
3814
|
+
|
|
3815
|
+
//#endregion
|
|
3816
|
+
//#region src/utils/resolveLogoUri.ts
|
|
3817
|
+
/**
|
|
3818
|
+
* Resolves an application logo spec string — `emoji:<glyph>`, `avatar:shape=...,variant=...,
|
|
3819
|
+
* content=...,colors=...,bg=...`, or a bare URL — into a renderable representation.
|
|
3820
|
+
*
|
|
3821
|
+
* A spec in none of the recognized schemes falls back to treating it as a plain URL so
|
|
3822
|
+
* callers can always render *something* without special-casing.
|
|
3823
|
+
*
|
|
3824
|
+
* @param spec - The stored logo spec string.
|
|
3825
|
+
* @param fallbackSeedText - Raw seed name (e.g. an app or user display name) used to derive
|
|
3826
|
+
* an `avatar:` spec's `content` when the spec itself doesn't carry one (e.g. an app name
|
|
3827
|
+
* to keep the avatar in sync as it changes).
|
|
3828
|
+
* @returns The resolved logo, ready to render.
|
|
3829
|
+
*
|
|
3830
|
+
* @example
|
|
3831
|
+
* ```typescript
|
|
3832
|
+
* resolveLogoUri("emoji:🛡️"); // { kind: "emoji", glyph: "🛡️" }
|
|
3833
|
+
* resolveLogoUri("avatar:shape=circle,variant=two_letter,content=BM"); // { kind: "avatar", imgSrc: "data:image/svg+xml,..." }
|
|
3834
|
+
* resolveLogoUri("https://example.com/logo.png"); // { kind: "url", imgSrc: "https://example.com/logo.png" }
|
|
3835
|
+
* ```
|
|
3836
|
+
*/
|
|
3837
|
+
const resolveLogoUri = (spec, fallbackSeedText = "") => {
|
|
3838
|
+
if (isEmojiUri(spec)) return {
|
|
3839
|
+
glyph: extractEmojiFromUri(spec),
|
|
3840
|
+
kind: "emoji"
|
|
3841
|
+
};
|
|
3842
|
+
if (isAvatarUri_default(spec)) {
|
|
3843
|
+
const params = extractAvatarParamsFromUri_default(spec);
|
|
3844
|
+
const content = params.content || deriveAvatarContent(params.variant, fallbackSeedText);
|
|
3845
|
+
return {
|
|
3846
|
+
imgSrc: generateAvatarDataUri_default({
|
|
3847
|
+
...params,
|
|
3848
|
+
content
|
|
3849
|
+
}),
|
|
3850
|
+
kind: "avatar"
|
|
3851
|
+
};
|
|
3852
|
+
}
|
|
3853
|
+
return {
|
|
3854
|
+
imgSrc: spec,
|
|
3855
|
+
kind: "url"
|
|
3856
|
+
};
|
|
3857
|
+
};
|
|
3858
|
+
var resolveLogoUri_default = resolveLogoUri;
|
|
3859
|
+
|
|
3365
3860
|
//#endregion
|
|
3366
3861
|
//#region src/theme/themeDetection.ts
|
|
3367
3862
|
const logger = createPackageComponentLogger("@thunderid/browser", "ThemeDetection");
|
|
@@ -3443,5 +3938,5 @@ const getActiveTheme = (mode, config = {}) => {
|
|
|
3443
3938
|
var getActiveTheme_default = getActiveTheme;
|
|
3444
3939
|
|
|
3445
3940
|
//#endregion
|
|
3446
|
-
export { ACCESS_TOKEN_INVALID, AuthenticationHelper_default as AuthenticationHelper, Hooks as BrowserHooks, BrowserStorage_default as BrowserStorage, CHECK_SESSION_SIGNED_IN, CHECK_SESSION_SIGNED_OUT, CUSTOM_GRANT_CONFIG, ERROR, ERROR_DESCRIPTION, FetchHttpClient_default as FetchHttpClient, Hooks_default as Hooks, INITIALIZED_SILENT_SIGN_IN, LocalStore_default as LocalStore, MemoryStore_default as MemoryStore, OP_IFRAME, PROMPT_NONE_IFRAME, PROMPT_NONE_REQUEST_SENT, REFRESH_ACCESS_TOKEN_ERR0R, RP_IFRAME, SET_SESSION_STATE_FROM_IFRAME, SILENT_SIGN_IN_STATE, SPACryptoUtils_default as SPACryptoUtils, SPAHelper_default as SPAHelper, SPAUtils_default as SPAUtils, STATE, STATE_QUERY, SessionStore_default as SessionStore, TOKEN_REQUEST_CONFIG_KEY, ThunderIDBrowserClient_default as ThunderIDBrowserClient, createClassObserver, createMediaQueryListener, SessionManagementHelper_default as createSessionManagementHelper, detectThemeMode, getActiveTheme_default as getActiveTheme, handleWebAuthnAuthentication_default as handleWebAuthnAuthentication, hasAuthParamsInUrl_default as hasAuthParamsInUrl, hasCalledForThisInstanceInUrl_default as hasCalledForThisInstanceInUrl, http_default as http, navigate_default as navigate, resolveEmojiUrisInHtml_default as resolveEmojiUrisInHtml };
|
|
3941
|
+
export { ACCESS_TOKEN_INVALID, ANONYMOUS_ANIMAL_ICONS, ANONYMOUS_ENTITY_ICONS, AVATAR_GRADIENT_COUNT, AVATAR_URI_SCHEME, AuthenticationHelper_default as AuthenticationHelper, Hooks as BrowserHooks, BrowserStorage_default as BrowserStorage, CHECK_SESSION_SIGNED_IN, CHECK_SESSION_SIGNED_OUT, CUSTOM_GRANT_CONFIG, ERROR, ERROR_DESCRIPTION, FetchHttpClient_default as FetchHttpClient, Hooks_default as Hooks, INITIALIZED_SILENT_SIGN_IN, LocalStore_default as LocalStore, MemoryStore_default as MemoryStore, OP_IFRAME, PROMPT_NONE_IFRAME, PROMPT_NONE_REQUEST_SENT, REFRESH_ACCESS_TOKEN_ERR0R, RP_IFRAME, SET_SESSION_STATE_FROM_IFRAME, SILENT_SIGN_IN_STATE, SPACryptoUtils_default as SPACryptoUtils, SPAHelper_default as SPAHelper, SPAUtils_default as SPAUtils, STATE, STATE_QUERY, SessionStore_default as SessionStore, TOKEN_REQUEST_CONFIG_KEY, ThunderIDBrowserClient_default as ThunderIDBrowserClient, createClassObserver, createMediaQueryListener, SessionManagementHelper_default as createSessionManagementHelper, deriveAvatarContent, detectThemeMode, extractAvatarParamsFromUri_default as extractAvatarParamsFromUri, generateAvatarDataUri_default as generateAvatarDataUri, getActiveTheme_default as getActiveTheme, handleWebAuthnAuthentication_default as handleWebAuthnAuthentication, hasAuthParamsInUrl_default as hasAuthParamsInUrl, hasCalledForThisInstanceInUrl_default as hasCalledForThisInstanceInUrl, http_default as http, isAvatarUri_default as isAvatarUri, navigate_default as navigate, pickAnonymousAvatarName_default as pickAnonymousAvatarName, pickAnonymousEntityName_default as pickAnonymousEntityName, resolveEmojiUrisInHtml_default as resolveEmojiUrisInHtml, resolveLogoUri_default as resolveLogoUri };
|
|
3447
3942
|
//# sourceMappingURL=index.js.map
|