inital commit

This commit is contained in:
2026-01-01 15:25:19 +05:30
commit f0ae49465a
36361 changed files with 4894111 additions and 0 deletions

21
node_modules/universal-cookie/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Benoit Tremblay
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

129
node_modules/universal-cookie/README.md generated vendored Normal file
View File

@@ -0,0 +1,129 @@
<h3 align="center">
universal-cookie
</h3>
<p align="center">
Universal cookies for JavaScript<br />
<a href="https://badge.fury.io/js/universal-cookie"><img src="https://badge.fury.io/js/universal-cookie.svg" /></a>
<img src="https://github.com/github/docs/actions/workflows/test.yml/badge.svg" />
</p>
## Integrations
- [`react-cookie`](https://www.npmjs.com/package/react-cookie) - Universal cookies for React
- [`universal-cookie-express`](https://www.npmjs.com/package/universal-cookie-express) - Hook cookies get/set on Express for server-rendering
## Getting started
`npm install universal-cookie`
or in the browser (global variable `UniversalCookie`):
```html
<script
crossorigin
src="https://unpkg.com/universal-cookie@7/umd/universalCookie.min.js"
></script>
```
## API - Cookies class
### `constructor([cookieHeader], [defaultSetOptions])`
Create a cookies context
- cookieHeader (string|object): specify the cookie header or object
- defaultSetOptions (object): specify the default options when setting cookies
- path (string): cookie path, use `/` as the path if you want your cookie to be accessible on all pages
- expires (Date): absolute expiration date for the cookie
- maxAge (number): relative max age of the cookie from when the client receives it in seconds
- domain (string): domain for the cookie (sub.domain.com or .allsubdomains.com)
- secure (boolean): Is only accessible through HTTPS?
- httpOnly (boolean): Is only the server can access the cookie? **Note: You cannot get or set httpOnly cookies from the browser, only the server.**
- sameSite (boolean|none|lax|strict): Strict or Lax enforcement
- partitioned (boolean): Indicates that the cookie should be stored using partitioned storage
### `get(name, [options])`
Get a cookie value
- name (string): cookie name
- options (object):
- doNotParse (boolean): do not convert the cookie into an object no matter what
### `getAll([options])`
Get all cookies
- options (object):
- doNotParse (boolean): do not convert the cookie into an object no matter what
### `set(name, value, [options])`
Set a cookie value
- name (string): cookie name
- value (string|object): save the value and stringify the object if needed
- options (object): Support all the cookie options from RFC 6265
- path (string): cookie path, use `/` as the path if you want your cookie to be accessible on all pages
- expires (Date): absolute expiration date for the cookie
- maxAge (number): relative max age of the cookie from when the client receives it in seconds
- domain (string): domain for the cookie (sub.domain.com or .allsubdomains.com)
- secure (boolean): Is only accessible through HTTPS?
- httpOnly (boolean): Is only the server can access the cookie? **Note: You cannot get or set httpOnly cookies from the browser, only the server.**
- sameSite (boolean|none|lax|strict): Strict or Lax enforcement
- partitioned (boolean): Indicates that the cookie should be stored using partitioned storage
### `remove(name, [options])`
Remove a cookie
- name (string): cookie name
- options (object): Support all the cookie options from RFC 6265
- path (string): cookie path, use `/` as the path if you want your cookie to be accessible on all pages
- expires (Date): absolute expiration date for the cookie
- maxAge (number): relative max age of the cookie from when the client receives it in seconds
- domain (string): domain for the cookie (sub.domain.com or .allsubdomains.com)
- secure (boolean): Is only accessible through HTTPS?
- httpOnly (boolean): Is only the server can access the cookie? **Note: You cannot get or set httpOnly cookies from the browser, only the server.**
- sameSite (boolean|none|lax|strict): Strict or Lax enforcement
- partitioned (boolean): Indicates that the cookie should be stored using partitioned storage
### `addChangeListener(callback)`
Add a listener to when a cookie is set or removed.
- callback (function): Call that will be called with the first argument containing `name`, `value` and `options` of the changed cookie.
### `removeChangeListener(callback)`
Remove a listener from the change callback.
### `removeAllChangeListeners()`
Remove all change listeners that were previously added with `addChangeListener()`.
### `update()`
Read back the cookies from the browser and triggers the change listeners. This should normally not be necessary because this library detects cookie changes automatically.
## Browser Example
```js
import Cookies from 'universal-cookie';
const cookies = new Cookies(null, { path: '/' });
cookies.set('myCat', 'Pacman');
console.log(cookies.get('myCat')); // Pacman
```
## Server Example
```js
import Cookies from 'universal-cookie';
const cookies = new Cookies(req.headers.cookie, { path: '/' });
console.log(cookies.get('myCat')); // Pacman or undefined if not set yet
```

23
node_modules/universal-cookie/cjs/Cookies.d.ts generated vendored Normal file
View File

@@ -0,0 +1,23 @@
import { Cookie, CookieChangeListener, CookieGetOptions, CookieSetOptions } from './types';
export default class Cookies {
private cookies;
private defaultSetOptions;
private changeListeners;
private pollingInterval?;
private HAS_DOCUMENT_COOKIE;
constructor(cookies?: string | object | null, defaultSetOptions?: CookieSetOptions);
private _emitChange;
private _checkChanges;
private _startPolling;
private _stopPolling;
get(name: string, options?: CookieGetOptions): any;
get<T>(name: string, options?: CookieGetOptions): T;
getAll(options?: CookieGetOptions): any;
getAll<T>(options?: CookieGetOptions): T;
set(name: string, value: Cookie, options?: CookieSetOptions): void;
remove(name: string, options?: CookieSetOptions): void;
update: () => void;
addChangeListener(callback: CookieChangeListener): void;
removeChangeListener(callback: CookieChangeListener): void;
removeAllChangeListeners(): void;
}

3
node_modules/universal-cookie/cjs/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import Cookies from './Cookies';
export default Cookies;
export * from './types';

179
node_modules/universal-cookie/cjs/index.js generated vendored Normal file
View File

@@ -0,0 +1,179 @@
'use strict';
var cookie = require('cookie');
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var cookie__namespace = /*#__PURE__*/_interopNamespaceDefault(cookie);
function hasDocumentCookie() {
const testingValue = typeof global === 'undefined'
? undefined
: global.TEST_HAS_DOCUMENT_COOKIE;
if (typeof testingValue === 'boolean') {
return testingValue;
}
// Can we get/set cookies on document.cookie?
return typeof document === 'object' && typeof document.cookie === 'string';
}
function parseCookies(cookies) {
if (typeof cookies === 'string') {
return cookie__namespace.parse(cookies);
}
else if (typeof cookies === 'object' && cookies !== null) {
return cookies;
}
else {
return {};
}
}
function readCookie(value, options = {}) {
const cleanValue = cleanupCookieValue(value);
if (!options.doNotParse) {
try {
return JSON.parse(cleanValue);
}
catch (e) {
// At least we tried
}
}
// Ignore clean value if we failed the deserialization
// It is not relevant anymore to trim those values
return value;
}
function cleanupCookieValue(value) {
// express prepend j: before serializing a cookie
if (value && value[0] === 'j' && value[1] === ':') {
return value.substr(2);
}
return value;
}
class Cookies {
constructor(cookies, defaultSetOptions = {}) {
this.changeListeners = [];
this.HAS_DOCUMENT_COOKIE = false;
this.update = () => {
if (!this.HAS_DOCUMENT_COOKIE) {
return;
}
const previousCookies = this.cookies;
this.cookies = cookie__namespace.parse(document.cookie);
this._checkChanges(previousCookies);
};
const domCookies = typeof document === 'undefined' ? '' : document.cookie;
this.cookies = parseCookies(cookies || domCookies);
this.defaultSetOptions = defaultSetOptions;
this.HAS_DOCUMENT_COOKIE = hasDocumentCookie();
}
_emitChange(params) {
for (let i = 0; i < this.changeListeners.length; ++i) {
this.changeListeners[i](params);
}
}
_checkChanges(previousCookies) {
const names = new Set(Object.keys(previousCookies).concat(Object.keys(this.cookies)));
names.forEach((name) => {
if (previousCookies[name] !== this.cookies[name]) {
this._emitChange({
name,
value: readCookie(this.cookies[name]),
});
}
});
}
_startPolling() {
this.pollingInterval = setInterval(this.update, 300);
}
_stopPolling() {
if (this.pollingInterval) {
clearInterval(this.pollingInterval);
}
}
get(name, options = {}) {
if (!options.doNotUpdate) {
this.update();
}
return readCookie(this.cookies[name], options);
}
getAll(options = {}) {
if (!options.doNotUpdate) {
this.update();
}
const result = {};
for (let name in this.cookies) {
result[name] = readCookie(this.cookies[name], options);
}
return result;
}
set(name, value, options) {
if (options) {
options = Object.assign(Object.assign({}, this.defaultSetOptions), options);
}
else {
options = this.defaultSetOptions;
}
const stringValue = typeof value === 'string' ? value : JSON.stringify(value);
this.cookies = Object.assign(Object.assign({}, this.cookies), { [name]: stringValue });
if (this.HAS_DOCUMENT_COOKIE) {
document.cookie = cookie__namespace.serialize(name, stringValue, options);
}
this._emitChange({ name, value, options });
}
remove(name, options) {
const finalOptions = (options = Object.assign(Object.assign(Object.assign({}, this.defaultSetOptions), options), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 }));
this.cookies = Object.assign({}, this.cookies);
delete this.cookies[name];
if (this.HAS_DOCUMENT_COOKIE) {
document.cookie = cookie__namespace.serialize(name, '', finalOptions);
}
this._emitChange({ name, value: undefined, options });
}
addChangeListener(callback) {
this.changeListeners.push(callback);
if (this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 1) {
if (typeof window === 'object' && 'cookieStore' in window) {
window.cookieStore.addEventListener('change', this.update);
}
else {
this._startPolling();
}
}
}
removeChangeListener(callback) {
const idx = this.changeListeners.indexOf(callback);
if (idx >= 0) {
this.changeListeners.splice(idx, 1);
}
if (this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 0) {
if (typeof window === 'object' && 'cookieStore' in window) {
window.cookieStore.removeEventListener('change', this.update);
}
else {
this._stopPolling();
}
}
}
removeAllChangeListeners() {
while (this.changeListeners.length > 0) {
this.removeChangeListener(this.changeListeners[0]);
}
}
}
module.exports = Cookies;

21
node_modules/universal-cookie/cjs/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
export type Cookie = any;
export interface CookieGetOptions {
doNotParse?: boolean;
doNotUpdate?: boolean;
}
export interface CookieSetOptions {
path?: string;
expires?: Date;
maxAge?: number;
domain?: string;
secure?: boolean;
httpOnly?: boolean;
sameSite?: boolean | 'none' | 'lax' | 'strict';
partitioned?: boolean;
}
export interface CookieChangeOptions {
name: string;
value?: any;
options?: CookieSetOptions;
}
export type CookieChangeListener = (options: CookieChangeOptions) => void;

5
node_modules/universal-cookie/cjs/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import { Cookie, CookieGetOptions } from './types';
export declare function hasDocumentCookie(): boolean;
export declare function cleanCookies(): void;
export declare function parseCookies(cookies?: string | object | null): object;
export declare function readCookie(value: Cookie, options?: CookieGetOptions): any;

23
node_modules/universal-cookie/esm/Cookies.d.ts generated vendored Normal file
View File

@@ -0,0 +1,23 @@
import { Cookie, CookieChangeListener, CookieGetOptions, CookieSetOptions } from './types';
export default class Cookies {
private cookies;
private defaultSetOptions;
private changeListeners;
private pollingInterval?;
private HAS_DOCUMENT_COOKIE;
constructor(cookies?: string | object | null, defaultSetOptions?: CookieSetOptions);
private _emitChange;
private _checkChanges;
private _startPolling;
private _stopPolling;
get(name: string, options?: CookieGetOptions): any;
get<T>(name: string, options?: CookieGetOptions): T;
getAll(options?: CookieGetOptions): any;
getAll<T>(options?: CookieGetOptions): T;
set(name: string, value: Cookie, options?: CookieSetOptions): void;
remove(name: string, options?: CookieSetOptions): void;
update: () => void;
addChangeListener(callback: CookieChangeListener): void;
removeChangeListener(callback: CookieChangeListener): void;
removeAllChangeListeners(): void;
}

3
node_modules/universal-cookie/esm/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import Cookies from './Cookies';
export default Cookies;
export * from './types';

406
node_modules/universal-cookie/esm/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,406 @@
var dist = {};
var hasRequiredDist;
function requireDist () {
if (hasRequiredDist) return dist;
hasRequiredDist = 1;
Object.defineProperty(dist, "__esModule", { value: true });
dist.parse = parse;
dist.serialize = serialize;
/**
* RegExp to match cookie-name in RFC 6265 sec 4.1.1
* This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
* which has been replaced by the token definition in RFC 7230 appendix B.
*
* cookie-name = token
* token = 1*tchar
* tchar = "!" / "#" / "$" / "%" / "&" / "'" /
* "*" / "+" / "-" / "." / "^" / "_" /
* "`" / "|" / "~" / DIGIT / ALPHA
*
* Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191
* Allow same range as cookie value, except `=`, which delimits end of name.
*/
const cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
/**
* RegExp to match cookie-value in RFC 6265 sec 4.1.1
*
* cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
* cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
* ; US-ASCII characters excluding CTLs,
* ; whitespace DQUOTE, comma, semicolon,
* ; and backslash
*
* Allowing more characters: https://github.com/jshttp/cookie/issues/191
* Comma, backslash, and DQUOTE are not part of the parsing algorithm.
*/
const cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
/**
* RegExp to match domain-value in RFC 6265 sec 4.1.1
*
* domain-value = <subdomain>
* ; defined in [RFC1034], Section 3.5, as
* ; enhanced by [RFC1123], Section 2.1
* <subdomain> = <label> | <subdomain> "." <label>
* <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]
* Labels must be 63 characters or less.
* 'let-dig' not 'letter' in the first char, per RFC1123
* <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>
* <let-dig-hyp> = <let-dig> | "-"
* <let-dig> = <letter> | <digit>
* <letter> = any one of the 52 alphabetic characters A through Z in
* upper case and a through z in lower case
* <digit> = any one of the ten digits 0 through 9
*
* Keep support for leading dot: https://github.com/jshttp/cookie/issues/173
*
* > (Note that a leading %x2E ("."), if present, is ignored even though that
* character is not permitted, but a trailing %x2E ("."), if present, will
* cause the user agent to ignore the attribute.)
*/
const domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
/**
* RegExp to match path-value in RFC 6265 sec 4.1.1
*
* path-value = <any CHAR except CTLs or ";">
* CHAR = %x01-7F
* ; defined in RFC 5234 appendix B.1
*/
const pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
const __toString = Object.prototype.toString;
const NullObject = /* @__PURE__ */ (() => {
const C = function () { };
C.prototype = Object.create(null);
return C;
})();
/**
* Parse a cookie header.
*
* Parse the given cookie header string into an object
* The object has the various cookies as keys(names) => values
*/
function parse(str, options) {
const obj = new NullObject();
const len = str.length;
// RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.
if (len < 2)
return obj;
const dec = options?.decode || decode;
let index = 0;
do {
const eqIdx = str.indexOf("=", index);
if (eqIdx === -1)
break; // No more cookie pairs.
const colonIdx = str.indexOf(";", index);
const endIdx = colonIdx === -1 ? len : colonIdx;
if (eqIdx > endIdx) {
// backtrack on prior semicolon
index = str.lastIndexOf(";", eqIdx - 1) + 1;
continue;
}
const keyStartIdx = startIndex(str, index, eqIdx);
const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
const key = str.slice(keyStartIdx, keyEndIdx);
// only assign once
if (obj[key] === undefined) {
let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
let valEndIdx = endIndex(str, endIdx, valStartIdx);
const value = dec(str.slice(valStartIdx, valEndIdx));
obj[key] = value;
}
index = endIdx + 1;
} while (index < len);
return obj;
}
function startIndex(str, index, max) {
do {
const code = str.charCodeAt(index);
if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
return index;
} while (++index < max);
return max;
}
function endIndex(str, index, min) {
while (index > min) {
const code = str.charCodeAt(--index);
if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
return index + 1;
}
return min;
}
/**
* Serialize data into a cookie header.
*
* Serialize a name value pair into a cookie string suitable for
* http headers. An optional options object specifies cookie parameters.
*
* serialize('foo', 'bar', { httpOnly: true })
* => "foo=bar; httpOnly"
*/
function serialize(name, val, options) {
const enc = options?.encode || encodeURIComponent;
if (!cookieNameRegExp.test(name)) {
throw new TypeError(`argument name is invalid: ${name}`);
}
const value = enc(val);
if (!cookieValueRegExp.test(value)) {
throw new TypeError(`argument val is invalid: ${val}`);
}
let str = name + "=" + value;
if (!options)
return str;
if (options.maxAge !== undefined) {
if (!Number.isInteger(options.maxAge)) {
throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
}
str += "; Max-Age=" + options.maxAge;
}
if (options.domain) {
if (!domainValueRegExp.test(options.domain)) {
throw new TypeError(`option domain is invalid: ${options.domain}`);
}
str += "; Domain=" + options.domain;
}
if (options.path) {
if (!pathValueRegExp.test(options.path)) {
throw new TypeError(`option path is invalid: ${options.path}`);
}
str += "; Path=" + options.path;
}
if (options.expires) {
if (!isDate(options.expires) ||
!Number.isFinite(options.expires.valueOf())) {
throw new TypeError(`option expires is invalid: ${options.expires}`);
}
str += "; Expires=" + options.expires.toUTCString();
}
if (options.httpOnly) {
str += "; HttpOnly";
}
if (options.secure) {
str += "; Secure";
}
if (options.partitioned) {
str += "; Partitioned";
}
if (options.priority) {
const priority = typeof options.priority === "string"
? options.priority.toLowerCase()
: undefined;
switch (priority) {
case "low":
str += "; Priority=Low";
break;
case "medium":
str += "; Priority=Medium";
break;
case "high":
str += "; Priority=High";
break;
default:
throw new TypeError(`option priority is invalid: ${options.priority}`);
}
}
if (options.sameSite) {
const sameSite = typeof options.sameSite === "string"
? options.sameSite.toLowerCase()
: options.sameSite;
switch (sameSite) {
case true:
case "strict":
str += "; SameSite=Strict";
break;
case "lax":
str += "; SameSite=Lax";
break;
case "none":
str += "; SameSite=None";
break;
default:
throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
}
}
return str;
}
/**
* URL-decode string value. Optimized to skip native call when no %.
*/
function decode(str) {
if (str.indexOf("%") === -1)
return str;
try {
return decodeURIComponent(str);
}
catch (e) {
return str;
}
}
/**
* Determine if value is a Date.
*/
function isDate(val) {
return __toString.call(val) === "[object Date]";
}
return dist;
}
var distExports = requireDist();
function hasDocumentCookie() {
const testingValue = typeof global === 'undefined'
? undefined
: global.TEST_HAS_DOCUMENT_COOKIE;
if (typeof testingValue === 'boolean') {
return testingValue;
}
// Can we get/set cookies on document.cookie?
return typeof document === 'object' && typeof document.cookie === 'string';
}
function parseCookies(cookies) {
if (typeof cookies === 'string') {
return distExports.parse(cookies);
}
else if (typeof cookies === 'object' && cookies !== null) {
return cookies;
}
else {
return {};
}
}
function readCookie(value, options = {}) {
const cleanValue = cleanupCookieValue(value);
if (!options.doNotParse) {
try {
return JSON.parse(cleanValue);
}
catch (e) {
// At least we tried
}
}
// Ignore clean value if we failed the deserialization
// It is not relevant anymore to trim those values
return value;
}
function cleanupCookieValue(value) {
// express prepend j: before serializing a cookie
if (value && value[0] === 'j' && value[1] === ':') {
return value.substr(2);
}
return value;
}
class Cookies {
constructor(cookies, defaultSetOptions = {}) {
this.changeListeners = [];
this.HAS_DOCUMENT_COOKIE = false;
this.update = () => {
if (!this.HAS_DOCUMENT_COOKIE) {
return;
}
const previousCookies = this.cookies;
this.cookies = distExports.parse(document.cookie);
this._checkChanges(previousCookies);
};
const domCookies = typeof document === 'undefined' ? '' : document.cookie;
this.cookies = parseCookies(cookies || domCookies);
this.defaultSetOptions = defaultSetOptions;
this.HAS_DOCUMENT_COOKIE = hasDocumentCookie();
}
_emitChange(params) {
for (let i = 0; i < this.changeListeners.length; ++i) {
this.changeListeners[i](params);
}
}
_checkChanges(previousCookies) {
const names = new Set(Object.keys(previousCookies).concat(Object.keys(this.cookies)));
names.forEach((name) => {
if (previousCookies[name] !== this.cookies[name]) {
this._emitChange({
name,
value: readCookie(this.cookies[name]),
});
}
});
}
_startPolling() {
this.pollingInterval = setInterval(this.update, 300);
}
_stopPolling() {
if (this.pollingInterval) {
clearInterval(this.pollingInterval);
}
}
get(name, options = {}) {
if (!options.doNotUpdate) {
this.update();
}
return readCookie(this.cookies[name], options);
}
getAll(options = {}) {
if (!options.doNotUpdate) {
this.update();
}
const result = {};
for (let name in this.cookies) {
result[name] = readCookie(this.cookies[name], options);
}
return result;
}
set(name, value, options) {
if (options) {
options = Object.assign(Object.assign({}, this.defaultSetOptions), options);
}
else {
options = this.defaultSetOptions;
}
const stringValue = typeof value === 'string' ? value : JSON.stringify(value);
this.cookies = Object.assign(Object.assign({}, this.cookies), { [name]: stringValue });
if (this.HAS_DOCUMENT_COOKIE) {
document.cookie = distExports.serialize(name, stringValue, options);
}
this._emitChange({ name, value, options });
}
remove(name, options) {
const finalOptions = (options = Object.assign(Object.assign(Object.assign({}, this.defaultSetOptions), options), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 }));
this.cookies = Object.assign({}, this.cookies);
delete this.cookies[name];
if (this.HAS_DOCUMENT_COOKIE) {
document.cookie = distExports.serialize(name, '', finalOptions);
}
this._emitChange({ name, value: undefined, options });
}
addChangeListener(callback) {
this.changeListeners.push(callback);
if (this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 1) {
if (typeof window === 'object' && 'cookieStore' in window) {
window.cookieStore.addEventListener('change', this.update);
}
else {
this._startPolling();
}
}
}
removeChangeListener(callback) {
const idx = this.changeListeners.indexOf(callback);
if (idx >= 0) {
this.changeListeners.splice(idx, 1);
}
if (this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 0) {
if (typeof window === 'object' && 'cookieStore' in window) {
window.cookieStore.removeEventListener('change', this.update);
}
else {
this._stopPolling();
}
}
}
removeAllChangeListeners() {
while (this.changeListeners.length > 0) {
this.removeChangeListener(this.changeListeners[0]);
}
}
}
export { Cookies as default };

