karin-plugin-kkk 2.45.1-beta.0 → 2.45.1-beta.1

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.
@@ -4,8 +4,7 @@ import $, { createRequire } from "node:module";
4
4
  import fs, { existsSync, readFileSync, writeSync } from "node:fs";
5
5
  import minpath, { default as path } from "node:path";
6
6
  import { fileURLToPath, fileURLToPath as urlToPath, pathToFileURL } from "node:url";
7
- import crypto$1, { createCipheriv, createHash, randomBytes } from "node:crypto";
8
- import { gzipSync } from "node:zlib";
7
+ import crypto$1 from "node:crypto";
9
8
  import jt from "fs";
10
9
  import minproc from "node:process";
11
10
  import { inspect } from "node:util";
@@ -5679,2310 +5678,6 @@ function number$1(params) {
5679
5678
  return /* @__PURE__ */ _coercedNumber(ZodNumber, params);
5680
5679
  }
5681
5680
  //#endregion
5682
- //#region ../../node_modules/.pnpm/@ikenxuan+xhshow-ts@1.1.0/node_modules/@ikenxuan/xhshow-ts/dist/index.mjs
5683
- var CryptoConfig = class CryptoConfig {
5684
- DES_KEY = "zbp30y86";
5685
- GID_URL = "https://as.xiaohongshu.com/api/sec/v1/shield/webprofile";
5686
- DATA_PLATFORM = "Windows";
5687
- DATA_SVN = "2";
5688
- DATA_SDK_VERSION = "4.3.5";
5689
- DATA_WEB_BUILD = "6.3.0";
5690
- MAX_32BIT = 4294967295;
5691
- MAX_SIGNED_32BIT = 2147483647;
5692
- MAX_BYTE = 255;
5693
- STANDARD_BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
5694
- CUSTOM_BASE64_ALPHABET = "ZmserbBoHQtNP+wOcza/LpngG8yJq42KWYj0DSfdikx3VT16IlUAFM97hECvuRX5";
5695
- X3_BASE64_ALPHABET = "MfgqrsbcyzPQRStuvC7mn501HIJBo2DEFTKdeNOwxWXYZap89+/A4UVLhijkl63G";
5696
- HEX_KEY = "71a302257793271ddd273bcee3e4b98d9d7935e1da33f5765e2ea8afb6dc77a51a499d23b67c20660025860cbf13d4540d92497f58686c574e508f46e1956344f39139bf4faf22a3eef120b79258145b2feb5193b6478669961298e79bedca646e1a693a926154a5a7a1bd1cf0dedb742f917a747a1e388b234f2277516db7116035439730fa61e9822a0eca7bff72d8";
5697
- EXPECTED_HEX_LENGTH = 32;
5698
- OUTPUT_BYTE_COUNT = 8;
5699
- HEX_CHUNK_SIZE = 2;
5700
- VERSION_BYTES = [
5701
- 121,
5702
- 104,
5703
- 96,
5704
- 41
5705
- ];
5706
- PAYLOAD_LENGTH = 144;
5707
- A1_LENGTH = 52;
5708
- APP_ID_LENGTH = 10;
5709
- MD5_XOR_LENGTH = 8;
5710
- A3_PREFIX = [
5711
- 2,
5712
- 97,
5713
- 51,
5714
- 16
5715
- ];
5716
- TIMESTAMP_LE_LENGTH = 8;
5717
- SEQUENCE_VALUE_MIN = 15;
5718
- SEQUENCE_VALUE_MAX = 50;
5719
- WINDOW_PROPS_LENGTH_MIN = 1e3;
5720
- WINDOW_PROPS_LENGTH_MAX = 1200;
5721
- SESSION_WINDOW_PROPS_INIT_MIN = 1e3;
5722
- SESSION_WINDOW_PROPS_INIT_MAX = 2e3;
5723
- SESSION_SEQUENCE_INIT_MIN = 15;
5724
- SESSION_SEQUENCE_INIT_MAX = 17;
5725
- SESSION_SEQUENCE_STEP_MIN = 0;
5726
- SESSION_SEQUENCE_STEP_MAX = 1;
5727
- SESSION_WINDOW_PROPS_STEP_MIN = 1;
5728
- SESSION_WINDOW_PROPS_STEP_MAX = 10;
5729
- CHECKSUM_VERSION = 1;
5730
- CHECKSUM_XOR_KEY = 115;
5731
- CHECKSUM_FIXED_TAIL = [
5732
- 249,
5733
- 65,
5734
- 103,
5735
- 103,
5736
- 201,
5737
- 181,
5738
- 131,
5739
- 99,
5740
- 94,
5741
- 7,
5742
- 68,
5743
- 250,
5744
- 132,
5745
- 21
5746
- ];
5747
- ENV_TABLE = [
5748
- 115,
5749
- 248,
5750
- 83,
5751
- 102,
5752
- 103,
5753
- 201,
5754
- 181,
5755
- 131,
5756
- 99,
5757
- 94,
5758
- 4,
5759
- 68,
5760
- 250,
5761
- 132,
5762
- 21
5763
- ];
5764
- ENV_CHECKS_DEFAULT = [
5765
- 0,
5766
- 1,
5767
- 18,
5768
- 1,
5769
- 0,
5770
- 0,
5771
- 0,
5772
- 0,
5773
- 0,
5774
- 0,
5775
- 3,
5776
- 0,
5777
- 0,
5778
- 0,
5779
- 0
5780
- ];
5781
- HASH_IV = [
5782
- 1831565813,
5783
- 461845907,
5784
- 2246822507,
5785
- 3266489909
5786
- ];
5787
- ENV_FINGERPRINT_XOR_KEY = 41;
5788
- ENV_FINGERPRINT_TIME_OFFSET_MIN = 10;
5789
- ENV_FINGERPRINT_TIME_OFFSET_MAX = 50;
5790
- SIGNATURE_DATA_TEMPLATE = {
5791
- x0: "4.4.3",
5792
- x1: "xhs-pc-web",
5793
- x2: "Windows",
5794
- x3: "",
5795
- x4: ""
5796
- };
5797
- X3_PREFIX = "mns0301_";
5798
- XYS_PREFIX = "XYS_";
5799
- XYW_PREFIX = "XYW_";
5800
- XYW_SIGN_SVN = "56";
5801
- XYW_SIGN_TYPE = "x2";
5802
- XYW_SIGN_VERSION = "1";
5803
- XYW_AES_KEY = "7cc4adla5ay0701v";
5804
- XYW_AES_IV = "4uzjr7mbsibcaldp";
5805
- XYW_ENV_FLAGS_DEFAULT = "0|0|0|1|0|0|1|0|0|0|1|0|0|0|0|1|0|0|1";
5806
- HEX_CHARS = "abcdef0123456789";
5807
- XRAY_TRACE_ID_SEQ_MAX = 8388607;
5808
- XRAY_TRACE_ID_TIMESTAMP_SHIFT = 23;
5809
- XRAY_TRACE_ID_PART1_LENGTH = 16;
5810
- XRAY_TRACE_ID_PART2_LENGTH = 16;
5811
- B3_TRACE_ID_LENGTH = 16;
5812
- B1_SECRET_KEY = "xhswebmplfbt";
5813
- XRAP_SDK_VERSION = 10300;
5814
- SIGNATURE_XSCOMMON_TEMPLATE = {
5815
- s0: 5,
5816
- s1: "",
5817
- x0: "1",
5818
- x1: "4.3.5",
5819
- x2: "Windows",
5820
- x3: "xhs-pc-web",
5821
- x4: "4.86.0",
5822
- x5: "",
5823
- x6: "",
5824
- x7: "",
5825
- x8: "",
5826
- x9: -596800761,
5827
- x10: 0,
5828
- x11: "normal"
5829
- };
5830
- PUBLIC_USERAGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0";
5831
- /**
5832
- * Create a new config instance with overridden values
5833
- */
5834
- withOverrides(overrides) {
5835
- const newConfig = new CryptoConfig();
5836
- Object.assign(newConfig, overrides);
5837
- return newConfig;
5838
- }
5839
- };
5840
- var BitOperations = class {
5841
- config;
5842
- constructor(config) {
5843
- this.config = config || new CryptoConfig();
5844
- }
5845
- normalizeTo32bit(value) {
5846
- return value & this.config.MAX_32BIT;
5847
- }
5848
- toSigned32bit(unsignedValue) {
5849
- if (unsignedValue > this.config.MAX_SIGNED_32BIT) return unsignedValue - 4294967296;
5850
- return unsignedValue;
5851
- }
5852
- computeSeedValue(seed32bit) {
5853
- const normalizedSeed = this.normalizeTo32bit(seed32bit);
5854
- const shift15Bits = normalizedSeed >> 15;
5855
- const shift13Bits = normalizedSeed >> 13;
5856
- const shift12Bits = normalizedSeed >> 12;
5857
- const shift10Bits = normalizedSeed >> 10;
5858
- const shiftedResult = ((shift15Bits & ~shift13Bits | shift13Bits & ~shift15Bits) ^ shift12Bits ^ shift10Bits) << 31 & this.config.MAX_32BIT;
5859
- return this.toSigned32bit(shiftedResult);
5860
- }
5861
- xorTransformArray(sourceIntegers) {
5862
- const result = new Uint8Array(sourceIntegers.length);
5863
- const keyBytes = Buffer.from(this.config.HEX_KEY, "hex");
5864
- const keyLength = keyBytes.length;
5865
- for (let i = 0; i < sourceIntegers.length; i++) if (i < keyLength) result[i] = (sourceIntegers[i] ^ keyBytes[i]) & 255;
5866
- else result[i] = sourceIntegers[i] & 255;
5867
- return result;
5868
- }
5869
- };
5870
- var Base64Encoder = class {
5871
- config;
5872
- customEncodeTable;
5873
- customDecodeTable;
5874
- x3EncodeTable;
5875
- x3DecodeTable;
5876
- constructor(config) {
5877
- this.config = config || new CryptoConfig();
5878
- this.customEncodeTable = this.buildTranslationTable(this.config.STANDARD_BASE64_ALPHABET, this.config.CUSTOM_BASE64_ALPHABET);
5879
- this.customDecodeTable = this.buildTranslationTable(this.config.CUSTOM_BASE64_ALPHABET, this.config.STANDARD_BASE64_ALPHABET);
5880
- this.x3EncodeTable = this.buildTranslationTable(this.config.STANDARD_BASE64_ALPHABET, this.config.X3_BASE64_ALPHABET);
5881
- this.x3DecodeTable = this.buildTranslationTable(this.config.X3_BASE64_ALPHABET, this.config.STANDARD_BASE64_ALPHABET);
5882
- }
5883
- buildTranslationTable(from, to) {
5884
- const table = /* @__PURE__ */ new Map();
5885
- for (let i = 0; i < from.length; i++) table.set(from[i], to[i]);
5886
- return table;
5887
- }
5888
- translate(str, table) {
5889
- let result = "";
5890
- for (const char of str) result += table.get(char) ?? char;
5891
- return result;
5892
- }
5893
- /**
5894
- * Encode a string using custom Base64 alphabet
5895
- */
5896
- encode(dataToEncode) {
5897
- const standardEncoded = Buffer.from(dataToEncode, "utf8").toString("base64");
5898
- return this.translate(standardEncoded, this.customEncodeTable);
5899
- }
5900
- /**
5901
- * Decode string using custom Base64 alphabet
5902
- */
5903
- decode(encodedString) {
5904
- const standardEncoded = this.translate(encodedString, this.customDecodeTable);
5905
- try {
5906
- return Buffer.from(standardEncoded, "base64").toString("utf8");
5907
- } catch (e) {
5908
- throw new Error("Invalid Base64 input: unable to decode string");
5909
- }
5910
- }
5911
- /**
5912
- * Decode x3 signature using X3_BASE64_ALPHABET
5913
- */
5914
- decodeX3(encodedString) {
5915
- const standardEncoded = this.translate(encodedString, this.x3DecodeTable);
5916
- try {
5917
- return Buffer.from(standardEncoded, "base64");
5918
- } catch (e) {
5919
- throw new Error("Invalid Base64 input: unable to decode string");
5920
- }
5921
- }
5922
- /**
5923
- * Encode x3 signature using X3_BASE64_ALPHABET
5924
- */
5925
- encodeX3(inputBytes) {
5926
- const standardEncoded = Buffer.from(inputBytes).toString("base64");
5927
- return this.translate(standardEncoded, this.x3EncodeTable);
5928
- }
5929
- };
5930
- var HexProcessor = class {
5931
- config;
5932
- constructor() {
5933
- this.config = new CryptoConfig();
5934
- }
5935
- hexStringToBytes(hexString) {
5936
- const byteValues = [];
5937
- for (let i = 0; i < hexString.length; i += this.config.HEX_CHUNK_SIZE) {
5938
- const hexChunk = hexString.slice(i, i + this.config.HEX_CHUNK_SIZE);
5939
- byteValues.push(parseInt(hexChunk, 16));
5940
- }
5941
- return byteValues;
5942
- }
5943
- processHexParameter(hexString, xorKey) {
5944
- if (hexString.length !== this.config.EXPECTED_HEX_LENGTH) throw new Error(`hex parameter must be ${this.config.EXPECTED_HEX_LENGTH} characters`);
5945
- return this.hexStringToBytes(hexString).map((byteVal) => byteVal ^ xorKey).slice(0, this.config.OUTPUT_BYTE_COUNT);
5946
- }
5947
- };
5948
- var BASE36_CHARS = "0123456789abcdefghijklmnopqrstuvwxyz";
5949
- var A1_CHARSET = "abcdefghijklmnopqrstuvwxyz1234567890";
5950
- var STD_CRC32_TABLE = null;
5951
- function stdCrc32(bytes) {
5952
- if (STD_CRC32_TABLE === null) {
5953
- const tbl = new Array(256);
5954
- for (let n = 0; n < 256; n++) {
5955
- let c = n;
5956
- for (let k = 0; k < 8; k++) c = c & 1 ? c >>> 1 ^ 3988292384 : c >>> 1;
5957
- tbl[n] = c >>> 0;
5958
- }
5959
- STD_CRC32_TABLE = tbl;
5960
- }
5961
- let crc = 4294967295;
5962
- for (let i = 0; i < bytes.length; i++) crc = (STD_CRC32_TABLE[(crc ^ bytes[i]) & 255] ^ crc >>> 8) >>> 0;
5963
- return (crc ^ 4294967295) >>> 0;
5964
- }
5965
- /**
5966
- * Convert a non-negative BigInt to a base36 string.
5967
- */
5968
- function intToBase36(value) {
5969
- if (value === 0n) return "0";
5970
- let result = "";
5971
- const base = 36n;
5972
- while (value > 0n) {
5973
- const remainder = value % base;
5974
- value = value / base;
5975
- result = BASE36_CHARS[Number(remainder)] + result;
5976
- }
5977
- return result;
5978
- }
5979
- var RandomGenerator = class {
5980
- config;
5981
- constructor() {
5982
- this.config = new CryptoConfig();
5983
- }
5984
- /**
5985
- * Generate random byte array
5986
- */
5987
- generateRandomBytes(byteCount) {
5988
- return Array.from({ length: byteCount }, () => Math.floor(Math.random() * (this.config.MAX_BYTE + 1)));
5989
- }
5990
- /**
5991
- * Generate random integer in range
5992
- */
5993
- generateRandomByteInRange(minVal, maxVal) {
5994
- return Math.floor(Math.random() * (maxVal - minVal + 1)) + minVal;
5995
- }
5996
- /**
5997
- * Generate 32-bit random integer
5998
- */
5999
- generateRandomInt() {
6000
- return Math.floor(Math.random() * (this.config.MAX_32BIT + 1));
6001
- }
6002
- /**
6003
- * Generate x-b3-traceid (16 random hex characters)
6004
- */
6005
- generateB3TraceId() {
6006
- let result = "";
6007
- for (let i = 0; i < this.config.B3_TRACE_ID_LENGTH; i++) result += this.config.HEX_CHARS[Math.floor(Math.random() * this.config.HEX_CHARS.length)];
6008
- return result;
6009
- }
6010
- /**
6011
- * Generate x-xray-traceid (32 characters: 16 timestamp+seq + 16 random)
6012
- */
6013
- generateXrayTraceId(timestamp, seq) {
6014
- if (timestamp === void 0) timestamp = Date.now();
6015
- if (seq === void 0) seq = Math.floor(Math.random() * (this.config.XRAY_TRACE_ID_SEQ_MAX + 1));
6016
- const part1 = (BigInt(timestamp) << BigInt(this.config.XRAY_TRACE_ID_TIMESTAMP_SHIFT) | BigInt(seq)).toString(16).padStart(this.config.XRAY_TRACE_ID_PART1_LENGTH, "0");
6017
- let part2 = "";
6018
- for (let i = 0; i < this.config.XRAY_TRACE_ID_PART2_LENGTH; i++) part2 += this.config.HEX_CHARS[Math.floor(Math.random() * this.config.HEX_CHARS.length)];
6019
- return part1 + part2;
6020
- }
6021
- /**
6022
- * Generate a random ASCII string of the given length
6023
- */
6024
- static generateRandomAscii(length, charset = "abcdefghijklmnopqrstuvwxyz0123456789") {
6025
- let result = "";
6026
- for (let i = 0; i < length; i++) result += charset[Math.floor(Math.random() * charset.length)];
6027
- return result;
6028
- }
6029
- /**
6030
- * Generate an a1 cookie value (52 characters)
6031
- */
6032
- static generateA1() {
6033
- const tsHex = Math.floor(Date.now()).toString(16);
6034
- let randomStr = "";
6035
- for (let i = 0; i < 30; i++) randomStr += A1_CHARSET[Math.floor(Math.random() * 36)];
6036
- const aPart = tsHex + randomStr + "50000";
6037
- const crc = stdCrc32(Buffer.from(aPart)) >>> 0;
6038
- return (aPart + String(crc)).slice(0, 52);
6039
- }
6040
- /**
6041
- * Generate web_id (32-character hex MD5) from an a1 cookie value
6042
- */
6043
- static generateWebId(a1) {
6044
- return createHash("md5").update(a1).digest("hex");
6045
- }
6046
- /**
6047
- * Generate search_id for search endpoints (base36 of (timestamp_ms << 64) + random)
6048
- */
6049
- generateSearchId() {
6050
- const timestampMs = BigInt(Date.now());
6051
- const randomPart = BigInt(Math.ceil(2147483646 * Math.random()));
6052
- return intToBase36((timestampMs << 64n) + randomPart);
6053
- }
6054
- /**
6055
- * Generate search request_id for search endpoints. Format: "{random}-{timestamp_ms}"
6056
- */
6057
- generateSearchRequestId() {
6058
- const timestampMs = Date.now();
6059
- return `${Math.ceil(2147483646 * Math.random())}-${timestampMs}`;
6060
- }
6061
- };
6062
- /**
6063
- * Extract URI path from full URL (removes protocol, host, query, fragment)
6064
- */
6065
- function extractUri(url) {
6066
- if (!url || typeof url !== "string") throw new Error("URL must be a non-empty string");
6067
- url = url.trim();
6068
- try {
6069
- if (url.startsWith("http://") || url.startsWith("https://")) {
6070
- const path = new URL(url).pathname;
6071
- if (!path || path === "/") throw new Error(`Cannot extract valid URI path from URL: ${url}`);
6072
- return path;
6073
- }
6074
- const queryIndex = url.indexOf("?");
6075
- const path = queryIndex >= 0 ? url.substring(0, queryIndex) : url;
6076
- if (!path || path === "/") throw new Error(`Cannot extract valid URI path from URL: ${url}`);
6077
- return path;
6078
- } catch (e) {
6079
- if (e instanceof Error && e.message.includes("Cannot extract")) throw e;
6080
- throw new Error(`Cannot extract valid URI path from URL: ${url}`);
6081
- }
6082
- }
6083
- /**
6084
- * Build complete URL with query parameters (handles parameter escaping)
6085
- *
6086
- * IMPORTANT: This function uses XHS platform-specific encoding rules.
6087
- * Only '=' characters are encoded as '%3D'. Other special characters
6088
- * (including ',') are NOT encoded, as required by XHS signature algorithm.
6089
- */
6090
- function buildUrl(baseUrl, params) {
6091
- if (!baseUrl || typeof baseUrl !== "string") throw new Error("baseUrl must be a non-empty string");
6092
- if (!params) return baseUrl;
6093
- const queryParts = [];
6094
- for (const [key, value] of Object.entries(params)) {
6095
- let formattedValue;
6096
- if (Array.isArray(value)) formattedValue = value.map((v) => String(v)).join(",");
6097
- else if (value !== null && value !== void 0) formattedValue = String(value);
6098
- else formattedValue = "";
6099
- const encodedValue = formattedValue.replace(/=/g, "%3D");
6100
- queryParts.push(`${key}=${encodedValue}`);
6101
- }
6102
- const queryString = queryParts.join("&");
6103
- let separator;
6104
- if (!baseUrl.includes("?")) separator = "?";
6105
- else if (baseUrl.endsWith("?") || baseUrl.endsWith("&")) separator = "";
6106
- else separator = "&";
6107
- return `${baseUrl}${separator}${queryString}`;
6108
- }
6109
- /**
6110
- * Pure TypeScript xxHash32 implementation.
6111
- *
6112
- * Ported from the upstream Python `utils/hash.py`. Used by the x-rap-param
6113
- * generator to compute integrity hashes over the request body and envelope.
6114
- */
6115
- var MASK_32 = 4294967295;
6116
- /**
6117
- * 32-bit left rotation (unsigned)
6118
- */
6119
- function rotl32$1(val, shift) {
6120
- val = val >>> 0;
6121
- return (val << shift | val >>> 32 - shift) >>> 0;
6122
- }
6123
- /**
6124
- * Compute the xxHash32 digest of the given bytes.
6125
- *
6126
- * @param data - Input bytes
6127
- * @param seed - Optional seed (default 0)
6128
- * @returns Unsigned 32-bit hash value
6129
- */
6130
- function xxh32(data, seed = 0) {
6131
- const buf = data;
6132
- const length = buf.length;
6133
- let pos = 0;
6134
- const prime1 = 2654435761;
6135
- const prime2 = 2246822519;
6136
- const prime3 = 3266489917;
6137
- const prime4 = 668265263;
6138
- const prime5 = 374761393;
6139
- let digest;
6140
- if (length >= 16) {
6141
- let acc1 = seed + prime1 + prime2 >>> 0;
6142
- let acc2 = seed + prime2 >>> 0;
6143
- let acc3 = seed >>> 0;
6144
- let acc4 = seed - prime1 >>> 0;
6145
- const end = length - 16;
6146
- while (pos <= end) for (let accRef = 0; accRef < 4; accRef++) {
6147
- const word = readU32LE(buf, pos);
6148
- pos += 4;
6149
- if (accRef === 0) acc1 = Math.imul(rotl32$1(acc1 + Math.imul(word, prime2) >>> 0, 13), prime1) >>> 0;
6150
- else if (accRef === 1) acc2 = Math.imul(rotl32$1(acc2 + Math.imul(word, prime2) >>> 0, 13), prime1) >>> 0;
6151
- else if (accRef === 2) acc3 = Math.imul(rotl32$1(acc3 + Math.imul(word, prime2) >>> 0, 13), prime1) >>> 0;
6152
- else acc4 = Math.imul(rotl32$1(acc4 + Math.imul(word, prime2) >>> 0, 13), prime1) >>> 0;
6153
- }
6154
- digest = rotl32$1(acc1, 1) + rotl32$1(acc2, 7) + rotl32$1(acc3, 12) + rotl32$1(acc4, 18) >>> 0;
6155
- } else digest = seed + prime5 >>> 0;
6156
- digest = digest + length >>> 0;
6157
- while (pos + 4 <= length) {
6158
- const word = readU32LE(buf, pos);
6159
- pos += 4;
6160
- digest = Math.imul(rotl32$1(digest + Math.imul(word, prime3) >>> 0, 17), prime4) >>> 0;
6161
- }
6162
- while (pos < length) {
6163
- digest = Math.imul(rotl32$1(digest + Math.imul(buf[pos], prime5) >>> 0, 11), prime1) >>> 0;
6164
- pos += 1;
6165
- }
6166
- digest ^= digest >>> 15;
6167
- digest = Math.imul(digest, prime2) >>> 0;
6168
- digest ^= digest >>> 13;
6169
- digest = Math.imul(digest, prime3) >>> 0;
6170
- digest ^= digest >>> 16;
6171
- return (digest & MASK_32) >>> 0;
6172
- }
6173
- /**
6174
- * Read a 32-bit little-endian unsigned integer from a byte buffer.
6175
- */
6176
- function readU32LE(buf, off) {
6177
- return (buf[off] | buf[off + 1] << 8 | buf[off + 2] << 16 | buf[off + 3] << 24) >>> 0;
6178
- }
6179
- /**
6180
- * Sharding key generation for the `xy-direction` request header.
6181
- *
6182
- * Ported from the upstream Python `utils/sharding.py`. When a `user_id` is
6183
- * provided, the key is derived deterministically via a MurmurHash3-x86-32
6184
- * variant; otherwise a random value in [10, 100] is returned.
6185
- */
6186
- var C1 = 3432918353;
6187
- var C2 = 461845907;
6188
- /**
6189
- * 32-bit left rotation (unsigned)
6190
- */
6191
- function rotl32(x, r) {
6192
- x = x >>> 0;
6193
- return (x << r | x >>> 32 - r) >>> 0;
6194
- }
6195
- /**
6196
- * Compute the sharding key for the `xy-direction` header.
6197
- *
6198
- * @param userId - Optional user id. If omitted, a random value in [10, 100].
6199
- * @returns Sharding key
6200
- */
6201
- function getShardingKey(userId) {
6202
- if (userId === null || userId === void 0) return Math.floor(Math.random() * 91) + 10;
6203
- const data = Buffer.from(userId, "utf-8");
6204
- const length = data.length;
6205
- let r = 151488;
6206
- const nblocks = Math.floor(length / 4);
6207
- for (let o = 0; o < nblocks; o++) {
6208
- const i = 4 * o;
6209
- let u = (data[i] | data[i + 1] << 8 | data[i + 2] << 16 | data[i + 3] << 24) >>> 0;
6210
- u = Math.imul(u, C1) >>> 0;
6211
- u = rotl32(u, 15);
6212
- u = Math.imul(u, C2) >>> 0;
6213
- r = (r ^ u) >>> 0;
6214
- r = rotl32(r, 13);
6215
- r = Math.imul(r, 5) + 3864292196 >>> 0;
6216
- }
6217
- const s = 4 * nblocks;
6218
- let c = 0;
6219
- const rem = length % 4;
6220
- if (rem >= 3) c ^= data[s + 2] << 16;
6221
- if (rem >= 2) c ^= data[s + 1] << 8;
6222
- if (rem >= 1) {
6223
- c ^= data[s];
6224
- c = Math.imul(c, C1) >>> 0;
6225
- c = rotl32(c, 15);
6226
- c = Math.imul(c, C2) >>> 0;
6227
- r = (r ^ c) >>> 0;
6228
- }
6229
- r = (r ^ length) >>> 0;
6230
- r ^= r >>> 16;
6231
- r = Math.imul(r, 2246822507) >>> 0;
6232
- r ^= r >>> 13;
6233
- r = Math.imul(r, 3266489909) >>> 0;
6234
- r ^= r >>> 16;
6235
- r = r >>> 0;
6236
- return r % 100 + 1;
6237
- }
6238
- var CryptoProcessor = class {
6239
- config;
6240
- bitOps;
6241
- b64encoder;
6242
- hexProcessor;
6243
- randomGen;
6244
- constructor(config) {
6245
- this.config = config || new CryptoConfig();
6246
- this.bitOps = new BitOperations(this.config);
6247
- this.b64encoder = new Base64Encoder(this.config);
6248
- this.hexProcessor = new HexProcessor();
6249
- this.randomGen = new RandomGenerator();
6250
- }
6251
- intToLeBytes(val, length = 4) {
6252
- const arr = [];
6253
- for (let i = 0; i < length; i++) {
6254
- arr.push(val & 255);
6255
- val = Math.floor(val / 256);
6256
- }
6257
- return arr;
6258
- }
6259
- /**
6260
- * 32-bit left rotation
6261
- */
6262
- rotateLeft(val, n) {
6263
- return (val << n | val >>> 32 - n) >>> 0;
6264
- }
6265
- /**
6266
- * Custom hash function for a3 field generation
6267
- * Input: byte array (must be multiple of 8)
6268
- * Output: 16-byte array
6269
- */
6270
- customHashV2(inputBytes) {
6271
- let [s0, s1, s2, s3] = this.config.HASH_IV;
6272
- const length = inputBytes.length;
6273
- s0 ^= length;
6274
- s1 ^= length << 8;
6275
- s2 ^= length << 16;
6276
- s3 ^= length << 24;
6277
- for (let i = 0; i < Math.floor(length / 8); i++) {
6278
- const offset = i * 8;
6279
- const v0 = (inputBytes[offset] | inputBytes[offset + 1] << 8 | inputBytes[offset + 2] << 16 | inputBytes[offset + 3] << 24) >>> 0;
6280
- const v1 = (inputBytes[offset + 4] | inputBytes[offset + 5] << 8 | inputBytes[offset + 6] << 16 | inputBytes[offset + 7] << 24) >>> 0;
6281
- s0 = this.rotateLeft(s0 + v0 & this.config.MAX_32BIT ^ s2, 7);
6282
- s1 = this.rotateLeft((v0 ^ s1) + s3 & this.config.MAX_32BIT, 11);
6283
- s2 = this.rotateLeft(s2 + v1 & this.config.MAX_32BIT ^ s0, 13);
6284
- s3 = this.rotateLeft((s3 ^ v1) + s1 & this.config.MAX_32BIT, 17);
6285
- }
6286
- const t0 = s0 ^ length;
6287
- const t1 = s1 ^ t0;
6288
- const t2 = s2 + t1 & this.config.MAX_32BIT;
6289
- const t3 = s3 ^ t2;
6290
- const rotT0 = this.rotateLeft(t0, 9);
6291
- const rotT1 = this.rotateLeft(t1, 13);
6292
- const rotT2 = this.rotateLeft(t2, 17);
6293
- const rotT3 = this.rotateLeft(t3, 19);
6294
- s0 = rotT0 + rotT2 & this.config.MAX_32BIT;
6295
- s1 = rotT1 ^ rotT3;
6296
- s2 = rotT2 + s0 & this.config.MAX_32BIT;
6297
- s3 = rotT3 ^ s1;
6298
- const result = [];
6299
- for (const s of [
6300
- s0,
6301
- s1,
6302
- s2,
6303
- s3
6304
- ]) result.push(...this.intToLeBytes(s, 4));
6305
- return result;
6306
- }
6307
- /**
6308
- * Build 144-byte payload array (mns0301 version)
6309
- *
6310
- * @param hexParameter - 32-char hex (MD5 of uri+data), used for the MD5 XOR segment
6311
- * @param hexMd5Path - 32-char hex path hash (GET: MD5 of uri+params, POST: MD5 of uri)
6312
- * @param a1Value - a1 value from cookies
6313
- * @param appIdentifier - Application identifier, default "xhs-pc-web"
6314
- * @param stringParam - String parameter (URI+data, used for length calculation)
6315
- * @param timestamp - Unix timestamp in seconds (defaults to current time)
6316
- * @param signState - Optional session state
6317
- */
6318
- buildPayloadArray(hexParameter, hexMd5Path, a1Value, appIdentifier = "xhs-pc-web", stringParam = "", timestamp, signState) {
6319
- if (timestamp === void 0) timestamp = Date.now() / 1e3;
6320
- const seed = this.randomGen.generateRandomInt();
6321
- const seedByte = seed & 255;
6322
- const payload = [];
6323
- payload.push(...this.config.VERSION_BYTES);
6324
- payload.push(...this.intToLeBytes(seed, 4));
6325
- const tsBytes = this.intToLeBytes(Math.floor(timestamp * 1e3), this.config.TIMESTAMP_LE_LENGTH);
6326
- payload.push(...tsBytes);
6327
- if (signState) {
6328
- payload.push(...this.intToLeBytes(signState.pageLoadTimestamp, this.config.TIMESTAMP_LE_LENGTH));
6329
- payload.push(...this.intToLeBytes(signState.sequenceValue, 4));
6330
- payload.push(...this.intToLeBytes(signState.windowPropsLength, 4));
6331
- payload.push(...this.intToLeBytes(signState.uriLength, 4));
6332
- } else {
6333
- const timeOffset = this.randomGen.generateRandomByteInRange(this.config.ENV_FINGERPRINT_TIME_OFFSET_MIN, this.config.ENV_FINGERPRINT_TIME_OFFSET_MAX);
6334
- const effectiveTsMs = Math.floor((timestamp - timeOffset) * 1e3);
6335
- payload.push(...this.intToLeBytes(effectiveTsMs, this.config.TIMESTAMP_LE_LENGTH));
6336
- const sequenceValue = this.randomGen.generateRandomByteInRange(this.config.SEQUENCE_VALUE_MIN, this.config.SEQUENCE_VALUE_MAX);
6337
- payload.push(...this.intToLeBytes(sequenceValue, 4));
6338
- const windowPropsLength = this.randomGen.generateRandomByteInRange(this.config.WINDOW_PROPS_LENGTH_MIN, this.config.WINDOW_PROPS_LENGTH_MAX);
6339
- payload.push(...this.intToLeBytes(windowPropsLength, 4));
6340
- const uriLength = Buffer.from(stringParam, "utf-8").length;
6341
- payload.push(...this.intToLeBytes(uriLength, 4));
6342
- }
6343
- const md5Bytes = Buffer.from(hexParameter, "hex");
6344
- for (let i = 0; i < this.config.MD5_XOR_LENGTH; i++) payload.push(md5Bytes[i] ^ seedByte);
6345
- const a1Bytes = Buffer.from(a1Value, "utf-8").subarray(0, this.config.A1_LENGTH);
6346
- const a1Padded = Buffer.alloc(this.config.A1_LENGTH);
6347
- a1Bytes.copy(a1Padded);
6348
- payload.push(a1Padded.length);
6349
- payload.push(...Array.from(a1Padded));
6350
- const appBytes = Buffer.from(appIdentifier, "utf-8").subarray(0, this.config.APP_ID_LENGTH);
6351
- const appPadded = Buffer.alloc(this.config.APP_ID_LENGTH);
6352
- appBytes.copy(appPadded);
6353
- payload.push(appPadded.length);
6354
- payload.push(...Array.from(appPadded));
6355
- const part11 = [1, seedByte ^ this.config.ENV_TABLE[0]];
6356
- for (let i = 1; i < 15; i++) part11.push(this.config.ENV_TABLE[i] ^ this.config.ENV_CHECKS_DEFAULT[i]);
6357
- payload.push(...part11);
6358
- const md5PathBytes = [];
6359
- for (let i = 0; i < 32; i += 2) md5PathBytes.push(parseInt(hexMd5Path.substring(i, i + 2), 16));
6360
- const a3Hash = this.customHashV2([...tsBytes, ...md5PathBytes]);
6361
- const a3Field = [...this.config.A3_PREFIX, ...a3Hash.map((b) => b ^ seedByte)];
6362
- payload.push(...a3Field);
6363
- return payload;
6364
- }
6365
- };
6366
- /**
6367
- * Custom CRC32 helper class.
6368
- *
6369
- * This implements a JavaScript-style CRC32 variant compatible with:
6370
- * (-1 ^ c ^ 0xEDB88320) >>> 0
6371
- * where `c` is the intermediate CRC state produced by the core CRC32 loop.
6372
- */
6373
- var MASK32 = 4294967295;
6374
- var POLY = 3988292384;
6375
- var TABLE = null;
6376
- function ensureTable() {
6377
- if (TABLE !== null) return TABLE;
6378
- const tbl = new Array(256);
6379
- for (let d = 0; d < 256; d++) {
6380
- let r = d;
6381
- for (let i = 0; i < 8; i++) {
6382
- r = r & 1 ? r >>> 1 ^ POLY : r >>> 1;
6383
- r = r >>> 0;
6384
- }
6385
- tbl[d] = r;
6386
- }
6387
- TABLE = tbl;
6388
- return TABLE;
6389
- }
6390
- function crc32Core(data, stringMode = "js") {
6391
- const table = ensureTable();
6392
- let c = MASK32;
6393
- let bytes;
6394
- if (typeof data === "string") {
6395
- if (stringMode === "utf8") bytes = Array.from(Buffer.from(data, "utf8"));
6396
- else {
6397
- bytes = [];
6398
- for (let i = 0; i < data.length; i++) bytes.push(data.charCodeAt(i) & 255);
6399
- }
6400
- } else bytes = data.map((b) => b & 255);
6401
- for (const b of bytes) c = (table[(c & 255 ^ b) & 255] ^ c >>> 8) >>> 0;
6402
- return c;
6403
- }
6404
- function toSigned32(u) {
6405
- return u & 2147483648 ? u - 4294967296 : u;
6406
- }
6407
- var CRC32 = class {
6408
- /**
6409
- * JavaScript-style CRC32 public entry.
6410
- *
6411
- * This matches the JS expression:
6412
- * (-1 ^ c ^ 0xEDB88320) >>> 0
6413
- */
6414
- static crc32JsInt(data, options = {}) {
6415
- const { stringMode = "js", signed = true } = options;
6416
- const u = (crc32Core(data, stringMode) ^ 306674911) >>> 0;
6417
- return signed ? toSigned32(u) : u;
6418
- }
6419
- };
6420
- /**
6421
- * Browser fingerprint data constants
6422
- */
6423
- var GPU_VENDORS = [
6424
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) HD Graphics 400 (0x00000166) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6425
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) HD Graphics 4400 (0x00001112) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6426
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) HD Graphics 4600 (0x00000412) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6427
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) HD Graphics 520 (0x1912) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6428
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) HD Graphics 530 (0x00001912) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6429
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) HD Graphics 550 (0x00001512) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6430
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) HD Graphics 6000 (0x1606) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6431
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris(TM) Graphics 540 (0x1912) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6432
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris(TM) Graphics 550 (0x1913) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6433
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris(TM) Plus Graphics 640 (0x161C) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6434
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) UHD Graphics 600 (0x3E80) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6435
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) UHD Graphics 620 (0x00003EA0) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6436
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) UHD Graphics 630 (0x00003E9B) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6437
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) UHD Graphics 655 (0x00009BC8) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6438
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris(R) Xe Graphics (0x000046A8) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6439
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris(R) Xe Graphics (0x00009A49) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6440
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris(R) Xe MAX Graphics (0x00009BC0) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6441
- "Google Inc. (Intel)|ANGLE (Intel, Intel Arc A370M (0x0000AF51) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6442
- "Google Inc. (Intel)|ANGLE (Intel, Intel Arc A380 (0x0000AF41) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6443
- "Google Inc. (Intel)|ANGLE (Intel, Intel Arc A380M (0x0000AF5E) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6444
- "Google Inc. (Intel)|ANGLE (Intel, Intel Arc A550 (0x0000AF42) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6445
- "Google Inc. (Intel)|ANGLE (Intel, Intel Arc A770 (0x0000AF43) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6446
- "Google Inc. (Intel)|ANGLE (Intel, Intel Arc A770M (0x0000AF50) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6447
- "Google Inc. (Intel)|ANGLE (Intel, Mesa Intel(R) Graphics (RPL‑P GT1) (0x0000A702) OpenGL 4.6)",
6448
- "Google Inc. (Intel)|ANGLE (Intel, Mesa Intel(R) UHD Graphics 770 (0x00004680) OpenGL 4.6)",
6449
- "Google Inc. (Intel)|ANGLE (Intel, Mesa Intel(R) HD Graphics 4400 (0x00001122) OpenGL 4.6)",
6450
- "Google Inc. (Intel)|ANGLE (Intel, Mesa Intel(R) Graphics (ADL‑S GT1) (0x0000A0A1) OpenGL 4.6)",
6451
- "Google Inc. (Intel)|ANGLE (Intel, Mesa Intel(R) Graphics (RKL GT1) (0x0000A9A1) OpenGL 4.6)",
6452
- "Google Inc. (Intel)|ANGLE (Intel, Mesa Intel(R) UHD Graphics (CML GT2) (0x00009A14) OpenGL 4.6)",
6453
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) HD Graphics 3000 (0x00001022) Direct3D9Ex vs_3_0 ps_3_0, igdumd64.dll)",
6454
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) HD Graphics Family (0x00000A16) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6455
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris Pro OpenGL Engine, OpenGL 4.1)",
6456
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris(TM) Plus Graphics 645 (0x1616) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6457
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) Iris(TM) Plus Graphics 655 (0x161E) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6458
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) UHD Graphics 730 (0x0000A100) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6459
- "Google Inc. (Intel)|ANGLE (Intel, Intel(R) UHD Graphics 805 (0x0000B0A0) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6460
- "Google Inc. (AMD)|ANGLE (AMD, AMD Radeon Vega 3 Graphics (0x000015E0) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6461
- "Google Inc. (AMD)|ANGLE (AMD, AMD Radeon Vega 8 Graphics (0x000015D8) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6462
- "Google Inc. (AMD)|ANGLE (AMD, AMD Radeon Vega 11 Graphics (0x000015DD) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6463
- "Google Inc. (AMD)|ANGLE (AMD, AMD Radeon Graphics (0x00001636) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6464
- "Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 5500 XT Direct3D11 vs_5_0 ps_5_0, D3D11)",
6465
- "Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 560 (0x000067EF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6466
- "Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 570 (0x000067DF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6467
- "Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 580 2048SP (0x00006FDF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6468
- "Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 590 (0x000067FF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6469
- "Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 6600 (0x000073FF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6470
- "Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 6600 XT (0x000073FF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6471
- "Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 6650 XT Direct3D11 vs_5_0 ps_5_0, D3D11)",
6472
- "Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 6700 XT (0x000073DF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6473
- "Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 6800 (0x000073BF) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6474
- "Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 6900 XT (0x000073C2) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6475
- "Google Inc. (AMD)|ANGLE (AMD, AMD Radeon RX 7700 XT Direct3D11 vs_5_0 ps_5_0, D3D11)",
6476
- "Google Inc. (AMD)|ANGLE (AMD, AMD Radeon Pro 5300M OpenGL Engine, OpenGL 4.1)",
6477
- "Google Inc. (AMD)|ANGLE (AMD, AMD Radeon Pro 5500 XT OpenGL Engine, OpenGL 4.1)",
6478
- "Google Inc. (AMD)|ANGLE (AMD, AMD Radeon R7 370 Series (0x00006811) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6479
- "Google Inc. (AMD)|ANGLE (AMD, ATI Technologies Inc. AMD Radeon RX Vega 64 OpenGL Engine, OpenGL 4.1)",
6480
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce GTX 1050 (0x00001C81) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6481
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce GTX 1050 Ti (0x00001C8C) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6482
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce GTX 1060 6GB (0x000010DE) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6483
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce GTX 1070 (0x00001B81) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6484
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce GTX 1080 (0x00001B80) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6485
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 2060 (0x00001F06) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6486
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 2060 SUPER (0x00001F06) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6487
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 2070 (0x00001F10) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6488
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 2070 SUPER (0x00001F10) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6489
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3060 (0x0000250F) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6490
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3060 Ti (0x00002489) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6491
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3070 (0x00002488) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6492
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3070 Ti (0x000028A5) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6493
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3080 (0x00002206) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6494
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3080 Ti (0x00002208) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6495
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 3090 (0x00002204) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6496
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 4060 (0x00002882) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6497
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 4060 Ti (0x00002803) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6498
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 4070 (0x00002786) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6499
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 4070 Ti (0x00002857) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6500
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 4080 (0x00002819) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6501
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA GeForce RTX 4090 (0x00002684) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6502
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA Quadro RTX 5000 Ada Generation (0x000026B2) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6503
- "Google Inc. (NVIDIA)|ANGLE (NVIDIA, NVIDIA Quadro P400 (0x00001CB3) Direct3D11 vs_5_0 ps_5_0, D3D11)",
6504
- "Google Inc. (Google)|ANGLE (Google, Vulkan 1.3.0 (SwiftShader Device (Subzero) (0x0000C0DE)), SwiftShader driver)",
6505
- "Google Inc. (Google)|ANGLE (Google, Vulkan 1.3.0 (SwiftShader Device (Subzero)), SwiftShader driver)",
6506
- "Google Inc. (Google)|ANGLE (Google, Vulkan 1.3.0 (SwiftShader Device), SwiftShader driver)"
6507
- ];
6508
- var SCREEN_RESOLUTIONS = {
6509
- resolutions: [
6510
- "1366;768",
6511
- "1600;900",
6512
- "1920;1080",
6513
- "2560;1440",
6514
- "3840;2160",
6515
- "7680;4320"
6516
- ],
6517
- weights: [
6518
- .25,
6519
- .15,
6520
- .35,
6521
- .15,
6522
- .08,
6523
- .02
6524
- ]
6525
- };
6526
- var COLOR_DEPTH_OPTIONS = {
6527
- values: [
6528
- 16,
6529
- 24,
6530
- 30,
6531
- 32
6532
- ],
6533
- weights: [
6534
- .05,
6535
- .6,
6536
- .05,
6537
- .3
6538
- ]
6539
- };
6540
- var DEVICE_MEMORY_OPTIONS = {
6541
- values: [
6542
- 1,
6543
- 2,
6544
- 4,
6545
- 8,
6546
- 12,
6547
- 16
6548
- ],
6549
- weights: [
6550
- .1,
6551
- .25,
6552
- .4,
6553
- .2,
6554
- .03,
6555
- .01
6556
- ]
6557
- };
6558
- var CORE_OPTIONS = {
6559
- values: [
6560
- 2,
6561
- 4,
6562
- 6,
6563
- 8,
6564
- 12,
6565
- 16,
6566
- 24,
6567
- 32
6568
- ],
6569
- weights: [
6570
- .1,
6571
- .4,
6572
- .2,
6573
- .15,
6574
- .08,
6575
- .04,
6576
- .02,
6577
- .01
6578
- ]
6579
- };
6580
- var BROWSER_PLUGINS = "PDF Viewer,Chrome PDF Viewer,Chromium PDF Viewer,Microsoft Edge PDF Viewer,WebKit built-in PDF";
6581
- var CANVAS_HASH = "742cc32c";
6582
- var VOICE_HASH_OPTIONS = "10311144241322244122";
6583
- var FONTS = "system-ui, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\", -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif, BlinkMacSystemFont, \"Helvetica Neue\", Arial, \"PingFang SC\", \"PingFang TC\", \"PingFang HK\", \"Microsoft Yahei\", \"Microsoft JhengHei\"";
6584
- /**
6585
- * Fingerprint generation helper functions
6586
- */
6587
- /**
6588
- * Random choice a value from list according to the given weights
6589
- */
6590
- function weightedRandomChoice(options, weights) {
6591
- const totalWeight = weights.reduce((sum, w) => sum + w, 0);
6592
- let random = Math.random() * totalWeight;
6593
- for (let i = 0; i < options.length; i++) {
6594
- random -= weights[i];
6595
- if (random <= 0) return String(options[i]);
6596
- }
6597
- return String(options[options.length - 1]);
6598
- }
6599
- /**
6600
- * Get random GPU renderer information
6601
- */
6602
- function getRendererInfo() {
6603
- const [vendor, renderer] = GPU_VENDORS[Math.floor(Math.random() * GPU_VENDORS.length)].split("|");
6604
- return [vendor, renderer];
6605
- }
6606
- /**
6607
- * Get random screen configuration with width, height, and available dimensions
6608
- */
6609
- function getScreenConfig() {
6610
- const [widthStr, heightStr] = weightedRandomChoice(SCREEN_RESOLUTIONS.resolutions, SCREEN_RESOLUTIONS.weights).split(";");
6611
- const width = parseInt(widthStr, 10);
6612
- const height = parseInt(heightStr, 10);
6613
- let availWidth;
6614
- let availHeight;
6615
- if (Math.random() < .5) {
6616
- availWidth = width - parseInt(weightedRandomChoice([
6617
- 0,
6618
- 30,
6619
- 60,
6620
- 80
6621
- ], [
6622
- .1,
6623
- .4,
6624
- .3,
6625
- .2
6626
- ]), 10);
6627
- availHeight = height;
6628
- } else {
6629
- availWidth = width;
6630
- availHeight = height - parseInt(weightedRandomChoice([
6631
- 30,
6632
- 60,
6633
- 80,
6634
- 100
6635
- ], [
6636
- .2,
6637
- .5,
6638
- .2,
6639
- .1
6640
- ]), 10);
6641
- }
6642
- return {
6643
- width,
6644
- height,
6645
- availWidth,
6646
- availHeight
6647
- };
6648
- }
6649
- /**
6650
- * Generate canvas fingerprint hash
6651
- */
6652
- function generateCanvasHash() {
6653
- return CANVAS_HASH;
6654
- }
6655
- /**
6656
- * Generate WebGL fingerprint hash
6657
- */
6658
- function generateWebglHash() {
6659
- return createHash("md5").update(randomBytes(32)).digest("hex");
6660
- }
6661
- /**
6662
- * Browser fingerprint generator
6663
- */
6664
- var FingerprintGenerator = class {
6665
- config;
6666
- b1Key;
6667
- encoder;
6668
- constructor(config) {
6669
- this.config = config || new CryptoConfig();
6670
- this.b1Key = Buffer.from(this.config.B1_SECRET_KEY, "utf8");
6671
- this.encoder = new Base64Encoder(this.config);
6672
- }
6673
- /**
6674
- * Generate b1 parameter from fingerprint
6675
- */
6676
- generateB1(fp) {
6677
- const b1Fp = {
6678
- x33: fp.x33,
6679
- x34: fp.x34,
6680
- x35: fp.x35,
6681
- x36: fp.x36,
6682
- x37: fp.x37,
6683
- x38: fp.x38,
6684
- x39: fp.x39,
6685
- x42: fp.x42,
6686
- x43: fp.x43,
6687
- x44: fp.x44,
6688
- x45: fp.x45,
6689
- x46: fp.x46,
6690
- x48: fp.x48,
6691
- x49: fp.x49,
6692
- x50: fp.x50,
6693
- x51: fp.x51,
6694
- x52: fp.x52,
6695
- x82: fp.x82
6696
- };
6697
- const b1Json = JSON.stringify(b1Fp);
6698
- const ciphertext = this.rc4Encrypt(b1Json, this.b1Key);
6699
- const encodedUrl = this.customUrlEncode(ciphertext);
6700
- const b = [];
6701
- const parts = encodedUrl.split("%").slice(1);
6702
- for (const part of parts) {
6703
- const chars = part.split("");
6704
- b.push(parseInt(chars.slice(0, 2).join(""), 16));
6705
- for (const c of chars.slice(2)) b.push(c.charCodeAt(0));
6706
- }
6707
- return this.encoder.encode(JSON.stringify(b));
6708
- }
6709
- /**
6710
- * RC4 encryption implementation
6711
- */
6712
- rc4Encrypt(data, key) {
6713
- const S = new Array(256);
6714
- for (let i = 0; i < 256; i++) S[i] = i;
6715
- let j = 0;
6716
- for (let i = 0; i < 256; i++) {
6717
- j = (j + S[i] + key[i % key.length]) % 256;
6718
- [S[i], S[j]] = [S[j], S[i]];
6719
- }
6720
- const dataBytes = Buffer.from(data, "utf8");
6721
- const result = Buffer.alloc(dataBytes.length);
6722
- let i = 0;
6723
- j = 0;
6724
- for (let k = 0; k < dataBytes.length; k++) {
6725
- i = (i + 1) % 256;
6726
- j = (j + S[i]) % 256;
6727
- [S[i], S[j]] = [S[j], S[i]];
6728
- const t = (S[i] + S[j]) % 256;
6729
- result[k] = dataBytes[k] ^ S[t];
6730
- }
6731
- return result.toString("latin1");
6732
- }
6733
- /**
6734
- * Custom URL encode matching Python's quote with safe="!*'()~_-"
6735
- */
6736
- customUrlEncode(str) {
6737
- const safeChars = "!*'()~_-";
6738
- let result = "";
6739
- for (let i = 0; i < str.length; i++) {
6740
- const char = str[i];
6741
- const code = str.charCodeAt(i);
6742
- if (code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 48 && code <= 57 || safeChars.includes(char)) result += char;
6743
- else result += "%" + code.toString(16).toUpperCase().padStart(2, "0");
6744
- }
6745
- return result;
6746
- }
6747
- /**
6748
- * Generate browser fingerprint
6749
- */
6750
- generate(cookies, userAgent) {
6751
- const cookieString = Object.entries(cookies).map(([k, v]) => `${k}=${v}`).join("; ");
6752
- const screenConfig = getScreenConfig();
6753
- const isIncognitoMode = weightedRandomChoice(["true", "false"], [.95, .05]);
6754
- const [vendor, renderer] = getRendererInfo();
6755
- const x78Y = Math.floor(Math.random() * 100) + 2350;
6756
- return {
6757
- x1: userAgent,
6758
- x2: "false",
6759
- x3: "zh-CN",
6760
- x4: weightedRandomChoice(COLOR_DEPTH_OPTIONS.values, COLOR_DEPTH_OPTIONS.weights),
6761
- x5: weightedRandomChoice(DEVICE_MEMORY_OPTIONS.values, DEVICE_MEMORY_OPTIONS.weights),
6762
- x6: "24",
6763
- x7: `${vendor},${renderer}`,
6764
- x8: weightedRandomChoice(CORE_OPTIONS.values, CORE_OPTIONS.weights),
6765
- x9: `${screenConfig.width};${screenConfig.height}`,
6766
- x10: `${screenConfig.availWidth};${screenConfig.availHeight}`,
6767
- x11: "-480",
6768
- x12: "Asia/Shanghai",
6769
- x13: isIncognitoMode,
6770
- x14: isIncognitoMode,
6771
- x15: isIncognitoMode,
6772
- x16: "false",
6773
- x17: "false",
6774
- x18: "un",
6775
- x19: "Win32",
6776
- x20: "",
6777
- x21: BROWSER_PLUGINS,
6778
- x22: generateWebglHash(),
6779
- x23: "false",
6780
- x24: "false",
6781
- x25: "false",
6782
- x26: "false",
6783
- x27: "false",
6784
- x28: "0,false,false",
6785
- x29: "4,7,8",
6786
- x30: "swf object not loaded",
6787
- x33: "0",
6788
- x34: "0",
6789
- x35: "0",
6790
- x36: `${Math.floor(Math.random() * 20) + 1}`,
6791
- x37: "0|0|0|0|0|0|0|0|0|1|0|0|0|0|0|0|0|0|1|0|0|0|0|0",
6792
- x38: "0|0|1|0|1|0|0|0|0|0|1|0|1|0|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0",
6793
- x39: 0,
6794
- x40: "0",
6795
- x41: "0",
6796
- x42: "3.4.4",
6797
- x43: generateCanvasHash(),
6798
- x44: `${Date.now()}`,
6799
- x45: "__SEC_CAV__1-1-1-1-1|__SEC_WSA__|",
6800
- x46: "false",
6801
- x47: "1|0|0|0|0|0",
6802
- x48: "",
6803
- x49: "{list:[],type:}",
6804
- x50: "",
6805
- x51: "",
6806
- x52: "",
6807
- x55: "380,380,360,400,380,400,420,380,400,400,360,360,440,420",
6808
- x56: `${vendor}|${renderer}|${generateWebglHash()}|35`,
6809
- x57: cookieString,
6810
- x58: "180",
6811
- x59: "2",
6812
- x60: "63",
6813
- x61: "1291",
6814
- x62: "2047",
6815
- x63: "0",
6816
- x64: "0",
6817
- x65: "0",
6818
- x66: {
6819
- referer: "",
6820
- location: "https://www.xiaohongshu.com/explore",
6821
- frame: 0
6822
- },
6823
- x67: "1|0",
6824
- x68: "0",
6825
- x69: "326|1292|30",
6826
- x70: ["location"],
6827
- x71: "true",
6828
- x72: "complete",
6829
- x73: "1191",
6830
- x74: "0|0|0",
6831
- x75: "Google Inc.",
6832
- x76: "true",
6833
- x77: "1|1|1|1|1|1|1|1|1|1",
6834
- x78: {
6835
- x: 0,
6836
- y: x78Y,
6837
- left: 0,
6838
- right: 290.828125,
6839
- bottom: x78Y + 18,
6840
- height: 18,
6841
- top: x78Y,
6842
- width: 290.828125,
6843
- font: FONTS
6844
- },
6845
- x82: "_0x17a2|_0x1954",
6846
- x31: "124.04347527516074",
6847
- x79: "144|599565058866",
6848
- x53: createHash("md5").update(randomBytes(32)).digest("hex"),
6849
- x54: VOICE_HASH_OPTIONS,
6850
- x80: "1|[object FileSystemDirectoryHandle]"
6851
- };
6852
- }
6853
- /**
6854
- * Update fingerprint with new cookies and URL
6855
- */
6856
- update(fp, cookies, url) {
6857
- const cookieString = Object.entries(cookies).map(([k, v]) => `${k}=${v}`).join("; ");
6858
- fp.x39 = 0;
6859
- fp.x44 = `${Date.now()}`;
6860
- fp.x57 = cookieString;
6861
- fp.x66 = {
6862
- referer: "https://www.xiaohongshu.com/explore",
6863
- location: url,
6864
- frame: 0
6865
- };
6866
- }
6867
- };
6868
- /**
6869
- * x-s-common signature generation
6870
- */
6871
- var XsCommonSigner = class {
6872
- config;
6873
- fpGenerator;
6874
- encoder;
6875
- constructor(config) {
6876
- this.config = config || new CryptoConfig();
6877
- this.fpGenerator = new FingerprintGenerator(this.config);
6878
- this.encoder = new Base64Encoder(this.config);
6879
- }
6880
- /**
6881
- * Generate x-s-common signature
6882
- */
6883
- sign(cookieDict) {
6884
- const a1Value = cookieDict.a1;
6885
- if (!a1Value) throw new Error("Missing 'a1' in cookies");
6886
- const fingerprint = this.fpGenerator.generate(cookieDict, this.config.PUBLIC_USERAGENT);
6887
- const b1 = this.fpGenerator.generateB1(fingerprint);
6888
- const x9 = CRC32.crc32JsInt(b1);
6889
- const signStruct = { ...this.config.SIGNATURE_XSCOMMON_TEMPLATE };
6890
- signStruct.x5 = a1Value;
6891
- signStruct.x8 = b1;
6892
- signStruct.x9 = x9;
6893
- const signJson = JSON.stringify(signStruct);
6894
- return this.encoder.encode(signJson);
6895
- }
6896
- };
6897
- /**
6898
- * XYW_ signature crypto (AES-128-CBC).
6899
- *
6900
- * Ported from the upstream Python `core/xyw_crypto.py`. Data-fetching APIs
6901
- * (user_posted, otherinfo, etc.) reject the traditional XYS_ format with HTTP
6902
- * 406; the XYW_ format uses an independent AES-128-CBC crypto path.
6903
- *
6904
- * The upstream ships a hand-rolled AES-128 implementation. Since it is
6905
- * standard AES-128 (identical S-box, RCON, key schedule and MixColumns), this
6906
- * port uses Node's native `aes-128-cbc` cipher, which produces byte-identical
6907
- * ciphertext while being far less error-prone.
6908
- */
6909
- var AES_BLOCK_SIZE = 16;
6910
- /**
6911
- * Apply PKCS#7 padding to a byte buffer.
6912
- */
6913
- function pkcs7Pad(data) {
6914
- const padLen = AES_BLOCK_SIZE - data.length % AES_BLOCK_SIZE;
6915
- return Buffer.concat([data, Buffer.alloc(padLen, padLen)]);
6916
- }
6917
- /**
6918
- * AES-128-CBC cipher matching the upstream XYW implementation.
6919
- */
6920
- var XywCipher = class {
6921
- key;
6922
- iv;
6923
- constructor(key, iv) {
6924
- if (key.length !== AES_BLOCK_SIZE) throw new Error("AES-128 requires a 16-byte key");
6925
- if (iv.length !== AES_BLOCK_SIZE) throw new Error("AES-CBC IV must be 16 bytes");
6926
- this.key = key;
6927
- this.iv = iv;
6928
- }
6929
- /**
6930
- * Encrypt PKCS#7-padded plaintext with AES-128-CBC.
6931
- *
6932
- * @param plaintextBytes - Plaintext, already padded to a 16-byte boundary
6933
- * @returns Ciphertext bytes
6934
- */
6935
- encrypt(plaintextBytes) {
6936
- if (plaintextBytes.length % AES_BLOCK_SIZE !== 0) throw new Error("plaintextBytes must be PKCS#7 padded to a 16-byte boundary");
6937
- const cipher = createCipheriv("aes-128-cbc", this.key, this.iv);
6938
- cipher.setAutoPadding(false);
6939
- return Buffer.concat([cipher.update(plaintextBytes), cipher.final()]);
6940
- }
6941
- };
6942
- /**
6943
- * Build the hex-encoded payload for an XYW_ signature.
6944
- *
6945
- * @param options.fullUri - The content string (uri + params/body)
6946
- * @param options.a1Value - a1 value from cookies
6947
- * @param options.timestampMs - Millisecond timestamp string
6948
- * @param options.config - Crypto configuration
6949
- * @param options.envFlags - Optional environment flags string
6950
- * @returns Hex-encoded AES-128-CBC ciphertext
6951
- */
6952
- function buildXywPayloadHex(options) {
6953
- const { fullUri, a1Value, timestampMs, config, envFlags } = options;
6954
- const x1 = createHash("md5").update(`url=${fullUri}`).digest("hex");
6955
- const x2 = envFlags || config.XYW_ENV_FLAGS_DEFAULT;
6956
- const message = Buffer.from(`x1=${x1};x2=${x2};x3=${a1Value};x4=${timestampMs};`);
6957
- const plaintext = pkcs7Pad(Buffer.from(message.toString("base64")));
6958
- return new XywCipher(Buffer.from(config.XYW_AES_KEY, "utf-8"), Buffer.from(config.XYW_AES_IV, "utf-8")).encrypt(plaintext).toString("hex");
6959
- }
6960
- /**
6961
- * x-rap-param generation.
6962
- *
6963
- * Ported from the upstream Python `core/xrap.py`. Required for feed, search,
6964
- * and note-publishing endpoints. Builds a TLV body structure, gzip-compresses
6965
- * it, then XOR + block-encrypts (SM4-variant with custom S-box/round keys) and
6966
- * wraps it in a base64 envelope.
6967
- */
6968
- var cfg = new CryptoConfig();
6969
- cfg.MAX_32BIT;
6970
- var XRAP_SDK_VERSION = cfg.XRAP_SDK_VERSION;
6971
- var ROUND_KEYS = [
6972
- [
6973
- 1802586417,
6974
- 1146381175,
6975
- 1264073008,
6976
- 1517568377
6977
- ],
6978
- [
6979
- 2301709464,
6980
- 3445960687,
6981
- 2252150495,
6982
- 3695794086
6983
- ],
6984
- [
6985
- 3255120652,
6986
- 257957091,
6987
- 2304576060,
6988
- 1427398042
6989
- ],
6990
- [
6991
- 3523543150,
6992
- 3714391181,
6993
- 1412961969,
6994
- 19680043
6995
- ],
6996
- [
6997
- 1997286255,
6998
- 2859022306,
6999
- 4266729811,
7000
- 4286409336
7001
- ],
7002
- [
7003
- 2020015092,
7004
- 3524250646,
7005
- 744418629,
7006
- 3542320957
7007
- ],
7008
- [
7009
- 2431239806,
7010
- 1122372200,
7011
- 1857611565,
7012
- 3181076496
7013
- ],
7014
- [
7015
- 3922013166,
7016
- 2871206278,
7017
- 3315320491,
7018
- 2013308603
7019
- ],
7020
- [
7021
- 330996286,
7022
- 3097082808,
7023
- 2097315091,
7024
- 84073384
7025
- ],
7026
- [
7027
- 1348547184,
7028
- 3908602312,
7029
- 2516251867,
7030
- 2432184179
7031
- ]
7032
- ];
7033
- var LAST_ROUND_KEY = [
7034
- 4086740047,
7035
- 460209543,
7036
- 2392115548,
7037
- 510453295
7038
- ];
7039
- var LAST_ROUND_KEY_BYTES = (() => {
7040
- const b = Buffer.alloc(16);
7041
- for (let i = 0; i < 4; i++) b.writeUInt32BE(LAST_ROUND_KEY[i] >>> 0, i * 4);
7042
- return b;
7043
- })();
7044
- var SBOX = [
7045
- 122,
7046
- 1,
7047
- 88,
7048
- 224,
7049
- 80,
7050
- 78,
7051
- 2,
7052
- 121,
7053
- 29,
7054
- 75,
7055
- 83,
7056
- 218,
7057
- 107,
7058
- 72,
7059
- 212,
7060
- 82,
7061
- 237,
7062
- 119,
7063
- 18,
7064
- 33,
7065
- 20,
7066
- 21,
7067
- 236,
7068
- 16,
7069
- 24,
7070
- 229,
7071
- 185,
7072
- 241,
7073
- 12,
7074
- 8,
7075
- 252,
7076
- 125,
7077
- 249,
7078
- 205,
7079
- 181,
7080
- 200,
7081
- 230,
7082
- 55,
7083
- 38,
7084
- 135,
7085
- 86,
7086
- 186,
7087
- 184,
7088
- 43,
7089
- 173,
7090
- 240,
7091
- 104,
7092
- 247,
7093
- 139,
7094
- 141,
7095
- 211,
7096
- 94,
7097
- 54,
7098
- 77,
7099
- 46,
7100
- 146,
7101
- 49,
7102
- 130,
7103
- 242,
7104
- 41,
7105
- 112,
7106
- 61,
7107
- 45,
7108
- 215,
7109
- 182,
7110
- 64,
7111
- 178,
7112
- 67,
7113
- 68,
7114
- 128,
7115
- 120,
7116
- 210,
7117
- 13,
7118
- 73,
7119
- 74,
7120
- 9,
7121
- 99,
7122
- 108,
7123
- 7,
7124
- 58,
7125
- 158,
7126
- 213,
7127
- 6,
7128
- 198,
7129
- 225,
7130
- 98,
7131
- 244,
7132
- 52,
7133
- 36,
7134
- 89,
7135
- 169,
7136
- 87,
7137
- 42,
7138
- 0,
7139
- 62,
7140
- 23,
7141
- 44,
7142
- 10,
7143
- 26,
7144
- 66,
7145
- 250,
7146
- 147,
7147
- 190,
7148
- 220,
7149
- 245,
7150
- 179,
7151
- 106,
7152
- 19,
7153
- 232,
7154
- 3,
7155
- 199,
7156
- 151,
7157
- 187,
7158
- 115,
7159
- 118,
7160
- 134,
7161
- 227,
7162
- 70,
7163
- 114,
7164
- 71,
7165
- 208,
7166
- 5,
7167
- 76,
7168
- 56,
7169
- 124,
7170
- 31,
7171
- 129,
7172
- 171,
7173
- 117,
7174
- 81,
7175
- 235,
7176
- 243,
7177
- 50,
7178
- 116,
7179
- 17,
7180
- 143,
7181
- 132,
7182
- 137,
7183
- 156,
7184
- 113,
7185
- 34,
7186
- 126,
7187
- 157,
7188
- 207,
7189
- 63,
7190
- 145,
7191
- 105,
7192
- 101,
7193
- 60,
7194
- 109,
7195
- 150,
7196
- 162,
7197
- 152,
7198
- 153,
7199
- 51,
7200
- 57,
7201
- 154,
7202
- 202,
7203
- 195,
7204
- 159,
7205
- 160,
7206
- 188,
7207
- 228,
7208
- 163,
7209
- 164,
7210
- 84,
7211
- 127,
7212
- 167,
7213
- 168,
7214
- 4,
7215
- 111,
7216
- 93,
7217
- 172,
7218
- 183,
7219
- 39,
7220
- 175,
7221
- 176,
7222
- 40,
7223
- 65,
7224
- 174,
7225
- 180,
7226
- 110,
7227
- 11,
7228
- 27,
7229
- 223,
7230
- 142,
7231
- 48,
7232
- 177,
7233
- 254,
7234
- 144,
7235
- 97,
7236
- 96,
7237
- 192,
7238
- 203,
7239
- 92,
7240
- 14,
7241
- 239,
7242
- 22,
7243
- 131,
7244
- 234,
7245
- 32,
7246
- 233,
7247
- 201,
7248
- 85,
7249
- 196,
7250
- 69,
7251
- 133,
7252
- 204,
7253
- 30,
7254
- 170,
7255
- 103,
7256
- 138,
7257
- 123,
7258
- 53,
7259
- 214,
7260
- 25,
7261
- 216,
7262
- 217,
7263
- 194,
7264
- 219,
7265
- 148,
7266
- 221,
7267
- 28,
7268
- 222,
7269
- 166,
7270
- 255,
7271
- 248,
7272
- 191,
7273
- 91,
7274
- 90,
7275
- 15,
7276
- 231,
7277
- 193,
7278
- 189,
7279
- 209,
7280
- 102,
7281
- 197,
7282
- 37,
7283
- 238,
7284
- 140,
7285
- 226,
7286
- 95,
7287
- 136,
7288
- 161,
7289
- 59,
7290
- 165,
7291
- 246,
7292
- 206,
7293
- 149,
7294
- 47,
7295
- 100,
7296
- 35,
7297
- 251,
7298
- 253,
7299
- 79,
7300
- 155
7301
- ];
7302
- function gfDouble(x) {
7303
- x <<= 1;
7304
- return x & 256 ? (x ^ 283) & 255 : x & 255;
7305
- }
7306
- function gfMul(x, n) {
7307
- if (n === 1) return x;
7308
- if (n === 2) return gfDouble(x);
7309
- if (n === 3) return gfDouble(x) ^ x;
7310
- throw new Error(`unsupported GF multiplier: ${n}`);
7311
- }
7312
- /**
7313
- * Pre-compute 4 shifted T-tables from the S-box for the round function.
7314
- */
7315
- function buildLookupTables() {
7316
- const col0 = [];
7317
- const col1 = [];
7318
- const col2 = [];
7319
- const col3 = [];
7320
- for (const s of SBOX) {
7321
- const a = gfMul(s, 2);
7322
- const d = gfMul(s, 3);
7323
- col0.push((a << 24 | s << 16 | s << 8 | d) >>> 0);
7324
- col1.push((d << 24 | a << 16 | s << 8 | s) >>> 0);
7325
- col2.push((s << 24 | d << 16 | a << 8 | s) >>> 0);
7326
- col3.push((s << 24 | s << 16 | d << 8 | a) >>> 0);
7327
- }
7328
- return [
7329
- col0,
7330
- col1,
7331
- col2,
7332
- col3
7333
- ];
7334
- }
7335
- var [LUT0, LUT1, LUT2, LUT3] = buildLookupTables();
7336
- function readU32BE(buf, off = 0) {
7337
- return buf.readUInt32BE(off);
7338
- }
7339
- function toCompactJson(data) {
7340
- if (typeof data === "string") return data;
7341
- if (Buffer.isBuffer(data) || data instanceof Uint8Array) return Buffer.from(data).toString("utf-8");
7342
- return JSON.stringify(data);
7343
- }
7344
- function fieldByte(tag, val = 0) {
7345
- const b = Buffer.alloc(3);
7346
- b.writeUInt16BE(tag, 0);
7347
- b.writeUInt8(val & 255, 2);
7348
- return b;
7349
- }
7350
- function fieldU32(tag, val) {
7351
- const b = Buffer.alloc(6);
7352
- b.writeUInt16BE(tag, 0);
7353
- b.writeUInt32BE(val >>> 0, 2);
7354
- return b;
7355
- }
7356
- function fieldU64(tag, val) {
7357
- const b = Buffer.alloc(10);
7358
- b.writeUInt16BE(tag, 0);
7359
- b.writeBigUInt64BE(BigInt(val), 2);
7360
- return b;
7361
- }
7362
- function fieldBlob(tag, data) {
7363
- const head = Buffer.alloc(6);
7364
- head.writeUInt16BE(tag, 0);
7365
- head.writeUInt32BE(data.length >>> 0, 2);
7366
- return Buffer.concat([head, data]);
7367
- }
7368
- /**
7369
- * Encrypt a single 16-byte block; shorter input is zero-padded on the right.
7370
- */
7371
- function encryptBlock16(block) {
7372
- const src = Buffer.from(block);
7373
- if (src.length > 16) throw new Error("block length must be <= 16");
7374
- const padded = Buffer.alloc(16);
7375
- src.copy(padded);
7376
- let s0 = (readU32BE(padded, 0) ^ ROUND_KEYS[0][0]) >>> 0;
7377
- let s1 = (readU32BE(padded, 4) ^ ROUND_KEYS[0][1]) >>> 0;
7378
- let s2 = (readU32BE(padded, 8) ^ ROUND_KEYS[0][2]) >>> 0;
7379
- let s3 = (readU32BE(padded, 12) ^ ROUND_KEYS[0][3]) >>> 0;
7380
- for (let rnd = 1; rnd < 10; rnd++) {
7381
- const rk = ROUND_KEYS[rnd];
7382
- const n0 = (LUT0[s0 >>> 24 & 255] ^ LUT1[s1 >>> 16 & 255] ^ LUT2[s2 >>> 8 & 255] ^ LUT3[s3 & 255] ^ rk[0]) >>> 0;
7383
- const n1 = (LUT0[s1 >>> 24 & 255] ^ LUT1[s2 >>> 16 & 255] ^ LUT2[s3 >>> 8 & 255] ^ LUT3[s0 & 255] ^ rk[1]) >>> 0;
7384
- const n2 = (LUT0[s2 >>> 24 & 255] ^ LUT1[s3 >>> 16 & 255] ^ LUT2[s0 >>> 8 & 255] ^ LUT3[s1 & 255] ^ rk[2]) >>> 0;
7385
- const n3 = (LUT0[s3 >>> 24 & 255] ^ LUT1[s0 >>> 16 & 255] ^ LUT2[s1 >>> 8 & 255] ^ LUT3[s2 & 255] ^ rk[3]) >>> 0;
7386
- s0 = n0;
7387
- s1 = n1;
7388
- s2 = n2;
7389
- s3 = n3;
7390
- }
7391
- const state = [
7392
- s0,
7393
- s1,
7394
- s2,
7395
- s3
7396
- ];
7397
- const out = Buffer.alloc(16);
7398
- for (let row = 0; row < 4; row++) for (let col = 0; col < 4; col++) {
7399
- const idx = state[row + col & 3] >>> 24 - 8 * col & 255;
7400
- out[4 * row + col] = SBOX[idx] ^ LAST_ROUND_KEY_BYTES[4 * row + col];
7401
- }
7402
- return out;
7403
- }
7404
- /**
7405
- * Encrypt data by splitting into 16-byte blocks (ECB mode).
7406
- */
7407
- function encryptBlocks(src) {
7408
- const parts = [];
7409
- for (let i = 0; i < src.length; i += 16) parts.push(encryptBlock16(src.subarray(i, i + 16)));
7410
- return Buffer.concat(parts);
7411
- }
7412
- /**
7413
- * Encrypt the 16-byte session key and append its length.
7414
- */
7415
- function encryptSessionKey(key) {
7416
- if (key.length !== 16) throw new Error("session key must be 16 bytes");
7417
- const len = Buffer.alloc(4);
7418
- len.writeUInt32BE(16, 0);
7419
- return Buffer.concat([encryptBlock16(key), len]);
7420
- }
7421
- var DEFAULT_INTERACTION_TRACE = Buffer.from("0002000200004700000000000001ffd9ffa8005c23fff1ffff001501ff90fff9000022fff2ffff001501ffb800770061a5ffe3ffff002a01fffcffe70000f0ffe4ffff002a01ffd30000003e01ffd40000003e01ffc8ffff005301ffbdfffa006901ffbefffb006901ffb1fff4007d01ffa6ffee009301ffa8ffef009301ff9effe900a801ff96ffe600be01ff97ffe600be01ff93ffe500d301ff92ffe500ea01ff92ffe4010501ff92ffe3011b01ff92ffe402d101ff93ffe502f201ff94ffe6040501", "hex");
7422
- var DEFAULT_ENVIRONMENT_SNAPSHOT = Buffer.from("000000010000000000000000fffeffff00000000000000390001ffff00bc00000000006e00020001013400000000012f00000002011a00000000016100000000019f0000000002470000000002790000000002b1", "hex");
7423
- /**
7424
- * Build the pre-compression TLV payload for the RAP parameter.
7425
- */
7426
- function buildBodyStructure(api, data, options = {}) {
7427
- const bodyStr = toCompactJson(data);
7428
- const hashInput = Buffer.from(api + bodyStr, "utf-8");
7429
- const ts = options.timestampMs === null || options.timestampMs === void 0 ? Math.floor(Date.now()) : Math.floor(options.timestampMs);
7430
- let key;
7431
- if (typeof options.sessionKey === "string") key = Buffer.from(options.sessionKey, "ascii");
7432
- else if (options.sessionKey) key = Buffer.from(options.sessionKey);
7433
- else key = Buffer.from(RandomGenerator.generateRandomAscii(16), "ascii");
7434
- if (key.length !== 16) throw new Error("sessionKey must be 16 bytes");
7435
- const xorByte = options.obfuscationByte === null || options.obfuscationByte === void 0 ? Math.floor(Math.random() * 255) + 1 : options.obfuscationByte & 255;
7436
- const randNonce = options.nonce === null || options.nonce === void 0 ? Math.floor(Math.random() * 4294967296) >>> 0 : options.nonce >>> 0;
7437
- const trace = options.interactionTrace ?? DEFAULT_INTERACTION_TRACE;
7438
- const env = options.environmentSnapshot ?? DEFAULT_ENVIRONMENT_SNAPSHOT;
7439
- const parts = [];
7440
- parts.push(fieldU64(1e3, ts));
7441
- parts.push(fieldU32(1001, randNonce));
7442
- parts.push(fieldBlob(1002, key));
7443
- parts.push(fieldU32(1003, xxh32(hashInput)));
7444
- const flagTags = [];
7445
- for (let t = 1051; t < 1066; t++) flagTags.push(t);
7446
- flagTags.push(1070);
7447
- for (let t = 1066; t < 1070; t++) flagTags.push(t);
7448
- for (const tag of flagTags) parts.push(fieldByte(tag));
7449
- parts.push(fieldU32(1100, 0));
7450
- for (let t = 1071; t < 1074; t++) parts.push(fieldByte(t));
7451
- parts.push(fieldU32(1075, 1380));
7452
- parts.push(fieldU32(1076, 44));
7453
- parts.push(fieldU64(1077, Math.max(0, ts - 1076)));
7454
- parts.push(fieldBlob(1078, trace));
7455
- parts.push(fieldU32(1082, 0));
7456
- parts.push(fieldU32(1084, 0));
7457
- parts.push(fieldU32(1085, 0));
7458
- parts.push(fieldU32(1086, 100));
7459
- parts.push(fieldU64(1087, Math.max(0, ts - 727)));
7460
- parts.push(fieldBlob(1088, env));
7461
- parts.push(fieldU32(1090, 0));
7462
- parts.push(fieldU32(1097, 0));
7463
- parts.push(fieldU32(1092, 1382));
7464
- parts.push(fieldU32(1094, 1305));
7465
- parts.push(fieldU64(1095, Math.max(0, ts - 8588)));
7466
- parts.push(fieldU32(1093, 0));
7467
- parts.push(fieldByte(1096));
7468
- parts.push(fieldBlob(1091, Buffer.from([
7469
- 0,
7470
- 0,
7471
- 255,
7472
- 255
7473
- ])));
7474
- for (let t = 1151; t < 1157; t++) parts.push(fieldByte(t));
7475
- const buf = Buffer.concat(parts);
7476
- const out = Buffer.from(buf);
7477
- for (let i = 16; i < out.length; i++) out[i] = out[i] ^ xorByte;
7478
- return out;
7479
- }
7480
- /**
7481
- * Gzip-compress with OS byte patched to match the browser runtime (0x03).
7482
- */
7483
- function compressBody(raw, mtime, level = 6) {
7484
- const mt = mtime === null || mtime === void 0 ? Math.floor(Date.now() / 1e3) : mtime;
7485
- const out = Buffer.from(gzipSync(raw, { level }));
7486
- if (out.length >= 10) {
7487
- out.writeUInt32LE(mt >>> 0, 4);
7488
- out[9] = 3;
7489
- }
7490
- return out;
7491
- }
7492
- function cyclicXor(data, key) {
7493
- const out = Buffer.alloc(data.length);
7494
- for (let i = 0; i < data.length; i++) out[i] = data[i] ^ key[i % key.length];
7495
- return out;
7496
- }
7497
- /**
7498
- * Encrypt, wrap, and base64-encode the compressed body into the final x-rap-param.
7499
- */
7500
- function packEnvelope(compressed, options = {}) {
7501
- const gz = Buffer.from(compressed);
7502
- let key;
7503
- if (typeof options.encryptionKey === "string") key = Buffer.from(options.encryptionKey, "ascii");
7504
- else if (options.encryptionKey) key = Buffer.from(options.encryptionKey);
7505
- else key = Buffer.from(RandomGenerator.generateRandomAscii(16), "ascii");
7506
- if (key.length !== 16) throw new Error("encryptionKey must be 16 bytes");
7507
- const salt = options.saltString === null || options.saltString === void 0 ? RandomGenerator.generateRandomAscii([
7508
- 4,
7509
- 5,
7510
- 6
7511
- ][Math.floor(Math.random() * 3)]) : options.saltString;
7512
- const saltBytes = Buffer.from(salt, "ascii");
7513
- if (saltBytes.length < 0 || saltBytes.length > 255) throw new Error("saltString length must fit one byte");
7514
- const cipherBlocks = encryptBlocks(cyclicXor(gz, key));
7515
- const gzLen = Buffer.alloc(4);
7516
- gzLen.writeUInt32BE(gz.length >>> 0, 0);
7517
- const cipherBody = Buffer.concat([cipherBlocks, gzLen]);
7518
- const content = Buffer.concat([
7519
- saltBytes,
7520
- encryptSessionKey(key),
7521
- cipherBody
7522
- ]);
7523
- const contentHash = xxh32(content);
7524
- const encTime = options.processingTime === null || options.processingTime === void 0 ? Math.floor(Math.random() * 181) + 60 : options.processingTime;
7525
- const protocolVersion = options.protocolVersion ?? XRAP_SDK_VERSION;
7526
- const header = Buffer.alloc(36);
7527
- header[0] = 7;
7528
- header[1] = 36;
7529
- header[2] = 1;
7530
- header[3] = saltBytes.length & 255;
7531
- header.writeUInt32BE(1, 4);
7532
- header.writeUInt32BE(20, 8);
7533
- header.writeUInt32BE(cipherBody.length >>> 0, 12);
7534
- header.writeUInt32BE(contentHash >>> 0, 16);
7535
- header.writeUInt32BE(protocolVersion >>> 0, 20);
7536
- header.writeUInt32BE(encTime >>> 0, 24);
7537
- return Buffer.concat([header, content]).toString("base64");
7538
- }
7539
- /**
7540
- * Generate x-rap-param from API path and request payload.
7541
- *
7542
- * @param api - Request API path (e.g. "//edith.xiaohongshu.com/api/sns/web/v1/feed")
7543
- * @param data - Request body as object, JSON string, or raw bytes
7544
- * @param options - Optional deterministic overrides (used for testing)
7545
- * @returns Base64-encoded x-rap-param string
7546
- */
7547
- function xRapParam(api, data, options = {}) {
7548
- return packEnvelope(compressBody(buildBodyStructure(api, data, {
7549
- sessionKey: options.innerKey,
7550
- timestampMs: options.timestampMs,
7551
- nonce: options.bodyRand32,
7552
- obfuscationByte: options.mask,
7553
- interactionTrace: options.tracePayload,
7554
- environmentSnapshot: options.envPayload
7555
- }), options.gzipMtime, options.compresslevel ?? 6), {
7556
- encryptionKey: options.aesKey,
7557
- saltString: options.randomString,
7558
- processingTime: options.bodyEncryTime,
7559
- protocolVersion: options.sdkVersion ?? XRAP_SDK_VERSION
7560
- });
7561
- }
7562
- var methodSchema = _enum(["GET", "POST"], { message: "method must be \"GET\" or \"POST\"" });
7563
- var uriSchema = string$2({ message: "uri must be a string" }).min(1, "uri cannot be empty");
7564
- var a1ValueSchema = string$2({ message: "a1Value must be a string" }).min(1, "a1Value cannot be empty");
7565
- string$2({ message: "xsecAppid must be a string" }).min(1, "xsecAppid cannot be empty");
7566
- record(string$2(), any()).nullable().optional();
7567
- var cookieSchema = union([record(string$2(), any()), string$2()]);
7568
- var signatureParamsSchema = object({
7569
- method: methodSchema,
7570
- uri: uriSchema,
7571
- a1Value: a1ValueSchema
7572
- });
7573
- var getSignatureParamsSchema = object({
7574
- uri: uriSchema,
7575
- a1Value: a1ValueSchema
7576
- });
7577
- var postSignatureParamsSchema = object({
7578
- uri: uriSchema,
7579
- a1Value: a1ValueSchema
7580
- });
7581
- var xsCommonParamsSchema = object({ cookieDict: cookieSchema });
7582
- function validateSignatureParams(method, uri, a1Value) {
7583
- try {
7584
- signatureParamsSchema.parse({
7585
- method,
7586
- uri,
7587
- a1Value
7588
- });
7589
- } catch (error) {
7590
- if (error instanceof ZodError) {
7591
- const firstError = error.issues[0];
7592
- throw new TypeError(firstError.message);
7593
- }
7594
- throw error;
7595
- }
7596
- }
7597
- function validateGetSignatureParams(uri, a1Value) {
7598
- try {
7599
- getSignatureParamsSchema.parse({
7600
- uri,
7601
- a1Value
7602
- });
7603
- } catch (error) {
7604
- if (error instanceof ZodError) {
7605
- const firstError = error.issues[0];
7606
- throw new TypeError(firstError.message);
7607
- }
7608
- throw error;
7609
- }
7610
- }
7611
- function validatePostSignatureParams(uri, a1Value) {
7612
- try {
7613
- postSignatureParamsSchema.parse({
7614
- uri,
7615
- a1Value
7616
- });
7617
- } catch (error) {
7618
- if (error instanceof ZodError) {
7619
- const firstError = error.issues[0];
7620
- throw new TypeError(firstError.message);
7621
- }
7622
- throw error;
7623
- }
7624
- }
7625
- function validateXsCommonParams(cookieDict) {
7626
- try {
7627
- xsCommonParamsSchema.parse({ cookieDict });
7628
- } catch (error) {
7629
- if (error instanceof ZodError) {
7630
- const firstError = error.issues[0];
7631
- throw new TypeError(firstError.message);
7632
- }
7633
- throw error;
7634
- }
7635
- }
7636
- var Xhshow = class {
7637
- config;
7638
- cryptoProcessor;
7639
- randomGenerator;
7640
- /**
7641
- * 创建 Xhshow 实例
7642
- * @param config - 可选的加密配置对象,不传则使用默认配置
7643
- */
7644
- constructor(config) {
7645
- this.config = config || new CryptoConfig();
7646
- this.cryptoProcessor = new CryptoProcessor(this.config);
7647
- this.randomGenerator = new RandomGenerator();
7648
- }
7649
- /**
7650
- * 构建内容字符串(用于 MD5 计算和签名生成)
7651
- * @param method - HTTP 请求方法
7652
- * @param uri - 请求 URI 路径
7653
- * @param payload - 请求参数或请求体
7654
- * @returns 用于签名的内容字符串
7655
- */
7656
- buildContentString(method, uri, payload = null) {
7657
- const normalizedPayload = payload || {};
7658
- if (method.toUpperCase() === "POST") return uri + JSON.stringify(normalizedPayload);
7659
- else {
7660
- if (Object.keys(normalizedPayload).length === 0) return uri;
7661
- return `${uri}?${Object.entries(normalizedPayload).map(([key, value]) => {
7662
- let valStr = "";
7663
- if (Array.isArray(value)) valStr = value.map((v) => String(v)).join(",");
7664
- else valStr = value !== null && value !== void 0 ? String(value) : "";
7665
- return `${key}=${valStr.replace(/=/g, "%3D")}`;
7666
- }).join("&")}`;
7667
- }
7668
- }
7669
- /**
7670
- * 根据内容字符串生成 d 值(MD5 哈希)
7671
- * @param content - 内容字符串
7672
- * @returns MD5 哈希值(十六进制字符串)
7673
- */
7674
- generateDValue(content) {
7675
- return createHash("md5").update(content, "utf8").digest("hex");
7676
- }
7677
- /**
7678
- * 构建签名
7679
- * @param dValue - MD5 哈希值
7680
- * @param a1Value - Cookie 中的 a1 值
7681
- * @param xsecAppid - 应用 ID,默认为 'xhs-pc-web'
7682
- * @param stringParam - 字符串参数
7683
- * @param timestamp - 可选的时间戳
7684
- * @param signState - 可选的签名状态(用于会话管理)
7685
- * @returns 编码后的签名字符串
7686
- */
7687
- buildSignature(dValue, mValue, a1Value, xsecAppid = "xhs-pc-web", stringParam = "", timestamp, signState) {
7688
- const payloadArray = this.cryptoProcessor.buildPayloadArray(dValue, mValue, a1Value, xsecAppid, stringParam, timestamp, signState);
7689
- const xorResult = this.cryptoProcessor.bitOps.xorTransformArray(payloadArray);
7690
- return this.cryptoProcessor.b64encoder.encodeX3(xorResult.subarray(0, this.config.PAYLOAD_LENGTH));
7691
- }
7692
- /**
7693
- * 生成请求签名(支持 GET 和 POST)
7694
- * @param method - HTTP 请求方法,'GET' 或 'POST'
7695
- * @param uri - 请求 URI 路径(可以是完整 URL,会自动提取路径部分)
7696
- * @param a1Value - Cookie 中的 a1 值
7697
- * @param xsecAppid - 应用 ID,默认为 'xhs-pc-web'
7698
- * @param payload - GET 请求的查询参数或 POST 请求的请求体
7699
- * @param timestamp - 可选的时间戳(秒),不传则使用当前时间
7700
- * @param session - 可选的会话管理器,用于生成更真实的签名
7701
- * @returns x-s 签名字符串
7702
- */
7703
- signXs(method, uri, a1Value, xsecAppid = "xhs-pc-web", payload = null, timestamp, session) {
7704
- validateSignatureParams(method, uri, a1Value);
7705
- uri = extractUri(uri);
7706
- const signatureData = { ...this.config.SIGNATURE_DATA_TEMPLATE };
7707
- const contentString = this.buildContentString(method, uri, payload);
7708
- const dValue = this.generateDValue(contentString);
7709
- const mValue = method === "GET" ? dValue : createHash("md5").update(uri, "utf8").digest("hex");
7710
- const signState = session ? session.getCurrentState(contentString) : void 0;
7711
- signatureData.x3 = this.config.X3_PREFIX + this.buildSignature(dValue, mValue, a1Value, xsecAppid, contentString, timestamp, signState);
7712
- const jsonStr = JSON.stringify(signatureData);
7713
- return this.config.XYS_PREFIX + this.cryptoProcessor.b64encoder.encode(jsonStr);
7714
- }
7715
- /**
7716
- * 生成 XYW_ 格式签名(AES-128-CBC 加密)
7717
- *
7718
- * 数据获取类接口(user_posted、otherinfo 等)自 2026 年 3 月起会以 HTTP 406
7719
- * 拒绝传统 XYS_ 格式,此时需改用 XYW_ 格式。它使用独立于 signXs 的加密路径。
7720
- *
7721
- * @param method - HTTP 请求方法,'GET' 或 'POST'
7722
- * @param uri - 请求 URI 路径(可以是完整 URL)
7723
- * @param a1Value - Cookie 中的 a1 值
7724
- * @param xsecAppid - 应用 ID,默认为 'xhs-pc-web'
7725
- * @param payload - GET 请求的查询参数或 POST 请求的请求体
7726
- * @param timestamp - 可选的时间戳(秒),不传则使用当前时间
7727
- * @param _session - 未使用,仅为保持与 signXs 的接口一致
7728
- * @returns XYW_ 格式签名字符串
7729
- */
7730
- signXyw(method, uri, a1Value, xsecAppid = "xhs-pc-web", payload = null, timestamp, _session) {
7731
- validateSignatureParams(method, uri, a1Value);
7732
- uri = extractUri(uri);
7733
- const payloadHex = buildXywPayloadHex({
7734
- fullUri: this.buildContentString(method, uri, payload),
7735
- a1Value,
7736
- timestampMs: String(this.getXT(timestamp)),
7737
- config: this.config
7738
- });
7739
- const xywData = {
7740
- signSvn: this.config.XYW_SIGN_SVN,
7741
- signType: this.config.XYW_SIGN_TYPE,
7742
- appId: xsecAppid,
7743
- signVersion: this.config.XYW_SIGN_VERSION,
7744
- payload: payloadHex
7745
- };
7746
- const xywJson = JSON.stringify(xywData);
7747
- return this.config.XYW_PREFIX + Buffer.from(xywJson, "utf-8").toString("base64");
7748
- }
7749
- /**
7750
- * 生成 x-s-common 签名
7751
- * @param cookieDict - Cookie 字典对象或 Cookie 字符串
7752
- * @returns x-s-common 签名字符串
7753
- */
7754
- signXsCommon(cookieDict) {
7755
- const parsedCookies = this.parseCookies(cookieDict);
7756
- return new XsCommonSigner(this.config).sign(parsedCookies);
7757
- }
7758
- /**
7759
- * 生成 GET 请求签名(便捷方法)
7760
- * @param uri - 请求 URI 路径
7761
- * @param a1Value - Cookie 中的 a1 值
7762
- * @param xsecAppid - 应用 ID,默认为 'xhs-pc-web'
7763
- * @param params - 查询参数对象
7764
- * @param timestamp - 可选的时间戳(秒)
7765
- * @param session - 可选的会话管理器
7766
- * @returns x-s 签名字符串
7767
- */
7768
- signXsGet(uri, a1Value, xsecAppid = "xhs-pc-web", params = null, timestamp, session) {
7769
- validateGetSignatureParams(uri, a1Value);
7770
- return this.signXs("GET", uri, a1Value, xsecAppid, params, timestamp, session);
7771
- }
7772
- /**
7773
- * 生成 POST 请求签名(便捷方法)
7774
- * @param uri - 请求 URI 路径
7775
- * @param a1Value - Cookie 中的 a1 值
7776
- * @param xsecAppid - 应用 ID,默认为 'xhs-pc-web'
7777
- * @param payload - 请求体对象
7778
- * @param timestamp - 可选的时间戳(秒)
7779
- * @param session - 可选的会话管理器
7780
- * @returns x-s 签名字符串
7781
- */
7782
- signXsPost(uri, a1Value, xsecAppid = "xhs-pc-web", payload = null, timestamp, session) {
7783
- validatePostSignatureParams(uri, a1Value);
7784
- return this.signXs("POST", uri, a1Value, xsecAppid, payload, timestamp, session);
7785
- }
7786
- /**
7787
- * 生成 x-s-common 签名的便捷包装方法
7788
- * @param cookieDict - Cookie 字典对象或 Cookie 字符串
7789
- * @returns x-s-common 签名字符串
7790
- */
7791
- signXsc(cookieDict) {
7792
- validateXsCommonParams(cookieDict);
7793
- return this.signXsCommon(cookieDict);
7794
- }
7795
- /**
7796
- * 解密 x3 签名(Base64 格式)
7797
- * @param x3Signature - x3 签名字符串
7798
- * @returns 解密后的字节数组
7799
- */
7800
- decodeX3(x3Signature) {
7801
- if (x3Signature.startsWith(this.config.X3_PREFIX)) x3Signature = x3Signature.slice(this.config.X3_PREFIX.length);
7802
- const decodedBytes = this.cryptoProcessor.b64encoder.decodeX3(x3Signature);
7803
- return this.cryptoProcessor.bitOps.xorTransformArray(Array.from(decodedBytes));
7804
- }
7805
- /**
7806
- * 解密完整的 XYS 签名
7807
- * @param xsSignature - x-s 签名字符串
7808
- * @returns 解密后的签名数据对象
7809
- * @throws 如果 JSON 解析失败则抛出错误
7810
- */
7811
- decodeXs(xsSignature) {
7812
- if (xsSignature.startsWith(this.config.XYS_PREFIX)) xsSignature = xsSignature.slice(this.config.XYS_PREFIX.length);
7813
- const jsonString = this.cryptoProcessor.b64encoder.decode(xsSignature);
7814
- try {
7815
- return JSON.parse(jsonString);
7816
- } catch (e) {
7817
- throw new Error(`Invalid signature: JSON decode failed - ${e}`);
7818
- }
7819
- }
7820
- /**
7821
- * 构建带查询参数的完整 URL(便捷方法)
7822
- * @param baseUrl - 基础 URL
7823
- * @param params - 可选的查询参数对象
7824
- * @returns 完整的 URL 字符串
7825
- */
7826
- buildUrl(baseUrl, params) {
7827
- return buildUrl(baseUrl, params);
7828
- }
7829
- /**
7830
- * 构建 POST 请求的 JSON 请求体字符串(便捷方法)
7831
- * @param payload - 请求体对象
7832
- * @returns JSON 字符串
7833
- */
7834
- buildJsonBody(payload) {
7835
- return JSON.stringify(payload);
7836
- }
7837
- /**
7838
- * 生成 HTTP 请求头中的 x-b3-traceid
7839
- * @returns x-b3-traceid 字符串
7840
- */
7841
- getB3TraceId() {
7842
- return this.randomGenerator.generateB3TraceId();
7843
- }
7844
- /**
7845
- * 生成 HTTP 请求头中的 x-xray-traceid
7846
- * @param timestamp - 可选的时间戳(毫秒)
7847
- * @param seq - 可选的序列号
7848
- * @returns x-xray-traceid 字符串
7849
- */
7850
- getXrayTraceId(timestamp, seq) {
7851
- return this.randomGenerator.generateXrayTraceId(timestamp, seq);
7852
- }
7853
- /**
7854
- * 生成搜索接口所需的 search_id
7855
- * @returns Base36 编码的搜索 ID
7856
- */
7857
- getSearchId() {
7858
- return this.randomGenerator.generateSearchId();
7859
- }
7860
- /**
7861
- * 生成搜索接口所需的 request_id
7862
- * @returns 格式为 "{random}-{timestamp_ms}" 的字符串
7863
- */
7864
- getSearchRequestId() {
7865
- return this.randomGenerator.generateSearchRequestId();
7866
- }
7867
- /**
7868
- * 生成 a1 Cookie 值
7869
- * @returns 52 字符的 a1 值
7870
- */
7871
- static generateA1() {
7872
- return RandomGenerator.generateA1();
7873
- }
7874
- /**
7875
- * 根据 a1 值生成 web_id
7876
- * @param a1 - a1 Cookie 值
7877
- * @returns 32 字符的十六进制 web_id
7878
- */
7879
- static generateWebId(a1) {
7880
- return RandomGenerator.generateWebId(a1);
7881
- }
7882
- /**
7883
- * 生成 x-t 请求头值(Unix 时间戳,毫秒)
7884
- * @param timestamp - 可选的时间戳(秒),不传则使用当前时间
7885
- * @returns Unix 时间戳(毫秒)
7886
- */
7887
- getXT(timestamp) {
7888
- if (timestamp === void 0) timestamp = Date.now() / 1e3;
7889
- return Math.floor(timestamp * 1e3);
7890
- }
7891
- /**
7892
- * 将 Cookie 解析为字典格式
7893
- * @param cookies - Cookie 字典对象或 Cookie 字符串
7894
- * @returns Cookie 字典对象
7895
- */
7896
- parseCookies(cookies) {
7897
- if (typeof cookies === "string") {
7898
- const result = {};
7899
- const pairs = cookies.split(";");
7900
- for (const pair of pairs) {
7901
- const trimmed = pair.trim();
7902
- const eqIndex = trimmed.indexOf("=");
7903
- if (eqIndex > 0) {
7904
- const key = trimmed.substring(0, eqIndex).trim();
7905
- result[key] = trimmed.substring(eqIndex + 1).trim();
7906
- }
7907
- }
7908
- return result;
7909
- }
7910
- return cookies;
7911
- }
7912
- /**
7913
- * 生成包含签名和追踪 ID 的完整请求头
7914
- * @param method - HTTP 请求方法,'GET' 或 'POST'
7915
- * @param uri - 请求 URI 路径
7916
- * @param cookies - Cookie 字典对象或 Cookie 字符串(必须包含 a1)
7917
- * @param xsecAppid - 应用 ID,默认为 'xhs-pc-web'
7918
- * @param params - GET 请求的查询参数(POST 请求时不可用)
7919
- * @param payload - POST 请求的请求体(GET 请求时不可用)
7920
- * @param timestamp - 可选的时间戳(秒)
7921
- * @param session - 可选的会话管理器
7922
- * @returns 包含 x-s、x-s-common、x-t、x-b3-traceid、x-xray-traceid 的请求头对象
7923
- * @throws 如果 GET 请求使用 payload 或 POST 请求使用 params 则抛出错误
7924
- * @throws 如果 cookies 中缺少 a1 则抛出错误
7925
- */
7926
- signHeaders(method, uri, cookies, xsecAppid = "xhs-pc-web", params, payload, timestamp, session, signFormat = "xys", userId, xRap = false) {
7927
- if (timestamp === void 0) timestamp = Date.now() / 1e3;
7928
- const methodUpper = method.toUpperCase();
7929
- let requestData;
7930
- if (methodUpper === "GET") {
7931
- if (payload !== void 0 && payload !== null) throw new Error("GET requests must use 'params', not 'payload'");
7932
- requestData = params ?? null;
7933
- } else if (methodUpper === "POST") {
7934
- if (params !== void 0 && params !== null) throw new Error("POST requests must use 'payload', not 'params'");
7935
- requestData = payload ?? null;
7936
- } else throw new Error(`Unsupported method: ${method}`);
7937
- if (signFormat !== "xys" && signFormat !== "xyw") throw new Error(`Unsupported signFormat=${JSON.stringify(signFormat)}; expected 'xys' or 'xyw'`);
7938
- const cookieDict = this.parseCookies(cookies);
7939
- const a1Value = cookieDict.a1;
7940
- if (!a1Value) throw new Error("Missing 'a1' in cookies");
7941
- const xS = signFormat === "xyw" ? this.signXyw(methodUpper, uri, a1Value, xsecAppid, requestData, timestamp) : this.signXs(methodUpper, uri, a1Value, xsecAppid, requestData, timestamp, session);
7942
- const xSCommon = this.signXsCommon(cookieDict);
7943
- const xT = this.getXT(timestamp);
7944
- const xB3Traceid = this.getB3TraceId();
7945
- const xXrayTraceid = this.getXrayTraceId(Math.floor(timestamp * 1e3));
7946
- const headers = {
7947
- "x-s": xS,
7948
- "x-s-common": xSCommon,
7949
- "x-t": String(xT),
7950
- "x-b3-traceid": xB3Traceid,
7951
- "x-xray-traceid": xXrayTraceid,
7952
- "x-mns": "unload",
7953
- "xy-direction": String(getShardingKey(userId))
7954
- };
7955
- if (xRap) headers["x-rap-param"] = xRapParam("//edith.xiaohongshu.com" + extractUri(uri), requestData || {});
7956
- return headers;
7957
- }
7958
- /**
7959
- * 生成 GET 请求的完整请求头(便捷方法)
7960
- * @param uri - 请求 URI 路径
7961
- * @param cookies - Cookie 字典对象或 Cookie 字符串(必须包含 a1)
7962
- * @param xsecAppid - 应用 ID,默认为 'xhs-pc-web'
7963
- * @param params - 查询参数对象
7964
- * @param timestamp - 可选的时间戳(秒)
7965
- * @param session - 可选的会话管理器
7966
- * @returns 包含签名和追踪 ID 的请求头对象
7967
- */
7968
- signHeadersGet(uri, cookies, xsecAppid = "xhs-pc-web", params, timestamp, session, signFormat = "xys", userId, xRap = false) {
7969
- return this.signHeaders("GET", uri, cookies, xsecAppid, params, void 0, timestamp, session, signFormat, userId, xRap);
7970
- }
7971
- /**
7972
- * 生成 POST 请求的完整请求头(便捷方法)
7973
- * @param uri - 请求 URI 路径
7974
- * @param cookies - Cookie 字典对象或 Cookie 字符串(必须包含 a1)
7975
- * @param xsecAppid - 应用 ID,默认为 'xhs-pc-web'
7976
- * @param payload - 请求体对象
7977
- * @param timestamp - 可选的时间戳(秒)
7978
- * @param session - 可选的会话管理器
7979
- * @returns 包含签名和追踪 ID 的请求头对象
7980
- */
7981
- signHeadersPost(uri, cookies, xsecAppid = "xhs-pc-web", payload, timestamp, session, signFormat = "xys", userId, xRap = false) {
7982
- return this.signHeaders("POST", uri, cookies, xsecAppid, void 0, payload, timestamp, session, signFormat, userId, xRap);
7983
- }
7984
- };
7985
- //#endregion
7986
5681
  //#region ../../node_modules/.pnpm/protobufjs@8.8.0/node_modules/protobufjs/src/util/aspromise.js
