Your Name 1912bcd25b
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
chore: sync all remaining local workspace changes
2026-05-08 11:26:57 +08:00

218 lines
6.4 KiB
JavaScript

/*
* Extracted from browser-delivered Turbopack chunk: b715dd3a8a120944.5a7f07e15c.js
* Module id: 222792
* For reading/searching only; this factory depends on the original Turbopack runtime.
*/
const moduleFactory = (e, t, r) => {
"use strict";
let i;
Object.defineProperty(r, "__esModule", { value: !0 }),
(r.parseCookie = l),
(r.parse = l),
(r.stringifyCookie = function (e, t) {
let r = t?.encode || encodeURIComponent,
i = [];
for (let t of Object.keys(e)) {
let a = e[t];
if (void 0 === a) continue;
if (!o.test(t)) throw TypeError(`cookie name is invalid: ${t}`);
let s = r(a);
if (!n.test(s)) throw TypeError(`cookie val is invalid: ${a}`);
i.push(`${t}=${s}`);
}
return i.join("; ");
}),
(r.stringifySetCookie = h),
(r.serialize = h),
(r.parseSetCookie = function (e, t) {
let r = t?.decode || v,
i = e.length,
o = p(e, 0, i),
n = d(e, 0, o),
a =
-1 === n
? { name: "", value: r(g(e, 0, o)) }
: { name: g(e, 0, n), value: r(g(e, n + 1, o)) },
s = o + 1;
for (; s < i; ) {
let t = p(e, s, i),
r = d(e, s, t),
o = -1 === r ? g(e, s, t) : g(e, s, r),
n = -1 === r ? void 0 : g(e, r + 1, t);
switch (o.toLowerCase()) {
case "httponly":
a.httpOnly = !0;
break;
case "secure":
a.secure = !0;
break;
case "partitioned":
a.partitioned = !0;
break;
case "domain":
a.domain = n;
break;
case "path":
a.path = n;
break;
case "max-age":
n && u.test(n) && (a.maxAge = Number(n));
break;
case "expires":
if (!n) break;
let f = new Date(n);
Number.isFinite(f.valueOf()) && (a.expires = f);
break;
case "priority":
if (!n) break;
let c = n.toLowerCase();
("low" === c || "medium" === c || "high" === c) &&
(a.priority = c);
break;
case "samesite":
if (!n) break;
let l = n.toLowerCase();
("lax" === l || "strict" === l || "none" === l) &&
(a.sameSite = l);
}
s = t + 1;
}
return a;
}),
(r.stringifySetCookie = h),
(r.serialize = h);
let o = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/,
n = /^[\u0021-\u003A\u003C-\u007E]*$/,
a =
/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,
s = /^[\u0020-\u003A\u003D-\u007E]*$/,
u = /^-?\d+$/,
f = Object.prototype.toString,
c = (((i = function () {}).prototype = Object.create(null)), i);
function l(e, t) {
let r = new c(),
i = e.length;
if (i < 2) return r;
let o = t?.decode || v,
n = 0;
do {
let t = d(e, n, i);
if (-1 === t) break;
let a = p(e, n, i);
if (t > a) {
n = e.lastIndexOf(";", t - 1) + 1;
continue;
}
let s = g(e, n, t);
void 0 === r[s] && (r[s] = o(g(e, t + 1, a))), (n = a + 1);
} while (n < i);
return r;
}
function h(e, t, r) {
let i = "object" == typeof e ? e : { ...r, name: e, value: String(t) },
u = ("object" == typeof t ? t : r)?.encode || encodeURIComponent;
if (!o.test(i.name))
throw TypeError(`argument name is invalid: ${i.name}`);
let c = i.value ? u(i.value) : "";
if (!n.test(c)) throw TypeError(`argument val is invalid: ${i.value}`);
let l = i.name + "=" + c;
if (void 0 !== i.maxAge) {
if (!Number.isInteger(i.maxAge))
throw TypeError(`option maxAge is invalid: ${i.maxAge}`);
l += "; Max-Age=" + i.maxAge;
}
if (i.domain) {
if (!a.test(i.domain))
throw TypeError(`option domain is invalid: ${i.domain}`);
l += "; Domain=" + i.domain;
}
if (i.path) {
if (!s.test(i.path))
throw TypeError(`option path is invalid: ${i.path}`);
l += "; Path=" + i.path;
}
if (i.expires) {
var h;
if (
((h = i.expires),
"[object Date]" !== f.call(h) ||
!Number.isFinite(i.expires.valueOf()))
)
throw TypeError(`option expires is invalid: ${i.expires}`);
l += "; Expires=" + i.expires.toUTCString();
}
if (
(i.httpOnly && (l += "; HttpOnly"),
i.secure && (l += "; Secure"),
i.partitioned && (l += "; Partitioned"),
i.priority)
)
switch (
"string" == typeof i.priority ? i.priority.toLowerCase() : void 0
) {
case "low":
l += "; Priority=Low";
break;
case "medium":
l += "; Priority=Medium";
break;
case "high":
l += "; Priority=High";
break;
default:
throw TypeError(`option priority is invalid: ${i.priority}`);
}
if (i.sameSite)
switch (
"string" == typeof i.sameSite ? i.sameSite.toLowerCase() : i.sameSite
) {
case !0:
case "strict":
l += "; SameSite=Strict";
break;
case "lax":
l += "; SameSite=Lax";
break;
case "none":
l += "; SameSite=None";
break;
default:
throw TypeError(`option sameSite is invalid: ${i.sameSite}`);
}
return l;
}
function p(e, t, r) {
let i = e.indexOf(";", t);
return -1 === i ? r : i;
}
function d(e, t, r) {
let i = e.indexOf("=", t);
return i < r ? i : -1;
}
function g(e, t, r) {
let i = t,
o = r;
do {
let t = e.charCodeAt(i);
if (32 !== t && 9 !== t) break;
} while (++i < o);
for (; o > i; ) {
let t = e.charCodeAt(o - 1);
if (32 !== t && 9 !== t) break;
o--;
}
return e.slice(i, o);
}
function v(e) {
if (-1 === e.indexOf("%")) return e;
try {
return decodeURIComponent(e);
} catch (t) {
return e;
}
}
};
export default moduleFactory;