2026-08-24 06:08:38 +00:00
|
|
|
// Module ID: 4296
|
|
|
|
|
// Function ID: 4297
|
2026-07-20 16:05:17 +00:00
|
|
|
// Name: parse
|
|
|
|
|
// Dependencies: []
|
|
|
|
|
|
2026-08-24 06:08:38 +00:00
|
|
|
// Module 4296 (parse)
|
2026-07-20 16:05:17 +00:00
|
|
|
arg5.parse = function parse(str) {
|
2026-08-04 21:03:28 +00:00
|
|
|
if (typeof str !== "string") {
|
2026-07-20 16:05:17 +00:00
|
|
|
const _TypeError = TypeError;
|
|
|
|
|
const typeError = new TypeError("argument str must be a string");
|
|
|
|
|
throw typeError;
|
|
|
|
|
} else {
|
2026-07-29 08:29:29 +00:00
|
|
|
let obj = arg1;
|
2026-07-20 16:05:17 +00:00
|
|
|
obj = {};
|
2026-07-29 08:29:29 +00:00
|
|
|
if (!arg1) {
|
2026-07-20 16:05:17 +00:00
|
|
|
obj = {};
|
|
|
|
|
}
|
|
|
|
|
const parts = str.split(closure_2);
|
2026-08-24 06:08:38 +00:00
|
|
|
closure_1 = obj.decode || obj;
|
2026-07-20 16:05:17 +00:00
|
|
|
const item = parts.forEach((arr) => {
|
|
|
|
|
const index = arr.indexOf("=");
|
|
|
|
|
if (index >= 0) {
|
|
|
|
|
const trimmed = arr.substr(0, index).trim();
|
|
|
|
|
const str = arr.substr(0, index);
|
|
|
|
|
const trimmed1 = arr.substr(index + 1, arr.length).trim();
|
|
|
|
|
let substr = trimmed1;
|
|
|
|
|
if ("\"" == trimmed1[0]) {
|
|
|
|
|
substr = trimmed1.slice(1, -1);
|
|
|
|
|
}
|
|
|
|
|
if (null == obj[trimmed]) {
|
2026-07-29 08:29:29 +00:00
|
|
|
tmp3[trimmed] = (function tryDecode(substr, closure_1) {
|
|
|
|
|
try {
|
|
|
|
|
return closure_1(substr);
|
|
|
|
|
} catch (err) {
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
})(substr, closure_1);
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
const str2 = arr.substr(index + 1, arr.length);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
arg5.serialize = function serialize(arg0, arg1, arg2) {
|
|
|
|
|
let obj = arg2;
|
|
|
|
|
if (!arg2) {
|
|
|
|
|
obj = {};
|
|
|
|
|
}
|
|
|
|
|
if (regex.test(arg0)) {
|
|
|
|
|
const tmpResult = tmp(arg1);
|
|
|
|
|
if (tmpResult) {
|
2026-07-29 08:29:29 +00:00
|
|
|
if (!obj2.test(tmpResult)) {
|
2026-07-20 16:05:17 +00:00
|
|
|
const _TypeError2 = TypeError;
|
|
|
|
|
const typeError = new TypeError("argument val is invalid");
|
|
|
|
|
throw typeError;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const items = [`${arg0}=${tmp8}`];
|
|
|
|
|
if (null != obj.maxAge) {
|
|
|
|
|
const maxAge = obj.maxAge;
|
|
|
|
|
const _isNaN = isNaN;
|
|
|
|
|
if (isNaN(maxAge)) {
|
|
|
|
|
const _Error = Error;
|
2026-08-24 06:08:38 +00:00
|
|
|
error = new Error("maxAge should be a Number");
|
2026-07-20 16:05:17 +00:00
|
|
|
throw error;
|
|
|
|
|
} else {
|
|
|
|
|
const _Math = Math;
|
|
|
|
|
items.push(`Max-Age=${Math.floor(maxAge)}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (obj.domain) {
|
2026-07-29 08:29:29 +00:00
|
|
|
if (obj2.test(obj.domain)) {
|
2026-07-20 16:05:17 +00:00
|
|
|
items.push(`Domain=${obj.domain}`);
|
|
|
|
|
} else {
|
|
|
|
|
const _TypeError3 = TypeError;
|
|
|
|
|
const typeError1 = new TypeError("option domain is invalid");
|
|
|
|
|
throw typeError1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (obj.path) {
|
2026-07-29 08:29:29 +00:00
|
|
|
if (obj2.test(obj.path)) {
|
2026-07-20 16:05:17 +00:00
|
|
|
items.push(`Path=${obj.path}`);
|
|
|
|
|
} else {
|
|
|
|
|
const _TypeError4 = TypeError;
|
|
|
|
|
const typeError2 = new TypeError("option path is invalid");
|
|
|
|
|
throw typeError2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (obj.expires) {
|
|
|
|
|
const expires = obj.expires;
|
|
|
|
|
items.push(`Expires=${expires.toUTCString()}`);
|
|
|
|
|
}
|
|
|
|
|
if (obj.httpOnly) {
|
|
|
|
|
items.push("HttpOnly");
|
|
|
|
|
}
|
|
|
|
|
if (obj.secure) {
|
|
|
|
|
items.push("Secure");
|
|
|
|
|
}
|
|
|
|
|
if (obj.firstPartyOnly) {
|
|
|
|
|
items.push("First-Party-Only");
|
|
|
|
|
}
|
|
|
|
|
return items.join("; ");
|
|
|
|
|
} else {
|
|
|
|
|
const _TypeError = TypeError;
|
|
|
|
|
const typeError3 = new TypeError("argument name is invalid");
|
|
|
|
|
throw typeError3;
|
|
|
|
|
}
|
2026-07-23 10:11:24 +00:00
|
|
|
tmp = obj.encode || encodeURIComponent;
|
2026-07-20 16:05:17 +00:00
|
|
|
};
|
2026-07-23 10:11:24 +00:00
|
|
|
const re2 = /; */;
|
|
|
|
|
const re3 = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|