21
node_modules/universal-cookie/esm/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
export type Cookie = any;
export interface CookieGetOptions {
doNotParse?: boolean;
doNotUpdate?: boolean;
}
export interface CookieSetOptions {
path?: string;
expires?: Date;
maxAge?: number;
domain?: string;
secure?: boolean;
httpOnly?: boolean;
sameSite?: boolean | 'none' | 'lax' | 'strict';
partitioned?: boolean;
}
export interface CookieChangeOptions {
name: string;
value?: any;
options?: CookieSetOptions;
}
export type CookieChangeListener = (options: CookieChangeOptions) => void;

5
node_modules/universal-cookie/esm/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import { Cookie, CookieGetOptions } from './types';
export declare function hasDocumentCookie(): boolean;
export declare function cleanCookies(): void;
export declare function parseCookies(cookies?: string | object | null): object;
export declare function readCookie(value: Cookie, options?: CookieGetOptions): any;

55
node_modules/universal-cookie/package.json generated vendored Normal file
View File

@@ -0,0 +1,55 @@
{
"name": "universal-cookie",
"version": "8.0.1",
"description": "Universal cookies for JavaScript",
"main": "cjs/index.js",
"types": "cjs/index.d.ts",
"module": "esm/index.mjs",
"exports": {
".": {
"import": {
"types": "./esm/index.d.mts",
"default": "./esm/index.mjs"
},
"require": {
"types": "./cjs/index.d.ts",
"default": "./cjs/index.js"
},
"default": "./cjs/index.js"
}
},
"sideEffects": false,
"files": [
"esm",
"cjs",
"umd",
"LICENSE"
],
"repository": {
"type": "git",
"url": "https://github.com/bendotcodes/cookies.git"
},
"bugs": "https://github.com/bendotcodes/cookies/issues",
"homepage": "https://github.com/bendotcodes/cookies/tree/main/packages/universal-cookie#readme",
"keywords": [
"universal",
"isomophic",
"cookie"
],
"author": "Benoit Tremblay <me@ben.codes>",
"license": "MIT",
"scripts": {
"prebuild": "rimraf esm && rimraf cjs && rimraf umd",
"build": "rollup -c",
"postbuild": "node ../../tools/fix-typescript-typedef.mjs ./esm"
},
"dependencies": {
"cookie": "^1.0.2"
},
"devDependencies": {
"@babel/cli": "^7.26.4",
"rimraf": "^6.0.1",
"rollup": "^4.36.0",
"typescript": "^5.8.2"
}
}

