UNPKG

@mankindui/core

Version:

- a react component library - you can see how @mankindui/core can be used via examples: [usage examples](https://github.com/clarklindev/mankindui-test)

98 lines (97 loc) 3.36 kB
import "../../../_virtual/_commonjsHelpers.js"; import { __module as f } from "../../../_virtual/set-cookie2.js"; var A = f.exports, C; function b() { if (C) return f.exports; C = 1; var h = { decodeValues: !0, map: !1, silent: !1 }; function v(e) { return typeof e == "string" && !!e.trim(); } function p(e, a) { var r = e.split(";").filter(v), s = r.shift(), t = g(s), l = t.name, n = t.value; a = a ? Object.assign({}, h, a) : h; try { n = a.decodeValues ? decodeURIComponent(n) : n; } catch (u) { console.error( "set-cookie-parser encountered an error while decoding a cookie with value '" + n + "'. Set options.decodeValues to false to disable this feature.", u ); } var i = { name: l, value: n }; return r.forEach(function(u) { var d = u.split("="), o = d.shift().trimLeft().toLowerCase(), c = d.join("="); o === "expires" ? i.expires = new Date(c) : o === "max-age" ? i.maxAge = parseInt(c, 10) : o === "secure" ? i.secure = !0 : o === "httponly" ? i.httpOnly = !0 : o === "samesite" ? i.sameSite = c : o === "partitioned" ? i.partitioned = !0 : i[o] = c; }), i; } function g(e) { var a = "", r = "", s = e.split("="); return s.length > 1 ? (a = s.shift(), r = s.join("=")) : r = e, { name: a, value: r }; } function m(e, a) { if (a = a ? Object.assign({}, h, a) : h, !e) return a.map ? {} : []; if (e.headers) if (typeof e.headers.getSetCookie == "function") e = e.headers.getSetCookie(); else if (e.headers["set-cookie"]) e = e.headers["set-cookie"]; else { var r = e.headers[Object.keys(e.headers).find(function(t) { return t.toLowerCase() === "set-cookie"; })]; !r && e.headers.cookie && !a.silent && console.warn( "Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning." ), e = r; } if (Array.isArray(e) || (e = [e]), a.map) { var s = {}; return e.filter(v).reduce(function(t, l) { var n = p(l, a); return t[n.name] = n, t; }, s); } else return e.filter(v).map(function(t) { return p(t, a); }); } function x(e) { if (Array.isArray(e)) return e; if (typeof e != "string") return []; var a = [], r = 0, s, t, l, n, i; function u() { for (; r < e.length && /\s/.test(e.charAt(r)); ) r += 1; return r < e.length; } function d() { return t = e.charAt(r), t !== "=" && t !== ";" && t !== ","; } for (; r < e.length; ) { for (s = r, i = !1; u(); ) if (t = e.charAt(r), t === ",") { for (l = r, r += 1, u(), n = r; r < e.length && d(); ) r += 1; r < e.length && e.charAt(r) === "=" ? (i = !0, r = n, a.push(e.substring(s, l)), s = r) : r = l + 1; } else r += 1; (!i || r >= e.length) && a.push(e.substring(s, e.length)); } return a; } return f.exports = m, f.exports.parse = m, f.exports.parseString = p, f.exports.splitCookiesString = x, f.exports; } export { b as __require }; //# sourceMappingURL=set-cookie.js.map