@luwiostack/cookie-consent 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,109 @@
1
+ import { S as ConsentCategoryId, d as ConsentSnapshot, f as ConsentStatus, n as ConsentCategory, u as ConsentManager, y as ConsentDecision } from "./types-ByyibBUg.cjs";
2
+ import { ReactNode } from "react";
3
+ //#region src/react/consent-context.d.ts
4
+ interface ConsentContextValue {
5
+ consent: ConsentManager;
6
+ snapshot: ConsentSnapshot;
7
+ isPreferencesOpen: boolean;
8
+ setPreferencesOpen: (open: boolean) => void;
9
+ }
10
+ declare const ConsentContext: import("react").Context<ConsentContextValue | null>;
11
+ //#endregion
12
+ //#region src/react/consent-gate.d.ts
13
+ type Id = ConsentCategoryId;
14
+ interface ConsentGateApi {
15
+ /** The categories still missing. */
16
+ missing: readonly Id[];
17
+ /** Grant the missing categories right here ("Load video" on a placeholder). */
18
+ grant: () => void;
19
+ /** Open the preferences instead. */
20
+ openPreferences: () => void;
21
+ }
22
+ interface ConsentGateProps {
23
+ /** The category — or categories, all required — the content needs. */
24
+ category: Id | readonly Id[];
25
+ /**
26
+ * The vendor the content belongs to (`"youtube"`). The gate then also needs that vendor to be used
27
+ * in the category — and renders nothing, not even the fallback, when it isn't: that integration
28
+ * is off for this app.
29
+ */
30
+ vendor?: string;
31
+ /** Rendered instead while consent is missing. A function gets the gate's api. */
32
+ fallback?: ReactNode | ((api: ConsentGateApi) => ReactNode);
33
+ children?: ReactNode;
34
+ }
35
+ /**
36
+ * Renders its children only once consent allows them — for embeds and widgets that set cookies or
37
+ * track (a YouTube player, a map, a chat widget). Shows `fallback` otherwise, including on the
38
+ * server and during hydration, so tracking content never renders before consent.
39
+ *
40
+ * ```tsx
41
+ * <ConsentGate
42
+ * category="preferences"
43
+ * vendor="youtube"
44
+ * fallback={(gate) => <button type="button" onClick={gate.grant}>Load video</button>}
45
+ * >
46
+ * <iframe src="https://www.youtube-nocookie.com/embed/…" />
47
+ * </ConsentGate>
48
+ * ```
49
+ */
50
+ declare function ConsentGate({ category, vendor, fallback, children }: ConsentGateProps): import("react").JSX.Element | null;
51
+ //#endregion
52
+ //#region src/react/consent-provider.d.ts
53
+ interface ConsentProps {
54
+ /** The instance from `createConsent(config)`. */
55
+ consent: ConsentManager;
56
+ children?: ReactNode;
57
+ }
58
+ /**
59
+ * Supplies a consent instance to the tree and keeps it reactive: every `useConsent()` and
60
+ * `<ConsentGate>` below re-renders when the decision changes — in this tab or another. Also owns
61
+ * whether your app's preferences UI is open, so a "Cookie settings" link anywhere (a footer) can
62
+ * reopen it with `openPreferences()`.
63
+ */
64
+ declare function Consent({ consent, children }: ConsentProps): import("react").JSX.Element;
65
+ //#endregion
66
+ //#region src/react/use-consent.d.ts
67
+ interface UseConsentReturn {
68
+ /** The underlying instance. */
69
+ consent: ConsentManager;
70
+ /** `unknown` during SSR/hydration, then `pending` or `decided`. */
71
+ status: ConsentStatus;
72
+ /** The valid decision, or `null` while `pending` / `unknown`. */
73
+ decision: ConsentDecision | null;
74
+ /** The four categories in order, each with its vendors and their cookies. */
75
+ categories: readonly ConsentCategory[];
76
+ /** Whether the visitor should be asked (status `pending`). `false` while `unknown`. */
77
+ needsDecision: boolean;
78
+ /**
79
+ * Reactive: necessary always, others only once decided. With a vendor, also whether it's used in
80
+ * that category — `isGranted('preferences', 'youtube')`.
81
+ */
82
+ isGranted: (category: ConsentCategoryId, vendorId?: string) => boolean;
83
+ isRequired: (category: ConsentCategoryId) => boolean;
84
+ /** Grant everything (closes the preferences). */
85
+ acceptAll: () => void;
86
+ /** Grant only the required categories (closes the preferences). */
87
+ rejectAll: () => void;
88
+ /** Grant exactly these (closes the preferences). */
89
+ save: (granted: Iterable<ConsentCategoryId>) => void;
90
+ /** Grant these on top of the current decision. */
91
+ grant: (...ids: ConsentCategoryId[]) => void;
92
+ /** Withdraw these from the current decision. */
93
+ revoke: (...ids: ConsentCategoryId[]) => void;
94
+ /** Forget the decision — the banner shows again. */
95
+ reset: () => void;
96
+ /** Whether the preferences are open (shared across the tree). */
97
+ isPreferencesOpen: boolean;
98
+ openPreferences: () => void;
99
+ closePreferences: () => void;
100
+ }
101
+ /**
102
+ * The visitor's consent, reactively, plus the actions to change it.
103
+ *
104
+ * @throws {Error} outside `<Consent>`.
105
+ */
106
+ declare function useConsent(): UseConsentReturn;
107
+ //#endregion
108
+ export { Consent, ConsentContext, type ConsentContextValue, ConsentGate, type ConsentGateApi, type ConsentGateProps, type ConsentProps, type UseConsentReturn, useConsent };
109
+ //# sourceMappingURL=react.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.d.cts","names":[],"sources":["../src/react/consent-context.ts","../src/react/consent-gate.tsx","../src/react/consent-provider.tsx","../src/react/use-consent.ts"],"mappings":";;;UAGiB;EACf,SAAS;EACT,UAAU;EACV;EACA,qBAAqB;;cAGV,gCAAc,QAAA;;;KCNtB,KAAK;UAEO;;EAEf,kBAAkB;;EAElB;;EAEA;;UAGe;;EAEf,UAAU,cAAc;;;;;;EAMxB;;EAEA,WAAW,cAAc,KAAK,mBAAmB;EACjD,WAAW;;;;;;;;;;;;;;;;;iBAkBG,cAAc,UAAU,QAAQ,UAAiB,YAAY,mCAAgB,IAAA;;;UClC5E;;EAEf,SAAS;EACT,WAAW;;;;;;;;iBASG,UAAU,SAAS,YAAY,+BAAY,IAAA;;;UCf1C;;EAEf,SAAS;;EAET,QAAQ;;EAER,UAAU;;EAEV,qBAAqB;;EAErB;;;;;EAKA,YAAY,UAAU,mBAAmB;EACzC,aAAa,UAAU;;EAEvB;;EAEA;;EAEA,OAAO,SAAS,SAAS;;EAEzB,WAAW,KAAK;;EAEhB,YAAY,KAAK;;EAEjB;;EAEA;EACA;EACA;;;;;;;iBAec,cAAc"}
@@ -0,0 +1,109 @@
1
+ import { S as ConsentCategoryId, d as ConsentSnapshot, f as ConsentStatus, n as ConsentCategory, u as ConsentManager, y as ConsentDecision } from "./types-ByyibBUg.mjs";
2
+ import { ReactNode } from "react";
3
+ //#region src/react/consent-context.d.ts
4
+ interface ConsentContextValue {
5
+ consent: ConsentManager;
6
+ snapshot: ConsentSnapshot;
7
+ isPreferencesOpen: boolean;
8
+ setPreferencesOpen: (open: boolean) => void;
9
+ }
10
+ declare const ConsentContext: import("react").Context<ConsentContextValue | null>;
11
+ //#endregion
12
+ //#region src/react/consent-gate.d.ts
13
+ type Id = ConsentCategoryId;
14
+ interface ConsentGateApi {
15
+ /** The categories still missing. */
16
+ missing: readonly Id[];
17
+ /** Grant the missing categories right here ("Load video" on a placeholder). */
18
+ grant: () => void;
19
+ /** Open the preferences instead. */
20
+ openPreferences: () => void;
21
+ }
22
+ interface ConsentGateProps {
23
+ /** The category — or categories, all required — the content needs. */
24
+ category: Id | readonly Id[];
25
+ /**
26
+ * The vendor the content belongs to (`"youtube"`). The gate then also needs that vendor to be used
27
+ * in the category — and renders nothing, not even the fallback, when it isn't: that integration
28
+ * is off for this app.
29
+ */
30
+ vendor?: string;
31
+ /** Rendered instead while consent is missing. A function gets the gate's api. */
32
+ fallback?: ReactNode | ((api: ConsentGateApi) => ReactNode);
33
+ children?: ReactNode;
34
+ }
35
+ /**
36
+ * Renders its children only once consent allows them — for embeds and widgets that set cookies or
37
+ * track (a YouTube player, a map, a chat widget). Shows `fallback` otherwise, including on the
38
+ * server and during hydration, so tracking content never renders before consent.
39
+ *
40
+ * ```tsx
41
+ * <ConsentGate
42
+ * category="preferences"
43
+ * vendor="youtube"
44
+ * fallback={(gate) => <button type="button" onClick={gate.grant}>Load video</button>}
45
+ * >
46
+ * <iframe src="https://www.youtube-nocookie.com/embed/…" />
47
+ * </ConsentGate>
48
+ * ```
49
+ */
50
+ declare function ConsentGate({ category, vendor, fallback, children }: ConsentGateProps): import("react").JSX.Element | null;
51
+ //#endregion
52
+ //#region src/react/consent-provider.d.ts
53
+ interface ConsentProps {
54
+ /** The instance from `createConsent(config)`. */
55
+ consent: ConsentManager;
56
+ children?: ReactNode;
57
+ }
58
+ /**
59
+ * Supplies a consent instance to the tree and keeps it reactive: every `useConsent()` and
60
+ * `<ConsentGate>` below re-renders when the decision changes — in this tab or another. Also owns
61
+ * whether your app's preferences UI is open, so a "Cookie settings" link anywhere (a footer) can
62
+ * reopen it with `openPreferences()`.
63
+ */
64
+ declare function Consent({ consent, children }: ConsentProps): import("react").JSX.Element;
65
+ //#endregion
66
+ //#region src/react/use-consent.d.ts
67
+ interface UseConsentReturn {
68
+ /** The underlying instance. */
69
+ consent: ConsentManager;
70
+ /** `unknown` during SSR/hydration, then `pending` or `decided`. */
71
+ status: ConsentStatus;
72
+ /** The valid decision, or `null` while `pending` / `unknown`. */
73
+ decision: ConsentDecision | null;
74
+ /** The four categories in order, each with its vendors and their cookies. */
75
+ categories: readonly ConsentCategory[];
76
+ /** Whether the visitor should be asked (status `pending`). `false` while `unknown`. */
77
+ needsDecision: boolean;
78
+ /**
79
+ * Reactive: necessary always, others only once decided. With a vendor, also whether it's used in
80
+ * that category — `isGranted('preferences', 'youtube')`.
81
+ */
82
+ isGranted: (category: ConsentCategoryId, vendorId?: string) => boolean;
83
+ isRequired: (category: ConsentCategoryId) => boolean;
84
+ /** Grant everything (closes the preferences). */
85
+ acceptAll: () => void;
86
+ /** Grant only the required categories (closes the preferences). */
87
+ rejectAll: () => void;
88
+ /** Grant exactly these (closes the preferences). */
89
+ save: (granted: Iterable<ConsentCategoryId>) => void;
90
+ /** Grant these on top of the current decision. */
91
+ grant: (...ids: ConsentCategoryId[]) => void;
92
+ /** Withdraw these from the current decision. */
93
+ revoke: (...ids: ConsentCategoryId[]) => void;
94
+ /** Forget the decision — the banner shows again. */
95
+ reset: () => void;
96
+ /** Whether the preferences are open (shared across the tree). */
97
+ isPreferencesOpen: boolean;
98
+ openPreferences: () => void;
99
+ closePreferences: () => void;
100
+ }
101
+ /**
102
+ * The visitor's consent, reactively, plus the actions to change it.
103
+ *
104
+ * @throws {Error} outside `<Consent>`.
105
+ */
106
+ declare function useConsent(): UseConsentReturn;
107
+ //#endregion
108
+ export { Consent, ConsentContext, type ConsentContextValue, ConsentGate, type ConsentGateApi, type ConsentGateProps, type ConsentProps, type UseConsentReturn, useConsent };
109
+ //# sourceMappingURL=react.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.d.mts","names":[],"sources":["../src/react/consent-context.ts","../src/react/consent-gate.tsx","../src/react/consent-provider.tsx","../src/react/use-consent.ts"],"mappings":";;;UAGiB;EACf,SAAS;EACT,UAAU;EACV;EACA,qBAAqB;;cAGV,gCAAc,QAAA;;;KCNtB,KAAK;UAEO;;EAEf,kBAAkB;;EAElB;;EAEA;;UAGe;;EAEf,UAAU,cAAc;;;;;;EAMxB;;EAEA,WAAW,cAAc,KAAK,mBAAmB;EACjD,WAAW;;;;;;;;;;;;;;;;;iBAkBG,cAAc,UAAU,QAAQ,UAAiB,YAAY,mCAAgB,IAAA;;;UClC5E;;EAEf,SAAS;EACT,WAAW;;;;;;;;iBASG,UAAU,SAAS,YAAY,+BAAY,IAAA;;;UCf1C;;EAEf,SAAS;;EAET,QAAQ;;EAER,UAAU;;EAEV,qBAAqB;;EAErB;;;;;EAKA,YAAY,UAAU,mBAAmB;EACzC,aAAa,UAAU;;EAEvB;;EAEA;;EAEA,OAAO,SAAS,SAAS;;EAEzB,WAAW,KAAK;;EAEhB,YAAY,KAAK;;EAEjB;;EAEA;EACA;EACA;;;;;;;iBAec,cAAc"}
package/dist/react.mjs ADDED
@@ -0,0 +1,120 @@
1
+ import { t as usedVendors } from "./used-vendors-Dxk4PZtY.mjs";
2
+ import { createContext, useContext, useMemo, useState, useSyncExternalStore } from "react";
3
+ import { Fragment, jsx } from "react/jsx-runtime";
4
+ //#region src/react/consent-context.ts
5
+ const ConsentContext = createContext(null);
6
+ //#endregion
7
+ //#region src/react/use-consent.ts
8
+ /** @internal Reads the raw context; throws outside `<Consent>`. */
9
+ function useConsentContext() {
10
+ const ctx = useContext(ConsentContext);
11
+ if (!ctx) throw new Error("useConsent must be used within <Consent consent={…}>.");
12
+ return ctx;
13
+ }
14
+ /**
15
+ * The visitor's consent, reactively, plus the actions to change it.
16
+ *
17
+ * @throws {Error} outside `<Consent>`.
18
+ */
19
+ function useConsent() {
20
+ const { consent, snapshot, isPreferencesOpen, setPreferencesOpen } = useConsentContext();
21
+ return useMemo(() => {
22
+ const m = consent;
23
+ const decision = snapshot.decision;
24
+ const closing = (fn) => (...args) => {
25
+ fn(...args);
26
+ setPreferencesOpen(false);
27
+ };
28
+ const usedIn = usedVendors(m.categories);
29
+ const isGranted = (id, vendorId) => (vendorId === void 0 || usedIn[id]?.has(vendorId) === true) && (m.isRequired(id) || (decision?.isGranted(id) ?? false));
30
+ return {
31
+ consent: m,
32
+ status: snapshot.status,
33
+ decision,
34
+ categories: m.categories,
35
+ needsDecision: snapshot.status === "pending",
36
+ isGranted,
37
+ isRequired: (id) => m.isRequired(id),
38
+ acceptAll: closing(() => m.acceptAll()),
39
+ rejectAll: closing(() => m.rejectAll()),
40
+ save: closing((granted) => m.save(granted)),
41
+ grant: (...ids) => void m.grant(...ids),
42
+ revoke: (...ids) => void m.revoke(...ids),
43
+ reset: () => m.reset(),
44
+ isPreferencesOpen,
45
+ openPreferences: () => setPreferencesOpen(true),
46
+ closePreferences: () => setPreferencesOpen(false)
47
+ };
48
+ }, [
49
+ consent,
50
+ snapshot,
51
+ isPreferencesOpen,
52
+ setPreferencesOpen
53
+ ]);
54
+ }
55
+ //#endregion
56
+ //#region src/react/consent-gate.tsx
57
+ /**
58
+ * Renders its children only once consent allows them — for embeds and widgets that set cookies or
59
+ * track (a YouTube player, a map, a chat widget). Shows `fallback` otherwise, including on the
60
+ * server and during hydration, so tracking content never renders before consent.
61
+ *
62
+ * ```tsx
63
+ * <ConsentGate
64
+ * category="preferences"
65
+ * vendor="youtube"
66
+ * fallback={(gate) => <button type="button" onClick={gate.grant}>Load video</button>}
67
+ * >
68
+ * <iframe src="https://www.youtube-nocookie.com/embed/…" />
69
+ * </ConsentGate>
70
+ * ```
71
+ */
72
+ function ConsentGate({ category, vendor, fallback = null, children }) {
73
+ const consent = useConsent();
74
+ const required = typeof category === "string" ? [category] : category;
75
+ const usedIn = (id) => consent.categories.find((c) => c.id === id)?.vendors.some((v) => v.id === vendor);
76
+ if (vendor !== void 0 && !required.every(usedIn)) return null;
77
+ const missing = required.filter((id) => !consent.isGranted(id));
78
+ if (missing.length === 0) return /* @__PURE__ */ jsx(Fragment, { children });
79
+ if (typeof fallback !== "function") return /* @__PURE__ */ jsx(Fragment, { children: fallback });
80
+ return /* @__PURE__ */ jsx(Fragment, { children: fallback({
81
+ missing,
82
+ grant: () => consent.grant(...missing),
83
+ openPreferences: consent.openPreferences
84
+ }) });
85
+ }
86
+ //#endregion
87
+ //#region src/react/consent-provider.tsx
88
+ const SERVER_SNAPSHOT = Object.freeze({
89
+ status: "unknown",
90
+ decision: null
91
+ });
92
+ const getServerSnapshot = () => SERVER_SNAPSHOT;
93
+ /**
94
+ * Supplies a consent instance to the tree and keeps it reactive: every `useConsent()` and
95
+ * `<ConsentGate>` below re-renders when the decision changes — in this tab or another. Also owns
96
+ * whether your app's preferences UI is open, so a "Cookie settings" link anywhere (a footer) can
97
+ * reopen it with `openPreferences()`.
98
+ */
99
+ function Consent({ consent, children }) {
100
+ const snapshot = useSyncExternalStore(consent.subscribe, consent.getSnapshot, getServerSnapshot);
101
+ const [isPreferencesOpen, setPreferencesOpen] = useState(false);
102
+ const value = useMemo(() => ({
103
+ consent,
104
+ snapshot,
105
+ isPreferencesOpen,
106
+ setPreferencesOpen
107
+ }), [
108
+ consent,
109
+ snapshot,
110
+ isPreferencesOpen
111
+ ]);
112
+ return /* @__PURE__ */ jsx(ConsentContext.Provider, {
113
+ value,
114
+ children
115
+ });
116
+ }
117
+ //#endregion
118
+ export { Consent, ConsentContext, ConsentGate, useConsent };
119
+
120
+ //# sourceMappingURL=react.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.mjs","names":[],"sources":["../src/react/consent-context.ts","../src/react/use-consent.ts","../src/react/consent-gate.tsx","../src/react/consent-provider.tsx"],"sourcesContent":["import { createContext } from 'react'\nimport type { ConsentManager, ConsentSnapshot } from '../types'\n\nexport interface ConsentContextValue {\n consent: ConsentManager\n snapshot: ConsentSnapshot\n isPreferencesOpen: boolean\n setPreferencesOpen: (open: boolean) => void\n}\n\nexport const ConsentContext = createContext<ConsentContextValue | null>(null)\n","import { useContext, useMemo } from 'react'\nimport type { ConsentCategoryId } from '../categories'\nimport type { ConsentDecision } from '../domain/consent-decision'\nimport type { ConsentCategory, ConsentManager, ConsentStatus } from '../types'\nimport { usedVendors } from '../used-vendors'\nimport { ConsentContext, type ConsentContextValue } from './consent-context'\n\nexport interface UseConsentReturn {\n /** The underlying instance. */\n consent: ConsentManager\n /** `unknown` during SSR/hydration, then `pending` or `decided`. */\n status: ConsentStatus\n /** The valid decision, or `null` while `pending` / `unknown`. */\n decision: ConsentDecision | null\n /** The four categories in order, each with its vendors and their cookies. */\n categories: readonly ConsentCategory[]\n /** Whether the visitor should be asked (status `pending`). `false` while `unknown`. */\n needsDecision: boolean\n /**\n * Reactive: necessary always, others only once decided. With a vendor, also whether it's used in\n * that category — `isGranted('preferences', 'youtube')`.\n */\n isGranted: (category: ConsentCategoryId, vendorId?: string) => boolean\n isRequired: (category: ConsentCategoryId) => boolean\n /** Grant everything (closes the preferences). */\n acceptAll: () => void\n /** Grant only the required categories (closes the preferences). */\n rejectAll: () => void\n /** Grant exactly these (closes the preferences). */\n save: (granted: Iterable<ConsentCategoryId>) => void\n /** Grant these on top of the current decision. */\n grant: (...ids: ConsentCategoryId[]) => void\n /** Withdraw these from the current decision. */\n revoke: (...ids: ConsentCategoryId[]) => void\n /** Forget the decision — the banner shows again. */\n reset: () => void\n /** Whether the preferences are open (shared across the tree). */\n isPreferencesOpen: boolean\n openPreferences: () => void\n closePreferences: () => void\n}\n\n/** @internal Reads the raw context; throws outside `<Consent>`. */\nexport function useConsentContext(): ConsentContextValue {\n const ctx = useContext(ConsentContext)\n if (!ctx) throw new Error('useConsent must be used within <Consent consent={…}>.')\n return ctx\n}\n\n/**\n * The visitor's consent, reactively, plus the actions to change it.\n *\n * @throws {Error} outside `<Consent>`.\n */\nexport function useConsent(): UseConsentReturn {\n const { consent, snapshot, isPreferencesOpen, setPreferencesOpen } = useConsentContext()\n return useMemo(() => {\n const m = consent\n const decision = snapshot.decision\n const closing =\n <A extends unknown[]>(fn: (...args: A) => unknown) =>\n (...args: A) => {\n fn(...args)\n setPreferencesOpen(false)\n }\n const usedIn = usedVendors(m.categories)\n const isGranted = (id: ConsentCategoryId, vendorId?: string) =>\n (vendorId === undefined || usedIn[id]?.has(vendorId) === true) &&\n (m.isRequired(id) || (decision?.isGranted(id) ?? false))\n return {\n consent: m,\n status: snapshot.status,\n decision,\n categories: m.categories,\n needsDecision: snapshot.status === 'pending',\n isGranted,\n isRequired: (id) => m.isRequired(id),\n acceptAll: closing(() => m.acceptAll()),\n rejectAll: closing(() => m.rejectAll()),\n save: closing((granted: Iterable<ConsentCategoryId>) => m.save(granted)),\n grant: (...ids) => void m.grant(...ids),\n revoke: (...ids) => void m.revoke(...ids),\n reset: () => m.reset(),\n isPreferencesOpen,\n openPreferences: () => setPreferencesOpen(true),\n closePreferences: () => setPreferencesOpen(false),\n }\n }, [consent, snapshot, isPreferencesOpen, setPreferencesOpen])\n}\n","import type { ReactNode } from 'react'\nimport type { ConsentCategoryId } from '../categories'\nimport { useConsent } from './use-consent'\n\ntype Id = ConsentCategoryId\n\nexport interface ConsentGateApi {\n /** The categories still missing. */\n missing: readonly Id[]\n /** Grant the missing categories right here (\"Load video\" on a placeholder). */\n grant: () => void\n /** Open the preferences instead. */\n openPreferences: () => void\n}\n\nexport interface ConsentGateProps {\n /** The category — or categories, all required — the content needs. */\n category: Id | readonly Id[]\n /**\n * The vendor the content belongs to (`\"youtube\"`). The gate then also needs that vendor to be used\n * in the category — and renders nothing, not even the fallback, when it isn't: that integration\n * is off for this app.\n */\n vendor?: string\n /** Rendered instead while consent is missing. A function gets the gate's api. */\n fallback?: ReactNode | ((api: ConsentGateApi) => ReactNode)\n children?: ReactNode\n}\n\n/**\n * Renders its children only once consent allows them — for embeds and widgets that set cookies or\n * track (a YouTube player, a map, a chat widget). Shows `fallback` otherwise, including on the\n * server and during hydration, so tracking content never renders before consent.\n *\n * ```tsx\n * <ConsentGate\n * category=\"preferences\"\n * vendor=\"youtube\"\n * fallback={(gate) => <button type=\"button\" onClick={gate.grant}>Load video</button>}\n * >\n * <iframe src=\"https://www.youtube-nocookie.com/embed/…\" />\n * </ConsentGate>\n * ```\n */\nexport function ConsentGate({ category, vendor, fallback = null, children }: ConsentGateProps) {\n const consent = useConsent()\n const required = (typeof category === 'string' ? [category] : category) as readonly Id[]\n // A vendor that isn't used in (every one of) these categories: the integration is off.\n const usedIn = (id: Id) =>\n consent.categories.find((c) => c.id === id)?.vendors.some((v) => v.id === vendor)\n if (vendor !== undefined && !required.every(usedIn)) return null\n const missing = required.filter((id) => !consent.isGranted(id))\n\n if (missing.length === 0) return <>{children}</>\n if (typeof fallback !== 'function') return <>{fallback}</>\n return (\n <>\n {fallback({\n missing,\n grant: () => consent.grant(...missing),\n openPreferences: consent.openPreferences,\n })}\n </>\n )\n}\n","import type { ReactNode } from 'react'\nimport { useMemo, useState, useSyncExternalStore } from 'react'\nimport type { ConsentManager, ConsentSnapshot } from '../types'\nimport { ConsentContext, type ConsentContextValue } from './consent-context'\n\n// Storage is out of reach on the server: render as `unknown` (gates closed, no banner) and let the\n// client snapshot take over after hydration — so a visitor who already decided never sees a flash.\nconst SERVER_SNAPSHOT: ConsentSnapshot = Object.freeze({ status: 'unknown', decision: null })\nconst getServerSnapshot = () => SERVER_SNAPSHOT\n\nexport interface ConsentProps {\n /** The instance from `createConsent(config)`. */\n consent: ConsentManager\n children?: ReactNode\n}\n\n/**\n * Supplies a consent instance to the tree and keeps it reactive: every `useConsent()` and\n * `<ConsentGate>` below re-renders when the decision changes — in this tab or another. Also owns\n * whether your app's preferences UI is open, so a \"Cookie settings\" link anywhere (a footer) can\n * reopen it with `openPreferences()`.\n */\nexport function Consent({ consent, children }: ConsentProps) {\n const snapshot = useSyncExternalStore(consent.subscribe, consent.getSnapshot, getServerSnapshot)\n const [isPreferencesOpen, setPreferencesOpen] = useState(false)\n\n const value = useMemo<ConsentContextValue>(\n () => ({ consent, snapshot, isPreferencesOpen, setPreferencesOpen }),\n [consent, snapshot, isPreferencesOpen],\n )\n return <ConsentContext.Provider value={value}>{children}</ConsentContext.Provider>\n}\n"],"mappings":";;;;AAUA,MAAa,iBAAiB,cAA0C,IAAI;;;;ACiC5E,SAAgB,oBAAyC;CACvD,MAAM,MAAM,WAAW,cAAc;CACrC,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,uDAAuD;CACjF,OAAO;AACT;;;;;;AAOA,SAAgB,aAA+B;CAC7C,MAAM,EAAE,SAAS,UAAU,mBAAmB,uBAAuB,kBAAkB;CACvF,OAAO,cAAc;EACnB,MAAM,IAAI;EACV,MAAM,WAAW,SAAS;EAC1B,MAAM,WACkB,QACrB,GAAG,SAAY;GACd,GAAG,GAAG,IAAI;GACV,mBAAmB,KAAK;EAC1B;EACF,MAAM,SAAS,YAAY,EAAE,UAAU;EACvC,MAAM,aAAa,IAAuB,cACvC,aAAa,KAAA,KAAa,OAAO,GAAG,EAAE,IAAI,QAAQ,MAAM,UACxD,EAAE,WAAW,EAAE,MAAM,UAAU,UAAU,EAAE,KAAK;EACnD,OAAO;GACL,SAAS;GACT,QAAQ,SAAS;GACjB;GACA,YAAY,EAAE;GACd,eAAe,SAAS,WAAW;GACnC;GACA,aAAa,OAAO,EAAE,WAAW,EAAE;GACnC,WAAW,cAAc,EAAE,UAAU,CAAC;GACtC,WAAW,cAAc,EAAE,UAAU,CAAC;GACtC,MAAM,SAAS,YAAyC,EAAE,KAAK,OAAO,CAAC;GACvE,QAAQ,GAAG,QAAQ,KAAK,EAAE,MAAM,GAAG,GAAG;GACtC,SAAS,GAAG,QAAQ,KAAK,EAAE,OAAO,GAAG,GAAG;GACxC,aAAa,EAAE,MAAM;GACrB;GACA,uBAAuB,mBAAmB,IAAI;GAC9C,wBAAwB,mBAAmB,KAAK;EAClD;CACF,GAAG;EAAC;EAAS;EAAU;EAAmB;CAAkB,CAAC;AAC/D;;;;;;;;;;;;;;;;;;AC5CA,SAAgB,YAAY,EAAE,UAAU,QAAQ,WAAW,MAAM,YAA8B;CAC7F,MAAM,UAAU,WAAW;CAC3B,MAAM,WAAY,OAAO,aAAa,WAAW,CAAC,QAAQ,IAAI;CAE9D,MAAM,UAAU,OACd,QAAQ,WAAW,MAAM,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,MAAM,MAAM,EAAE,OAAO,MAAM;CAClF,IAAI,WAAW,KAAA,KAAa,CAAC,SAAS,MAAM,MAAM,GAAG,OAAO;CAC5D,MAAM,UAAU,SAAS,QAAQ,OAAO,CAAC,QAAQ,UAAU,EAAE,CAAC;CAE9D,IAAI,QAAQ,WAAW,GAAG,OAAO,oBAAA,UAAA,EAAG,SAAW,CAAA;CAC/C,IAAI,OAAO,aAAa,YAAY,OAAO,oBAAA,UAAA,EAAA,UAAG,SAAW,CAAA;CACzD,OACE,oBAAA,UAAA,EAAA,UACG,SAAS;EACR;EACA,aAAa,QAAQ,MAAM,GAAG,OAAO;EACrC,iBAAiB,QAAQ;CAC3B,CAAC,EACD,CAAA;AAEN;;;ACzDA,MAAM,kBAAmC,OAAO,OAAO;CAAE,QAAQ;CAAW,UAAU;AAAK,CAAC;AAC5F,MAAM,0BAA0B;;;;;;;AAchC,SAAgB,QAAQ,EAAE,SAAS,YAA0B;CAC3D,MAAM,WAAW,qBAAqB,QAAQ,WAAW,QAAQ,aAAa,iBAAiB;CAC/F,MAAM,CAAC,mBAAmB,sBAAsB,SAAS,KAAK;CAE9D,MAAM,QAAQ,eACL;EAAE;EAAS;EAAU;EAAmB;CAAmB,IAClE;EAAC;EAAS;EAAU;CAAiB,CACvC;CACA,OAAO,oBAAC,eAAe,UAAhB;EAAgC;EAAQ;CAAkC,CAAA;AACnF"}
@@ -0,0 +1,272 @@
1
+ import { ObservableStore } from "@luwiostack/storage";
2
+ //#region src/categories.d.ts
3
+ /**
4
+ * The fixed consent categories, in display order — the same four every consent tool (and Google
5
+ * Consent Mode) works with. `necessary` is always granted. A category's name and description are
6
+ * translated by machine name (`consent_category_<id>`, `consent_category_<id>_description`) from
7
+ * the package catalogs.
8
+ */
9
+ declare const CONSENT_CATEGORIES: readonly ['necessary', 'preferences', 'statistics', 'marketing'];
10
+ /** `'necessary' | 'preferences' | 'statistics' | 'marketing'` */
11
+ type ConsentCategoryId = (typeof CONSENT_CATEGORIES)[number];
12
+ /** The category that is always granted and can't be refused. */
13
+ declare const REQUIRED_CATEGORY = "necessary";
14
+ /** Whether a value is one of the fixed category ids. */
15
+ declare function isConsentCategoryId(value: unknown): value is ConsentCategoryId;
16
+ //#endregion
17
+ //#region src/domain/consent-decision.d.ts
18
+ interface ConsentDecisionInput {
19
+ consent_id: string;
20
+ policy_version: string;
21
+ granted: Iterable<ConsentCategoryId>;
22
+ decided_at: number;
23
+ }
24
+ /**
25
+ * One visitor's answer to the consent question: which categories they granted, under which policy
26
+ * version, and when. Immutable and always valid — the factory throws on a malformed input.
27
+ *
28
+ * Validity over time (policy version, expiry) is not the decision's concern: the consent instance
29
+ * decides whether a stored decision still counts.
30
+ */
31
+ declare class ConsentDecision {
32
+ #private;
33
+ readonly consent_id: string;
34
+ readonly policy_version: string;
35
+ /** When the decision was made, in epoch milliseconds. */
36
+ readonly decided_at: number;
37
+ private constructor();
38
+ /** @throws {ConsentError} on an empty `consent_id` / `policy_version` or a non-finite `decided_at`. */
39
+ static new(input: ConsentDecisionInput): ConsentDecision;
40
+ /** Like {@link ConsentDecision.new}, but returns `null` instead of throwing. */
41
+ static tryNew(input: ConsentDecisionInput): ConsentDecision | null;
42
+ /** Whether this decision grants the category. */
43
+ isGranted(id: ConsentCategoryId): boolean;
44
+ /** Every granted category id. */
45
+ granted(): ConsentCategoryId[];
46
+ /** Same id, version, time and granted set. */
47
+ equals(other: ConsentDecision): boolean;
48
+ /** The serialized form kept in the store. */
49
+ toJSON(): StoredConsent;
50
+ }
51
+ //#endregion
52
+ //#region src/types.d.ts
53
+ /**
54
+ * A category as the consent instance presents it: one of the fixed four, whether it's required, and
55
+ * the vendors that set cookies in it — each with only its cookies of this category. Derived from the
56
+ * config; carries no display text: `t(category.machine_name)` and
57
+ * `t(category.description_machine_name)`.
58
+ */
59
+ interface ConsentCategory {
60
+ readonly id: ConsentCategoryId;
61
+ /** The translation key of its name, e.g. `consent_category_statistics`. */
62
+ readonly machine_name: string;
63
+ /** The translation key of its description, e.g. `consent_category_statistics_description`. */
64
+ readonly description_machine_name: string;
65
+ /** `true` for `necessary` only: always granted, can't be switched off. */
66
+ readonly required: boolean;
67
+ /** The vendors with cookies in this category, their cookies narrowed to it. May be empty. */
68
+ readonly vendors: readonly ConsentVendor[];
69
+ }
70
+ /**
71
+ * A partner that sets cookies — your own site, Google, Meta, YouTube — as you declare it: its id
72
+ * and every cookie it sets. One vendor may set cookies in several categories. A preset from
73
+ * `@luwiostack/cookie-consent/vendors` is one; so is your own site.
74
+ */
75
+ interface ConsentVendorDeclaration {
76
+ /**
77
+ * Stable id — what `isGranted(category, vendor)` and analytics' `vendor` refer to. snake_case by
78
+ * convention; its machine name is derived from it.
79
+ */
80
+ readonly id: string;
81
+ /** Where the vendor explains what it does with the data. */
82
+ readonly privacy_policy_url?: string;
83
+ /**
84
+ * The countries outside the EEA the vendor sends visitors' personal data to, each with its
85
+ * safeguards. `[]`: it stays in the EEA; absent: not declared.
86
+ */
87
+ readonly transfers?: readonly ConsentTransferDeclaration[];
88
+ /** Every cookie (or storage item) this vendor sets, each with its category. */
89
+ readonly cookies: readonly ConsentCookieDeclaration[];
90
+ }
91
+ /**
92
+ * A vendor as the consent instance presents it: the declaration plus its machine names. Carries no
93
+ * display text: render its name with `t(vendor.machine_name)`.
94
+ */
95
+ interface ConsentVendor extends ConsentVendorDeclaration {
96
+ /** The translation key of its name: its id as a machine name, e.g. `google_analytics`. */
97
+ readonly machine_name: string;
98
+ readonly transfers?: readonly ConsentTransfer[];
99
+ readonly cookies: readonly ConsentCookie[];
100
+ }
101
+ /**
102
+ * What makes a transfer outside the EEA lawful (GDPR art. 45-47): an adequacy decision for the
103
+ * country, the vendor's EU-US Data Privacy Framework certification, standard contractual clauses or
104
+ * binding corporate rules.
105
+ */
106
+ type ConsentTransferSafeguard = 'adequacy' | 'dpf' | 'scc' | 'bcr';
107
+ /** One country outside the EEA a vendor sends personal data to, as you declare it. */
108
+ interface ConsentTransferDeclaration {
109
+ /** ISO 3166-1 alpha-2, e.g. `US`; render it with `Intl.DisplayNames`. */
110
+ readonly country: string;
111
+ /** At least one. */
112
+ readonly safeguards: readonly ConsentTransferSafeguard[];
113
+ }
114
+ /** A transfer as the consent instance presents it: `t(key)` for each of `safeguard_machine_names`. */
115
+ interface ConsentTransfer extends ConsentTransferDeclaration {
116
+ /** The safeguards' translation keys, in order, e.g. `consent_transfer_safeguard_dpf`. */
117
+ readonly safeguard_machine_names: readonly string[];
118
+ }
119
+ /** Whether a cookie is set on the site's own domain or on the vendor's. */
120
+ type ConsentCookieParty = 'first' | 'third';
121
+ /** Where a cookie lives. `http` is a real cookie; the others are browser storage or a tracking pixel. */
122
+ type ConsentCookieType = 'http' | 'local_storage' | 'session_storage' | 'indexed_db' | 'pixel';
123
+ /**
124
+ * How long a cookie lives: milliseconds (like `maxAge`), `'session'` (gone when the browser closes)
125
+ * or `'persistent'` (no expiry — e.g. a `localStorage` item).
126
+ */
127
+ type ConsentCookieMaxAge = number | ConsentCookieWordedMaxAge;
128
+ /** The lifetimes that are a word, not a duration — translated, not formatted. */
129
+ type ConsentCookieWordedMaxAge = 'session' | 'persistent';
130
+ /**
131
+ * One cookie a vendor sets, as you declare it. `name` is the real cookie name (`_ga`, `_fbp`) — a
132
+ * technical identifier, not display text.
133
+ */
134
+ interface ConsentCookieDeclaration {
135
+ /** The cookie's actual name, e.g. `_ga`. Unique within its vendor. */
136
+ readonly name: string;
137
+ /** What it's for — the category the visitor must grant before it may be set. */
138
+ readonly category: ConsentCategoryId;
139
+ /** Default `'http'`. */
140
+ readonly type?: ConsentCookieType;
141
+ /** Its lifetime. Format it with `ConsentCookieFormatter.formatLocale`. */
142
+ readonly max_age: ConsentCookieMaxAge;
143
+ /**
144
+ * The vendor's domain it's set on (or, for storage, the origin's host), e.g. `.youtube.com`.
145
+ * Absent: the site's own domain, so a first-party cookie.
146
+ */
147
+ readonly domain?: string;
148
+ }
149
+ /**
150
+ * A cookie as the consent instance presents it: the declaration plus the translation keys of
151
+ * everything about it that's text — `t(cookie.machine_name)` (its purpose),
152
+ * `t(cookie.type_machine_name)`, `t(cookie.party_machine_name)`, and its lifetime as
153
+ * `ConsentCookieFormatter.formatLocale(cookie, locale) ?? t(cookie.max_age_machine_name)`.
154
+ */
155
+ interface ConsentCookie extends ConsentCookieDeclaration {
156
+ /**
157
+ * The translation key of its purpose: the vendor's machine name plus the cookie name, a `*` read
158
+ * as `wildcard` — `google_analytics_ga`, `google_analytics_ga_wildcard` for `_ga_*`.
159
+ */
160
+ readonly machine_name: string;
161
+ /** The translation key of its type, e.g. `consent_cookie_type_http` (the default type). */
162
+ readonly type_machine_name: string;
163
+ /** `third` when it has a `domain`, else `first`. */
164
+ readonly party: ConsentCookieParty;
165
+ /** The translation key of its party: `consent_cookie_party_first` / `consent_cookie_party_third`. */
166
+ readonly party_machine_name: string;
167
+ /**
168
+ * The translation key of a worded lifetime (`consent_max_age_session`,
169
+ * `consent_max_age_persistent`); absent for a duration, which `formatLocale` formats itself.
170
+ */
171
+ readonly max_age_machine_name?: string;
172
+ }
173
+ /** The serialized form of a decision, as kept in the store. Fields are snake_case like every dataset. */
174
+ interface StoredConsent {
175
+ /** Random id for this visitor's consent — reused across later changes; quote it in a consent log. */
176
+ consent_id: string;
177
+ /** The `policyVersion` the visitor agreed to. A different version invalidates the decision. */
178
+ policy_version: string;
179
+ /** The ids of every granted category (required ones included). */
180
+ granted: string[];
181
+ /** When the decision was made, in epoch milliseconds. */
182
+ decided_at: number;
183
+ }
184
+ /**
185
+ * - `pending` — no valid decision: none stored, or it's for another policy version, or it expired.
186
+ * Only required categories count as granted; a banner should ask.
187
+ * - `decided` — a valid decision is stored.
188
+ * - `unknown` — not readable yet: the server render (and hydration pass) in React, where storage is
189
+ * out of reach. Treated like `pending` for gating, but a banner must not show.
190
+ */
191
+ type ConsentStatus = 'unknown' | 'pending' | 'decided';
192
+ /** The current consent state — referentially stable between changes (safe for `useSyncExternalStore`). */
193
+ interface ConsentSnapshot {
194
+ readonly status: ConsentStatus;
195
+ /** The valid decision, or `null` while `pending` / `unknown`. */
196
+ readonly decision: ConsentDecision | null;
197
+ }
198
+ /**
199
+ * Per category, the vendors the app uses there. A vendor listed under a category brings only its
200
+ * cookies of that category — plus its necessary cookies, which are always allowed. So
201
+ * `preferences: [youtube()]` is the YouTube embed without its marketing cookies; list it under
202
+ * `marketing` too to declare those.
203
+ */
204
+ type ConsentCategoriesConfig = Partial<Record<ConsentCategoryId, readonly ConsentVendorDeclaration[]>>;
205
+ interface ConsentConfig {
206
+ /**
207
+ * Per category, the vendors used in it — usually presets from `@luwiostack/cookie-consent/vendors`.
208
+ * Default: none.
209
+ */
210
+ categories?: ConsentCategoriesConfig;
211
+ /**
212
+ * The version of your cookie policy. Bump it when the policy changes materially (new vendors, new
213
+ * purposes) and every stored decision for an older version becomes `pending` again. Default `1`.
214
+ */
215
+ policyVersion?: string | number;
216
+ /**
217
+ * How long a decision stays valid, in milliseconds; after that the visitor is asked again.
218
+ * Default: 365 days. Pass `Number.POSITIVE_INFINITY` to never expire.
219
+ */
220
+ maxAge?: number;
221
+ /**
222
+ * Where the decision is kept. Default: `localStore('luwio.consent', { onError: 'ignore' })` from
223
+ * `@luwiostack/storage` (persists across tabs and restarts, synced between tabs; where storage is
224
+ * blocked or full the decision just isn't kept). A store you pass in fails per its own `onError`
225
+ * — by default a failed write throws out of `acceptAll()` & co. Pass `memoryStore()` in tests.
226
+ */
227
+ store?: ObservableStore<StoredConsent>;
228
+ /** The current time in epoch milliseconds. Default `Date.now` — inject for tests. */
229
+ now?: () => number;
230
+ /**
231
+ * Called after every decision made **through this instance** (accept, reject, save, grant, revoke,
232
+ * reset) — not for changes arriving from another tab. The place to log consent server-side.
233
+ */
234
+ onChange?: (next: ConsentDecision | null, previous: ConsentDecision | null) => void;
235
+ }
236
+ /** A consent instance — created once with `createConsent(config)` and handed to `<Consent>`. */
237
+ interface ConsentManager {
238
+ /** The four categories in order, each with the vendors (and cookies) configured in it. */
239
+ readonly categories: readonly ConsentCategory[];
240
+ /** Every vendor in use, once, with only the cookies its categories bring in. */
241
+ readonly vendors: readonly ConsentVendor[];
242
+ /** The configured policy version, as a string. */
243
+ readonly policyVersion: string;
244
+ /** The current state. Never `unknown` — that status is only produced by the React server snapshot. */
245
+ getSnapshot(): ConsentSnapshot;
246
+ /** Subscribe to changes (this tab and, for `localStorage`, others); returns an unsubscribe. */
247
+ subscribe(onChange: () => void): () => void;
248
+ /**
249
+ * Whether a category is granted now — `necessary` always is, others only once decided. With a
250
+ * vendor, also whether that vendor is used in this category: `isGranted('preferences', 'youtube')`
251
+ * is the YouTube embed, `isGranted('marketing', 'youtube')` its tracking. `false` for a vendor
252
+ * that isn't configured in the category.
253
+ */
254
+ isGranted(category: ConsentCategoryId, vendorId?: string): boolean;
255
+ /** Whether a category is required (always granted) — `necessary`. */
256
+ isRequired(category: ConsentCategoryId): boolean;
257
+ /** Grant every category. */
258
+ acceptAll(): ConsentDecision;
259
+ /** Grant only `necessary`. */
260
+ rejectAll(): ConsentDecision;
261
+ /** Grant exactly these categories (`necessary` is always added; unknown ids are ignored). */
262
+ save(granted: Iterable<ConsentCategoryId>): ConsentDecision;
263
+ /** Grant these categories on top of the current decision (or on top of `necessary` while pending). */
264
+ grant(...ids: ConsentCategoryId[]): ConsentDecision;
265
+ /** Withdraw these categories from the current decision. `necessary` can't be withdrawn. */
266
+ revoke(...ids: ConsentCategoryId[]): ConsentDecision;
267
+ /** Forget the decision — the status goes back to `pending`. */
268
+ reset(): void;
269
+ }
270
+ //#endregion
271
+ export { REQUIRED_CATEGORY as C, ConsentCategoryId as S, ConsentVendorDeclaration as _, ConsentCookieDeclaration as a, ConsentDecisionInput as b, ConsentCookieType as c, ConsentSnapshot as d, ConsentStatus as f, ConsentVendor as g, ConsentTransferSafeguard as h, ConsentCookie as i, ConsentCookieWordedMaxAge as l, ConsentTransferDeclaration as m, ConsentCategory as n, ConsentCookieMaxAge as o, ConsentTransfer as p, ConsentConfig as r, ConsentCookieParty as s, ConsentCategoriesConfig as t, ConsentManager as u, StoredConsent as v, isConsentCategoryId as w, CONSENT_CATEGORIES as x, ConsentDecision as y };
272
+ //# sourceMappingURL=types-ByyibBUg.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-ByyibBUg.d.cts","names":[],"sources":["../src/categories.ts","../src/domain/consent-decision.ts","../src/types.ts"],"mappings":";;;;;;;;cAMa;;KAGD,4BAA4B;;cAG3B;;iBAGG,oBAAoB,iBAAiB,SAAS;;;UCX7C;EACf;EACA;EACA,SAAS,SAAS;EAClB;;;;;;;;;cAUW;;WACF;WACA;;WAEA;UAGF;;SAQA,IAAI,OAAO,uBAAuB;;SAclC,OAAO,OAAO,uBAAuB;;EAS5C,UAAU,IAAI;;EAKd,WAAW;;EAKX,OAAO,OAAO;;EAcd,UAAU;;;;;;;;;;UCtEK;WACN,IAAI;;WAEJ;;WAEA;;WAEA;;WAEA,kBAAkB;;;;;;;UAQZ;;;;;WAKN;;WAEA;;;;;WAKA,qBAAqB;;WAErB,kBAAkB;;;;;;UAOZ,sBAAsB;;WAE5B;WACA,qBAAqB;WACrB,kBAAkB;;;;;;;KAQjB;;UAGK;;WAEN;;WAEA,qBAAqB;;;UAIf,wBAAwB;;WAE9B;;;KAIC;;KAGA;;;;;KAWA,+BAA+B;;KAG/B;;;;;UAMK;;WAEN;;WAEA,UAAU;;WAEV,OAAO;;WAEP,SAAS;;;;;WAKT;;;;;;;;UASM,sBAAsB;;;;;WAK5B;;WAEA;;WAEA,OAAO;;WAEP;;;;;WAKA;;;UAIM;;EAEf;;EAEA;;EAEA;;EAEA;;;;;;;;;KAUU;;UAGK;WACN,QAAQ;;WAER,UAAU;;;;;;;;KAST,0BAA0B,QACpC,OAAO,4BAA4B;UAGpB;;;;;EAKf,aAAa;;;;;EAKb;;;;;EAKA;;;;;;;EAOA,QAAQ,gBAAgB;;EAExB;;;;;EAKA,YAAY,MAAM,wBAAwB,UAAU;;;UAIrC;;WAEN,qBAAqB;;WAErB,kBAAkB;;WAElB;;EAET,eAAe;;EAEf,UAAU;;;;;;;EAOV,UAAU,UAAU,mBAAmB;;EAEvC,WAAW,UAAU;;EAErB,aAAa;;EAEb,aAAa;;EAEb,KAAK,SAAS,SAAS,qBAAqB;;EAE5C,SAAS,KAAK,sBAAsB;;EAEpC,UAAU,KAAK,sBAAsB;;EAErC"}