23
node_modules/universal-cookie/umd/Cookies.d.ts generated vendored Normal file
View File

@@ -0,0 +1,23 @@
import { Cookie, CookieChangeListener, CookieGetOptions, CookieSetOptions } from './types';
export default class Cookies {
private cookies;
private defaultSetOptions;
private changeListeners;
private pollingInterval?;
private HAS_DOCUMENT_COOKIE;
constructor(cookies?: string | object | null, defaultSetOptions?: CookieSetOptions);
private _emitChange;
private _checkChanges;
private _startPolling;
private _stopPolling;
get(name: string, options?: CookieGetOptions): any;
get<T>(name: string, options?: CookieGetOptions): T;
getAll(options?: CookieGetOptions): any;
getAll<T>(options?: CookieGetOptions): T;
set(name: string, value: Cookie, options?: CookieSetOptions): void;
remove(name: string, options?: CookieSetOptions): void;
update: () => void;
addChangeListener(callback: CookieChangeListener): void;
removeChangeListener(callback: CookieChangeListener): void;
removeAllChangeListeners(): void;
}

3
node_modules/universal-cookie/umd/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import Cookies from './Cookies';
export default Cookies;
export * from './types';

21
node_modules/universal-cookie/umd/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
export type Cookie = any;
export interface CookieGetOptions {
doNotParse?: boolean;
doNotUpdate?: boolean;
}
export interface CookieSetOptions {
path?: string;
expires?: Date;
maxAge?: number;
domain?: string;
secure?: boolean;
httpOnly?: boolean;
sameSite?: boolean | 'none' | 'lax' | 'strict';
partitioned?: boolean;
}
export interface CookieChangeOptions {
name: string;
value?: any;
options?: CookieSetOptions;
}
export type CookieChangeListener = (options: CookieChangeOptions) => void;

