decord/source/__polyfill/00xxx/module_782.js
github-actions e510164e6b chore: update source for alpha 346.2
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4759.js (118.4 MB)
2026-09-10 05:38:07 +00:00

49 lines
1.3 KiB
JavaScript

// Module ID: 782
// Function ID: 783
// Dependencies: []
// Exports: parseCookie
// Module 782
Object.defineProperty(arg5, Symbol.toStringTag, { value: "Module" });
export const parseCookie = function parseCookie(arr) {
const obj = {};
let num = 0;
if (0 < arr.length) {
let index = arr.indexOf("=", num);
while (-1 !== index) {
let length = arr.indexOf(";", num);
if (-1 === length) {
length = arr.length;
} else if (length < index) {
let sum = arr.lastIndexOf(";", index - 1) + 1;
num = sum;
if (sum >= arr.length) {
break;
}
}
let str = arr.slice(num, index);
let trimmed = str.trim();
if (undefined === obj[trimmed]) {
let str2 = arr.slice(index + 1, length);
let trimmed1 = str2.trim();
index = trimmed1;
if (34 === trimmed1.charCodeAt(0)) {
index = trimmed1.slice(1, -1);
}
try {
let decodeURIComponentResult = index;
if (-1 !== index.indexOf("%")) {
let _decodeURIComponent = decodeURIComponent;
decodeURIComponentResult = decodeURIComponent(index);
}
obj[trimmed] = decodeURIComponentResult;
} catch (err) {
obj[trimmed] = index;
}
}
let sum1 = length + 1;
}
}
return obj;
};