7987
5682
  var require_aspromise = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
7988
5683
  module.exports = asPromise;
@@ -159710,4 +157405,4 @@ var G = WebAssembly.compile((a = "AGFzbQEAAAABKwhgAX8Bf2AEf39/fwBgAAF/YAAAYAF/AG
159710
157405
  });
159711
157406
  var a;
159712
157407
  //#endregion
159713
- export { RiPieChart2Fill as $, Gamepad2 as $n, literal as $r, UsersRound as $t, MdFitScreen as A, Plus as An, Bookmark as Ar, e$5 as At, AiFillHeart as B, Maximize as Bn, resolveTemplateStyle as Br, s$4 as Bt, webassembly_default as C, RotateCcw as Cn, Check as Cr, o$4 as Ct, tailwind_css_default as D, Quote as Dn, Braces as Dr, a$4 as Dt, tsdown_default as E, Radio as En, Calendar as Er, m$5 as Et, FaCommentDots as F, Music as Fn, Button as Fr, c$7 as Ft, RiArrowRightFill as G, LayoutTemplate as Gn, require_protobufjs as Gr, formatDistanceToNow as Gt, AiFillStar as H, LoaderCircle as Hn, require_react as Hr, zhCN as Ht, FaMusic as I, Moon as In, require_jsx_runtime as Ir, o$8 as It, RiHeart3Fill as J, Heart as Jn, Xhshow as Jr, Zap as Jt, RiGroupLine as K, Info$1 as Kn, CryptoConfig as Kr, format$1 as Kt, FaTiktok as L, Monitor as Ln, twMerge as Lr, c$8 as Lt, MdLightbulbOutline as M, Pencil as Mn, BellRing as Mr, a$6 as Mt, MdLocationOn as N, Palette as Nn, ArrowRight as Nr, m$6 as Nt, sqlite_default as O, QrCode as On, Box as Or, n$2 as Ot, MdSchedule as P, Network as Pn, Chip as Pr, m$7 as Pt, RiMessage3Fill as Q, Gauge as Qn, array as Qr, Users as Qt, FaUserGroup as R, MessageCircle as Rn, clsx as Rr, p$5 as Rt, rehypeHighlight as S, Route as Sn, CircleAlert as Sr, r$3 as St, typescript_default as T, RefreshCw as Tn, Camera as Tr, s$3 as Tt, AiOutlineVideoCamera as U, ListChecks as Un, HtmlWrapper as Ur, parse$2 as Ut, AiFillPushpin as V, MapPin as Vn, require_server_node as Vr, m$8 as Vt, Markdown as W, Link as Wn, defineTemplate as Wr, fromUnixTime as Wt, RiHeartLine as X, GitBranch as Xn, number$1 as Xr, WandSparkles as Xt, RiHeart3Line as Y, Hash as Yn, xRapParam as Yr, X$2 as Yt, RiLiveLine as Z, Gift as Zn, _enum as Zr, Video as Zt, use as _, Share2 as _n, CircleFadingArrowUp as _r, SiGithub as _t, drawDither as a, Timer as an, EyeOff as ar, RiTrophyFill as at, install$14 as b, ScanLine as bn, CircleCheck as br, SiAnthropic as bt, install as c, Star as cn, Crown as cr, RiVideoLine as ct, install$5 as d, Sparkles as dn, Copy as dr, SiSamsung as dt, number$2 as ei, User as en, FingerprintPattern as er, RiShareForwardFill as et, install$6 as f, Smartphone as fn, Code as fr, SiOppo as ft, install$11 as g, ShieldAlert as gn, CircleQuestionMark as gr, SiGooglephotos as gt, install$10 as h, ShieldCheck as hn, Clapperboard as hr, SiHonor as ht, qe as i, toJSONSchema as ii, Trash as in, Eye as ir, RiTiktokFill as it, MdInfoOutline as j, Play as jn, BookOpenText as jr, c$6 as jt, react_default as k, Puzzle as kn, Bot as kr, p$4 as kt, install$1 as l, Square as ln, Cpu as lr, SiXiaomi as lt, install$9 as m, Shield as mn, Clock3 as mr, SiHuawei as mt, G as n, string$2 as ni, Upload as nn, FilePlay as nr, RiStarLine as nt, require_jpeg_js as o, Terminal as on, ExternalLink as or, RiUserFollowLine as ot, install$8 as p, ShoppingBag as pn, Clock as pr, SiOneplus as pt, RiHashtag as q, Image$1 as qn, FingerprintGenerator as qr, differenceInSeconds as qt, L as r, union as ri, TriangleAlert as rn, FileExclamationPoint as rr, RiThumbUpFill as rt, require_heic_decode as s, Sun as sn, Download as sr, RiVerifiedBadgeFill as st, F as t, object as ti, UserPlus as tn, FileText as tr, RiStarFill as tt, install$4 as u, SquarePen as un, CornerDownLeft as ur, SiVivo as ut, init as v, Settings2 as vn, CircleEllipsis as vr, SiBilibili as vt, vite_default as w, Repeat as wn, ChartColumn as wr, o$5 as wt, install$15 as x, Save as xn, CircleCheckBig as xr, o$3 as xt, install$13 as y, Search as yn, CircleDashed as yr, SiApple as yt, BiImage as z, Menu as zn, createTemplateRenderer as zr, n$3 as zt };
157408
+ export { RiPieChart2Fill as $, Gamepad2 as $n, record as $r, UsersRound as $t, MdFitScreen as A, Plus as An, Bookmark as Ar, e$5 as At, AiFillHeart as B, Maximize as Bn, resolveTemplateStyle as Br, s$4 as Bt, webassembly_default as C, RotateCcw as Cn, Check as Cr, o$4 as Ct, tailwind_css_default as D, Quote as Dn, Braces as Dr, a$4 as Dt, tsdown_default as E, Radio as En, Calendar as Er, m$5 as Et, FaCommentDots as F, Music as Fn, Button as Fr, c$7 as Ft, RiArrowRightFill as G, LayoutTemplate as Gn, require_protobufjs as Gr, formatDistanceToNow as Gt, AiFillStar as H, LoaderCircle as Hn, require_react as Hr, zhCN as Ht, FaMusic as I, Moon as In, require_jsx_runtime as Ir, o$8 as It, RiHeart3Fill as J, Heart as Jn, any as Jr, Zap as Jt, RiGroupLine as K, Info$1 as Kn, number$1 as Kr, format$1 as Kt, FaTiktok as L, Monitor as Ln, twMerge as Lr, c$8 as Lt, MdLightbulbOutline as M, Pencil as Mn, BellRing as Mr, a$6 as Mt, MdLocationOn as N, Palette as Nn, ArrowRight as Nr, m$6 as Nt, sqlite_default as O, QrCode as On, Box as Or, n$2 as Ot, MdSchedule as P, Network as Pn, Chip as Pr, m$7 as Pt, RiMessage3Fill as Q, Gauge as Qn, object as Qr, Users as Qt, FaUserGroup as R, MessageCircle as Rn, clsx as Rr, p$5 as Rt, rehypeHighlight as S, Route as Sn, CircleAlert as Sr, r$3 as St, typescript_default as T, RefreshCw as Tn, Camera as Tr, s$3 as Tt, AiOutlineVideoCamera as U, ListChecks as Un, HtmlWrapper as Ur, parse$2 as Ut, AiFillPushpin as V, MapPin as Vn, require_server_node as Vr, m$8 as Vt, Markdown as W, Link as Wn, defineTemplate as Wr, fromUnixTime as Wt, RiHeartLine as X, GitBranch as Xn, literal as Xr, WandSparkles as Xt, RiHeart3Line as Y, Hash as Yn, array as Yr, X$2 as Yt, RiLiveLine as Z, Gift as Zn, number$2 as Zr, Video as Zt, use as _, Share2 as _n, CircleFadingArrowUp as _r, SiGithub as _t, drawDither as a, Timer as an, EyeOff as ar, RiTrophyFill as at, install$14 as b, ScanLine as bn, CircleCheck as br, SiAnthropic as bt, install as c, Star as cn, Crown as cr, RiVideoLine as ct, install$5 as d, Sparkles as dn, Copy as dr, SiSamsung as dt, string$2 as ei, User as en, FingerprintPattern as er, RiShareForwardFill as et, install$6 as f, Smartphone as fn, Code as fr, SiOppo as ft, install$11 as g, ShieldAlert as gn, CircleQuestionMark as gr, SiGooglephotos as gt, install$10 as h, ShieldCheck as hn, Clapperboard as hr, SiHonor as ht, qe as i, Trash as in, Eye as ir, RiTiktokFill as it, MdInfoOutline as j, Play as jn, BookOpenText as jr, c$6 as jt, react_default as k, Puzzle as kn, Bot as kr, p$4 as kt, install$1 as l, Square as ln, Cpu as lr, SiXiaomi as lt, install$9 as m, Shield as mn, Clock3 as mr, SiHuawei as mt, G as n, ZodError as ni, Upload as nn, FilePlay as nr, RiStarLine as nt, require_jpeg_js as o, Terminal as on, ExternalLink as or, RiUserFollowLine as ot, install$8 as p, ShoppingBag as pn, Clock as pr, SiOneplus as pt, RiHashtag as q, Image$1 as qn, _enum as qr, differenceInSeconds as qt, L as r, toJSONSchema as ri, TriangleAlert as rn, FileExclamationPoint as rr, RiThumbUpFill as rt, require_heic_decode as s, Sun as sn, Download as sr, RiVerifiedBadgeFill as st, F as t, union as ti, UserPlus as tn, FileText as tr, RiStarFill as tt, install$4 as u, SquarePen as un, CornerDownLeft as ur, SiVivo as ut, init as v, Settings2 as vn, CircleEllipsis as vr, SiBilibili as vt, vite_default as w, Repeat as wn, ChartColumn as wr, o$5 as wt, install$15 as x, Save as xn, CircleCheckBig as xr, o$3 as xt, install$13 as y, Search as yn, CircleDashed as yr, SiApple as yt, BiImage as z, Menu as zn, createTemplateRenderer as zr, n$3 as zt };