414
node_modules/universal-cookie/umd/universalCookie.js generated vendored Normal file
View File

@@ -0,0 +1,414 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.UniversalCookie = factory());
})(this, (function () { 'use strict';
var dist = {};
var hasRequiredDist;
function requireDist () {
if (hasRequiredDist) return dist;
hasRequiredDist = 1;
Object.defineProperty(dist, "__esModule", { value: true });
dist.parse = parse;
dist.serialize = serialize;
/**
* RegExp to match cookie-name in RFC 6265 sec 4.1.1
* This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
* which has been replaced by the token definition in RFC 7230 appendix B.
*
* cookie-name = token
* token = 1*tchar
* tchar = "!" / "#" / "$" / "%" / "&" / "'" /
* "*" / "+" / "-" / "." / "^" / "_" /
* "`" / "|" / "~" / DIGIT / ALPHA
*
* Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191
* Allow same range as cookie value, except `=`, which delimits end of name.
*/
const cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
/**
* RegExp to match cookie-value in RFC 6265 sec 4.1.1
*
* cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
* cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
* ; US-ASCII characters excluding CTLs,
* ; whitespace DQUOTE, comma, semicolon,
* ; and backslash
*
* Allowing more characters: https://github.com/jshttp/cookie/issues/191
* Comma, backslash, and DQUOTE are not part of the parsing algorithm.
*/
const cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
/**
* RegExp to match domain-value in RFC 6265 sec 4.1.1
*
* domain-value = <subdomain>
* ; defined in [RFC1034], Section 3.5, as
* ; enhanced by [RFC1123], Section 2.1
* <subdomain> = <label> | <subdomain> "." <label>
* <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]
* Labels must be 63 characters or less.
* 'let-dig' not 'letter' in the first char, per RFC1123
* <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>
* <let-dig-hyp> = <let-dig> | "-"
* <let-dig> = <letter> | <digit>
* <letter> = any one of the 52 alphabetic characters A through Z in
* upper case and a through z in lower case
* <digit> = any one of the ten digits 0 through 9
*
* Keep support for leading dot: https://github.com/jshttp/cookie/issues/173
*
* > (Note that a leading %x2E ("."), if present, is ignored even though that
* character is not permitted, but a trailing %x2E ("."), if present, will
* cause the user agent to ignore the attribute.)
*/
const domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
/**
* RegExp to match path-value in RFC 6265 sec 4.1.1
*
* path-value = <any CHAR except CTLs or ";">
* CHAR = %x01-7F
* ; defined in RFC 5234 appendix B.1
*/
const pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
const __toString = Object.prototype.toString;
const NullObject = /* @__PURE__ */ (() => {
const C = function () { };
C.prototype = Object.create(null);
return C;
})();
/**
* Parse a cookie header.
*
* Parse the given cookie header string into an object
* The object has the various cookies as keys(names) => values
*/
function parse(str, options) {
const obj = new NullObject();
const len = str.length;
// RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.
if (len < 2)
return obj;
const dec = options?.decode || decode;
let index = 0;
do {
const eqIdx = str.indexOf("=", index);
if (eqIdx === -1)
break; // No more cookie pairs.
const colonIdx = str.indexOf(";", index);
const endIdx = colonIdx === -1 ? len : colonIdx;
if (eqIdx > endIdx) {
// backtrack on prior semicolon
index = str.lastIndexOf(";", eqIdx - 1) + 1;
continue;
}
const keyStartIdx = startIndex(str, index, eqIdx);
const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
const key = str.slice(keyStartIdx, keyEndIdx);
// only assign once
if (obj[key] === undefined) {
let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
let valEndIdx = endIndex(str, endIdx, valStartIdx);
const value = dec(str.slice(valStartIdx, valEndIdx));
obj[key] = value;
}
index = endIdx + 1;
} while (index < len);
return obj;
}
function startIndex(str, index, max) {
do {
const code = str.charCodeAt(index);
if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
return index;
} while (++index < max);
return max;
}
function endIndex(str, index, min) {
while (index > min) {
const code = str.charCodeAt(--index);
if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
return index + 1;
}
return min;
}
/**
* Serialize data into a cookie header.
*
* Serialize a name value pair into a cookie string suitable for
* http headers. An optional options object specifies cookie parameters.
*
* serialize('foo', 'bar', { httpOnly: true })
* => "foo=bar; httpOnly"
*/
function serialize(name, val, options) {
const enc = options?.encode || encodeURIComponent;
if (!cookieNameRegExp.test(name)) {
throw new TypeError(`argument name is invalid: ${name}`);
}
const value = enc(val);
if (!cookieValueRegExp.test(value)) {
throw new TypeError(`argument val is invalid: ${val}`);
}
let str = name + "=" + value;
if (!options)
return str;
if (options.maxAge !== undefined) {
if (!Number.isInteger(options.maxAge)) {
throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
}
str += "; Max-Age=" + options.maxAge;
}
if (options.domain) {
if (!domainValueRegExp.test(options.domain)) {
throw new TypeError(`option domain is invalid: ${options.domain}`);
}
str += "; Domain=" + options.domain;
}
if (options.path) {
if (!pathValueRegExp.test(options.path)) {
throw new TypeError(`option path is invalid: ${options.path}`);
}
str += "; Path=" + options.path;
}
if (options.expires) {
if (!isDate(options.expires) ||
!Number.isFinite(options.expires.valueOf())) {
throw new TypeError(`option expires is invalid: ${options.expires}`);
}
str += "; Expires=" + options.expires.toUTCString();
}
if (options.httpOnly) {
str += "; HttpOnly";
}
if (options.secure) {
str += "; Secure";
}
if (options.partitioned) {
str += "; Partitioned";
}
if (options.priority) {
const priority = typeof options.priority === "string"
? options.priority.toLowerCase()
: undefined;
switch (priority) {
case "low":
str += "; Priority=Low";
break;
case "medium":
str += "; Priority=Medium";
break;
case "high":
str += "; Priority=High";
break;
default:
throw new TypeError(`option priority is invalid: ${options.priority}`);
}
}
if (options.sameSite) {
const sameSite = typeof options.sameSite === "string"
? options.sameSite.toLowerCase()
: options.sameSite;
switch (sameSite) {
case true:
case "strict":
str += "; SameSite=Strict";
break;
case "lax":
str += "; SameSite=Lax";
break;
case "none":
str += "; SameSite=None";
break;
default:
throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
}
}
return str;
}
/**
* URL-decode string value. Optimized to skip native call when no %.
*/
function decode(str) {
if (str.indexOf("%") === -1)
return str;
try {
return decodeURIComponent(str);
}
catch (e) {
return str;
}
}
/**
* Determine if value is a Date.
*/
function isDate(val) {
return __toString.call(val) === "[object Date]";
}
return dist;
}
var distExports = requireDist();
function hasDocumentCookie() {
const testingValue = typeof global === 'undefined'
? undefined
: global.TEST_HAS_DOCUMENT_COOKIE;
if (typeof testingValue === 'boolean') {
return testingValue;
}
// Can we get/set cookies on document.cookie?
return typeof document === 'object' && typeof document.cookie === 'string';
}
function parseCookies(cookies) {
if (typeof cookies === 'string') {
return distExports.parse(cookies);
}
else if (typeof cookies === 'object' && cookies !== null) {
return cookies;
}
else {
return {};
}
}
function readCookie(value, options = {}) {
const cleanValue = cleanupCookieValue(value);
if (!options.doNotParse) {
try {
return JSON.parse(cleanValue);
}
catch (e) {
// At least we tried
}
}
// Ignore clean value if we failed the deserialization
// It is not relevant anymore to trim those values
return value;
}
function cleanupCookieValue(value) {
// express prepend j: before serializing a cookie
if (value && value[0] === 'j' && value[1] === ':') {
return value.substr(2);
}
return value;
}
class Cookies {
constructor(cookies, defaultSetOptions = {}) {
this.changeListeners = [];
this.HAS_DOCUMENT_COOKIE = false;
this.update = () => {
if (!this.HAS_DOCUMENT_COOKIE) {
return;
}
const previousCookies = this.cookies;
this.cookies = distExports.parse(document.cookie);
this._checkChanges(previousCookies);
};
const domCookies = typeof document === 'undefined' ? '' : document.cookie;
this.cookies = parseCookies(cookies || domCookies);
this.defaultSetOptions = defaultSetOptions;
this.HAS_DOCUMENT_COOKIE = hasDocumentCookie();
}
_emitChange(params) {
for (let i = 0; i < this.changeListeners.length; ++i) {
this.changeListeners[i](params);
}
}
_checkChanges(previousCookies) {
const names = new Set(Object.keys(previousCookies).concat(Object.keys(this.cookies)));
names.forEach((name) => {
if (previousCookies[name] !== this.cookies[name]) {
this._emitChange({
name,
value: readCookie(this.cookies[name]),
});
}
});
}
_startPolling() {
this.pollingInterval = setInterval(this.update, 300);
}
_stopPolling() {
if (this.pollingInterval) {
clearInterval(this.pollingInterval);
}
}
get(name, options = {}) {
if (!options.doNotUpdate) {
this.update();
}
return readCookie(this.cookies[name], options);
}
getAll(options = {}) {
if (!options.doNotUpdate) {
this.update();
}
const result = {};
for (let name in this.cookies) {
result[name] = readCookie(this.cookies[name], options);
}
return result;
}
set(name, value, options) {
if (options) {
options = Object.assign(Object.assign({}, this.defaultSetOptions), options);
}
else {
options = this.defaultSetOptions;
}
const stringValue = typeof value === 'string' ? value : JSON.stringify(value);
this.cookies = Object.assign(Object.assign({}, this.cookies), { [name]: stringValue });
if (this.HAS_DOCUMENT_COOKIE) {
document.cookie = distExports.serialize(name, stringValue, options);
}
this._emitChange({ name, value, options });
}
remove(name, options) {
const finalOptions = (options = Object.assign(Object.assign(Object.assign({}, this.defaultSetOptions), options), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 }));
this.cookies = Object.assign({}, this.cookies);
delete this.cookies[name];
if (this.HAS_DOCUMENT_COOKIE) {
document.cookie = distExports.serialize(name, '', finalOptions);
}
this._emitChange({ name, value: undefined, options });
}
addChangeListener(callback) {
this.changeListeners.push(callback);
if (this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 1) {
if (typeof window === 'object' && 'cookieStore' in window) {
window.cookieStore.addEventListener('change', this.update);
}
else {
this._startPolling();
}
}
}
removeChangeListener(callback) {
const idx = this.changeListeners.indexOf(callback);
if (idx >= 0) {
this.changeListeners.splice(idx, 1);
}
if (this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 0) {
if (typeof window === 'object' && 'cookieStore' in window) {
window.cookieStore.removeEventListener('change', this.update);
}
else {
this._stopPolling();
}
}
}
removeAllChangeListeners() {
while (this.changeListeners.length > 0) {
this.removeChangeListener(this.changeListeners[0]);
}
}
}
return Cookies;
}));

File diff suppressed because one or more lines are too long

5
node_modules/universal-cookie/umd/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import { Cookie, CookieGetOptions } from './types';
export declare function hasDocumentCookie(): boolean;
export declare function cleanCookies(): void;
export declare function parseCookies(cookies?: string | object | null): object;
export declare function readCookie(value: Cookie, options?: CookieGetOptions): any;