@solvenza/cookies-compliance 1.2.1 → 1.5.3

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.
Files changed (72) hide show
  1. package/README.md +960 -36
  2. package/bin/audit-cli.js +134 -13
  3. package/dist/audit.cjs +811 -0
  4. package/dist/audit.cjs.map +1 -0
  5. package/dist/audit.d.cts +60 -0
  6. package/dist/audit.d.ts +60 -0
  7. package/dist/audit.js +380 -0
  8. package/dist/audit.js.map +1 -0
  9. package/dist/chunk-C5QPXHTH.js +3557 -0
  10. package/dist/chunk-C5QPXHTH.js.map +1 -0
  11. package/dist/chunk-OHOHIAK6.js +442 -0
  12. package/dist/chunk-OHOHIAK6.js.map +1 -0
  13. package/dist/chunk-Q3FZFXQE.js +89 -0
  14. package/dist/chunk-UQU54ANZ.js +225 -0
  15. package/dist/chunk-UQU54ANZ.js.map +1 -0
  16. package/dist/chunk-W5MG56VI.js +269 -0
  17. package/dist/chunk-W5MG56VI.js.map +1 -0
  18. package/dist/consent.esm.cjs +2195 -84
  19. package/dist/consent.esm.cjs.map +1 -1
  20. package/dist/consent.esm.d.cts +173 -6
  21. package/dist/consent.esm.d.ts +173 -6
  22. package/dist/consent.esm.js +57 -23
  23. package/dist/consent.esm.js.map +1 -1
  24. package/dist/consent.min.js +437 -55
  25. package/dist/consent.min.js.map +1 -1
  26. package/dist/presets.cjs +495 -0
  27. package/dist/presets.cjs.map +1 -0
  28. package/dist/presets.d.cts +51 -0
  29. package/dist/presets.d.ts +51 -0
  30. package/dist/presets.js +16 -0
  31. package/dist/presets.js.map +1 -0
  32. package/dist/types--kyI7OOR.d.cts +314 -0
  33. package/dist/types--kyI7OOR.d.ts +314 -0
  34. package/dist/wrappers/angular.cjs +2341 -65
  35. package/dist/wrappers/angular.cjs.map +1 -1
  36. package/dist/wrappers/angular.d.cts +85 -5
  37. package/dist/wrappers/angular.d.ts +85 -5
  38. package/dist/wrappers/angular.js +217 -3
  39. package/dist/wrappers/angular.js.map +1 -1
  40. package/dist/wrappers/next.cjs +2353 -103
  41. package/dist/wrappers/next.cjs.map +1 -1
  42. package/dist/wrappers/next.d.cts +25 -1
  43. package/dist/wrappers/next.d.ts +25 -1
  44. package/dist/wrappers/next.js +30 -5
  45. package/dist/wrappers/next.js.map +1 -1
  46. package/dist/wrappers/nuxt.cjs +4171 -0
  47. package/dist/wrappers/nuxt.cjs.map +1 -0
  48. package/dist/wrappers/nuxt.d.cts +33 -0
  49. package/dist/wrappers/nuxt.d.ts +33 -0
  50. package/dist/wrappers/nuxt.js +51 -0
  51. package/dist/wrappers/nuxt.js.map +1 -0
  52. package/dist/wrappers/react.cjs +2336 -141
  53. package/dist/wrappers/react.cjs.map +1 -1
  54. package/dist/wrappers/react.d.cts +87 -1
  55. package/dist/wrappers/react.d.ts +87 -1
  56. package/dist/wrappers/react.js +21 -51
  57. package/dist/wrappers/react.js.map +1 -1
  58. package/dist/wrappers/vue.cjs +4163 -0
  59. package/dist/wrappers/vue.cjs.map +1 -0
  60. package/dist/wrappers/vue.d.cts +144 -0
  61. package/dist/wrappers/vue.d.ts +144 -0
  62. package/dist/wrappers/vue.js +28 -0
  63. package/dist/wrappers/vue.js.map +1 -0
  64. package/dist/wrappers/wordpress.js +1 -1
  65. package/package.json +26 -5
  66. package/schema.json +143 -4
  67. package/dist/chunk-DDAAVRWG.js +0 -25
  68. package/dist/chunk-FBRP4MSA.js +0 -1907
  69. package/dist/chunk-FBRP4MSA.js.map +0 -1
  70. package/dist/consent-engine-DOMyEKfk.d.cts +0 -193
  71. package/dist/consent-engine-DOMyEKfk.d.ts +0 -193
  72. /package/dist/{chunk-DDAAVRWG.js.map → chunk-Q3FZFXQE.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/config-validator.ts","../src/core/security.ts","../src/core/receipt.ts","../src/storage/cookie-store.ts","../src/storage/memory-store.ts","../src/storage/storage-cleaner.ts","../src/blocker/script-gate.ts","../src/blocker/iframe-gate.ts","../src/blocker/resource-gate.ts","../src/services/google.ts","../src/ui/styles.ts","../src/ui/floating-badge.ts","../src/diagnostics/resource-scanner.ts","../src/ui/policy-generator.ts","../src/i18n/engine.ts","../src/core/gpc.ts","../src/core/state.ts","../src/core/events.ts","../src/core/policy-engine.ts","../src/blocker/registry.ts","../src/services/custom.ts","../src/ui/banner.ts","../src/ui/preferences.ts","../src/core/consent-engine.ts"],"sourcesContent":["import type { ConsentConfig } from \"./types.js\";\n\nexport class ConfigValidationError extends Error {\n constructor(message: string) {\n super(`[ConsentSDK Config Error] ${message}`);\n this.name = \"ConfigValidationError\";\n }\n}\n\nexport function validateConfig(config: ConsentConfig): void {\n if (!config) {\n throw new ConfigValidationError(\"Configuration object is null or undefined.\");\n }\n\n if (typeof config.schemaVersion !== \"number\" || config.schemaVersion < 1) {\n throw new ConfigValidationError(\"Invalid or missing 'schemaVersion'. Expected integer >= 1.\");\n }\n\n if (!config.policyVersion || typeof config.policyVersion !== \"string\") {\n throw new ConfigValidationError(\"Invalid or missing 'policyVersion'. String required.\");\n }\n\n if (!config.categories || typeof config.categories !== \"object\") {\n throw new ConfigValidationError(\"Missing 'categories' map in configuration.\");\n }\n\n const categoryKeys = Object.keys(config.categories);\n if (categoryKeys.length === 0) {\n throw new ConfigValidationError(\"At least one category must be defined in 'categories'.\");\n }\n\n // Ensure necessary category exists and is required\n const necessaryCategory = config.categories[\"necessary\"];\n if (!necessaryCategory) {\n throw new ConfigValidationError(\"Category 'necessary' must be defined.\");\n }\n if (necessaryCategory.required !== true) {\n throw new ConfigValidationError(\"Category 'necessary' must have 'required: true'.\");\n }\n\n // Legal guardrail (AEPD): Optional categories MUST NOT be pre-selected (default = true)\n for (const [catId, catConfig] of Object.entries(config.categories)) {\n if (catId !== \"necessary\" && !catConfig.required) {\n if (catConfig.default === true) {\n throw new ConfigValidationError(\n `Legal violation (AEPD): Optional category '${catId}' cannot have default: true. All optional categories must be opt-in (default: false).`\n );\n }\n }\n }\n\n // Validate services if present\n if (config.services && typeof config.services === \"object\") {\n for (const [serviceId, serviceConfig] of Object.entries(config.services)) {\n const category = serviceConfig.category;\n if (!category) {\n throw new ConfigValidationError(\n `Service '${serviceId}' missing 'category' reference.`\n );\n }\n if (!config.categories[category]) {\n throw new ConfigValidationError(\n `Service '${serviceId}' references non-existent category '${category}'.`\n );\n }\n }\n }\n}\n","/**\n * Security & Anti-Tampering Utilities\n * Solvenza Cookies Compliance\n */\n\n// Pure JS SHA-256 implementation (Zero-dependency, works in Node, Browser, Web Workers)\nfunction sha256Sync(ascii: string): string {\n let i, j;\n let result = \"\";\n\n const asciiLength = ascii.length * 8;\n let hash = [\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,\n 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,\n ];\n\n const k = [\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,\n ];\n\n const blocks: number[] = [];\n for (i = 0; i < ascii.length; i++) {\n blocks[i >> 2] |= ascii.charCodeAt(i) << (24 - (i % 4) * 8);\n }\n blocks[asciiLength >> 5] |= 0x80 << (24 - (asciiLength % 32));\n blocks[(((asciiLength + 64) >> 9) << 4) + 15] = asciiLength;\n\n for (i = 0; i < blocks.length; i += 16) {\n const w = blocks.slice(i, i + 16);\n const oldHash = [...hash];\n\n for (j = 0; j < 64; j++) {\n const w15 = w[j - 15], w2 = w[j - 2];\n\n const s0 = ((w15 >>> 7) | (w15 << 25)) ^ ((w15 >>> 18) | (w15 << 14)) ^ (w15 >>> 3);\n const s1 = ((w2 >>> 17) | (w2 << 15)) ^ ((w2 >>> 19) | (w2 << 13)) ^ (w2 >>> 10);\n\n w[j] = j < 16 ? (w[j] || 0) : (w[j - 16] + s0 + w[j - 7] + s1) | 0;\n\n const ch = (hash[4] & hash[5]) ^ (~hash[4] & hash[6]);\n const maj = (hash[0] & hash[1]) ^ (hash[0] & hash[2]) ^ (hash[1] & hash[2]);\n\n const sig0 = ((hash[0] >>> 2) | (hash[0] << 30)) ^ ((hash[0] >>> 13) | (hash[0] << 19)) ^ ((hash[0] >>> 22) | (hash[0] << 10));\n const sig1 = ((hash[4] >>> 6) | (hash[4] << 26)) ^ ((hash[4] >>> 11) | (hash[4] << 21)) ^ ((hash[4] >>> 25) | (hash[4] << 7));\n\n const t1 = hash[7] + sig1 + ch + k[j] + (w[j] | 0);\n const t2 = sig0 + maj;\n\n hash[7] = hash[6];\n hash[6] = hash[5];\n hash[5] = hash[4];\n hash[4] = (hash[3] + t1) | 0;\n hash[3] = hash[2];\n hash[2] = hash[1];\n hash[1] = hash[0];\n hash[0] = (t1 + t2) | 0;\n }\n\n for (j = 0; j < 8; j++) {\n hash[j] = (hash[j] + oldHash[j]) | 0;\n }\n }\n\n for (i = 0; i < 8; i++) {\n for (j = 3; j >= 0; j--) {\n const b = (hash[i] >> (j * 8)) & 255;\n result += (b < 16 ? \"0\" : \"\") + b.toString(16);\n }\n }\n\n return result;\n}\n\nexport function computeReceiptSignature(payload: string, secretKey?: string): string {\n if (secretKey) {\n return sha256Sync(`${secretKey}:${payload}:${secretKey}`);\n }\n // Fallback FNV-1a hash if no secret key provided\n let hash = 2166136261;\n for (let i = 0; i < payload.length; i++) {\n hash ^= payload.charCodeAt(i);\n hash = Math.imul(hash, 16777619);\n }\n return (hash >>> 0).toString(16);\n}\n\nexport function verifyReceiptIntegrity(payload: string, expectedSignature: string, secretKey?: string): boolean {\n if (!expectedSignature) return false;\n return computeReceiptSignature(payload, secretKey) === expectedSignature;\n}\n\nexport function sanitizeHtml(str: string): string {\n if (!str) return \"\";\n return str\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\")\n .replace(/'/g, \"&#039;\");\n}\n\nexport function sanitizeUrl(url: string): string {\n if (!url) return \"#\";\n const trimmed = url.trim().toLowerCase();\n if (trimmed.startsWith(\"javascript:\") || trimmed.startsWith(\"data:\") || trimmed.startsWith(\"vbscript:\")) {\n return \"#\";\n }\n return url;\n}\n","import type { ConsentChoices, ConsentReceipt } from \"./types.js\";\nimport { computeReceiptSignature } from \"./security.js\";\n\nfunction generateUUID(): string {\n if (\n typeof crypto !== \"undefined\" &&\n typeof crypto.randomUUID === \"function\"\n ) {\n return crypto.randomUUID();\n }\n // Fallback for environments lacking crypto.randomUUID\n return \"xxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n\nexport function createReceipt(\n policyVersion: string,\n choices: ConsentChoices,\n source: ConsentReceipt[\"source\"],\n existingReceipt?: ConsentReceipt | null,\n secretKey?: string,\n): ConsentReceipt {\n const now = new Date().toISOString();\n const receiptId = existingReceipt?.receiptId || generateUUID();\n const decidedAt = existingReceipt?.decidedAt || now;\n\n const payloadToSign = `${receiptId}:${policyVersion}:${JSON.stringify(choices)}`;\n const signature = computeReceiptSignature(payloadToSign, secretKey);\n\n return {\n schema: 1,\n receiptId,\n policyVersion,\n decidedAt,\n updatedAt: now,\n source,\n choices,\n signature,\n };\n}\n\nexport function parseReceipt(jsonStr: string): ConsentReceipt | null {\n try {\n const data = JSON.parse(jsonStr);\n if (\n typeof data === \"object\" &&\n data !== null &&\n typeof data.receiptId === \"string\" &&\n typeof data.policyVersion === \"string\" &&\n typeof data.choices === \"object\"\n ) {\n return data as ConsentReceipt;\n }\n return null;\n } catch {\n return null;\n }\n}\n\nexport function isReceiptExpired(\n receipt: ConsentReceipt,\n maxAgeDays = 365,\n): boolean {\n if (!receipt.updatedAt) return true;\n const updated = new Date(receipt.updatedAt).getTime();\n const now = Date.now();\n const maxAgeMs = maxAgeDays * 86400 * 1000;\n return now - updated > maxAgeMs;\n}\n","import type { ConsentConfig } from \"../core/types.js\";\nimport type { CookieOptions, IStorageProvider } from \"../core/contracts/storage.interface.js\";\n\nexport type { CookieOptions };\n\nexport class CookieStorageProvider implements IStorageProvider {\n get(key: string): string | null {\n return CookieStore.get(key);\n }\n\n set(key: string, value: string, options?: CookieOptions): void {\n CookieStore.set(key, value, options);\n }\n\n remove(key: string, path = \"/\", domain?: string): void {\n CookieStore.remove(key, path, domain);\n }\n}\n\nexport class CookieStore {\n static get(name: string): string | null {\n if (typeof document === \"undefined\") return null;\n const nameEQ = encodeURIComponent(name) + \"=\";\n const ca = document.cookie.split(\";\");\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === \" \") c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) {\n return decodeURIComponent(c.substring(nameEQ.length, c.length));\n }\n }\n return null;\n }\n\n static set(name: string, value: string, options: CookieOptions = {}): void {\n if (typeof document === \"undefined\") return;\n\n const path = options.path || \"/\";\n const maxAgeDays = options.maxAgeDays ?? 365;\n const maxAgeSeconds = Math.floor(maxAgeDays * 86400);\n const sameSite = options.sameSite || \"Lax\";\n\n const isHttps =\n typeof window !== \"undefined\" && window.location.protocol === \"https:\";\n const secure = options.secure ?? isHttps;\n\n let cookieStr = `${encodeURIComponent(name)}=${encodeURIComponent(value)}; Path=${path}; Max-Age=${maxAgeSeconds}; SameSite=${sameSite}`;\n\n if (options.domain) {\n cookieStr += `; Domain=${options.domain}`;\n }\n\n if (secure) {\n cookieStr += \"; Secure\";\n }\n\n document.cookie = cookieStr;\n }\n\n static remove(name: string, path = \"/\", domain?: string): void {\n if (typeof document === \"undefined\") return;\n let cookieStr = `${encodeURIComponent(name)}=; Path=${path}; Max-Age=0; SameSite=Lax`;\n if (domain) {\n cookieStr += `; Domain=${domain}`;\n }\n document.cookie = cookieStr;\n }\n\n static clearServiceCookies(config: ConsentConfig, revokedCategory: string): void {\n if (typeof document === \"undefined\" || !config.services) return;\n\n const path = config.storage?.path || \"/\";\n const domain = config.storage?.domain;\n\n for (const service of Object.values(config.services)) {\n if (service.category === revokedCategory && service.cookies) {\n for (const cookieItem of service.cookies) {\n this.remove(cookieItem.name, path, domain || cookieItem.domain);\n }\n }\n }\n }\n}\n","import type { IStorageProvider } from \"../core/contracts/storage.interface.js\";\n\nexport class MemoryStorageProvider implements IStorageProvider {\n private static store = new Map<string, string>();\n\n get(key: string): string | null {\n return MemoryStorageProvider.store.get(key) ?? null;\n }\n\n set(key: string, value: string): void {\n MemoryStorageProvider.store.set(key, value);\n }\n\n remove(key: string): void {\n MemoryStorageProvider.store.delete(key);\n }\n\n clear(): void {\n MemoryStorageProvider.store.clear();\n }\n}\n\nexport const MemoryStore = {\n get: (name: string) => new MemoryStorageProvider().get(name),\n set: (name: string, val: string) => new MemoryStorageProvider().set(name, val),\n remove: (name: string) => new MemoryStorageProvider().remove(name),\n clear: () => new MemoryStorageProvider().clear(),\n};\n","import type { ConsentConfig, StoragePurgeReport } from \"../core/types.js\";\nimport { CookieStore } from \"./cookie-store.js\";\n\n/**\n * Service responsible for purging cookies, localStorage, and sessionStorage\n * keys associated with revoked consent categories or services.\n */\nexport class StorageCleaner {\n /**\n * Evaluates if a given storage key or cookie name matches a pattern.\n * Supports:\n * - Wildcard glob: \"*\", \"_ga*\", \"ph_*_posthog\", \"*session*\"\n * - Exact string match (case-insensitive)\n */\n static matchesPattern(key: string, pattern: string): boolean {\n if (!key || !pattern) return false;\n if (pattern === \"*\" || key === pattern) return true;\n if (pattern.includes(\"*\")) {\n const escaped = pattern\n .split(\"*\")\n .map((segment) => segment.replace(/[-[\\]{}()+?.,\\\\^$|#\\s]/g, \"\\\\$&\"))\n .join(\".*\");\n try {\n const regex = new RegExp(`^${escaped}$`, \"i\");\n return regex.test(key);\n } catch {\n return false;\n }\n }\n return key.toLowerCase() === pattern.toLowerCase();\n }\n\n /**\n * Purges keys from window.localStorage that match any of the provided patterns.\n * Safe in SSR, sandboxed iframes, and private browsing modes.\n */\n static purgeLocalStorage(patterns: string[]): string[] {\n if (typeof window === \"undefined\" || !patterns || patterns.length === 0) return [];\n try {\n if (typeof window.localStorage === \"undefined\") return [];\n const keysToRemove: string[] = [];\n const len = window.localStorage.length;\n for (let i = 0; i < len; i++) {\n const key = window.localStorage.key(i);\n if (key && patterns.some((p) => this.matchesPattern(key, p))) {\n keysToRemove.push(key);\n }\n }\n for (const key of keysToRemove) {\n window.localStorage.removeItem(key);\n }\n return keysToRemove;\n } catch {\n return [];\n }\n }\n\n /**\n * Purges keys from window.sessionStorage that match any of the provided patterns.\n * Safe in SSR, sandboxed iframes, and private browsing modes.\n */\n static purgeSessionStorage(patterns: string[]): string[] {\n if (typeof window === \"undefined\" || !patterns || patterns.length === 0) return [];\n try {\n if (typeof window.sessionStorage === \"undefined\") return [];\n const keysToRemove: string[] = [];\n const len = window.sessionStorage.length;\n for (let i = 0; i < len; i++) {\n const key = window.sessionStorage.key(i);\n if (key && patterns.some((p) => this.matchesPattern(key, p))) {\n keysToRemove.push(key);\n }\n }\n for (const key of keysToRemove) {\n window.sessionStorage.removeItem(key);\n }\n return keysToRemove;\n } catch {\n return [];\n }\n }\n\n /**\n * Purges cookies declared for services, supporting wildcard glob names (e.g. \"_ga_*\").\n */\n static purgeCookies(\n cookieDeclarations: Array<{ name: string; domain?: string }>,\n defaultPath = \"/\",\n defaultDomain?: string,\n ): string[] {\n if (typeof document === \"undefined\" || !cookieDeclarations || cookieDeclarations.length === 0) {\n return [];\n }\n\n const removedCookies: string[] = [];\n const allExistingCookies = this.getAllCookieNames();\n\n for (const cookieItem of cookieDeclarations) {\n const targetDomain = cookieItem.domain || defaultDomain;\n\n if (cookieItem.name.includes(\"*\")) {\n for (const existingName of allExistingCookies) {\n if (this.matchesPattern(existingName, cookieItem.name)) {\n CookieStore.remove(existingName, defaultPath, targetDomain);\n if (!removedCookies.includes(existingName)) {\n removedCookies.push(existingName);\n }\n }\n }\n } else {\n CookieStore.remove(cookieItem.name, defaultPath, targetDomain);\n if (!removedCookies.includes(cookieItem.name)) {\n removedCookies.push(cookieItem.name);\n }\n }\n }\n\n return removedCookies;\n }\n\n private static getAllCookieNames(): string[] {\n if (typeof document === \"undefined\") return [];\n try {\n return document.cookie\n .split(\";\")\n .map((c) => c.trim().split(\"=\")[0])\n .filter((n) => !!n);\n } catch {\n return [];\n }\n }\n\n /**\n * Purges all cookies, localStorage, and sessionStorage keys associated with a category.\n */\n static purgeCategory(config: ConsentConfig, category: string): StoragePurgeReport {\n const report: StoragePurgeReport = {\n category,\n purgedCookies: [],\n purgedLocalStorage: [],\n purgedSessionStorage: [],\n };\n\n if (!config) return report;\n\n const path = config.storage?.path || \"/\";\n const defaultDomain = config.storage?.domain;\n\n const cookiesToPurge: Array<{ name: string; domain?: string }> = [];\n const localStoragePatterns: Set<string> = new Set();\n const sessionStoragePatterns: Set<string> = new Set();\n\n // 1. Collect from Category definition\n const catConfig = config.categories?.[category];\n if (catConfig) {\n if (catConfig.storageKeys) {\n catConfig.storageKeys.forEach((k) => {\n localStoragePatterns.add(k);\n sessionStoragePatterns.add(k);\n });\n }\n if (catConfig.localStorage) {\n catConfig.localStorage.forEach((k) => localStoragePatterns.add(k));\n }\n if (catConfig.sessionStorage) {\n catConfig.sessionStorage.forEach((k) => sessionStoragePatterns.add(k));\n }\n }\n\n // 2. Collect from Services belonging to this category\n if (config.services) {\n for (const service of Object.values(config.services)) {\n if (service.category === category) {\n if (service.cookies) {\n for (const cookieItem of service.cookies) {\n cookiesToPurge.push({\n name: cookieItem.name,\n domain: cookieItem.domain || defaultDomain,\n });\n }\n }\n if (service.storageKeys) {\n service.storageKeys.forEach((k) => {\n localStoragePatterns.add(k);\n sessionStoragePatterns.add(k);\n });\n }\n if (service.localStorage) {\n service.localStorage.forEach((k) => localStoragePatterns.add(k));\n }\n if (service.sessionStorage) {\n service.sessionStorage.forEach((k) => sessionStoragePatterns.add(k));\n }\n }\n }\n }\n\n // 3. Execute purges\n report.purgedCookies = this.purgeCookies(cookiesToPurge, path, defaultDomain);\n report.purgedLocalStorage = this.purgeLocalStorage(Array.from(localStoragePatterns));\n report.purgedSessionStorage = this.purgeSessionStorage(Array.from(sessionStoragePatterns));\n\n return report;\n }\n}\n","import type { IResourceBlocker } from \"../core/contracts/blocker.interface.js\";\n\nexport class ScriptResourceBlocker implements IResourceBlocker {\n type: \"script\" = \"script\";\n\n process(\n isCategoryAllowed: (category: string) => boolean,\n isServiceAllowed: (serviceId: string) => boolean\n ): void {\n ScriptGate.scanAndActivate(isCategoryAllowed, isServiceAllowed);\n }\n}\n\nexport class ScriptGate {\n private static executedScripts = new Set<Element>();\n\n static scanAndActivate(\n isCategoryAllowed: (category: string) => boolean,\n isServiceAllowed: (serviceId: string) => boolean,\n onServiceLoaded?: (serviceId: string, category: string) => void,\n ): void {\n if (typeof document === \"undefined\") return;\n\n const blockedScripts = Array.from(\n document.querySelectorAll<HTMLScriptElement>(\n 'script[type=\"text/plain\"][data-consent], script[type=\"text/plain\"][data-service]',\n ),\n );\n\n for (const oldScript of blockedScripts) {\n if (this.executedScripts.has(oldScript)) continue;\n\n const category = oldScript.getAttribute(\"data-consent\");\n const serviceId = oldScript.getAttribute(\"data-service\");\n\n let isAllowed = false;\n if (serviceId) {\n isAllowed = isServiceAllowed(serviceId);\n } else if (category) {\n isAllowed = isCategoryAllowed(category);\n }\n\n if (!isAllowed) continue;\n\n this.executedScripts.add(oldScript);\n const newScript = document.createElement(\"script\");\n\n for (let i = 0; i < oldScript.attributes.length; i++) {\n const attr = oldScript.attributes[i];\n if (attr.name === \"type\") continue;\n if (attr.name === \"data-src\") {\n newScript.src = attr.value;\n continue;\n }\n newScript.setAttribute(attr.name, attr.value);\n }\n\n newScript.type = \"text/javascript\";\n if (!newScript.src && oldScript.textContent) {\n newScript.textContent = oldScript.textContent;\n }\n\n oldScript.parentNode?.replaceChild(newScript, oldScript);\n\n if (serviceId || category) {\n onServiceLoaded?.(serviceId || category!, category || \"custom\");\n }\n }\n }\n}\n","import type { IResourceBlocker } from \"../core/contracts/blocker.interface.js\";\n\nexport interface IframeGateOptions {\n onAllowClick?: (category: string, serviceId?: string) => void;\n}\n\nexport class IframeResourceBlocker implements IResourceBlocker {\n type: \"iframe\" = \"iframe\";\n\n process(\n isCategoryAllowed: (category: string) => boolean,\n isServiceAllowed: (serviceId: string) => boolean\n ): void {\n IframeGate.processIframes(isCategoryAllowed, isServiceAllowed);\n }\n}\n\nexport class IframeGate {\n private static placeholders = new Map<HTMLIFrameElement, HTMLElement>();\n\n static processIframes(\n isCategoryAllowed: (category: string) => boolean,\n isServiceAllowed: (serviceId: string) => boolean,\n options: IframeGateOptions = {},\n ): void {\n if (typeof document === \"undefined\") return;\n\n const iframes = Array.from(\n document.querySelectorAll<HTMLIFrameElement>(\n \"iframe[data-consent], iframe[data-service]\",\n ),\n );\n\n for (const iframe of iframes) {\n const category = iframe.getAttribute(\"data-consent\");\n const serviceId = iframe.getAttribute(\"data-service\");\n\n let isAllowed = false;\n if (serviceId) {\n isAllowed = isServiceAllowed(serviceId);\n } else if (category) {\n isAllowed = isCategoryAllowed(category);\n }\n\n const originalSrc =\n iframe.getAttribute(\"data-src\") || iframe.getAttribute(\"src\");\n\n if (!originalSrc) continue;\n\n if (!iframe.getAttribute(\"data-src\")) {\n iframe.setAttribute(\"data-src\", originalSrc);\n }\n\n if (isAllowed) {\n this.unlockIframe(iframe, originalSrc);\n } else {\n this.lockIframe(\n iframe,\n category || \"marketing\",\n serviceId || undefined,\n options,\n );\n }\n }\n }\n\n private static lockIframe(\n iframe: HTMLIFrameElement,\n category: string,\n serviceId: string | undefined,\n options: IframeGateOptions,\n ): void {\n if (iframe.hasAttribute(\"src\")) {\n iframe.removeAttribute(\"src\");\n }\n\n if (this.placeholders.has(iframe)) return;\n\n const container = document.createElement(\"div\");\n container.className = \"consent-iframe-placeholder\";\n container.style.cssText = `\n width: ${iframe.width ? (iframe.width.endsWith(\"%\") || iframe.width.endsWith(\"px\") ? iframe.width : iframe.width + \"px\") : \"100%\"};\n height: ${iframe.height ? (iframe.height.endsWith(\"%\") || iframe.height.endsWith(\"px\") ? iframe.height : iframe.height + \"px\") : \"315px\"};\n min-height: 200px;\n background: #0f172a;\n color: #f8fafc;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n padding: 1.5rem;\n border-radius: 8px;\n box-sizing: border-box;\n font-family: system-ui, -apple-system, sans-serif;\n `;\n\n const titleText = serviceId\n ? `Contenido de ${serviceId} bloqueado`\n : \"Contenido externo bloqueado\";\n const bodyText =\n \"Este contenido está bloqueado hasta que autorices esta finalidad de privacidad.\";\n\n container.innerHTML = `\n <div style=\"font-weight: 600; font-size: 1.1rem; margin-bottom: 0.5rem; color: #f8fafc;\">\n ${titleText}\n </div>\n <p style=\"font-size: 0.9rem; color: #94a3b8; margin: 0 0 1rem 0; max-width: 400px;\">\n ${bodyText}\n </p>\n <button type=\"button\" class=\"consent-placeholder-allow-btn\" style=\"\n background: #2563eb;\n color: #ffffff;\n border: none;\n padding: 0.6rem 1.2rem;\n border-radius: 6px;\n font-weight: 500;\n cursor: pointer;\n font-size: 0.9rem;\n transition: background 0.2s ease;\n \">\n Permitir y mostrar contenido\n </button>\n `;\n\n const button = container.querySelector<HTMLButtonElement>(\n \".consent-placeholder-allow-btn\",\n );\n button?.addEventListener(\"click\", () => {\n options.onAllowClick?.(category, serviceId);\n });\n\n iframe.style.display = \"none\";\n iframe.parentNode?.insertBefore(container, iframe);\n this.placeholders.set(iframe, container);\n }\n\n private static unlockIframe(iframe: HTMLIFrameElement, src: string): void {\n if (iframe.getAttribute(\"src\") !== src) {\n iframe.setAttribute(\"src\", src);\n }\n iframe.style.display = \"\";\n\n const placeholder = this.placeholders.get(iframe);\n if (placeholder) {\n placeholder.parentNode?.removeChild(placeholder);\n this.placeholders.delete(iframe);\n }\n }\n}\n","import type { IResourceBlocker } from \"../core/contracts/blocker.interface.js\";\n\nexport class ImageResourceBlocker implements IResourceBlocker {\n type: \"image\" = \"image\";\n\n process(\n isCategoryAllowed: (category: string) => boolean,\n isServiceAllowed: (serviceId: string) => boolean\n ): void {\n ResourceGate.processImages(isCategoryAllowed, isServiceAllowed);\n }\n}\n\nexport class ResourceGate {\n static processImages(\n isCategoryAllowed: (category: string) => boolean,\n isServiceAllowed: (serviceId: string) => boolean,\n ): void {\n if (typeof document === \"undefined\") return;\n\n const images = Array.from(\n document.querySelectorAll<HTMLImageElement>(\n \"img[data-consent], img[data-service]\",\n ),\n );\n\n for (const img of images) {\n const category = img.getAttribute(\"data-consent\");\n const serviceId = img.getAttribute(\"data-service\");\n\n let isAllowed = false;\n if (serviceId) {\n isAllowed = isServiceAllowed(serviceId);\n } else if (category) {\n isAllowed = isCategoryAllowed(category);\n }\n\n const originalSrc =\n img.getAttribute(\"data-src\") || img.getAttribute(\"src\");\n\n if (!originalSrc) continue;\n\n if (!img.getAttribute(\"data-src\")) {\n img.setAttribute(\"data-src\", originalSrc);\n }\n\n if (isAllowed) {\n if (img.getAttribute(\"src\") !== originalSrc) {\n img.setAttribute(\"src\", originalSrc);\n }\n } else {\n if (img.hasAttribute(\"src\")) {\n img.removeAttribute(\"src\");\n }\n }\n }\n }\n}\n","import type { ConsentChoices } from \"../core/types.js\";\n\ndeclare global {\n interface Window {\n dataLayer?: any[];\n gtag?: (...args: any[]) => void;\n }\n}\n\nexport interface GoogleConsentModeConfig {\n analytics_storage?: string; // category id e.g. \"analytics\"\n ad_storage?: string; // category id e.g. \"marketing\"\n ad_user_data?: string; // category id e.g. \"marketing\"\n ad_personalization?: string; // category id e.g. \"marketing\"\n}\n\nexport class GoogleConsentAdapter {\n private static initialized = false;\n\n static initDefault(_configMap?: GoogleConsentModeConfig): void {\n if (typeof window === \"undefined\") return;\n\n window.dataLayer = window.dataLayer || [];\n if (!window.gtag) {\n window.gtag = function () {\n window.dataLayer?.push(arguments);\n };\n }\n\n if (!this.initialized) {\n window.gtag(\"consent\", \"default\", {\n analytics_storage: \"denied\",\n ad_storage: \"denied\",\n ad_user_data: \"denied\",\n ad_personalization: \"denied\",\n wait_for_update: 500,\n });\n this.initialized = true;\n }\n }\n\n static update(choices: ConsentChoices, configMap?: GoogleConsentModeConfig): void {\n if (typeof window === \"undefined\") return;\n\n this.initDefault(configMap);\n\n const analyticsCategory = configMap?.analytics_storage || \"analytics\";\n const marketingCategory = configMap?.ad_storage || \"marketing\";\n\n const isAnalyticsAllowed = choices[analyticsCategory] === true;\n const isMarketingAllowed = choices[marketingCategory] === true;\n\n window.gtag!(\"consent\", \"update\", {\n analytics_storage: isAnalyticsAllowed ? \"granted\" : \"denied\",\n ad_storage: isMarketingAllowed ? \"granted\" : \"denied\",\n ad_user_data: isMarketingAllowed ? \"granted\" : \"denied\",\n ad_personalization: isMarketingAllowed ? \"granted\" : \"denied\",\n });\n }\n}\n","export function injectStyles(nonce?: string): void {\n if (typeof document === \"undefined\") return;\n\n const existing = document.getElementById(\"consent-sdk-styles\");\n if (existing) {\n existing.remove(); // Re-inject updated styles\n }\n\n const styleEl = document.createElement(\"style\");\n styleEl.id = \"consent-sdk-styles\";\n if (nonce) {\n styleEl.setAttribute(\"nonce\", nonce);\n }\n\n styleEl.textContent = `\n :root {\n --consent-bg: #ffffff;\n --consent-fg: #0f172a;\n --consent-muted: #64748b;\n --consent-divider: #f1f5f9;\n --consent-border: #e2e8f0;\n --consent-hover-bg: #f8fafc;\n --consent-primary: #0f172a;\n --consent-primary-hover: #1e293b;\n --consent-primary-fg: #ffffff;\n --consent-secondary: #f8fafc;\n --consent-secondary-hover: #f1f5f9;\n --consent-secondary-fg: #0f172a;\n --consent-accent: #2563eb;\n --consent-focus-ring: rgba(37, 99, 235, 0.3);\n --consent-font: system-ui, -apple-system, BlinkMacSystemFont, \"SF Pro Display\", \"SF Pro Text\", \"Segoe UI\", Roboto, sans-serif;\n --consent-modal-shadow: 0 32px 64px -16px rgba(15, 23, 42, 0.2), 0 0 1px rgba(15, 23, 42, 0.12);\n }\n\n @media (prefers-color-scheme: dark) {\n :root {\n --consent-bg: #0f172a;\n --consent-fg: #f8fafc;\n --consent-muted: #94a3b8;\n --consent-divider: #1e293b;\n --consent-border: #334155;\n --consent-hover-bg: #1e293b;\n --consent-primary: #f8fafc;\n --consent-primary-hover: #ffffff;\n --consent-primary-fg: #0f172a;\n --consent-secondary: #1e293b;\n --consent-secondary-hover: #334155;\n --consent-secondary-fg: #f8fafc;\n --consent-modal-shadow: 0 32px 64px -16px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 255, 255, 0.12);\n }\n }\n\n @keyframes consentSlideUp {\n from {\n opacity: 0;\n transform: translateY(16px) scale(0.985);\n }\n to {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n }\n\n @keyframes consentFadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n\n /* 1st Layer Banner - Clean & Seamless */\n .consent-banner-wrapper {\n position: fixed;\n bottom: 1.25rem;\n left: 1.25rem;\n right: 1.25rem;\n max-width: 1060px;\n margin: 0 auto;\n z-index: 2147483645;\n background: var(--consent-bg);\n color: var(--consent-fg);\n border: 1px solid var(--consent-border);\n border-radius: 20px;\n box-shadow: var(--consent-modal-shadow);\n padding: 1.5rem 1.75rem;\n font-family: var(--consent-font);\n font-size: 0.92rem;\n line-height: 1.5;\n animation: consentSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;\n box-sizing: border-box;\n }\n\n .consent-banner-container {\n display: flex;\n flex-direction: column;\n gap: 1.25rem;\n }\n\n @media (min-width: 860px) {\n .consent-banner-container {\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n }\n }\n\n .consent-banner-text {\n flex: 1;\n }\n\n .consent-banner-title {\n font-size: 1.1rem;\n font-weight: 700;\n letter-spacing: -0.015em;\n margin: 0 0 0.35rem 0;\n color: var(--consent-fg);\n display: flex;\n align-items: center;\n gap: 0.5rem;\n }\n\n .consent-banner-title-icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 22px;\n height: 22px;\n border-radius: 6px;\n background: rgba(37, 99, 235, 0.1);\n color: var(--consent-accent);\n }\n\n .consent-banner-desc {\n margin: 0;\n color: var(--consent-muted);\n font-size: 0.88rem;\n max-width: 720px;\n }\n\n .consent-banner-links {\n margin-top: 0.4rem;\n }\n\n .consent-banner-links a {\n color: var(--consent-muted);\n font-size: 0.83rem;\n text-decoration: underline;\n text-underline-offset: 3px;\n font-weight: 500;\n margin-right: 1.2rem;\n transition: color 0.15s ease;\n }\n\n .consent-banner-links a:hover {\n color: var(--consent-fg);\n }\n\n /* Equal Visual Prominence CTAs */\n .consent-banner-actions {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n width: 100%;\n }\n\n @media (min-width: 640px) {\n .consent-banner-actions {\n flex-direction: row;\n width: auto;\n align-items: center;\n }\n }\n\n .consent-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: 0.6rem 1.2rem;\n font-size: 0.88rem;\n font-weight: 600;\n border-radius: 10px;\n border: 1px solid var(--consent-border);\n cursor: pointer;\n font-family: inherit;\n transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);\n min-height: 42px;\n min-width: 110px;\n box-sizing: border-box;\n user-select: none;\n }\n\n .consent-btn:hover {\n transform: translateY(-1px);\n }\n\n .consent-btn:active {\n transform: translateY(0) scale(0.98);\n }\n\n .consent-btn:focus-visible {\n outline: 3px solid var(--consent-focus-ring);\n outline-offset: 2px;\n }\n\n .consent-btn-reject {\n background: var(--consent-secondary);\n color: var(--consent-secondary-fg);\n border-color: var(--consent-border);\n }\n\n .consent-btn-reject:hover {\n background: var(--consent-secondary-hover);\n }\n\n .consent-btn-configure {\n background: transparent;\n color: var(--consent-muted);\n border-color: transparent;\n }\n\n .consent-btn-configure:hover {\n color: var(--consent-fg);\n background: var(--consent-secondary);\n }\n\n .consent-btn-accept {\n background: var(--consent-primary);\n color: var(--consent-primary-fg);\n border-color: var(--consent-primary);\n }\n\n .consent-btn-accept:hover {\n background: var(--consent-primary-hover);\n }\n\n /* 2nd Layer Preference Modal - Ultra Clean Linear List Style */\n .consent-dialog-backdrop {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background: rgba(15, 23, 42, 0.45);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n z-index: 2147483646;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 1.25rem;\n box-sizing: border-box;\n animation: consentFadeIn 0.2s ease forwards;\n }\n\n .consent-dialog {\n background: var(--consent-bg);\n color: var(--consent-fg);\n border: 1px solid var(--consent-border);\n border-radius: 20px;\n width: 100%;\n max-width: 600px;\n max-height: 85vh;\n display: flex;\n flex-direction: column;\n box-shadow: var(--consent-modal-shadow);\n font-family: var(--consent-font);\n overflow: hidden;\n animation: consentSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;\n }\n\n .consent-dialog-header {\n padding: 1.5rem 1.75rem 1.25rem 1.75rem;\n border-bottom: 1px solid var(--consent-divider);\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n }\n\n .consent-dialog-title {\n font-size: 1.15rem;\n font-weight: 700;\n letter-spacing: -0.015em;\n margin: 0;\n }\n\n .consent-dialog-close {\n background: transparent;\n border: none;\n color: var(--consent-muted);\n cursor: pointer;\n padding: 0.35rem;\n border-radius: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: background 0.15s ease, color 0.15s ease;\n margin: -0.35rem -0.35rem 0 0;\n }\n\n .consent-dialog-close:hover {\n background: var(--consent-secondary);\n color: var(--consent-fg);\n }\n\n /* Seamless Category List Body (NO individual boxed divs) */\n .consent-dialog-body {\n padding: 0;\n overflow-y: auto;\n display: flex;\n flex-direction: column;\n }\n\n .consent-category-row {\n padding: 1.25rem 1.75rem;\n border-bottom: 1px solid var(--consent-divider);\n transition: background 0.15s ease;\n }\n\n .consent-category-row:last-child {\n border-bottom: none;\n }\n\n .consent-category-row:hover {\n background: var(--consent-hover-bg);\n }\n\n .consent-category-header {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 1rem;\n }\n\n .consent-category-name {\n font-weight: 600;\n font-size: 0.95rem;\n color: var(--consent-fg);\n }\n\n .consent-category-desc {\n margin: 0.3rem 0 0 0;\n font-size: 0.85rem;\n color: var(--consent-muted);\n line-height: 1.45;\n }\n\n /* Minimalist Badges */\n .consent-badge {\n display: inline-flex;\n align-items: center;\n padding: 0.15rem 0.5rem;\n border-radius: 6px;\n font-size: 0.7rem;\n font-weight: 600;\n letter-spacing: 0.01em;\n }\n\n .consent-badge-required {\n background: rgba(16, 185, 129, 0.1);\n color: #059669;\n }\n\n .consent-badge-optional {\n background: rgba(100, 116, 139, 0.08);\n color: var(--consent-muted);\n }\n\n /* Inline Service Disclosure Button */\n .consent-toggle-services-btn {\n border: none;\n background: transparent;\n color: var(--consent-accent);\n font-size: 0.78rem;\n font-weight: 600;\n cursor: pointer;\n padding: 0.35rem 0 0 0;\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n font-family: inherit;\n }\n\n .consent-toggle-services-btn:hover {\n opacity: 0.85;\n }\n\n /* Minimalist Toggle Switch */\n .consent-toggle {\n position: relative;\n display: inline-block;\n width: 40px;\n height: 22px;\n flex-shrink: 0;\n margin-top: 0.15rem;\n }\n\n .consent-toggle input {\n opacity: 0;\n width: 0;\n height: 0;\n }\n\n .consent-toggle-slider {\n position: absolute;\n cursor: pointer;\n top: 0; left: 0; right: 0; bottom: 0;\n background-color: #cbd5e1;\n transition: background-color 0.2s ease;\n border-radius: 22px;\n }\n\n .consent-toggle-slider:before {\n position: absolute;\n content: \"\";\n height: 16px;\n width: 16px;\n left: 3px;\n bottom: 3px;\n background-color: white;\n transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);\n border-radius: 50%;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);\n }\n\n .consent-toggle input:checked + .consent-toggle-slider {\n background-color: var(--consent-accent);\n }\n\n .consent-toggle input:checked + .consent-toggle-slider:before {\n transform: translateX(18px);\n }\n\n .consent-toggle input:disabled + .consent-toggle-slider {\n opacity: 0.45;\n cursor: not-allowed;\n }\n\n /* Footer */\n .consent-dialog-footer {\n padding: 1.25rem 1.75rem;\n border-top: 1px solid var(--consent-divider);\n background: var(--consent-bg);\n display: flex;\n flex-direction: column;\n gap: 0.6rem;\n justify-content: space-between;\n align-items: center;\n }\n\n @media (min-width: 520px) {\n .consent-dialog-footer {\n flex-direction: row;\n }\n }\n\n /* Floating Revocation & Preference Badge */\n .consent-floating-badge {\n position: fixed;\n z-index: 2147483640;\n font-family: var(--consent-font);\n opacity: 0;\n transform: scale(0.85);\n pointer-events: none;\n transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);\n }\n\n .consent-floating-badge.is-visible {\n opacity: 1;\n transform: scale(1);\n pointer-events: auto;\n }\n\n .consent-floating-badge--bottom-left {\n bottom: 1.25rem;\n left: 1.25rem;\n }\n\n .consent-floating-badge--bottom-right {\n bottom: 1.25rem;\n right: 1.25rem;\n }\n\n .consent-floating-badge--top-left {\n top: 1.25rem;\n left: 1.25rem;\n }\n\n .consent-floating-badge--top-right {\n top: 1.25rem;\n right: 1.25rem;\n }\n\n .consent-floating-badge-inner {\n position: relative;\n display: inline-flex;\n align-items: center;\n }\n\n .consent-floating-badge-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n width: 46px;\n height: 46px;\n min-width: 46px;\n border-radius: 9999px;\n background: var(--consent-bg);\n color: var(--consent-fg);\n border: 1px solid var(--consent-border);\n box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.15), 0 4px 6px -2px rgba(15, 23, 42, 0.05);\n cursor: pointer;\n padding: 0;\n margin: 0;\n transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;\n outline: none;\n }\n\n .consent-floating-badge-btn.has-label {\n width: auto;\n padding: 0 1rem;\n }\n\n .consent-floating-badge-btn:hover {\n transform: translateY(-2px);\n box-shadow: 0 14px 28px -6px rgba(15, 23, 42, 0.2), 0 6px 10px -3px rgba(15, 23, 42, 0.08);\n border-color: var(--consent-accent);\n color: var(--consent-accent);\n }\n\n .consent-floating-badge-btn:active {\n transform: translateY(0) scale(0.96);\n }\n\n .consent-floating-badge-btn:focus-visible {\n box-shadow: 0 0 0 3px var(--consent-focus-ring), 0 10px 25px -5px rgba(15, 23, 42, 0.15);\n border-color: var(--consent-accent);\n }\n\n .consent-floating-badge-icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 22px;\n height: 22px;\n }\n\n .consent-floating-badge-text {\n font-size: 0.85rem;\n font-weight: 600;\n white-space: nowrap;\n }\n\n .consent-floating-badge-tooltip {\n position: absolute;\n white-space: nowrap;\n pointer-events: none;\n opacity: 0;\n visibility: hidden;\n background: var(--consent-primary);\n color: var(--consent-primary-fg);\n font-size: 0.76rem;\n font-weight: 500;\n padding: 0.4rem 0.75rem;\n border-radius: 8px;\n box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);\n transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;\n z-index: 2147483641;\n }\n\n .consent-floating-badge--bottom-left .consent-floating-badge-tooltip {\n bottom: calc(100% + 8px);\n left: 0;\n transform: translateY(4px);\n }\n\n .consent-floating-badge--bottom-right .consent-floating-badge-tooltip {\n bottom: calc(100% + 8px);\n right: 0;\n transform: translateY(4px);\n }\n\n .consent-floating-badge--top-left .consent-floating-badge-tooltip {\n top: calc(100% + 8px);\n left: 0;\n transform: translateY(-4px);\n }\n\n .consent-floating-badge--top-right .consent-floating-badge-tooltip {\n top: calc(100% + 8px);\n right: 0;\n transform: translateY(-4px);\n }\n\n .consent-floating-badge-inner:hover .consent-floating-badge-tooltip,\n .consent-floating-badge-btn:focus-visible + .consent-floating-badge-tooltip {\n opacity: 1;\n visibility: visible;\n transform: translateY(0);\n }\n `;\n document.head.appendChild(styleEl);\n}\n","import type { ConsentConfig, FloatingBadgeConfig } from \"../core/types.js\";\nimport { injectStyles } from \"./styles.js\";\nimport { sanitizeHtml } from \"../core/security.js\";\n\nexport interface FloatingBadgeHandlers {\n onClick: () => void;\n}\n\nexport class FloatingBadge {\n private element: HTMLElement | null = null;\n private isVisible: boolean = false;\n\n private getIconSvg(icon: FloatingBadgeConfig[\"icon\"]): string {\n switch (icon) {\n case \"shield\":\n return `<svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z\"/>\n <path d=\"m9 12 2 2 4-4\"/>\n </svg>`;\n case \"settings\":\n return `<svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <circle cx=\"12\" cy=\"12\" r=\"3\"/>\n <path d=\"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z\"/>\n </svg>`;\n case \"cookie\":\n default:\n return `<svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5\"/>\n <path d=\"M8.5 8.5v.01\"/>\n <path d=\"M16 15.5v.01\"/>\n <path d=\"M12 12v.01\"/>\n <path d=\"M11 17v.01\"/>\n <path d=\"M7 13v.01\"/>\n </svg>`;\n }\n }\n\n render(config: ConsentConfig, handlers: FloatingBadgeHandlers): void {\n if (typeof document === \"undefined\") return;\n this.remove();\n injectStyles(config.csp?.nonce);\n\n const badgeConfig: FloatingBadgeConfig =\n typeof config.ui?.floatingBadge === \"object\" && config.ui?.floatingBadge !== null\n ? config.ui.floatingBadge\n : {};\n\n const position = badgeConfig.position || \"bottom-left\";\n const labelText = badgeConfig.label ? sanitizeHtml(badgeConfig.label) : \"\";\n const ariaLabel = badgeConfig.ariaLabel\n ? sanitizeHtml(badgeConfig.ariaLabel)\n : (labelText || \"Configuración y revocación de cookies\");\n const tooltipText = badgeConfig.tooltip\n ? sanitizeHtml(badgeConfig.tooltip)\n : (labelText || \"Configurar o declinar cookies\");\n const showLabel = badgeConfig.showLabel === true && !!labelText;\n const iconSvg = this.getIconSvg(badgeConfig.icon);\n\n const container = document.createElement(\"div\");\n container.className = `consent-floating-badge consent-floating-badge--${position}`;\n container.setAttribute(\"role\", \"complementary\");\n container.setAttribute(\"aria-label\", ariaLabel);\n\n container.innerHTML = `\n <div class=\"consent-floating-badge-inner\">\n <button\n type=\"button\"\n class=\"consent-floating-badge-btn ${showLabel ? 'has-label' : ''}\"\n id=\"consent-floating-trigger\"\n data-consent-open\n aria-label=\"${ariaLabel}\"\n >\n <span class=\"consent-floating-badge-icon\" aria-hidden=\"true\">\n ${iconSvg}\n </span>\n ${showLabel ? `<span class=\"consent-floating-badge-text\">${labelText}</span>` : \"\"}\n </button>\n <div class=\"consent-floating-badge-tooltip\" role=\"tooltip\" aria-hidden=\"true\">\n ${tooltipText}\n </div>\n </div>\n `;\n\n const button = container.querySelector<HTMLButtonElement>(\"#consent-floating-trigger\");\n button?.addEventListener(\"click\", (e) => {\n e.preventDefault();\n handlers.onClick();\n });\n\n document.body.appendChild(container);\n this.element = container;\n }\n\n show(): void {\n if (this.element) {\n this.element.classList.add(\"is-visible\");\n this.isVisible = true;\n }\n }\n\n hide(): void {\n if (this.element) {\n this.element.classList.remove(\"is-visible\");\n this.isVisible = false;\n }\n }\n\n getIsVisible(): boolean {\n return this.isVisible;\n }\n\n hasElement(): boolean {\n return this.element !== null;\n }\n\n getElement(): HTMLElement | null {\n return this.element;\n }\n\n remove(): void {\n if (this.element && this.element.parentNode) {\n this.element.parentNode.removeChild(this.element);\n this.element = null;\n this.isVisible = false;\n }\n }\n}\n","import type { ConsentConfig, DiagnosticReport } from \"../core/types.js\";\n\nexport class ResourceScanner {\n static runDiagnostic(_config: ConsentConfig, isConsentGiven: boolean): DiagnosticReport {\n const thirdPartyScripts: string[] = [];\n if (typeof document !== \"undefined\") {\n const scripts = document.querySelectorAll(\"script[src]\");\n scripts.forEach((script) => {\n const src = script.getAttribute(\"src\");\n if (src && (src.startsWith(\"http://\") || src.startsWith(\"https://\"))) {\n thirdPartyScripts.push(src);\n }\n });\n }\n\n return {\n timestamp: new Date().toISOString(),\n unblockedThirdPartyScripts: isConsentGiven ? [] : thirdPartyScripts,\n compliant: isConsentGiven || thirdPartyScripts.length === 0,\n };\n }\n\n scanThirdPartyResources(): string[] {\n return ResourceScanner.runDiagnostic({} as any, true).unblockedThirdPartyScripts;\n }\n}\n","import type { ConsentConfig, LegalPolicyOptions } from \"../core/types.js\";\nimport { sanitizeHtml } from \"../core/security.js\";\n\ninterface CookieDetailRow {\n name: string;\n type: \"Cookie\" | \"localStorage\" | \"sessionStorage\";\n provider: string;\n purpose: string;\n duration: string;\n categoryLabel: string;\n policyUrl?: string;\n}\n\nexport class PolicyGenerator {\n /**\n * Extract all cookie and storage key details across categories and services (including presets).\n */\n static extractCookieRows(config: ConsentConfig): CookieDetailRow[] {\n const rows: CookieDetailRow[] = [];\n\n // 1. Process services\n if (config.services) {\n for (const [srvId, srv] of Object.entries(config.services)) {\n const cat = config.categories[srv.category || \"necessary\"] || { label: srv.category || \"General\" };\n const providerName = srv.provider || srv.label || srvId;\n\n if (srv.cookies && srv.cookies.length > 0) {\n for (const c of srv.cookies) {\n rows.push({\n name: c.name,\n type: \"Cookie\",\n provider: providerName,\n purpose: c.purpose || srv.description || cat.description || \"Funcionalidad del servicio\",\n duration: c.duration || \"Persistente\",\n categoryLabel: cat.label,\n policyUrl: srv.policyUrl,\n });\n }\n }\n\n if (srv.storageKeys && srv.storageKeys.length > 0) {\n for (const k of srv.storageKeys) {\n rows.push({\n name: k,\n type: \"localStorage\",\n provider: providerName,\n purpose: srv.description || cat.description || \"Almacenamiento de estado y preferencias\",\n duration: \"Persistente\",\n categoryLabel: cat.label,\n policyUrl: srv.policyUrl,\n });\n }\n }\n\n if (srv.localStorage && srv.localStorage.length > 0) {\n for (const k of srv.localStorage) {\n rows.push({\n name: k,\n type: \"localStorage\",\n provider: providerName,\n purpose: srv.description || cat.description || \"Almacenamiento web local\",\n duration: \"Persistente\",\n categoryLabel: cat.label,\n policyUrl: srv.policyUrl,\n });\n }\n }\n\n if (srv.sessionStorage && srv.sessionStorage.length > 0) {\n for (const k of srv.sessionStorage) {\n rows.push({\n name: k,\n type: \"sessionStorage\",\n provider: providerName,\n purpose: srv.description || cat.description || \"Almacenamiento temporal de sesión\",\n duration: \"Sesión\",\n categoryLabel: cat.label,\n policyUrl: srv.policyUrl,\n });\n }\n }\n\n // If no explicit cookies/keys declared, add service row summary\n if (!srv.cookies?.length && !srv.storageKeys?.length && !srv.localStorage?.length && !srv.sessionStorage?.length) {\n rows.push({\n name: srvId,\n type: \"Cookie\",\n provider: providerName,\n purpose: srv.description || cat.description || \"Servicio integrado\",\n duration: \"Variable\",\n categoryLabel: cat.label,\n policyUrl: srv.policyUrl,\n });\n }\n }\n }\n\n // 2. Process category level storage keys\n if (config.categories) {\n for (const [, cat] of Object.entries(config.categories)) {\n if (cat.storageKeys) {\n for (const k of cat.storageKeys) {\n if (!rows.some((r) => r.name === k)) {\n rows.push({\n name: k,\n type: \"localStorage\",\n provider: \"Propia / Sitio Web\",\n purpose: cat.description,\n duration: \"Persistente\",\n categoryLabel: cat.label,\n });\n }\n }\n }\n if (cat.localStorage) {\n for (const k of cat.localStorage) {\n if (!rows.some((r) => r.name === k)) {\n rows.push({\n name: k,\n type: \"localStorage\",\n provider: \"Propia / Sitio Web\",\n purpose: cat.description,\n duration: \"Persistente\",\n categoryLabel: cat.label,\n });\n }\n }\n }\n if (cat.sessionStorage) {\n for (const k of cat.sessionStorage) {\n if (!rows.some((r) => r.name === k)) {\n rows.push({\n name: k,\n type: \"sessionStorage\",\n provider: \"Propia / Sitio Web\",\n purpose: cat.description,\n duration: \"Sesión\",\n categoryLabel: cat.label,\n });\n }\n }\n }\n }\n }\n\n // 3. Include default consent SDK storage cookie\n const consentCookieName = config.storage?.name || \"site_consent\";\n if (!rows.some((r) => r.name === consentCookieName)) {\n rows.unshift({\n name: consentCookieName,\n type: config.storage?.type === \"memory\" ? \"localStorage\" : \"Cookie\",\n provider: \"Propia (Solvenza Cookies Compliance)\",\n purpose: \"Guarda las preferencias y recibo firmado de consentimiento del usuario.\",\n duration: `${config.consent?.maxAgeDays ?? 365} días`,\n categoryLabel: config.categories?.necessary?.label || \"Necesarias\",\n });\n }\n\n return rows;\n }\n\n /**\n * Render stylized table of cookies and storage keys.\n */\n static renderTable(config: ConsentConfig, options: LegalPolicyOptions = {}): string {\n const isDark = options.theme === \"dark\";\n const bgHeader = isDark ? \"#1e293b\" : \"#f8fafc\";\n const borderCol = isDark ? \"#334155\" : \"#e2e8f0\";\n const textCol = isDark ? \"#f8fafc\" : \"#0f172a\";\n const mutedCol = isDark ? \"#94a3b8\" : \"#64748b\";\n const rowAltBg = isDark ? \"#0f172a\" : \"#ffffff\";\n const rowBg = isDark ? \"#1e293b\" : \"#f8fafc\";\n\n let html = `\n <div class=\"solvenza-policy-table-wrapper\" style=\"overflow-x: auto; margin: 1.5rem 0; border: 1px solid ${borderCol}; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); font-family: system-ui, -apple-system, sans-serif;\">\n <table style=\"width: 100%; border-collapse: collapse; text-align: left; font-size: 0.88rem; color: ${textCol};\">\n <thead>\n <tr style=\"background: ${bgHeader}; border-bottom: 2px solid ${borderCol};\">\n <th style=\"padding: 0.85rem 1rem; font-weight: 700;\">Nombre / Clave</th>\n <th style=\"padding: 0.85rem 1rem; font-weight: 700;\">Tipo</th>\n <th style=\"padding: 0.85rem 1rem; font-weight: 700;\">Categoría</th>\n <th style=\"padding: 0.85rem 1rem; font-weight: 700;\">Proveedor</th>\n <th style=\"padding: 0.85rem 1rem; font-weight: 700;\">Finalidad</th>\n <th style=\"padding: 0.85rem 1rem; font-weight: 700;\">Duración</th>\n </tr>\n </thead>\n <tbody>\n `;\n\n const rows = this.extractCookieRows(config);\n\n if (rows.length === 0) {\n html += `\n <tr>\n <td colspan=\"6\" style=\"padding: 1.5rem; text-align: center; color: ${mutedCol};\">\n No se han registrado cookies ni elementos de almacenamiento en la configuración.\n </td>\n </tr>\n `;\n } else {\n rows.forEach((r, idx) => {\n const bg = idx % 2 === 0 ? rowAltBg : rowBg;\n const providerHtml = r.policyUrl\n ? `<a href=\"${sanitizeHtml(r.policyUrl)}\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color: #2563eb; text-decoration: underline;\">${sanitizeHtml(r.provider)} ↗</a>`\n : sanitizeHtml(r.provider);\n\n html += `\n <tr style=\"background: ${bg}; border-bottom: 1px solid ${borderCol};\">\n <td style=\"padding: 0.75rem 1rem; font-family: monospace; font-weight: 600; color: #2563eb;\">${sanitizeHtml(r.name)}</td>\n <td style=\"padding: 0.75rem 1rem;\">\n <span style=\"display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; background: ${r.type === \"Cookie\" ? \"#e0e7ff\" : \"#fef3c7\"}; color: ${r.type === \"Cookie\" ? \"#3730a3\" : \"#92400e\"};\">\n ${r.type}\n </span>\n </td>\n <td style=\"padding: 0.75rem 1rem; font-weight: 500;\">${sanitizeHtml(r.categoryLabel)}</td>\n <td style=\"padding: 0.75rem 1rem;\">${providerHtml}</td>\n <td style=\"padding: 0.75rem 1rem; color: ${mutedCol};\">${sanitizeHtml(r.purpose)}</td>\n <td style=\"padding: 0.75rem 1rem; white-space: nowrap;\">${sanitizeHtml(r.duration)}</td>\n </tr>\n `;\n });\n }\n\n html += `\n </tbody>\n </table>\n </div>\n `;\n\n return html;\n }\n\n /**\n * Render complete legal Cookie Policy document adapted to LSSI art. 22.2 and AEPD 2024.\n */\n static renderCookiePolicy(config: ConsentConfig, options: LegalPolicyOptions = {}): string {\n if (options.view === \"table-only\") {\n return this.renderTable(config, options);\n }\n\n const companyName = config.legalEntity?.tradeName || config.legalEntity?.name || \"el Titular del Sitio Web\";\n const lastUpdated = config.legalNotice?.lastUpdated || config.policyVersion || new Date().toISOString().split(\"T\")[0];\n const isDark = options.theme === \"dark\";\n const textCol = isDark ? \"#f8fafc\" : \"#0f172a\";\n const mutedCol = isDark ? \"#94a3b8\" : \"#475569\";\n const cardBg = isDark ? \"#1e293b\" : \"#ffffff\";\n const borderCol = isDark ? \"#334155\" : \"#e2e8f0\";\n\n const tableHtml = this.renderTable(config, options);\n\n let html = `\n <article class=\"solvenza-cookie-policy-document ${options.className || \"\"}\" style=\"font-family: system-ui, -apple-system, sans-serif; color: ${textCol}; line-height: 1.7; max-width: 900px; margin: 0 auto; padding: 1rem 0;\">\n <header style=\"margin-bottom: 2rem; border-bottom: 1px solid ${borderCol}; padding-bottom: 1.5rem;\">\n <h1 style=\"font-size: 1.85rem; font-weight: 800; margin: 0 0 0.5rem 0; color: ${textCol};\">Política de Cookies</h1>\n <p style=\"margin: 0; font-size: 0.9rem; color: ${mutedCol};\">\n Conforme al artículo 22.2 de la Ley 34/2002 (LSSI-CE), el RGPD (UE 2016/679) y la Guía sobre el uso de cookies de la AEPD.\n <br><em>Última actualización: ${sanitizeHtml(lastUpdated)}</em>\n </p>\n </header>\n\n <section style=\"margin-bottom: 2rem;\">\n <h2 style=\"font-size: 1.3rem; font-weight: 700; color: ${textCol};\">1. ¿Qué son las cookies y tecnologías de almacenamiento local?</h2>\n <p style=\"color: ${mutedCol};\">\n Este sitio web, titularidad de <strong>${sanitizeHtml(companyName)}</strong>, utiliza cookies y tecnologías de almacenamiento similares (tales como <code>localStorage</code>, <code>sessionStorage</code>, píxeles de seguimiento y etiquetas) para garantizar el funcionamiento técnico del sitio, optimizar la experiencia de navegación, medir el uso de la web y, en su caso, mostrar contenidos personalizados o multimedia.\n </p>\n <p style=\"color: ${mutedCol};\">\n Una <strong>cookie</strong> es un pequeño fichero de texto que se descarga y almacena en el navegador del usuario al acceder a determinadas páginas web. Permite a una página web, entre otras cosas, recordar las preferencias de navegación, almacenar y recuperar información sobre los hábitos de visita y reconocer al usuario en visitas posteriores.\n </p>\n </section>\n\n <section style=\"margin-bottom: 2rem;\">\n <h2 style=\"font-size: 1.3rem; font-weight: 700; color: ${textCol};\">2. Tipos de cookies y finalidades utilizadas</h2>\n <p style=\"color: ${mutedCol};\">\n En función de su finalidad, titularidad y plazo de permanencia, en este sitio web se utilizan las siguientes categorías:\n </p>\n <ul style=\"color: ${mutedCol}; padding-left: 1.5rem; margin-bottom: 1.5rem;\">\n `;\n\n for (const [, cat] of Object.entries(config.categories)) {\n const isReq = cat.required === true;\n html += `\n <li style=\"margin-bottom: 0.6rem;\">\n <strong>${sanitizeHtml(cat.label)}</strong> (${isReq ? \"Técnicas / Exentas de consentimiento\" : \"Opcionales / Sujetas a consentimiento\"}):\n ${sanitizeHtml(cat.description)}\n </li>\n `;\n }\n\n html += `\n </ul>\n\n <h3 style=\"font-size: 1.1rem; font-weight: 700; color: ${textCol}; margin-top: 1.5rem;\">Inventario detallado de cookies y almacenamiento web</h3>\n <p style=\"color: ${mutedCol}; font-size: 0.9rem;\">\n A continuación se detallan de forma transparente todas las cookies y claves de almacenamiento registradas en la aplicación:\n </p>\n ${tableHtml}\n </section>\n\n <section style=\"margin-bottom: 2rem; background: ${cardBg}; border: 1px solid ${borderCol}; border-radius: 12px; padding: 1.5rem; box-shadow: 0 2px 4px rgba(0,0,0,0.03);\">\n <h2 style=\"font-size: 1.3rem; font-weight: 700; color: ${textCol}; margin-top: 0;\">3. Gestión, configuración y revocación del consentimiento</h2>\n <p style=\"color: ${mutedCol};\">\n De acuerdo con las directrices de la Agencia Española de Protección de Datos (AEPD), retirar o modificar el consentimiento debe ser tan fácil como otorgarlo. Puedes modificar tus preferencias o revocar el consentimiento en cualquier momento:\n </p>\n <div style=\"display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem;\">\n <button\n type=\"button\"\n data-consent-open\n onclick=\"if(window.Consent) window.Consent.openPreferences()\"\n style=\"background: #0f172a; color: #ffffff; border: none; padding: 0.65rem 1.3rem; border-radius: 8px; font-weight: 600; font-size: 0.9rem; cursor: pointer; display: inline-flex; align-items: center; gap: 0.5rem;\"\n >\n ⚙️ Abrir panel de preferencias de cookies\n </button>\n <button\n type=\"button\"\n onclick=\"if(window.Consent) window.Consent.withdraw()\"\n style=\"background: #ffffff; color: #dc2626; border: 1px solid #fca5a5; padding: 0.65rem 1.3rem; border-radius: 8px; font-weight: 600; font-size: 0.9rem; cursor: pointer; display: inline-flex; align-items: center; gap: 0.5rem;\"\n >\n 🔄 Revocar consentimiento y purgar datos\n </button>\n </div>\n </section>\n\n <section style=\"margin-bottom: 2rem;\">\n <h2 style=\"font-size: 1.3rem; font-weight: 700; color: ${textCol};\">4. Cómo deshabilitar o eliminar las cookies en los navegadores</h2>\n <p style=\"color: ${mutedCol};\">\n El usuario puede permitir, bloquear o eliminar las cookies instaladas en su equipo mediante la configuración de las opciones de su navegador web:\n </p>\n <ul style=\"color: #2563eb; padding-left: 1.5rem;\">\n <li style=\"margin-bottom: 0.4rem;\"><a href=\"https://support.google.com/chrome/answer/95647\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color: inherit; text-decoration: underline;\">Google Chrome</a></li>\n <li style=\"margin-bottom: 0.4rem;\"><a href=\"https://support.mozilla.org/es/kb/habilitar-y-deshabilitar-cookies-sitios-web-rastrear-preferencias\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color: inherit; text-decoration: underline;\">Mozilla Firefox</a></li>\n <li style=\"margin-bottom: 0.4rem;\"><a href=\"https://support.apple.com/es-es/guide/safari/sfri11471/mac\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color: inherit; text-decoration: underline;\">Apple Safari</a></li>\n <li style=\"margin-bottom: 0.4rem;\"><a href=\"https://support.microsoft.com/es-es/microsoft-edge/eliminar-las-cookies-en-microsoft-edge-63947406-40ac-c3b8-57b9-2a946a29ae09\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color: inherit; text-decoration: underline;\">Microsoft Edge</a></li>\n <li style=\"margin-bottom: 0.4rem;\"><a href=\"https://help.opera.com/en/latest/web-preferences/#cookies\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color: inherit; text-decoration: underline;\">Opera Browser</a></li>\n </ul>\n </section>\n\n <section style=\"margin-bottom: 2rem;\">\n <h2 style=\"font-size: 1.3rem; font-weight: 700; color: ${textCol};\">5. Reconocimiento de Global Privacy Control (GPC)</h2>\n <p style=\"color: ${mutedCol};\">\n Este sitio web está adaptado al estándar <strong>Global Privacy Control (GPC)</strong> y a la cabecera <code>Do Not Track (DNT)</code>. Si tu navegador emite una señal universal de no seguimiento, nuestro sistema desactivará automáticamente todas las cookies no necesarias sin requerir interacción manual.\n </p>\n </section>\n\n <section style=\"margin-bottom: 2rem;\">\n <h2 style=\"font-size: 1.3rem; font-weight: 700; color: ${textCol};\">6. Transferencias internacionales de datos</h2>\n <p style=\"color: ${mutedCol};\">\n Determinadas cookies de terceros (tales como Google Analytics o Meta) pueden implicar la transferencia internacional de datos a servidores ubicados en Estados Unidos u otros países fuera del Espacio Económico Europeo (EEE). Dichas transferencias se encuentran amparadas bajo el Marco de Privacidad de Datos UE-EE.UU. (Data Privacy Framework) o Cláusulas Contractuales Tipo aprobadas por la Comisión Europea.\n </p>\n </section>\n </article>\n `;\n\n return html;\n }\n\n /**\n * Render complete legal notice (Aviso Legal) conforming to LSSI-CE Art. 10.\n */\n static renderLegalNotice(config: ConsentConfig, options: LegalPolicyOptions = {}): string {\n const entity = config.legalEntity || {\n name: \"[Razón Social del Titular]\",\n taxId: \"[NIF / CIF]\",\n address: \"[Domicilio Social]\",\n email: \"[Email de Contacto]\",\n };\n\n const law = config.legalNotice?.applicableLaw || \"Legislación española (LSSI-CE, LOPDGDD) y Reglamento General de Protección de Datos (RGPD UE 2016/679)\";\n const jurisdiction = config.legalNotice?.jurisdiction || \"Juzgados y Tribunales competentes conforme a la normativa de consumidores y usuarios\";\n const lastUpdated = config.legalNotice?.lastUpdated || config.policyVersion || new Date().toISOString().split(\"T\")[0];\n\n const isDark = options.theme === \"dark\";\n const textCol = isDark ? \"#f8fafc\" : \"#0f172a\";\n const mutedCol = isDark ? \"#94a3b8\" : \"#475569\";\n const borderCol = isDark ? \"#334155\" : \"#e2e8f0\";\n\n return `\n <article class=\"solvenza-legal-notice-document ${options.className || \"\"}\" style=\"font-family: system-ui, -apple-system, sans-serif; color: ${textCol}; line-height: 1.7; max-width: 900px; margin: 0 auto; padding: 1rem 0;\">\n <header style=\"margin-bottom: 2rem; border-bottom: 1px solid ${borderCol}; padding-bottom: 1.5rem;\">\n <h1 style=\"font-size: 1.85rem; font-weight: 800; margin: 0 0 0.5rem 0; color: ${textCol};\">Aviso Legal</h1>\n <p style=\"margin: 0; font-size: 0.9rem; color: ${mutedCol};\">\n En cumplimiento del artículo 10 de la Ley 34/2002, de 11 de julio, de Servicios de la Sociedad de la Información y de Comercio Electrónico (LSSI-CE).\n <br><em>Última actualización: ${sanitizeHtml(lastUpdated)}</em>\n </p>\n </header>\n\n <section style=\"margin-bottom: 2rem;\">\n <h2 style=\"font-size: 1.3rem; font-weight: 700; color: ${textCol};\">1. Datos identificativos del titular</h2>\n <table style=\"width: 100%; border-collapse: collapse; margin-top: 1rem; border: 1px solid ${borderCol};\">\n <tbody>\n <tr style=\"border-bottom: 1px solid ${borderCol};\">\n <td style=\"padding: 0.75rem 1rem; font-weight: 600; width: 30%;\">Razón Social:</td>\n <td style=\"padding: 0.75rem 1rem; color: ${mutedCol};\">${sanitizeHtml(entity.name)}</td>\n </tr>\n ${entity.tradeName ? `<tr style=\"border-bottom: 1px solid ${borderCol};\"><td style=\"padding: 0.75rem 1rem; font-weight: 600;\">Nombre Comercial:</td><td style=\"padding: 0.75rem 1rem; color: ${mutedCol};\">${sanitizeHtml(entity.tradeName)}</td></tr>` : \"\"}\n <tr style=\"border-bottom: 1px solid ${borderCol};\">\n <td style=\"padding: 0.75rem 1rem; font-weight: 600;\">NIF / CIF:</td>\n <td style=\"padding: 0.75rem 1rem; color: ${mutedCol};\">${sanitizeHtml(entity.taxId || \"-\")}</td>\n </tr>\n <tr style=\"border-bottom: 1px solid ${borderCol};\">\n <td style=\"padding: 0.75rem 1rem; font-weight: 600;\">Domicilio Social:</td>\n <td style=\"padding: 0.75rem 1rem; color: ${mutedCol};\">${sanitizeHtml(entity.address || \"-\")}</td>\n </tr>\n <tr style=\"border-bottom: 1px solid ${borderCol};\">\n <td style=\"padding: 0.75rem 1rem; font-weight: 600;\">Correo Electrónico:</td>\n <td style=\"padding: 0.75rem 1rem; color: ${mutedCol};\"><a href=\"mailto:${sanitizeHtml(entity.email || \"\")}\" style=\"color: #2563eb;\">${sanitizeHtml(entity.email || \"-\")}</a></td>\n </tr>\n ${entity.phone ? `<tr style=\"border-bottom: 1px solid ${borderCol};\"><td style=\"padding: 0.75rem 1rem; font-weight: 600;\">Teléfono:</td><td style=\"padding: 0.75rem 1rem; color: ${mutedCol};\">${sanitizeHtml(entity.phone)}</td></tr>` : \"\"}\n ${entity.registryData ? `<tr style=\"border-bottom: 1px solid ${borderCol};\"><td style=\"padding: 0.75rem 1rem; font-weight: 600;\">Datos Registrales:</td><td style=\"padding: 0.75rem 1rem; color: ${mutedCol};\">${sanitizeHtml(entity.registryData)}</td></tr>` : \"\"}\n ${entity.dpoEmail ? `<tr><td style=\"padding: 0.75rem 1rem; font-weight: 600;\">Delegado de Protección de Datos (DPO):</td><td style=\"padding: 0.75rem 1rem; color: ${mutedCol};\"><a href=\"mailto:${sanitizeHtml(entity.dpoEmail)}\" style=\"color: #2563eb;\">${sanitizeHtml(entity.dpoEmail)}</a></td></tr>` : \"\"}\n </tbody>\n </table>\n </section>\n\n <section style=\"margin-bottom: 2rem;\">\n <h2 style=\"font-size: 1.3rem; font-weight: 700; color: ${textCol};\">2. Condiciones generales de uso</h2>\n <p style=\"color: ${mutedCol};\">\n El acceso y/o uso de este sitio web atribuye la condición de usuario, que acepta, desde dicho acceso y/o uso, las presentes condiciones generales. El usuario se compromete a hacer un uso adecuado de los contenidos y servicios que el titular ofrece a través de su sitio web y a no emplearlos para incurrir en actividades ilícitas o contrarias a la buena fe y al orden público.\n </p>\n </section>\n\n <section style=\"margin-bottom: 2rem;\">\n <h2 style=\"font-size: 1.3rem; font-weight: 700; color: ${textCol};\">3. Propiedad intelectual e industrial</h2>\n <p style=\"color: ${mutedCol};\">\n Todos los derechos de propiedad intelectual e industrial sobre el diseño, marcas, logotipos, textos, código fuente e ilustraciones de este sitio web corresponden al titular o a sus legítimos licenciantes. Queda expresamente prohibida la reproducción, distribución o comunicación pública de la totalidad o parte de los contenidos sin autorización previa y por escrito.\n </p>\n </section>\n\n <section style=\"margin-bottom: 2rem;\">\n <h2 style=\"font-size: 1.3rem; font-weight: 700; color: ${textCol};\">4. Exclusión de garantías y responsabilidad</h2>\n <p style=\"color: ${mutedCol};\">\n El titular no se hace responsable, en ningún caso, de los daños y perjuicios de cualquier naturaleza que pudieran ocasionar errores u omisiones en los contenidos, falta de disponibilidad del portal o la transmisión de virus o programas maliciosos, a pesar de haber adoptado todas las medidas tecnológicas necesarias para evitarlo.\n </p>\n </section>\n\n <section style=\"margin-bottom: 2rem;\">\n <h2 style=\"font-size: 1.3rem; font-weight: 700; color: ${textCol};\">5. Legislación aplicable y jurisdicción</h2>\n <p style=\"color: ${mutedCol};\">\n Las relaciones entre el titular y el usuario se regirán por la <strong>${sanitizeHtml(law)}</strong>. Para la resolución de cualquier controversia, las partes se someten a los <strong>${sanitizeHtml(jurisdiction)}</strong>, sin perjuicio de los fueros imperativos legales aplicables.\n </p>\n </section>\n </article>\n `;\n }\n\n /**\n * Render Privacy Policy document (Política de Privacidad RGPD).\n */\n static renderPrivacyPolicy(config: ConsentConfig, options: LegalPolicyOptions = {}): string {\n const entity = config.legalEntity || {\n name: \"[Razón Social del Responsable]\",\n taxId: \"[NIF / CIF]\",\n address: \"[Domicilio]\",\n email: \"privacidad@solvenza.es\",\n };\n\n const isDark = options.theme === \"dark\";\n const textCol = isDark ? \"#f8fafc\" : \"#0f172a\";\n const mutedCol = isDark ? \"#94a3b8\" : \"#475569\";\n const borderCol = isDark ? \"#334155\" : \"#e2e8f0\";\n\n return `\n <article class=\"solvenza-privacy-policy-document ${options.className || \"\"}\" style=\"font-family: system-ui, -apple-system, sans-serif; color: ${textCol}; line-height: 1.7; max-width: 900px; margin: 0 auto; padding: 1rem 0;\">\n <header style=\"margin-bottom: 2rem; border-bottom: 1px solid ${borderCol}; padding-bottom: 1.5rem;\">\n <h1 style=\"font-size: 1.85rem; font-weight: 800; margin: 0 0 0.5rem 0; color: ${textCol};\">Política de Privacidad y Protección de Datos</h1>\n <p style=\"margin: 0; font-size: 0.9rem; color: ${mutedCol};\">\n Conforme al Reglamento General de Protección de Datos (RGPD UE 2016/679) y la Ley Orgánica 3/2018 (LOPDGDD).\n </p>\n </header>\n\n <section style=\"margin-bottom: 2rem;\">\n <h2 style=\"font-size: 1.3rem; font-weight: 700; color: ${textCol};\">1. Responsable del tratamiento</h2>\n <p style=\"color: ${mutedCol};\">\n <strong>Identidad:</strong> ${sanitizeHtml(entity.name)}<br>\n <strong>NIF / CIF:</strong> ${sanitizeHtml(entity.taxId || \"-\")}<br>\n <strong>Dirección:</strong> ${sanitizeHtml(entity.address || \"-\")}<br>\n <strong>Correo electrónico:</strong> <a href=\"mailto:${sanitizeHtml(entity.email || \"\")}\" style=\"color: #2563eb;\">${sanitizeHtml(entity.email || \"-\")}</a><br>\n ${entity.dpoEmail ? `<strong>Contacto DPO:</strong> <a href=\"mailto:${sanitizeHtml(entity.dpoEmail)}\" style=\"color: #2563eb;\">${sanitizeHtml(entity.dpoEmail)}</a>` : \"\"}\n </p>\n </section>\n\n <section style=\"margin-bottom: 2rem;\">\n <h2 style=\"font-size: 1.3rem; font-weight: 700; color: ${textCol};\">2. Finalidad del tratamiento y base jurídica</h2>\n <p style=\"color: ${mutedCol};\">\n Tratamos los datos facilitados por los usuarios con las finalidades de gestionar sus solicitudes, prestar los servicios contratados y, en su caso, analizar el rendimiento de la web y remitir comunicaciones comerciales sobre la base de su <strong>consentimiento explícito</strong> (art. 6.1.a RGPD) o en la <strong>ejecución contractual</strong> (art. 6.1.b RGPD).\n </p>\n </section>\n\n <section style=\"margin-bottom: 2rem;\">\n <h2 style=\"font-size: 1.3rem; font-weight: 700; color: ${textCol};\">3. Derechos del interesado</h2>\n <p style=\"color: ${mutedCol};\">\n Cualquier persona tiene derecho a obtener confirmación sobre si estamos tratando datos personales que le conciernen. Los interesados tienen derecho a acceder a sus datos personales, solicitar la rectificación de los datos inexactos o, en su caso, solicitar su supresión cuando los datos ya no sean necesarios para los fines que fueron recogidos.\n </p>\n <p style=\"color: ${mutedCol};\">\n Puedes ejercer tus derechos de Acceso, Rectificación, Supresión, Limitación, Portabilidad y Oposición enviando un correo a <a href=\"mailto:${sanitizeHtml(entity.email || \"\")}\" style=\"color: #2563eb;\">${sanitizeHtml(entity.email || \"\")}</a>. Asimismo, puedes presentar una reclamación ante la Agencia Española de Protección de Datos (<a href=\"https://www.aepd.es\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color: #2563eb;\">www.aepd.es</a>).\n </p>\n </section>\n </article>\n `;\n }\n}\n","import type {\n ConsentConfig,\n TranslationConfig,\n} from \"../core/types.js\";\n\nexport const BUILTIN_TRANSLATIONS: Record<string, TranslationConfig> = {\n es: {\n ui: {\n banner: {\n title: \"Tu privacidad, bajo tu control\",\n description:\n \"Usamos tecnologías necesarias para el funcionamiento del sitio. Con tu permiso, también podemos utilizar analítica y marketing.\",\n accept: \"Aceptar todas\",\n reject: \"Rechazar todas\",\n configure: \"Configurar\",\n cookiesPolicy: \"Política de cookies\",\n privacyPolicy: \"Política de privacidad\",\n ariaLabel: \"Gestión de consentimiento de privacidad\",\n },\n preferences: {\n title: \"Preferencias de privacidad\",\n subtitle:\n \"Gestiona tus permisos de almacenamiento por finalidad (LSSI art. 22.2 & RGPD).\",\n save: \"Guardar selección\",\n acceptAll: \"Permitir todas\",\n rejectAll: \"Rechazar opcionales\",\n closeLabel: \"Cerrar ventana\",\n requiredBadge: \"Requerida\",\n optionalBadge: \"Opcional\",\n servicesLabel: \"Servicios incluidos\",\n viewServices: \"Ver servicios\",\n hideServices: \"Ocultar servicios\",\n thirdParty: \"Terceros\",\n },\n floatingBadge: {\n label: \"Cookies\",\n ariaLabel: \"Configuración y revocación de cookies\",\n tooltip: \"Configurar o declinar cookies\",\n },\n },\n categories: {\n necessary: {\n label: \"Cookies Técnicas y Necesarias\",\n description:\n \"Imprescindibles para que el sitio web funcione y no pueden ser desactivadas.\",\n },\n analytics: {\n label: \"Medición y Rendimiento\",\n description:\n \"Nos permiten analizar las visitas y fuentes de tráfico para optimizar el sitio.\",\n },\n marketing: {\n label: \"Publicidad Personalizada\",\n description:\n \"Utilizadas para mostrar anuncios relevantes según tus intereses y navegación.\",\n },\n preferences: {\n label: \"Preferencias y Personalización\",\n description:\n \"Permiten recordar información que cambia el aspecto o comportamiento del sitio.\",\n },\n },\n },\n en: {\n ui: {\n banner: {\n title: \"Your privacy, under your control\",\n description:\n \"We use essential technologies for our website to function. With your consent, we may also use analytics and marketing technologies.\",\n accept: \"Accept all\",\n reject: \"Reject all\",\n configure: \"Customize\",\n cookiesPolicy: \"Cookie policy\",\n privacyPolicy: \"Privacy policy\",\n ariaLabel: \"Privacy consent management\",\n },\n preferences: {\n title: \"Privacy Preferences\",\n subtitle:\n \"Manage your storage permissions by purpose (GDPR & ePrivacy compliant).\",\n save: \"Save preferences\",\n acceptAll: \"Allow all\",\n rejectAll: \"Reject optional\",\n closeLabel: \"Close dialog\",\n requiredBadge: \"Required\",\n optionalBadge: \"Optional\",\n servicesLabel: \"Included services\",\n viewServices: \"View services\",\n hideServices: \"Hide services\",\n thirdParty: \"Third-party\",\n },\n floatingBadge: {\n label: \"Cookies\",\n ariaLabel: \"Cookie preferences and revocation\",\n tooltip: \"Customize or decline cookies\",\n },\n },\n categories: {\n necessary: {\n label: \"Strictly Necessary Cookies\",\n description:\n \"Essential for the website to function properly and cannot be deactivated.\",\n },\n analytics: {\n label: \"Performance & Analytics\",\n description:\n \"Help us understand visitor behavior and traffic sources to optimize performance.\",\n },\n marketing: {\n label: \"Targeted Advertising\",\n description:\n \"Used to deliver relevant ads and track campaign effectiveness across websites.\",\n },\n preferences: {\n label: \"Preferences & Personalization\",\n description:\n \"Enable the website to remember user choices like language and layout settings.\",\n },\n },\n },\n ca: {\n ui: {\n banner: {\n title: \"La teva privacitat, sota el teu control\",\n description:\n \"Utilitzem tecnologies necessàries per al funcionament del lloc. Amb el teu permís, també podem utilitzar analítica i màrqueting.\",\n accept: \"Acceptar-les totes\",\n reject: \"Rebutjar-les totes\",\n configure: \"Configurar\",\n cookiesPolicy: \"Política de cookies\",\n privacyPolicy: \"Política de privacitat\",\n ariaLabel: \"Gestió de consentiment de privacitat\",\n },\n preferences: {\n title: \"Preferències de privacitat\",\n subtitle:\n \"Gestiona els teus permisos d'emmagatzematge per finalitat (LSSI art. 22.2 & RGPD).\",\n save: \"Desar selecció\",\n acceptAll: \"Permetre-les totes\",\n rejectAll: \"Rebutjar opcionals\",\n closeLabel: \"Tancar finestra\",\n requiredBadge: \"Requerida\",\n optionalBadge: \"Opcional\",\n servicesLabel: \"Serveis inclosos\",\n viewServices: \"Veure serveis\",\n hideServices: \"Amagar serveis\",\n thirdParty: \"Tercers\",\n },\n floatingBadge: {\n label: \"Cookies\",\n ariaLabel: \"Configuració i revocació de cookies\",\n tooltip: \"Configurar o declinar cookies\",\n },\n },\n categories: {\n necessary: {\n label: \"Cookies Tècniques i Necessàries\",\n description:\n \"Imprescindibles perquè el lloc web funcioni correctament i no es poden desactivar.\",\n },\n analytics: {\n label: \"Mesurament i Rendiment\",\n description:\n \"Ens permeten analitzar les visites i fonts de trànsit per optimitzar el lloc.\",\n },\n marketing: {\n label: \"Publicidad Personalitzada\",\n description:\n \"Utilitzades per mostrar anuncis rellevants segons els teus interessos i navegació.\",\n },\n preferences: {\n label: \"Preferències i Personalització\",\n description:\n \"Permeten recordar informació que canvia l'aspecte o comportament del lloc.\",\n },\n },\n },\n eu: {\n ui: {\n banner: {\n title: \"Zure pribatutasuna, zure kontrolpean\",\n description:\n \"Webguneak funtzionatzeko beharrezkoak diren teknologiak erabiltzen ditugu. Zure baimenarekin, analitika eta marketina ere erabil ditzakegu.\",\n accept: \"Onartu guztiak\",\n reject: \"Baztertu guztiak\",\n configure: \"Konfiguratu\",\n cookiesPolicy: \"Cookie politika\",\n privacyPolicy: \"Pribatutasun politika\",\n ariaLabel: \"Pribatutasun-baimenen kudeaketa\",\n },\n preferences: {\n title: \"Pribatutasun-hobespenak\",\n subtitle:\n \"Kudeatu zure biltegiratze-baimenak helburuaren arabera (RGPD).\",\n save: \"Gorde hautapena\",\n acceptAll: \"Onartu guztiak\",\n rejectAll: \"Baztertu aukerakoak\",\n closeLabel: \"Itxi leihoa\",\n requiredBadge: \"Beharrezkoa\",\n optionalBadge: \"Aukerakoa\",\n servicesLabel: \"Barne dauden zerbitzuak\",\n viewServices: \"Ikusi zerbitzuak\",\n hideServices: \"Ezkutatu zerbitzuak\",\n thirdParty: \"Hirugarrenak\",\n },\n floatingBadge: {\n label: \"Cookieak\",\n ariaLabel: \"Cookien ezarpenak eta ezeztapena\",\n tooltip: \"Konfiguratu edo baztertu cookieak\",\n },\n },\n },\n gl: {\n ui: {\n banner: {\n title: \"A túa privacidade, baixo o teu control\",\n description:\n \"Empregamos tecnoloxías necesarias para o funcionamento do sitio. Co teu permiso, tamén podemos utilizar analítica e márketing.\",\n accept: \"Aceptar todas\",\n reject: \"Rexeitar todas\",\n configure: \"Configurar\",\n cookiesPolicy: \"Política de cookies\",\n privacyPolicy: \"Política de privacidade\",\n ariaLabel: \"Xestión de consentimento de privacidade\",\n },\n preferences: {\n title: \"Preferencias de privacidade\",\n subtitle:\n \"Xestiona os teus permisos de almacenamento por finalidade (LSSI art. 22.2 & RGPD).\",\n save: \"Gardar selección\",\n acceptAll: \"Permitir todas\",\n rejectAll: \"Rexeitar opcionais\",\n closeLabel: \"Pechar xanela\",\n requiredBadge: \"Requirida\",\n optionalBadge: \"Opcional\",\n servicesLabel: \"Servizos incluídos\",\n viewServices: \"Ver servizos\",\n hideServices: \"Ocultar servizos\",\n thirdParty: \"Terceiros\",\n },\n floatingBadge: {\n label: \"Cookies\",\n ariaLabel: \"Configuración e revocación de cookies\",\n tooltip: \"Configurar ou declinar cookies\",\n },\n },\n },\n};\n\nexport class I18nEngine {\n private locale: string = \"es\";\n\n constructor(defaultLocale: string = \"es\") {\n this.locale = defaultLocale;\n }\n\n setLocale(locale: string): void {\n this.locale = locale.toLowerCase();\n }\n\n getLocale(): string {\n return this.locale;\n }\n\n detectBrowserLocale(supportedLocales?: string[]): string {\n if (typeof navigator !== \"undefined\" && navigator.language) {\n const detected = navigator.language.split(\"-\")[0].toLowerCase();\n if (supportedLocales && supportedLocales.length > 0) {\n const normalized = supportedLocales.map((l) => l.toLowerCase());\n if (normalized.includes(detected)) {\n return detected;\n }\n return normalized[0];\n }\n return detected;\n }\n return \"es\";\n }\n\n isLocaleSupported(locale: string, config?: ConsentConfig): boolean {\n const clean = locale.toLowerCase();\n if (config?.locale?.supported && config.locale.supported.length > 0) {\n return config.locale.supported.map((s) => s.toLowerCase()).includes(clean);\n }\n if (config?.translations && config.translations[clean]) {\n return true;\n }\n if (BUILTIN_TRANSLATIONS[clean]) {\n return true;\n }\n return clean === (config?.locale?.default || \"es\").toLowerCase();\n }\n\n detectParentLocale(config?: ConsentConfig): string {\n const supported = config?.locale?.supported;\n const defaultLocale = (config?.locale?.default || \"es\").toLowerCase();\n\n // 1. Sync with parent application's <html lang=\"...\"> tag (unless explicitly disabled)\n if (config?.locale?.syncHtmlLang !== false && typeof document !== \"undefined\" && document.documentElement) {\n const htmlLang = document.documentElement.lang;\n if (htmlLang && htmlLang.trim().length > 0) {\n const clean = htmlLang.split(\"-\")[0].toLowerCase().trim();\n if (this.isLocaleSupported(clean, config)) {\n return clean;\n }\n }\n }\n\n // 2. Sync with parent application's URL path (/en/...) or query (?lang=en, ?locale=en)\n if (config?.locale?.syncUrl !== false && typeof window !== \"undefined\" && window.location) {\n const pathSegments = window.location.pathname.split(\"/\").filter(Boolean);\n if (pathSegments.length > 0) {\n const potentialLang = pathSegments[0].toLowerCase();\n if (this.isLocaleSupported(potentialLang, config)) {\n return potentialLang;\n }\n }\n try {\n const urlParams = new URLSearchParams(window.location.search);\n const queryLang = (urlParams.get(\"lang\") || urlParams.get(\"locale\"))?.toLowerCase();\n if (queryLang && this.isLocaleSupported(queryLang, config)) {\n return queryLang;\n }\n } catch {}\n }\n\n // 3. Auto-detect from browser navigator\n if (config?.locale?.autoDetect) {\n return this.detectBrowserLocale(supported);\n }\n\n return defaultLocale;\n }\n\n startParentSync(\n config: ConsentConfig,\n onLocaleChange: (newLocale: string) => void,\n ): () => void {\n const cleanups: (() => void)[] = [];\n\n // 1. Observe <html lang=\"...\"> attribute changes made by parent framework (Next.js, React, Angular, etc.)\n if (\n config.locale?.syncHtmlLang !== false &&\n typeof document !== \"undefined\" &&\n typeof MutationObserver !== \"undefined\" &&\n document.documentElement\n ) {\n const observer = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.type === \"attributes\" && mutation.attributeName === \"lang\") {\n const rawLang = document.documentElement.lang;\n if (rawLang && rawLang.trim().length > 0) {\n const clean = rawLang.split(\"-\")[0].toLowerCase().trim();\n if (this.isLocaleSupported(clean, config) && clean !== this.locale) {\n onLocaleChange(clean);\n }\n }\n }\n }\n });\n\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [\"lang\"],\n });\n\n cleanups.push(() => observer.disconnect());\n }\n\n // 2. Listen to system language changes if autoDetect is enabled\n if (config.locale?.autoDetect && typeof window !== \"undefined\") {\n const handleLangChange = () => {\n const detected = this.detectBrowserLocale(config.locale?.supported);\n if (detected !== this.locale) {\n onLocaleChange(detected);\n }\n };\n\n window.addEventListener(\"languagechange\", handleLangChange);\n cleanups.push(() => window.removeEventListener(\"languagechange\", handleLangChange));\n }\n\n return () => {\n cleanups.forEach((cleanup) => cleanup());\n };\n }\n\n resolveConfig(config: ConsentConfig, targetLocale?: string): ConsentConfig {\n const baseLocale = (config.locale?.default || \"es\").toLowerCase();\n const locale = (targetLocale || this.locale || baseLocale).toLowerCase();\n\n // Deep clone base config so we don't mutate original configuration\n const resolved: ConsentConfig = JSON.parse(JSON.stringify(config));\n\n // 1. Overlay built-in dictionary if available (es, en, ca, eu, gl)\n const builtin = BUILTIN_TRANSLATIONS[locale];\n if (builtin) {\n const isBaseLocale = locale === baseLocale;\n this.applyTranslation(resolved, builtin, !isBaseLocale);\n }\n\n // 2. Overlay user custom translation from config.translations[locale] if defined (takes precedence)\n const custom = config.translations?.[locale];\n if (custom) {\n this.applyTranslation(resolved, custom, true);\n }\n\n return resolved;\n }\n\n private applyTranslation(\n target: ConsentConfig,\n translation: TranslationConfig,\n overwriteExisting: boolean,\n ): void {\n // Policy links\n if (translation.policy) {\n if (!target.policy) target.policy = {};\n if (translation.policy.privacyUrl && (overwriteExisting || !target.policy.privacyUrl)) {\n target.policy.privacyUrl = translation.policy.privacyUrl;\n }\n if (translation.policy.cookiesUrl && (overwriteExisting || !target.policy.cookiesUrl)) {\n target.policy.cookiesUrl = translation.policy.cookiesUrl;\n }\n }\n\n // UI elements\n if (translation.ui) {\n if (!target.ui) target.ui = {};\n\n // Banner\n if (translation.ui.banner) {\n if (!target.ui.banner) target.ui.banner = {};\n for (const [key, value] of Object.entries(this.filterDefined(translation.ui.banner))) {\n if (overwriteExisting || !(target.ui.banner as any)[key]) {\n (target.ui.banner as any)[key] = value;\n }\n }\n }\n\n // Preferences\n if (translation.ui.preferences) {\n if (!target.ui.preferences) target.ui.preferences = {};\n for (const [key, value] of Object.entries(this.filterDefined(translation.ui.preferences))) {\n if (overwriteExisting || !(target.ui.preferences as any)[key]) {\n (target.ui.preferences as any)[key] = value;\n }\n }\n }\n\n // Floating Badge\n if (translation.ui.floatingBadge) {\n if (typeof target.ui.floatingBadge === \"object\" && target.ui.floatingBadge !== null) {\n for (const [key, value] of Object.entries(this.filterDefined(translation.ui.floatingBadge))) {\n if (overwriteExisting || !(target.ui.floatingBadge as any)[key]) {\n (target.ui.floatingBadge as any)[key] = value;\n }\n }\n } else if (target.ui.floatingBadge === true) {\n target.ui.floatingBadge = {\n enabled: true,\n position: \"bottom-left\",\n icon: \"cookie\",\n ...this.filterDefined(translation.ui.floatingBadge),\n };\n }\n }\n }\n\n // Categories\n if (translation.categories && target.categories) {\n for (const [catId, catTrans] of Object.entries(translation.categories)) {\n if (target.categories[catId]) {\n if (catTrans.label && (overwriteExisting || !target.categories[catId].label)) {\n target.categories[catId].label = catTrans.label;\n }\n if (catTrans.description && (overwriteExisting || !target.categories[catId].description)) {\n target.categories[catId].description = catTrans.description;\n }\n }\n }\n }\n\n // Services\n if (translation.services && target.services) {\n for (const [srvId, srvTrans] of Object.entries(translation.services)) {\n if (target.services[srvId]) {\n if (srvTrans.label && (overwriteExisting || !target.services[srvId].label)) {\n target.services[srvId].label = srvTrans.label;\n }\n if (srvTrans.provider && (overwriteExisting || !target.services[srvId].provider)) {\n target.services[srvId].provider = srvTrans.provider;\n }\n }\n }\n }\n }\n\n private filterDefined<T extends Record<string, any>>(obj: T): Partial<T> {\n const result: Partial<T> = {};\n for (const [key, value] of Object.entries(obj)) {\n if (value !== undefined && value !== null) {\n result[key as keyof T] = value;\n }\n }\n return result;\n }\n}\n","import type { ConsentChoices, ConsentConfig, GpcConfig } from \"./types.js\";\n\n/**\n * Detect Global Privacy Control (GPC) or Do Not Track (DNT) signal from the browser environment.\n * Compliant with W3C Global Privacy Control specification and privacy standards.\n *\n * @returns boolean indicating if a privacy signal is active\n */\nexport function detectGpcSignal(): boolean {\n if (typeof window === \"undefined\" && typeof navigator === \"undefined\" && typeof globalThis === \"undefined\") {\n return false;\n }\n\n const nav = typeof navigator !== \"undefined\" ? (navigator as any) : null;\n const win = typeof window !== \"undefined\" ? (window as any) : null;\n const glob = typeof globalThis !== \"undefined\" ? (globalThis as any) : null;\n\n // 1. Check official Global Privacy Control (GPC) property\n if (\n nav?.globalPrivacyControl === true ||\n win?.globalPrivacyControl === true ||\n win?.navigator?.globalPrivacyControl === true ||\n glob?.navigator?.globalPrivacyControl === true ||\n glob?.globalPrivacyControl === true\n ) {\n return true;\n }\n\n // 2. Check Do Not Track (DNT) standard headers / browser flags as fallback\n if (\n nav?.doNotTrack === \"1\" ||\n win?.doNotTrack === \"1\" ||\n win?.navigator?.doNotTrack === \"1\" ||\n glob?.navigator?.doNotTrack === \"1\" ||\n glob?.doNotTrack === \"1\" ||\n nav?.msDoNotTrack === \"1\" ||\n (win?.external && typeof win.external.msTrackingProtectionEnabled === \"function\" && win.external.msTrackingProtectionEnabled())\n ) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Resolve GPC configuration options with defaults.\n */\nexport function resolveGpcConfig(config?: ConsentConfig): Required<GpcConfig> {\n const gpc = config?.gpc;\n return {\n enabled: gpc?.enabled !== false,\n respectSignal: gpc?.respectSignal !== false,\n mode: gpc?.mode || \"auto-reject\",\n categories: gpc?.categories || [],\n noticeText: gpc?.noticeText || \"Señal de Privacidad Global (GPC) detectada: cookies no esenciales desactivadas.\",\n };\n}\n\n/**\n * Calculate the resulting consent choices when applying a GPC signal.\n */\nexport function applyGpcChoices(\n config: ConsentConfig,\n baseChoices?: ConsentChoices,\n): ConsentChoices {\n const result: ConsentChoices = { ...(baseChoices || {}) };\n const gpcOptions = resolveGpcConfig(config);\n\n for (const [catId, catConfig] of Object.entries(config.categories)) {\n if (catConfig.required || catId === \"necessary\") {\n result[catId] = true;\n } else {\n if (\n gpcOptions.categories.length === 0 ||\n gpcOptions.categories.includes(catId)\n ) {\n result[catId] = false;\n }\n }\n }\n\n return result;\n}\n","import type {\n ConsentChoices,\n ConsentConfig,\n ConsentReceipt,\n ConsentState,\n} from \"./types.js\";\n\nexport class StateManager {\n private state: ConsentState = {\n initialized: false,\n policyVersion: \"\",\n locale: \"es\",\n receipt: null,\n choices: {},\n };\n\n private config: ConsentConfig | null = null;\n\n init(\n config: ConsentConfig,\n choices: ConsentChoices,\n receipt: ConsentReceipt | null,\n gpc?: boolean,\n ): void {\n this.config = config;\n this.state = {\n initialized: true,\n policyVersion: config.policyVersion,\n locale: config.locale?.default || \"es\",\n receipt,\n choices,\n gpc: gpc ?? receipt?.gpc ?? false,\n };\n }\n\n setLocale(locale: string): void {\n this.state.locale = locale;\n }\n\n getConfig(): ConsentConfig | null {\n return this.config;\n }\n\n getState(): ConsentState {\n return { ...this.state };\n }\n\n getChoices(): ConsentChoices {\n return { ...this.state.choices };\n }\n\n getReceipt(): ConsentReceipt | null {\n return this.state.receipt;\n }\n\n hasCategory(category: string): boolean {\n return this.state.choices[category] === true;\n }\n\n hasService(serviceId: string): boolean {\n if (!this.config || !this.config.services) return false;\n const service = this.config.services[serviceId];\n if (!service || !service.category) return false;\n\n return this.hasCategory(service.category);\n }\n\n updateChoices(receipt: ConsentReceipt): void {\n this.state.receipt = receipt;\n this.state.choices = { ...receipt.choices };\n }\n\n clearChoices(): void {\n if (!this.config) return;\n const resetChoices: ConsentChoices = {};\n for (const [catId, catConfig] of Object.entries(this.config.categories)) {\n resetChoices[catId] = catConfig.required === true;\n }\n this.state.choices = resetChoices;\n this.state.receipt = null;\n }\n}\n","import type {\n ConsentEvent,\n ConsentEventDetailMap,\n ConsentEventHandler,\n} from \"./types.js\";\n\nexport class EventBus {\n private handlers = new Map<ConsentEvent, Set<ConsentEventHandler<any>>>();\n\n on<E extends ConsentEvent>(\n event: E,\n handler: ConsentEventHandler<E>\n ): () => void {\n if (!this.handlers.has(event)) {\n this.handlers.set(event, new Set());\n }\n const set = this.handlers.get(event)!;\n set.add(handler);\n\n return () => {\n set.delete(handler);\n };\n }\n\n emit<E extends ConsentEvent>(event: E, detail: ConsentEventDetailMap[E]): void {\n const set = this.handlers.get(event);\n if (!set) return;\n\n for (const handler of set) {\n try {\n handler(detail);\n } catch (err) {\n console.error(`[ConsentSDK Event Error] Handler for '${event}' failed:`, err);\n }\n }\n }\n\n clear(): void {\n this.handlers.clear();\n }\n}\n","import type { ConsentChoices, ConsentConfig, ConsentReceipt } from \"./types.js\";\nimport { isReceiptExpired } from \"./receipt.js\";\nimport { computeReceiptSignature } from \"./security.js\";\n\nexport interface PolicyEvaluationResult {\n isValid: boolean;\n reason?: \"missing\" | \"policy_version_changed\" | \"expired\" | \"tampered\" | \"valid\";\n choices: ConsentChoices;\n}\n\nexport function evaluatePolicy(\n config: ConsentConfig,\n receipt: ConsentReceipt | null\n): PolicyEvaluationResult {\n // Build default deny choices (necessary = true, all optionals = false)\n const defaultChoices: ConsentChoices = {};\n for (const [catId, catConfig] of Object.entries(config.categories)) {\n defaultChoices[catId] = catConfig.required === true;\n }\n\n if (!receipt) {\n return {\n isValid: false,\n reason: \"missing\",\n choices: defaultChoices,\n };\n }\n\n if (receipt.policyVersion !== config.policyVersion) {\n return {\n isValid: false,\n reason: \"policy_version_changed\",\n choices: defaultChoices,\n };\n }\n\n const maxAgeDays = config.consent?.maxAgeDays ?? 365;\n if (isReceiptExpired(receipt, maxAgeDays)) {\n return {\n isValid: false,\n reason: \"expired\",\n choices: defaultChoices,\n };\n }\n\n // Anti-tampering signature verification\n if (receipt.signature) {\n const payloadToSign = `${receipt.receiptId}:${receipt.policyVersion}:${JSON.stringify(receipt.choices)}`;\n const expectedSignature = computeReceiptSignature(payloadToSign, config.security?.secretKey);\n if (receipt.signature !== expectedSignature) {\n return {\n isValid: false,\n reason: \"tampered\",\n choices: defaultChoices,\n };\n }\n }\n\n // Merge receipt choices ensuring necessary remains true and any missing category defaults to false\n const activeChoices: ConsentChoices = { ...defaultChoices };\n for (const catId of Object.keys(config.categories)) {\n if (catId === \"necessary\") {\n activeChoices[catId] = true;\n } else if (typeof receipt.choices[catId] === \"boolean\") {\n activeChoices[catId] = receipt.choices[catId];\n }\n }\n\n return {\n isValid: true,\n reason: \"valid\",\n choices: activeChoices,\n };\n}\n","import { ScriptGate } from \"./script-gate.js\";\nimport { IframeGate, type IframeGateOptions } from \"./iframe-gate.js\";\nimport { ResourceGate } from \"./resource-gate.js\";\n\nexport class BlockerRegistry {\n private observer: MutationObserver | null = null;\n\n init(\n isCategoryAllowed: (category: string) => boolean,\n isServiceAllowed: (serviceId: string) => boolean,\n iframeOptions?: IframeGateOptions,\n onServiceLoaded?: (serviceId: string, category: string) => void,\n ): void {\n const runBlockers = () => {\n ScriptGate.scanAndActivate(\n isCategoryAllowed,\n isServiceAllowed,\n onServiceLoaded,\n );\n IframeGate.processIframes(\n isCategoryAllowed,\n isServiceAllowed,\n iframeOptions,\n );\n ResourceGate.processImages(isCategoryAllowed, isServiceAllowed);\n };\n\n // Initial pass\n runBlockers();\n\n // Set up MutationObserver Level B defense for dynamically injected scripts/iframes\n if (\n typeof MutationObserver !== \"undefined\" &&\n typeof document !== \"undefined\"\n ) {\n this.observer = new MutationObserver(() => {\n runBlockers();\n });\n\n this.observer.observe(document.documentElement || document.body, {\n childList: true,\n subtree: true,\n });\n }\n }\n\n destroy(): void {\n if (this.observer) {\n this.observer.disconnect();\n this.observer = null;\n }\n }\n}\n","import type { EventBus } from \"../core/events.js\";\n\nexport class CustomServiceAdapter {\n static createWhen(\n eventBus: EventBus,\n isCategoryAllowed: (cat: string) => boolean,\n isServiceAllowed: (srv: string) => boolean\n ) {\n return function when(\n categoryOrService: string,\n callback: () => void\n ): () => void {\n // Execute immediately if already granted\n if (isCategoryAllowed(categoryOrService) || isServiceAllowed(categoryOrService)) {\n try {\n callback();\n } catch (err) {\n console.error(`[ConsentSDK when()] Callback execution failed:`, err);\n }\n }\n\n // Listen for future consent changes\n return eventBus.on(\"consent:changed\", ({ choices }) => {\n if (choices[categoryOrService] === true || isServiceAllowed(categoryOrService)) {\n try {\n callback();\n } catch (err) {\n console.error(`[ConsentSDK when()] Callback execution failed:`, err);\n }\n }\n });\n };\n }\n}\n","import type { ConsentConfig } from \"../core/types.js\";\nimport { injectStyles } from \"./styles.js\";\nimport { sanitizeHtml, sanitizeUrl } from \"../core/security.js\";\n\nexport interface BannerHandlers {\n onAcceptAll: () => void;\n onRejectAll: () => void;\n onConfigure: () => void;\n}\n\nexport class ConsentBanner {\n private element: HTMLElement | null = null;\n\n render(config: ConsentConfig, handlers: BannerHandlers): void {\n if (typeof document === \"undefined\") return;\n this.remove();\n injectStyles(config.csp?.nonce);\n\n const bannerConfig = config.ui?.banner || {};\n const titleText = sanitizeHtml(bannerConfig.title || \"Tu privacidad, bajo tu control\");\n const descText = sanitizeHtml(\n bannerConfig.description ||\n \"Usamos tecnologías necesarias para el funcionamiento del sitio. Con tu permiso, también podemos utilizar analítica y marketing.\"\n );\n const acceptText = sanitizeHtml(bannerConfig.accept || \"Aceptar todas\");\n const rejectText = sanitizeHtml(bannerConfig.reject || \"Rechazar todas\");\n const configureText = sanitizeHtml(bannerConfig.configure || \"Configurar\");\n const cookiesPolicyText = sanitizeHtml(bannerConfig.cookiesPolicy || \"Política de cookies\");\n const privacyPolicyText = sanitizeHtml(bannerConfig.privacyPolicy || \"Política de privacidad\");\n const bannerAriaLabel = sanitizeHtml(bannerConfig.ariaLabel || \"Gestión de consentimiento de privacidad\");\n\n const privacyUrl = sanitizeUrl(config.policy?.privacyUrl || \"/politica-privacidad\");\n const cookiesUrl = sanitizeUrl(config.policy?.cookiesUrl || \"/politica-cookies\");\n\n const wrapper = document.createElement(\"div\");\n wrapper.className = \"consent-banner-wrapper\";\n wrapper.setAttribute(\"role\", \"region\");\n wrapper.setAttribute(\n \"aria-label\",\n bannerAriaLabel,\n );\n\n wrapper.innerHTML = `\n <div class=\"consent-banner-container\">\n <div class=\"consent-banner-text\">\n <h2 class=\"consent-banner-title\">\n <span class=\"consent-banner-title-icon\">\n <svg width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\">\n <path d=\"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z\"/>\n </svg>\n </span>\n ${titleText}\n </h2>\n <p class=\"consent-banner-desc\">${descText}</p>\n <div class=\"consent-banner-links\">\n <a href=\"${cookiesUrl}\" target=\"_blank\" rel=\"noopener\">${cookiesPolicyText}</a>\n <a href=\"${privacyUrl}\" target=\"_blank\" rel=\"noopener\">${privacyPolicyText}</a>\n </div>\n </div>\n <div class=\"consent-banner-actions\">\n <button type=\"button\" class=\"consent-btn consent-btn-reject\" id=\"consent-btn-reject\">\n ${rejectText}\n </button>\n <button type=\"button\" class=\"consent-btn consent-btn-configure\" id=\"consent-btn-configure\">\n ${configureText}\n </button>\n <button type=\"button\" class=\"consent-btn consent-btn-accept\" id=\"consent-btn-accept\">\n ${acceptText}\n </button>\n </div>\n </div>\n `;\n\n wrapper\n .querySelector(\"#consent-btn-reject\")\n ?.addEventListener(\"click\", () => {\n handlers.onRejectAll();\n this.remove();\n });\n\n wrapper\n .querySelector(\"#consent-btn-configure\")\n ?.addEventListener(\"click\", () => {\n handlers.onConfigure();\n });\n\n wrapper\n .querySelector(\"#consent-btn-accept\")\n ?.addEventListener(\"click\", () => {\n handlers.onAcceptAll();\n this.remove();\n });\n\n document.body.appendChild(wrapper);\n this.element = wrapper;\n }\n\n getIsVisible(): boolean {\n return this.element !== null;\n }\n\n remove(): void {\n if (this.element && this.element.parentNode) {\n this.element.parentNode.removeChild(this.element);\n this.element = null;\n }\n }\n}\n","import type { ConsentChoices, ConsentConfig } from \"../core/types.js\";\nimport { injectStyles } from \"./styles.js\";\nimport { sanitizeHtml } from \"../core/security.js\";\n\nexport interface PreferencesHandlers {\n onSave: (choices: ConsentChoices) => void;\n onAcceptAll: () => void;\n onRejectAll: () => void;\n onClose: () => void;\n}\n\nexport class PreferencesModal {\n private backdrop: HTMLElement | null = null;\n private lastFocusedElement: HTMLElement | null = null;\n\n render(\n config: ConsentConfig,\n currentChoices: ConsentChoices,\n handlers: PreferencesHandlers,\n ): void {\n if (typeof document === \"undefined\") return;\n this.close();\n injectStyles(config.csp?.nonce);\n\n this.lastFocusedElement = document.activeElement as HTMLElement;\n\n const prefConfig = config.ui?.preferences || {};\n const modalTitle = sanitizeHtml(prefConfig.title || \"Preferencias de privacidad\");\n const modalSubtitle = sanitizeHtml(\n prefConfig.subtitle ||\n \"Gestiona tus permisos de almacenamiento por finalidad (LSSI art. 22.2 & RGPD).\",\n );\n const saveText = sanitizeHtml(prefConfig.save || \"Guardar selección\");\n const acceptAllText = sanitizeHtml(prefConfig.acceptAll || \"Permitir todas\");\n const rejectAllText = sanitizeHtml(prefConfig.rejectAll || \"Rechazar opcionales\");\n const closeLabel = sanitizeHtml(prefConfig.closeLabel || \"Cerrar ventana\");\n const requiredBadge = sanitizeHtml(prefConfig.requiredBadge || \"Requerida\");\n const optionalBadge = sanitizeHtml(prefConfig.optionalBadge || \"Opcional\");\n const servicesLabel = sanitizeHtml(prefConfig.servicesLabel || \"Servicios incluidos\");\n const viewServices = sanitizeHtml(prefConfig.viewServices || \"Ver servicios\");\n const hideServices = sanitizeHtml(prefConfig.hideServices || \"Ocultar servicios\");\n const thirdParty = sanitizeHtml(prefConfig.thirdParty || \"Terceros\");\n\n const backdrop = document.createElement(\"div\");\n backdrop.className = \"consent-dialog-backdrop\";\n\n const dialog = document.createElement(\"div\");\n dialog.className = \"consent-dialog\";\n dialog.setAttribute(\"role\", \"dialog\");\n dialog.setAttribute(\"aria-modal\", \"true\");\n dialog.setAttribute(\"aria-labelledby\", \"consent-dialog-title-id\");\n\n // Header\n const header = document.createElement(\"div\");\n header.className = \"consent-dialog-header\";\n header.innerHTML = `\n <div>\n <h2 class=\"consent-dialog-title\" id=\"consent-dialog-title-id\">${modalTitle}</h2>\n <p style=\"margin: 0.2rem 0 0 0; font-size: 0.84rem; color: var(--consent-muted); font-weight: 400;\">\n ${modalSubtitle}\n </p>\n </div>\n <button type=\"button\" class=\"consent-dialog-close\" aria-label=\"${closeLabel}\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\">\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line>\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line>\n </svg>\n </button>\n `;\n\n // Body (Seamless List Rows)\n const body = document.createElement(\"div\");\n body.className = \"consent-dialog-body\";\n\n const categoryChoices: ConsentChoices = { ...currentChoices };\n\n for (const [catId, catConfig] of Object.entries(config.categories)) {\n const catRow = document.createElement(\"div\");\n catRow.className = \"consent-category-row\";\n\n const isRequired = catConfig.required === true;\n const isChecked = isRequired ? true : (categoryChoices[catId] ?? false);\n\n const associatedServices = config.services\n ? Object.entries(config.services).filter(([_, srv]) => srv.category === catId)\n : [];\n\n let servicesHtml = \"\";\n if (associatedServices.length > 0) {\n servicesHtml = `\n <div class=\"consent-category-services\" id=\"cat-services-${catId}\" style=\"display: none; margin-top: 0.75rem; padding-top: 0.6rem; border-top: 1px dashed var(--consent-divider); font-size: 0.82rem;\">\n <div style=\"font-weight: 600; color: var(--consent-muted); margin-bottom: 0.4rem; font-size: 0.75rem; letter-spacing: 0.02em;\">\n ${servicesLabel} (${associatedServices.length})\n </div>\n <div style=\"display: flex; flex-direction: column; gap: 0.3rem;\">\n ${associatedServices\n .map(\n ([srvId, srv]) => `\n <div style=\"display: flex; justify-content: space-between; align-items: center; padding: 0.2rem 0;\">\n <span style=\"font-weight: 500;\">${sanitizeHtml(srv.label || srvId)}</span>\n <span style=\"color: var(--consent-muted); font-size: 0.78rem;\">${sanitizeHtml(srv.provider || thirdParty)}</span>\n </div>\n `,\n )\n .join(\"\")}\n </div>\n </div>\n `;\n }\n\n catRow.innerHTML = `\n <div class=\"consent-category-header\">\n <div style=\"flex: 1; padding-right: 1rem;\">\n <div style=\"display: flex; align-items: center; gap: 0.4rem;\">\n <span class=\"consent-category-name\">${sanitizeHtml(catConfig.label)}</span>\n ${\n isRequired\n ? `<span class=\"consent-badge consent-badge-required\">${requiredBadge}</span>`\n : `<span class=\"consent-badge consent-badge-optional\">${optionalBadge}</span>`\n }\n </div>\n <p class=\"consent-category-desc\">${sanitizeHtml(catConfig.description)}</p>\n ${\n associatedServices.length > 0\n ? `<button type=\"button\" class=\"consent-toggle-services-btn\" data-target=\"cat-services-${catId}\">\n ${viewServices} (${associatedServices.length}) ▾\n </button>`\n : \"\"\n }\n </div>\n <label class=\"consent-toggle\">\n <input type=\"checkbox\" id=\"cat-toggle-${catId}\" ${isChecked ? \"checked\" : \"\"} ${isRequired ? \"disabled\" : \"\"}>\n <span class=\"consent-toggle-slider\"></span>\n </label>\n </div>\n ${servicesHtml}\n `;\n\n if (!isRequired) {\n const checkbox = catRow.querySelector<HTMLInputElement>(\n `#cat-toggle-${catId}`,\n );\n checkbox?.addEventListener(\"change\", (e) => {\n categoryChoices[catId] = (e.target as HTMLInputElement).checked;\n });\n }\n\n const toggleServicesBtn = catRow.querySelector<HTMLButtonElement>(\n \".consent-toggle-services-btn\",\n );\n if (toggleServicesBtn) {\n toggleServicesBtn.addEventListener(\"click\", () => {\n const targetId = toggleServicesBtn.getAttribute(\"data-target\");\n if (targetId) {\n const targetEl = catRow.querySelector<HTMLElement>(`#${targetId}`);\n if (targetEl) {\n const isHidden = targetEl.style.display === \"none\";\n targetEl.style.display = isHidden ? \"block\" : \"none\";\n toggleServicesBtn.textContent = isHidden\n ? `${hideServices} (${associatedServices.length}) ▴`\n : `${viewServices} (${associatedServices.length}) ▾`;\n }\n }\n });\n }\n\n body.appendChild(catRow);\n }\n\n // Footer\n const footer = document.createElement(\"div\");\n footer.className = \"consent-dialog-footer\";\n footer.innerHTML = `\n <button type=\"button\" class=\"consent-btn consent-btn-reject\" id=\"consent-pref-reject\">\n ${rejectAllText}\n </button>\n <div style=\"display: flex; gap: 0.5rem; flex-wrap: wrap;\">\n <button type=\"button\" class=\"consent-btn consent-btn-configure\" id=\"consent-pref-accept\">\n ${acceptAllText}\n </button>\n <button type=\"button\" class=\"consent-btn consent-btn-accept\" id=\"consent-pref-save\">\n ${saveText}\n </button>\n </div>\n `;\n\n dialog.appendChild(header);\n dialog.appendChild(body);\n dialog.appendChild(footer);\n backdrop.appendChild(dialog);\n\n // Event listeners\n header\n .querySelector(\".consent-dialog-close\")\n ?.addEventListener(\"click\", () => {\n handlers.onClose();\n this.close();\n });\n\n // Close on clicking backdrop outside dialog\n backdrop.addEventListener(\"click\", (e) => {\n if (e.target === backdrop) {\n handlers.onClose();\n this.close();\n }\n });\n\n footer\n .querySelector(\"#consent-pref-reject\")\n ?.addEventListener(\"click\", () => {\n handlers.onRejectAll();\n this.close();\n });\n\n footer\n .querySelector(\"#consent-pref-accept\")\n ?.addEventListener(\"click\", () => {\n handlers.onAcceptAll();\n this.close();\n });\n\n footer\n .querySelector(\"#consent-pref-save\")\n ?.addEventListener(\"click\", () => {\n handlers.onSave(categoryChoices);\n this.close();\n });\n\n // Keyboard navigation (Escape & Focus Trap)\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") {\n handlers.onClose();\n this.close();\n return;\n }\n\n if (e.key === \"Tab\") {\n const focusableElements = dialog.querySelectorAll<HTMLElement>(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\n );\n const firstElement = focusableElements[0];\n const lastElement = focusableElements[focusableElements.length - 1];\n\n if (e.shiftKey) {\n if (document.activeElement === firstElement) {\n lastElement?.focus();\n e.preventDefault();\n }\n } else {\n if (document.activeElement === lastElement) {\n firstElement?.focus();\n e.preventDefault();\n }\n }\n }\n };\n\n document.addEventListener(\"keydown\", handleKeyDown);\n (this as any)._keyListener = handleKeyDown;\n\n document.body.appendChild(backdrop);\n this.backdrop = backdrop;\n\n // Focus first element\n const firstFocusable = dialog.querySelector<HTMLElement>(\"button\");\n firstFocusable?.focus();\n }\n\n getIsOpen(): boolean {\n return this.backdrop !== null;\n }\n\n close(): void {\n if ((this as any)._keyListener) {\n document.removeEventListener(\"keydown\", (this as any)._keyListener);\n delete (this as any)._keyListener;\n }\n\n if (this.backdrop && this.backdrop.parentNode) {\n this.backdrop.parentNode.removeChild(this.backdrop);\n this.backdrop = null;\n }\n\n if (\n this.lastFocusedElement &&\n typeof this.lastFocusedElement.focus === \"function\"\n ) {\n this.lastFocusedElement.focus();\n this.lastFocusedElement = null;\n }\n }\n}\n","import type {\n ConsentChoices,\n ConsentConfig,\n ConsentEvent,\n ConsentEventHandler,\n ConsentReceipt,\n ConsentSDKInterface,\n ConsentState,\n DiagnosticReport,\n FloatingBadgeConfig,\n LegalPolicyOptions,\n StoragePurgeReport,\n} from \"./types.js\";\nimport { validateConfig } from \"./config-validator.js\";\nimport { StateManager } from \"./state.js\";\nimport { EventBus } from \"./events.js\";\nimport { createReceipt, parseReceipt } from \"./receipt.js\";\nimport { evaluatePolicy } from \"./policy-engine.js\";\nimport { CookieStore } from \"../storage/cookie-store.js\";\nimport { MemoryStore } from \"../storage/memory-store.js\";\nimport { StorageCleaner } from \"../storage/storage-cleaner.js\";\nimport { BlockerRegistry } from \"../blocker/registry.js\";\nimport { GoogleConsentAdapter } from \"../services/google.js\";\nimport { CustomServiceAdapter } from \"../services/custom.js\";\nimport { ConsentBanner } from \"../ui/banner.js\";\nimport { PreferencesModal } from \"../ui/preferences.js\";\nimport { FloatingBadge } from \"../ui/floating-badge.js\";\nimport { ResourceScanner } from \"../diagnostics/resource-scanner.js\";\nimport { PolicyGenerator } from \"../ui/policy-generator.js\";\nimport { I18nEngine } from \"../i18n/engine.js\";\nimport { resolveConfigPresets } from \"../presets/index.js\";\nimport { detectGpcSignal, resolveGpcConfig, applyGpcChoices } from \"./gpc.js\";\n\nexport class ConsentEngine implements ConsentSDKInterface {\n private stateManager = new StateManager();\n private eventBus = new EventBus();\n private blockerRegistry = new BlockerRegistry();\n private banner = new ConsentBanner();\n private preferencesModal = new PreferencesModal();\n private floatingBadge = new FloatingBadge();\n private i18n = new I18nEngine();\n private stopLocaleSync: (() => void) | null = null;\n\n private initPromise: Promise<void> | null = null;\n private resolveReady: (() => void) | null = null;\n private readyPromise = new Promise<void>((resolve) => {\n this.resolveReady = resolve;\n });\n\n async init(configInput: ConsentConfig | string): Promise<void> {\n if (this.initPromise) return this.initPromise;\n\n this.initPromise = (async () => {\n let config: ConsentConfig;\n\n if (typeof configInput === \"string\") {\n const response = await fetch(configInput);\n if (!response.ok) {\n throw new Error(\n `[ConsentSDK] Failed to fetch consent configuration from '${configInput}' (HTTP ${response.status})`,\n );\n }\n config = await response.json();\n } else {\n config = configInput;\n }\n\n config = resolveConfigPresets(config);\n validateConfig(config);\n\n // Determine initial locale from parent application (<html lang>, URL, navigator, or default)\n const initialLocale = this.i18n.detectParentLocale(config);\n this.i18n.setLocale(initialLocale);\n\n // Start zero-boilerplate automatic synchronization with parent application i18n\n this.stopLocaleSync?.();\n this.stopLocaleSync = this.i18n.startParentSync(config, (newLocale) => {\n this.setLocale(newLocale);\n });\n\n // Load saved receipt from cookie or memory\n const cookieName = config.storage?.name || \"site_consent\";\n const rawReceipt =\n config.storage?.type === \"memory\"\n ? MemoryStore.get(cookieName)\n : CookieStore.get(cookieName);\n\n const savedReceipt = rawReceipt ? parseReceipt(rawReceipt) : null;\n const evalResult = evaluatePolicy(config, savedReceipt);\n\n // Global Privacy Control (GPC) evaluation\n const isGpcDetected = detectGpcSignal();\n const gpcConfig = resolveGpcConfig(config);\n const isGpcActive = isGpcDetected && gpcConfig.enabled && gpcConfig.respectSignal;\n\n let activeReceipt = evalResult.isValid ? savedReceipt : null;\n let activeChoices = evalResult.choices;\n let autoAppliedGpc = false;\n\n if (!evalResult.isValid && isGpcActive) {\n if (gpcConfig.mode !== \"notice-only\") {\n activeChoices = applyGpcChoices(config);\n activeReceipt = createReceipt(\n config.policyVersion,\n activeChoices,\n \"gpc\",\n null,\n config.security?.secretKey,\n );\n activeReceipt.gpc = true;\n autoAppliedGpc = true;\n\n // Save GPC receipt\n const receiptJson = JSON.stringify(activeReceipt);\n if (config.storage?.type === \"memory\") {\n MemoryStore.set(cookieName, receiptJson);\n } else {\n CookieStore.set(cookieName, receiptJson, {\n path: config.storage?.path || \"/\",\n maxAgeDays: config.consent?.maxAgeDays ?? 365,\n sameSite: config.storage?.sameSite || \"Lax\",\n secure: config.storage?.secure,\n domain: config.storage?.domain,\n });\n }\n\n // Purge optional storage on GPC auto-rejection\n for (const [catId, allowed] of Object.entries(activeChoices)) {\n if (!allowed && catId !== \"necessary\") {\n StorageCleaner.purgeCategory(config, catId);\n }\n }\n }\n }\n\n this.stateManager.init(config, activeChoices, activeReceipt, isGpcDetected);\n this.stateManager.setLocale(initialLocale);\n\n if (isGpcDetected) {\n this.eventBus.emit(\"gpc:detected\", {\n signal: true,\n autoApplied: autoAppliedGpc,\n choices: activeChoices,\n });\n this.dispatchDomEvent(\"solvenza:gpc\", {\n signal: true,\n autoApplied: autoAppliedGpc,\n choices: activeChoices,\n });\n }\n\n // Initialize Google Consent Mode defaults\n GoogleConsentAdapter.initDefault();\n if (evalResult.isValid || autoAppliedGpc) {\n GoogleConsentAdapter.update(activeChoices);\n this.dispatchDomEvent(\"solvenza:restored\", { state: this.getConsent() });\n }\n\n // Initialize Blocker System\n this.blockerRegistry.init(\n (cat) => this.has(cat),\n (srv) => this.hasService(srv),\n {\n onAllowClick: (category) => {\n const current = this.stateManager.getChoices();\n current[category] = true;\n this.setPreferences(current);\n },\n },\n (serviceId, category) => {\n this.eventBus.emit(\"service:loaded\", { serviceId, category });\n },\n );\n\n // Attach global listeners for permanent revocation trigger [data-consent-open] and CustomEvents\n this.setupGlobalRevocationTrigger();\n\n // Initialize Floating Badge if configured\n const resolvedConfig = this.getResolvedConfig() || config;\n const badgeConfig = this.resolveFloatingBadgeConfig(resolvedConfig);\n if (badgeConfig.enabled) {\n this.floatingBadge.render(resolvedConfig, {\n onClick: () => this.openPreferences(),\n });\n if (evalResult.isValid || autoAppliedGpc || badgeConfig.visibility === \"always\") {\n this.showFloatingBadge();\n }\n }\n\n this.resolveReady?.();\n this.eventBus.emit(\"ready\", { state: this.getConsent() });\n\n // If missing receipt and GPC did not auto-apply choices, display 1st layer banner\n if (!evalResult.isValid && !autoAppliedGpc) {\n this.showBanner();\n }\n })();\n\n return this.initPromise;\n }\n\n async ready(): Promise<void> {\n return this.readyPromise;\n }\n\n getConsent(): ConsentState {\n return this.stateManager.getState();\n }\n\n has(category: string): boolean {\n return this.stateManager.hasCategory(category);\n }\n\n hasService(serviceId: string): boolean {\n return this.stateManager.hasService(serviceId);\n }\n\n acceptAll(): void {\n const config = this.stateManager.getConfig();\n if (!config) return;\n\n const choices: ConsentChoices = {};\n for (const catId of Object.keys(config.categories)) {\n choices[catId] = true;\n }\n\n this.saveChoices(choices, \"banner\");\n this.eventBus.emit(\"consent:accepted\", {\n choices,\n receipt: this.getReceipt()!,\n });\n }\n\n rejectAll(): void {\n const config = this.stateManager.getConfig();\n if (!config) return;\n\n const choices: ConsentChoices = {};\n for (const [catId, catConfig] of Object.entries(config.categories)) {\n choices[catId] = catConfig.required === true;\n }\n\n this.saveChoices(choices, \"banner\");\n this.eventBus.emit(\"consent:rejected\", {\n choices,\n receipt: this.getReceipt()!,\n });\n }\n\n setPreferences(choices: ConsentChoices): void {\n const config = this.stateManager.getConfig();\n if (!config) return;\n\n // Enforce necessary = true\n const sanitizedChoices: ConsentChoices = { ...choices };\n sanitizedChoices[\"necessary\"] = true;\n\n this.saveChoices(sanitizedChoices, \"preferences\");\n }\n\n openPreferences(): void {\n const config = this.getResolvedConfig();\n if (!config) return;\n\n // Temporarily hide floating badge while modal is active\n this.hideFloatingBadge();\n\n this.preferencesModal.render(config, this.stateManager.getChoices(), {\n onSave: (choices) => {\n this.setPreferences(choices);\n this.restoreFloatingBadgeIfNeeded();\n },\n onAcceptAll: () => {\n this.acceptAll();\n this.restoreFloatingBadgeIfNeeded();\n },\n onRejectAll: () => {\n this.rejectAll();\n this.restoreFloatingBadgeIfNeeded();\n },\n onClose: () => {\n this.restoreFloatingBadgeIfNeeded();\n this.eventBus.emit(\"preferences:closed\", undefined);\n },\n });\n\n this.eventBus.emit(\"preferences:opened\", undefined);\n }\n\n closePreferences(): void {\n this.preferencesModal.close();\n this.restoreFloatingBadgeIfNeeded();\n this.eventBus.emit(\"preferences:closed\", undefined);\n }\n\n getLocale(): string {\n return this.i18n.getLocale();\n }\n\n setLocale(locale: string): void {\n const previousLocale = this.i18n.getLocale();\n if (locale.toLowerCase() === previousLocale.toLowerCase()) return;\n\n this.i18n.setLocale(locale);\n this.stateManager.setLocale(locale);\n\n const config = this.getResolvedConfig();\n if (!config) return;\n\n // Re-render banner if visible\n if (this.banner.getIsVisible()) {\n this.banner.render(config, {\n onAcceptAll: () => this.acceptAll(),\n onRejectAll: () => this.rejectAll(),\n onConfigure: () => this.openPreferences(),\n });\n }\n\n // Re-render modal if open\n if (this.preferencesModal.getIsOpen()) {\n this.preferencesModal.render(config, this.stateManager.getChoices(), {\n onSave: (choices) => {\n this.setPreferences(choices);\n this.restoreFloatingBadgeIfNeeded();\n },\n onAcceptAll: () => {\n this.acceptAll();\n this.restoreFloatingBadgeIfNeeded();\n },\n onRejectAll: () => {\n this.rejectAll();\n this.restoreFloatingBadgeIfNeeded();\n },\n onClose: () => {\n this.restoreFloatingBadgeIfNeeded();\n this.eventBus.emit(\"preferences:closed\", undefined);\n },\n });\n }\n\n // Re-render floating badge if enabled\n const badgeConfig = this.resolveFloatingBadgeConfig(config);\n if (badgeConfig.enabled) {\n const wasVisible = this.floatingBadge.getIsVisible();\n this.floatingBadge.render(config, {\n onClick: () => this.openPreferences(),\n });\n if (wasVisible) {\n this.floatingBadge.show();\n }\n }\n\n this.eventBus.emit(\"locale:changed\", { locale, previousLocale });\n this.dispatchDomEvent(\"solvenza:locale:changed\", { locale, previousLocale });\n }\n\n /**\n * Synchronize active locale with parent application i18n state.\n */\n syncLocale(locale: string): void {\n this.setLocale(locale);\n }\n\n /**\n * Check if Global Privacy Control (GPC) or Do Not Track (DNT) signal is active.\n */\n isGpcActive(): boolean {\n return detectGpcSignal();\n }\n\n private restoreFloatingBadgeIfNeeded(): void {\n const config = this.getResolvedConfig();\n if (!config) return;\n\n const badgeConfig = this.resolveFloatingBadgeConfig(config);\n if (!badgeConfig.enabled) return;\n\n this.showFloatingBadge();\n }\n\n private getResolvedConfig(): ConsentConfig | null {\n const rawConfig = this.stateManager.getConfig();\n if (!rawConfig) return null;\n return this.i18n.resolveConfig(rawConfig, this.getLocale());\n }\n\n withdraw(): void {\n const previousChoices = this.stateManager.getChoices();\n const config = this.stateManager.getConfig();\n if (!config) return;\n\n const cookieName = config.storage?.name || \"site_consent\";\n if (config.storage?.type === \"memory\") {\n MemoryStore.remove(cookieName);\n } else {\n CookieStore.remove(cookieName, config.storage?.path || \"/\", config.storage?.domain);\n }\n\n // Auto-clear all storage (cookies, localStorage, sessionStorage) for optional categories\n for (const catId of Object.keys(config.categories)) {\n if (catId !== \"necessary\") {\n this.purgeCategory(catId);\n }\n }\n\n this.stateManager.clearChoices();\n GoogleConsentAdapter.update(this.stateManager.getChoices());\n this.eventBus.emit(\"consent:withdrawn\", { previousChoices });\n this.dispatchDomEvent(\"solvenza:updated\", { choices: this.stateManager.getChoices() });\n\n const badgeConfig = this.resolveFloatingBadgeConfig(this.getResolvedConfig() || config);\n if (badgeConfig.enabled && badgeConfig.visibility !== \"always\") {\n this.hideFloatingBadge();\n }\n\n this.showBanner();\n }\n\n purgeCategory(category: string): StoragePurgeReport {\n const config = this.stateManager.getConfig();\n if (!config) {\n return {\n category,\n purgedCookies: [],\n purgedLocalStorage: [],\n purgedSessionStorage: [],\n };\n }\n\n const report = StorageCleaner.purgeCategory(config, category);\n this.eventBus.emit(\"storage:purged\", { category, report });\n this.dispatchDomEvent(\"solvenza:storage:purged\", { category, report });\n return report;\n }\n\n purgeStorage(categoryOrService?: string): StoragePurgeReport[] {\n const config = this.stateManager.getConfig();\n if (!config) return [];\n\n if (categoryOrService) {\n if (config.categories?.[categoryOrService]) {\n return [this.purgeCategory(categoryOrService)];\n }\n const service = config.services?.[categoryOrService];\n if (service?.category) {\n return [this.purgeCategory(service.category)];\n }\n }\n\n const reports: StoragePurgeReport[] = [];\n const currentChoices = this.stateManager.getChoices();\n for (const [catId, allowed] of Object.entries(currentChoices)) {\n if (!allowed && catId !== \"necessary\") {\n reports.push(this.purgeCategory(catId));\n }\n }\n return reports;\n }\n\n showFloatingBadge(): void {\n const config = this.getResolvedConfig();\n if (!config) return;\n const badgeConfig = this.resolveFloatingBadgeConfig(config);\n if (!badgeConfig.enabled) return;\n\n const el = this.floatingBadge.getElement();\n if (!el || !el.parentNode) {\n this.floatingBadge.render(config, {\n onClick: () => this.openPreferences(),\n });\n }\n this.floatingBadge.show();\n this.eventBus.emit(\"floating-badge:shown\", undefined);\n this.dispatchDomEvent(\"solvenza:badge:shown\", undefined);\n }\n\n hideFloatingBadge(): void {\n this.floatingBadge.hide();\n this.eventBus.emit(\"floating-badge:hidden\", undefined);\n this.dispatchDomEvent(\"solvenza:badge:hidden\", undefined);\n }\n\n when(categoryOrService: string, callback: () => void): () => void {\n return CustomServiceAdapter.createWhen(\n this.eventBus,\n (cat) => this.has(cat),\n (srv) => this.hasService(srv),\n )(categoryOrService, callback);\n }\n\n on<E extends ConsentEvent>(\n event: E,\n handler: ConsentEventHandler<E>,\n ): () => void {\n return this.eventBus.on(event, handler);\n }\n\n getReceipt(): ConsentReceipt | null {\n return this.stateManager.getReceipt();\n }\n\n rescan(): DiagnosticReport {\n const config = this.stateManager.getConfig();\n if (!config) {\n throw new Error(\"[ConsentSDK] SDK not initialized.\");\n }\n const isGiven = !!this.getReceipt();\n return ResourceScanner.runDiagnostic(config, isGiven);\n }\n\n mountPolicy(targetContainer: HTMLElement | string, options?: LegalPolicyOptions): void {\n const config = this.getResolvedConfig() || this.stateManager.getConfig();\n if (!config) {\n throw new Error(\"[ConsentSDK] SDK not initialized.\");\n }\n const container =\n typeof targetContainer === \"string\"\n ? document.querySelector<HTMLElement>(targetContainer)\n : targetContainer;\n if (container) {\n container.innerHTML = PolicyGenerator.renderCookiePolicy(config, options);\n }\n }\n\n renderPolicyHtml(options?: LegalPolicyOptions): string {\n const config = this.getResolvedConfig() || this.stateManager.getConfig();\n if (!config) {\n throw new Error(\"[ConsentSDK] SDK not initialized.\");\n }\n return PolicyGenerator.renderCookiePolicy(config, options);\n }\n\n mountLegalNotice(targetContainer: HTMLElement | string, options?: LegalPolicyOptions): void {\n const config = this.getResolvedConfig() || this.stateManager.getConfig();\n if (!config) {\n throw new Error(\"[ConsentSDK] SDK not initialized.\");\n }\n const container =\n typeof targetContainer === \"string\"\n ? document.querySelector<HTMLElement>(targetContainer)\n : targetContainer;\n if (container) {\n container.innerHTML = PolicyGenerator.renderLegalNotice(config, options);\n }\n }\n\n renderLegalNoticeHtml(options?: LegalPolicyOptions): string {\n const config = this.getResolvedConfig() || this.stateManager.getConfig();\n if (!config) {\n throw new Error(\"[ConsentSDK] SDK not initialized.\");\n }\n return PolicyGenerator.renderLegalNotice(config, options);\n }\n\n mountPrivacyPolicy(targetContainer: HTMLElement | string, options?: LegalPolicyOptions): void {\n const config = this.getResolvedConfig() || this.stateManager.getConfig();\n if (!config) {\n throw new Error(\"[ConsentSDK] SDK not initialized.\");\n }\n const container =\n typeof targetContainer === \"string\"\n ? document.querySelector<HTMLElement>(targetContainer)\n : targetContainer;\n if (container) {\n container.innerHTML = PolicyGenerator.renderPrivacyPolicy(config, options);\n }\n }\n\n renderPrivacyPolicyHtml(options?: LegalPolicyOptions): string {\n const config = this.getResolvedConfig() || this.stateManager.getConfig();\n if (!config) {\n throw new Error(\"[ConsentSDK] SDK not initialized.\");\n }\n return PolicyGenerator.renderPrivacyPolicy(config, options);\n }\n\n private saveChoices(\n choices: ConsentChoices,\n source: ConsentReceipt[\"source\"],\n ): void {\n const config = this.stateManager.getConfig();\n if (!config) return;\n\n const receipt = createReceipt(\n config.policyVersion,\n choices,\n source,\n this.stateManager.getReceipt(),\n config.security?.secretKey,\n );\n if (this.isGpcActive()) {\n receipt.gpc = true;\n }\n\n this.stateManager.updateChoices(receipt);\n\n // Auto-clear cookies and web storage for revoked categories\n for (const [catId, isAllowed] of Object.entries(choices)) {\n if (!isAllowed) {\n this.purgeCategory(catId);\n }\n }\n\n // Persist receipt\n const cookieName = config.storage?.name || \"site_consent\";\n const receiptJson = JSON.stringify(receipt);\n\n if (config.storage?.type === \"memory\") {\n MemoryStore.set(cookieName, receiptJson);\n } else {\n CookieStore.set(cookieName, receiptJson, {\n path: config.storage?.path || \"/\",\n maxAgeDays: config.consent?.maxAgeDays ?? 365,\n sameSite: config.storage?.sameSite || \"Lax\",\n secure: config.storage?.secure,\n domain: config.storage?.domain,\n });\n }\n\n // Update Google Consent Mode\n GoogleConsentAdapter.update(choices);\n\n // Trigger blocker scan for newly permitted resources\n this.blockerRegistry.init(\n (cat) => this.has(cat),\n (srv) => this.hasService(srv),\n );\n\n // Optional receipt log endpoint\n if (config.logging?.enabled && config.logging.endpoint) {\n try {\n fetch(config.logging.endpoint, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: receiptJson,\n }).catch(() => {});\n } catch {}\n }\n\n this.banner.remove();\n\n const resolvedConfig = this.getResolvedConfig() || config;\n const badgeConfig = this.resolveFloatingBadgeConfig(resolvedConfig);\n if (badgeConfig.enabled) {\n this.showFloatingBadge();\n }\n\n this.eventBus.emit(\"consent:changed\", { choices, receipt });\n this.dispatchDomEvent(\"solvenza:updated\", { choices, receipt });\n }\n\n private showBanner(): void {\n const config = this.getResolvedConfig() || this.stateManager.getConfig();\n if (!config) return;\n\n const badgeConfig = this.resolveFloatingBadgeConfig(config);\n if (badgeConfig.enabled && badgeConfig.visibility !== \"always\") {\n this.hideFloatingBadge();\n }\n\n this.banner.render(config, {\n onAcceptAll: () => this.acceptAll(),\n onRejectAll: () => this.rejectAll(),\n onConfigure: () => this.openPreferences(),\n });\n this.eventBus.emit(\"banner:shown\", undefined);\n this.dispatchDomEvent(\"solvenza:show\", undefined);\n }\n\n private setupGlobalRevocationTrigger(): void {\n if (typeof document === \"undefined\") return;\n\n document.addEventListener(\"click\", (e) => {\n const target = e.target as HTMLElement | null;\n if (target?.closest(\"[data-consent-open]\")) {\n e.preventDefault();\n this.openPreferences();\n }\n });\n\n // Support zero-code DOM CustomEvents dispatching (e.g. document.dispatchEvent(new Event('solvenza:show')))\n document.addEventListener(\"solvenza:show\", () => {\n this.showBanner();\n });\n\n document.addEventListener(\"solvenza:preferences\", () => {\n this.openPreferences();\n });\n\n document.addEventListener(\"solvenza:badge:show\", () => {\n this.showFloatingBadge();\n });\n\n document.addEventListener(\"solvenza:badge:hide\", () => {\n this.hideFloatingBadge();\n });\n\n document.addEventListener(\"solvenza:locale\", (e: any) => {\n if (e?.detail?.locale) {\n this.setLocale(e.detail.locale);\n }\n });\n }\n\n private resolveFloatingBadgeConfig(\n config?: ConsentConfig,\n ): FloatingBadgeConfig & { enabled: boolean } {\n const raw = config?.ui?.floatingBadge;\n if (raw === false) {\n return { enabled: false };\n }\n if (raw === true || raw === undefined) {\n return {\n enabled: true,\n position: \"bottom-left\",\n icon: \"cookie\",\n visibility: \"after-consent\",\n };\n }\n if (typeof raw === \"object\" && raw !== null) {\n return {\n enabled: raw.enabled !== false,\n position: raw.position || \"bottom-left\",\n label: raw.label,\n ariaLabel: raw.ariaLabel,\n showLabel: raw.showLabel,\n icon: raw.icon || \"cookie\",\n visibility: raw.visibility || \"after-consent\",\n };\n }\n return { enabled: true, position: \"bottom-left\", icon: \"cookie\", visibility: \"after-consent\" };\n }\n\n private dispatchDomEvent(name: string, detail: unknown): void {\n if (typeof document === \"undefined\") return;\n try {\n const customEvent = new CustomEvent(name, { detail, bubbles: true });\n document.dispatchEvent(customEvent);\n } catch {}\n }\n}\n\n// Ensure global singleton instance across bundler chunks, wrappers, and HMR\nconst globalScope = typeof window !== \"undefined\" ? (window as any) : globalThis;\nif (!globalScope.__ConsentSDK_Instance__) {\n globalScope.__ConsentSDK_Instance__ = new ConsentEngine();\n}\n\nexport const Consent: ConsentEngine = globalScope.__ConsentSDK_Instance__;\n"],"mappings":";;;;;;;;AAEO,IAAM,wBAAN,cAAoC,MAAM;AAAA,EAC/C,YAAY,SAAiB;AAC3B,UAAM,6BAA6B,OAAO,EAAE;AAC5C,SAAK,OAAO;AAAA,EACd;AACF;AAEO,SAAS,eAAe,QAA6B;AAC1D,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,sBAAsB,4CAA4C;AAAA,EAC9E;AAEA,MAAI,OAAO,OAAO,kBAAkB,YAAY,OAAO,gBAAgB,GAAG;AACxE,UAAM,IAAI,sBAAsB,4DAA4D;AAAA,EAC9F;AAEA,MAAI,CAAC,OAAO,iBAAiB,OAAO,OAAO,kBAAkB,UAAU;AACrE,UAAM,IAAI,sBAAsB,sDAAsD;AAAA,EACxF;AAEA,MAAI,CAAC,OAAO,cAAc,OAAO,OAAO,eAAe,UAAU;AAC/D,UAAM,IAAI,sBAAsB,4CAA4C;AAAA,EAC9E;AAEA,QAAM,eAAe,OAAO,KAAK,OAAO,UAAU;AAClD,MAAI,aAAa,WAAW,GAAG;AAC7B,UAAM,IAAI,sBAAsB,wDAAwD;AAAA,EAC1F;AAGA,QAAM,oBAAoB,OAAO,WAAW,WAAW;AACvD,MAAI,CAAC,mBAAmB;AACtB,UAAM,IAAI,sBAAsB,uCAAuC;AAAA,EACzE;AACA,MAAI,kBAAkB,aAAa,MAAM;AACvC,UAAM,IAAI,sBAAsB,kDAAkD;AAAA,EACpF;AAGA,aAAW,CAAC,OAAO,SAAS,KAAK,OAAO,QAAQ,OAAO,UAAU,GAAG;AAClE,QAAI,UAAU,eAAe,CAAC,UAAU,UAAU;AAChD,UAAI,UAAU,YAAY,MAAM;AAC9B,cAAM,IAAI;AAAA,UACR,8CAA8C,KAAK;AAAA,QACrD;AAAA,MACF;AAAA,IACF;A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