@1consent/cli 0.1.0-beta.1 → 0.1.0-beta.2

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.
package/dist/cli.js CHANGED
@@ -21833,7 +21833,7 @@ function getWorkspaceRoot(cwd = process.cwd()) {
21833
21833
 
21834
21834
  // src/package-identity.ts
21835
21835
  var CLI_PACKAGE_NAME = "@1consent/cli";
21836
- var CLI_VERSION = "0.1.0-beta.1";
21836
+ var CLI_VERSION = "0.1.0-beta.2";
21837
21837
 
21838
21838
  // src/commands/init.ts
21839
21839
  var ENDPOINTS = {
@@ -1 +1 @@
1
- function K(t,e){let n=t.base?e[t.base]:e;t.root==="scope"&&(n=e);for(let s of t.path){if(n==null)return;n=n[s]}return n}function us(t,e){switch(t.k){case"bool":return t.v;case"str":return t.v;case"path":return K(t.v,e)}}function ft(t,e,n){if(n==null||n===!1){t.removeAttribute(e);return}if(n===!0){t.setAttribute(e,"");return}let s=String(n);if(e==="class"&&(s=s.trim().replace(/\s+/g," ")),s===""&&!e.startsWith("data-1c-")){t.removeAttribute(e);return}t.setAttribute(e,s)}function nn(t){return t==null||t===!1||t===0||t===""?!1:Array.isArray(t)?t.length>0:!0}function H(t,e,n,s,r,o){switch(t.t){case"text":r.appendChild(document.createTextNode(t.v));break;case"bind":{let i=K(t.p,e);if(i!=null){let c=String(i);r.appendChild(document.createTextNode(c))}break}case"children":if(o)for(let i of o.nodes)H(i,o.scope,n,s,r);break;case"each":{let i=K(t.list,e);if(Array.isArray(i))for(let c of i){let a={...e,[t.item]:c},l=document.createDocumentFragment();for(let d of t.body)H(d,a,n,s,l,o);r.appendChild(l)}break}case"if":if(nn(K(t.path,e))){let i=document.createDocumentFragment();for(let c of t.body)H(c,e,n,s,i,o);r.appendChild(i)}break;case"if-not":if(!nn(K(t.path,e))){let i=document.createDocumentFragment();for(let c of t.body)H(c,e,n,s,i,o);r.appendChild(i)}break;case"use":{let i=n[t.name];if(!i){console.warn(`[1CL Executor] Component not found: ${t.name}`);return}let c={};for(let[p,m]of Object.entries(t.props))c[p]=us(m,e);let a={...e,props:c},l=t.children&&t.children.length>0?{nodes:t.children,scope:e}:void 0,d=document.createDocumentFragment();for(let p of i)H(p,a,n,s,d,l);r.appendChild(d);break}case"el":{let i=["svg","path","g","circle","rect","line","polyline","polygon","defs","clipPath"].includes(t.tag)?document.createElementNS("http://www.w3.org/2000/svg",t.tag):document.createElement(t.tag);for(let a of t.attrs)if(a.k==="static")ft(i,a.name,a.value);else if(a.k==="bind"){let l=K(a.value,e);ft(i,a.name,l)}else if(a.k==="concat"){let l=a.parts.map(d=>d.k==="str"?d.v:String(K(d.v,e)??"")).join("");ft(i,a.name,l)}let c=document.createDocumentFragment();for(let a of t.kids)H(a,e,n,s,c,o);i.appendChild(c),r.appendChild(i);break}}}function ps(t,e,n={}){let s=document.createDocumentFragment(),r=n.view||"main",o=t.views[r];if(!o)return console.error(`[1CL Executor] View not found: ${r}`),s;for(let i of o)H(i,e,t.components,n,s);return s}function gt(t,e,n,s={}){let r=ps(t,e,s);n.innerHTML="",n.appendChild(r)}function Se(t,e=Date.now()){if(!Number.isSafeInteger(t)||t<=0||!Number.isSafeInteger(e)||e<0)return!1;let n=e+33696e6;return Number.isSafeInteger(n)?t>=e&&t<=n:!1}var sn=["ar","bg","bs","ca","cs","cy","da","de","el","en","es","et","eu","fi","fr","gl","he","hi","hr","hu","id","is","it","ja","ka","ko","lt","lv","mk","ms","mt","nl","no","pl","pt-br","pt-pt","ro","ru","sk","sl","sq","sr-latn","sr-cyrl","sv","sw","th","tl","tr","uk","vi","zh","zh-hant"],Nr=new Set(sn),Rr=sn.filter(t=>t.includes("-")).sort((t,e)=>e.length-t.length);function hs(t){if(typeof t!="string")return null;let e=t.trim();if(e.length<2||e.length>255)return null;try{return Intl.getCanonicalLocales(e)[0]??null}catch{return null}}function mt(t){return typeof t=="string"&&hs(t)===t}function fs(t){return t.split("-")[0]||"en"}function rn(t){let e=fs(t).toLowerCase();return/^[a-z]{2}$/.test(e)?e:null}var gs=1440*60*1e3;var St="reload";var z=5;var on=["VA","CO","CT","MT","TX","OR","DE","NH","NJ","MN","NE","MD","TN","FL","IN","KY","RI"];function yt(t){return t===void 0?!0:on.indexOf(t.toUpperCase())!==-1}function ye(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function te(t){if(!ye(t))return!1;let e=t;return!(!(typeof e.appId=="string"&&typeof e.version=="number"&&typeof e.machine=="string"&&ye(e.languages)&&typeof e.languages.primary=="string"&&Array.isArray(e.languages.supported)&&e.languages.supported.length>0&&mt(e.languages.primary)&&e.languages.supported.every(mt)&&new Set(e.languages.supported).size===e.languages.supported.length&&e.languages.supported.includes(e.languages.primary)&&ye(e.cmp)&&typeof e.cmp.main=="string"&&typeof e.cmp.uiData=="string"&&typeof e.cmp.serviceDetails=="string"&&Array.isArray(e.categories)&&Array.isArray(e.services)&&Array.isArray(e.scripts)&&typeof e.appearance=="object"&&e.appearance!==null&&typeof e.framework=="object"&&e.framework!==null)||!["P","S","D"].includes(e.machine))}function wt(t){return t.cmp.trigger?t.framework.type==="us"?!0:!!t.appearance?.trigger:!1}function Ct(t){return te(t)&&t.framework.type==="gdpr"}function vt(t){if(!te(t)||t.framework.type!=="tcf"||!("vendorListVersion"in t.framework)||!Number.isSafeInteger(t.framework.vendorListVersion)||t.framework.vendorListVersion<=0||!("vendors"in t)||!Array.isArray(t.vendors))return!1;let e=s=>Array.isArray(s)&&s.every(r=>Number.isSafeInteger(r)&&r>0)&&new Set(s).size===s.length,n=[];for(let s of t.vendors){if(!ye(s))return!1;let r=s.id;if(typeof r!="number"||!Number.isSafeInteger(r)||r<=0||!e(s.consentPurposeIds)||!e(s.legitimateInterestPurposeIds)||!e(s.flexiblePurposeIds)||!e(s.specialFeatureIds))return!1;n.push(r)}return new Set(n).size===n.length}function we(t){return te(t)&&t.framework.type==="us"}var se="1consent",Et=1;function N(t){return{appId:t.appId,frameworkId:t.framework.id,type:t.framework.type,machine:t.machine,configVersion:t.version,consentEpoch:t.consentEpoch??0,...t.framework.type==="tcf"?{tcfPolicyVersion:z}:{},primaryLanguage:t.languages.primary}}function ne(){return{schemaVersion:Et,apps:{}}}function je(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function an(t){return je(t)&&t.schemaVersion===Et&&je(t.apps)}function Ke(t){if(!t)return ne();try{let e=JSON.parse(t);return an(e)?e:ne()}catch{return ne()}}function bt(t){return je(t)?Object.values(t).every(e=>typeof e=="boolean"):!1}function He(t){return je(t)?typeof t.structuralVersion=="string"&&typeof t.consentEpoch=="number"&&Number.isSafeInteger(t.consentEpoch)&&t.consentEpoch>=0&&typeof t.expiresAt=="number"&&Number.isSafeInteger(t.expiresAt)&&t.expiresAt>=0&&bt(t.services)&&bt(t.categories)&&(t.decisionIntegrity===void 0||typeof t.decisionIntegrity=="string")&&(t.tcfCmpId===void 0||typeof t.tcfCmpId=="number"&&Number.isSafeInteger(t.tcfCmpId)&&t.tcfCmpId>=0&&t.tcfCmpId<=4095)&&(t.tcfValidationVersion===void 0||typeof t.tcfValidationVersion=="number"&&Number.isSafeInteger(t.tcfValidationVersion)&&t.tcfValidationVersion>0)&&(t.tcfDisclosedVendorKey===void 0||typeof t.tcfDisclosedVendorKey=="string"&&/^(?:[1-9]\d*(?:,[1-9]\d*)*)?$/.test(t.tcfDisclosedVendorKey))&&(t.tcfApiDataIntegrity===void 0||typeof t.tcfApiDataIntegrity=="string")&&(t.gpcRevocable===void 0||t.gpcRevocable===!0)&&(t.posture===void 0||t.posture===!0):!1}function It(t,e=Date.now()){return He(t)?Se(t.expiresAt,e):!1}var Tt=["center-center","bottom-left","bottom-right","bottom-center"],cn=[...Tt,"panel-right"],ln=["left","center"],dn=["accept-first","reject-first"],un=["left","right","center","full"],pn=["equal","emphasize-accept"];var Kr=new Set(Tt),Hr=new Set(cn);var zr=new Set(ln),qr=new Set(dn),Wr=new Set(un),Yr=new Set(pn);function At(t){let e=a=>typeof a=="object"&&a!==null&&!Array.isArray(a);if(!e(t))return!1;let n=t,s=a=>Array.isArray(a)&&a.every(l=>typeof l=="number"&&Number.isSafeInteger(l)&&l>0),r=a=>Array.isArray(a)&&a.every(l=>typeof l=="string"),o=n.disclosures;if(!Array.isArray(o)||!o.every(a=>{if(!e(a))return!1;let l=a;return typeof l.identifier=="string"&&["cookie","web","app"].includes(String(l.type))&&(l.maxAgeSeconds===null||typeof l.maxAgeSeconds=="number"&&Number.isSafeInteger(l.maxAgeSeconds)&&l.maxAgeSeconds>=0)&&typeof l.cookieRefresh=="boolean"&&r(l.domains)&&s(l.purposes)&&s(l.specialPurposes)&&(l.description===void 0||typeof l.description=="string")&&typeof l.optOut=="boolean"}))return!1;let i=n.domains;if(i!==void 0&&(!Array.isArray(i)||!i.every(a=>e(a)&&typeof a.domain=="string"&&typeof a.use=="string")))return!1;let c=n.sdks;return c===void 0||Array.isArray(c)&&c.every(a=>e(a)&&typeof a.name=="string"&&typeof a.use=="string")}var ie="1consent";var Ce=["data-1c-service","data-1c-service-tag","data-1c-tag"],ve="data-1c-category",Pt="data-1c-resolved";function fn(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=e+((e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24))>>>0;return e.toString(36)}function R(t,e){let n=t.map(r=>`${r.id}\0${r.name??""}\0${r.tag??""}\0${r.categoryId??""}\0${r.essential?1:0}${r.catalogServiceKey?`\0k\0${r.catalogServiceKey}`:""}${r.usSensitive?"\x001":""}`).sort(),s=e.map(r=>`${r.id}\0${r.name}\0${r.essential?1:0}`).sort();return fn(`s:${n.join("")}|c:${s.join("")}`)}function re(t,e,n){t[e]=e in t?t[e]===!0&&n:n}function be(t,e,n,s){let r=gn(t,e,n,s);return{services:r.services,categories:r.categories}}function gn(t,e,n,s){let r={},o=new Map,i=!1;for(let a of t){let l=a.essential===!0||n[a.id]===!0;if(l&&a.essential!==!0&&(i=!0),re(r,a.id,l),a.catalogServiceKey&&re(r,a.catalogServiceKey,l),a.tag&&re(r,a.tag,l),a.name&&re(r,a.name,l),a.categoryId){let d=o.get(a.categoryId)??{total:0,granted:0};d.total+=1,l&&(d.granted+=1),o.set(a.categoryId,d)}}let c={};for(let a of e){let l=o.get(a.id),d=l!==void 0&&l.total>0&&l.granted===l.total,p=a.essential===!0||s[a.id]===!0||d;p&&a.essential!==!0&&s[a.id]===!0&&(i=!0),re(c,a.id,p),re(c,a.name,p)}return{services:r,categories:c,nonEssentialGranted:i}}function _t(t,e,n,s,r){let o=gn(t,e,n,s),i=r?.decisionTimestamp,c=i!==void 0&&Number.isSafeInteger(i)&&i>0?i+33696e6:0,a={v:R(t,e),e:Number.isSafeInteger(c)?c:0,s:o.services,c:o.categories};return r?.gpcRevocable===!0&&o.nonEssentialGranted&&(a.g=1),r?.posture===!0&&(a.p=1),a}function Ee(){return typeof navigator>"u"?!1:navigator.globalPrivacyControl===!0}var Dt=2;function mn(t){return t==="A"||t==="D"||t==="G"}var Ss=/^[A-Za-z0-9_-]+$/,ys=/^[a-z0-9]+$/;function Ot(t){return t.length>0&&Ss.test(t)}function ws(t){return t.length>0&&ys.test(t)}function Cs(t){return t==="gdpr"||t==="tcf"||t==="us"}function vs(t){return t==="P"||t==="S"||t==="D"}function Sn(t){return mn(t.decision)&&typeof t.appId=="string"&&Ot(t.appId)&&typeof t.frameworkId=="string"&&Ot(t.frameworkId)&&Cs(t.frameworkType)&&vs(t.machine)&&typeof t.primaryLanguage=="string"&&Ot(t.primaryLanguage)&&typeof t.structuralVersion=="string"&&ws(t.structuralVersion)&&typeof t.consentEpoch=="number"&&Number.isSafeInteger(t.consentEpoch)&&t.consentEpoch>=0&&typeof t.expiresAt=="number"&&Number.isSafeInteger(t.expiresAt)&&t.expiresAt>0}function hn(t){if(!/^(0|[1-9]\d*)$/.test(t))return null;let e=Number(t);return Number.isSafeInteger(e)&&String(e)===t?e:null}function Lt(t){if(!Sn(t))throw new TypeError(ie);return[Dt,t.decision,t.appId,t.frameworkId,t.frameworkType,t.machine,t.primaryLanguage,t.structuralVersion,t.consentEpoch,t.expiresAt].join(".")}function xt(t){if(!t)return null;let e=t.split(".");if(e.length!==10||e[0]!==String(Dt))return null;let n=e[1],s=e[2],r=e[3],o=e[4],i=e[5],c=e[6],a=e[7],l=e[8],d=e[9];if(!l||!d)return null;let p=hn(l),m=hn(d),y={decision:n,appId:s,frameworkId:r,frameworkType:o,machine:i,primaryLanguage:c,structuralVersion:a,consentEpoch:p,expiresAt:m};return Sn(y)?y:null}function M(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function q(t,e){return M(t)&&Object.entries(t).every(([n,s])=>/^[1-9]\d*$/.test(n)&&s===!0&&(typeof e=="number"?+n<=e:e[n]===!0))}function bs(t){return M(t)&&Object.entries(t).every(([e,n])=>/^(1[01]|[1-9])$/.test(e)&&M(n)&&Object.entries(n).every(([s,r])=>/^[1-9]\d*$/.test(s)&&+s<=65535&&(r===0||r===1||r===2)))}function yn(t){if(!M(t)||!M(t.purpose)||!M(t.vendor))return!1;let e=t.publisher;return!M(e)||!M(e.customPurpose)?!1:(t.enableAdvertiserConsentMode===void 0||t.enableAdvertiserConsentMode===!0)&&[t.tcfPolicyVersion,t.cmpId,t.cmpVersion].every(n=>typeof n=="number"&&Number.isSafeInteger(n)&&n>=0&&n<2**12)&&[t.isServiceSpecific,t.useNonStandardTexts,t.purposeOneTreatment].every(n=>typeof n=="boolean")&&typeof t.publisherCC=="string"&&/^[A-Z]{2}$/.test(t.publisherCC)&&q(t.purpose.consents,11)&&q(t.purpose.legitimateInterests,11)&&Object.keys(t.purpose.legitimateInterests).every(n=>/^(2|[789]|1[01])$/.test(n))&&q(t.vendor.disclosedVendors,65535)&&q(t.vendor.consents,t.vendor.disclosedVendors)&&q(t.vendor.legitimateInterests,t.vendor.disclosedVendors)&&q(t.specialFeatureOptins,2)&&[e.consents,e.legitimateInterests,e.customPurpose.consents,e.customPurpose.legitimateInterests].every(n=>q(n,0))&&bs(e.restrictions)}function wn(t,e){return`${t}\0${JSON.stringify(e)}`}var Ie=4095,Cn=1,vn=10;function ze(t){return[...new Set(t)].sort((e,n)=>e-n).join(",")}var qe=class{config;framework;sampled;hadStoredConsent;buffer=[];impressionAt=null;decisionQueued=!1;pendingAction="granular";reportedCodes=new Set;abStamp;constructor(e,n,s,r){this.config=e,this.framework=r,this.sampled=Math.random()<e.sampleRate,this.hadStoredConsent=s.getConsentId()!==void 0;let o=typeof window<"u"?window.__1C_AB:void 0;if(this.abStamp=o?{abTestId:o.testId,abVariant:o.variant}:void 0,typeof document>"u"||(n.on("monitoring:error",c=>this.trackMonitoring(c.payload.code)),!this.sampled))return;n.on("view:transition",c=>{c.payload.to!=="none"&&this.trackImpression()}),n.on("view:change",c=>{c.payload.view!=="none"&&this.trackImpression()}),n.on("consent:accepted-all",()=>{this.pendingAction="accept_all"}),n.on("consent:rejected-all",()=>{this.pendingAction="deny_all"}),n.on("consent:rejected",()=>{this.pendingAction="deny_all"}),n.on("consent:saved",()=>this.trackDecision());let i=()=>{document.visibilityState==="hidden"&&this.flush()};document.addEventListener("visibilitychange",i),window.addEventListener("pagehide",()=>this.flush())}trackImpression(){if(this.impressionAt!==null)return;let e=Date.now();this.impressionAt=e,this.buffer.push({type:"impression",ts:e,hasConsentStored:this.hadStoredConsent,framework:this.framework,...this.abStamp})}trackDecision(){if(this.impressionAt===null||this.decisionQueued)return;this.decisionQueued=!0;let e=Date.now();this.buffer.push({type:"decision",ts:e,hasConsentStored:this.hadStoredConsent,framework:this.framework,action:this.pendingAction,tToConsentMs:e-this.impressionAt,...this.abStamp}),this.flush()}trackMonitoring(e){this.reportedCodes.has(e)||(this.reportedCodes.add(e),this.buffer.push({type:"monitoring",ts:Date.now(),hasConsentStored:this.hadStoredConsent,framework:this.framework,code:e,...this.abStamp}),this.flush())}flush(){if(this.buffer.length===0)return;let e=JSON.stringify({id:crypto.randomUUID(),token:this.config.token,events:this.buffer});this.buffer=[];let n=`${this.config.url}/v1/analytics`;typeof navigator.sendBeacon=="function"&&navigator.sendBeacon(n,new Blob([e],{type:"text/plain"}))||fetch(n,{method:"POST",body:e,keepalive:!0}).catch(()=>{})}};function D(t){if(!t.startsWith("consent:"))return null;let e=t.slice(8).split(".");if(e.length!==2)return null;let[n,s]=e;return n!=="gdpr"&&n!=="tcf"&&n!=="us"||!s?null:{framework:n,entity:s}}function Vt(t){return D(t)!==null}var Te=class{version=0;getVersion(){return this.version}increment(){return++this.version}reset(){this.version=0}};function B(t,e){let n={};for(let s of t.categories)n[`category:${s.id}`]=e[s.id]===!0;for(let s of t.services)n[`service:${s.id}`]=e[s.id]===!0;return n}function Ae(t,e){if(!It(e)||e.consentEpoch<(t.consentEpoch??0)||e.structuralVersion!==R(t.services,t.categories))return;if(e.gpcRevocable&&Ee())return B(t,{});let n={};for(let s of t.categories)n[`category:${s.id}`]=e.categories[s.id]===!0;for(let s of t.services)n[`service:${s.id}`]=e.services[s.id]===!0;return n}function oe(t,e){for(let n of Object.keys(t))if(t[n]===!0&&e[n]!==!0)return!0;return!1}function ae(t){return t.consentDowngradeBehavior??St}function bn(t,e){if(!/^[0-9a-z]+$/.test(t))throw new Error(`Invalid consent string: ${e} is not canonical base36`);let n=Number.parseInt(t,36);if(!Number.isSafeInteger(n)||n.toString(36)!==t)throw new Error(`Invalid consent string: ${e} is not a safe canonical integer`);return n}function Is(t){if(!/^[A-Za-z0-9_-]*$/.test(t)||t.length%4===1)return!1;try{let e=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=atob(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")===t}catch{return!1}}var T=class t{static encode(e){let n=[e.machine,e.configId,e.version.toString(36),e.framework,e.state];return e.state==="G"&&e.payload&&n.push(`${e.payload.mode}${e.payload.bits}`),n.push(e.language),n.push(e.timestamp.toString(36)),n.join(".")}static decode(e,n={}){let s=e.split("."),r=s[0],o=s[1],i=s[2],c=s[3],a=s[4];if(r!=="P"&&r!=="S"&&r!=="D")throw new Error("Invalid consent string: unsupported machine");if(!o)throw new Error("Invalid consent string: missing config id");if(!i)throw new Error("Invalid consent string: missing codec version");let l=bn(i,"codec version");if(l!==1)throw new Error("Invalid consent string: unsupported codec version");if(c!=="gdpr"&&c!=="tcf"&&c!=="us")throw new Error("Invalid consent string: unsupported framework");if(a!=="A"&&a!=="D"&&a!=="G")throw new Error("Invalid consent string: unsupported state");let d=a==="G"?8:7;if(s.length!==d)throw new Error("Invalid consent string: noncanonical component count");let p,m=5;if(a==="G"){let h=s[5];if(!h)throw new Error("Invalid consent string: missing granular payload");let f=h[0],E=h.slice(1);if(f!=="a"&&f!=="d"||!Is(E))throw new Error("Invalid consent string: malformed granular payload");p={mode:f,bits:E},m=6}let y=s[m],u=s[m+1];if(!y||!u)throw new Error("Invalid consent string: missing language or timestamp");let S=bn(u,"timestamp"),C=Math.floor(Date.now()/1e3),g=n.maxFutureSkewSeconds??0;if(S<=0||!Number.isSafeInteger(C)||C<0||!Number.isSafeInteger(g)||g<0||S>C+g)throw new Error("Invalid consent string: timestamp is not a past positive instant");let b={machine:r,configId:o,version:l,framework:c,state:a,...p?{payload:p}:{},language:y,timestamp:S};if(t.encode(b)!==e)throw new Error("Invalid consent string: noncanonical encoding");return b}static decodeForConfig(e,n){let s=t.decode(e);if(s.machine!==n.machine||s.configId!==n.appId||s.framework!==n.framework.type)throw new Error("Invalid consent string: decision identity does not match live config");return s}static encodeBitset(e){let n=e.filter(Boolean).length,s=e.length-n,r=n<=s?"a":"d",o=r==="a",i=new Uint8Array(Math.ceil(e.length/8));for(let a=0;a<e.length;a++)if(e[a]===o){let l=Math.floor(a/8),d=a%8;i[l]|=1<<d}let c=btoa(String.fromCharCode(...i)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return{mode:r,bits:c}}static decodeBitset(e,n){let s=e.bits.replace(/-/g,"+").replace(/_/g,"/"),r=atob(s),o=new Uint8Array(r.length);for(let a=0;a<r.length;a++)o[a]=r.charCodeAt(a);let i=e.mode,c=new Array(n).fill(i!=="a");for(let a=0;a<n;a++){let l=Math.floor(a/8),d=a%8;l<o.length&&o[l]&1<<d&&(c[a]=i==="a")}return c}};var kt=class{isAvailable;memoryStorage=new Map;persistenceFailureListeners=[];persistenceFailureNotified=!1;constructor(){this.isAvailable=this.checkAvailability()}checkAvailability(){let e="__1c_storage_test__";try{localStorage.setItem(e,"test");let n=localStorage.getItem(e);return localStorage.removeItem(e),n==="test"}catch{return!1}}getItem(e){if(this.isAvailable)try{return localStorage.getItem(e)}catch{this.isAvailable=!1}return this.memoryStorage.get(e)??null}setItem(e,n){if(this.isAvailable)try{localStorage.setItem(e,n);return}catch{this.isAvailable=!1}this.memoryStorage.set(e,n),this.notifyPersistenceFailure()}onPersistenceFailure(e){this.persistenceFailureListeners.push(e),this.persistenceFailureNotified&&e()}notifyPersistenceFailure(){if(!this.persistenceFailureNotified){this.persistenceFailureNotified=!0;for(let e of this.persistenceFailureListeners)e()}}removeItem(e){if(this.isAvailable)try{localStorage.removeItem(e)}catch{this.isAvailable=!1}this.memoryStorage.delete(e)}isLocalStorageAvailable(){return this.isAvailable}},ce=new kt;var X=class{read(){return ce.getItem(se)}write(e){ce.setItem(se,e)}remove(){ce.removeItem(se)}};function W(){return Math.floor(Date.now()/1e3)}function le(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function In(t){return le(t)&&typeof t.updatedAt=="number"&&le(t.frameworks)&&(t.consentId===void 0||typeof t.consentId=="string")}function We(t){return le(t)&&(t.type==="gdpr"||t.type==="tcf"||t.type==="us")&&(t.machine==="P"||t.machine==="S"||t.machine==="D")&&typeof t.configVersion=="number"&&(t.consentEpoch===void 0||typeof t.consentEpoch=="number"&&Number.isSafeInteger(t.consentEpoch)&&t.consentEpoch>=0)&&(t.tcfPolicyVersion===void 0||typeof t.tcfPolicyVersion=="number"&&Number.isSafeInteger(t.tcfPolicyVersion)&&t.tcfPolicyVersion>=0)&&typeof t.primaryLanguage=="string"&&typeof t.updatedAt=="number"}function Y(t,e){return t.type===e.type&&t.machine===e.machine&&(t.consentEpoch??0)>=e.consentEpoch&&(e.tcfPolicyVersion===void 0||t.tcfPolicyVersion===e.tcfPolicyVersion)&&t.primaryLanguage===e.primaryLanguage}function de(t,e){let s=Ke(t).apps[e.appId];if(!In(s))return;let r=s.frameworks[e.frameworkId];return We(r)&&Y(r,e)?r:void 0}function En(t){let e={consent:t.value,firstSeenAt:t.firstSeenAt,lastSeenAt:t.lastSeenAt,...t.tcString===void 0?{}:{tcString:t.tcString},...t.uspString===void 0?{}:{uspString:t.uspString},...t.gppString===void 0?{}:{gppString:t.gppString},...t.limitSensitiveUse===void 0?{}:{limitSensitiveUse:t.limitSensitiveUse}};return Tn(e)?e:void 0}function Ts(t){return{value:t.consent,firstSeenAt:t.firstSeenAt,lastSeenAt:t.lastSeenAt,...t.tcString===void 0?{}:{tcString:t.tcString},...t.uspString===void 0?{}:{uspString:t.uspString},...t.gppString===void 0?{}:{gppString:t.gppString},...!("limitSensitiveUse"in t)||t.limitSensitiveUse===void 0?{}:{limitSensitiveUse:t.limitSensitiveUse}}}var J=class{storage;scope;MAX_PENDING=10;constructor(e,n){this.storage=e,this.scope=n}getScope(){return this.scope}readStore(){try{return Ke(this.storage.read())}catch{return ne()}}writeStore(e){this.storage.write(JSON.stringify(e))}mutate(e){let n=this.readStore();e(n),this.writeStore(n)}readApp(e){let n=e.apps[this.scope.appId];return In(n)?n:void 0}readFramework(e){let n=this.readApp(e)?.frameworks[this.scope.frameworkId];return We(n)&&n.type===this.scope.type?n:void 0}ensureApp(e,n){let s=this.readApp(e);if(s)return s.updatedAt=n,s;let r={updatedAt:n,frameworks:{}};return e.apps[this.scope.appId]=r,r}ensureFramework(e,n){let s=this.ensureApp(e,n),r=s.frameworks[this.scope.frameworkId];if(We(r)&&Y(r,this.scope))return r.updatedAt=n,r;let o={type:this.scope.type,machine:this.scope.machine,configVersion:this.scope.configVersion,consentEpoch:this.scope.consentEpoch,tcfPolicyVersion:this.scope.tcfPolicyVersion,primaryLanguage:this.scope.primaryLanguage,updatedAt:n};return We(r)&&(r.type===this.scope.type&&(o.prior=r.consent??r.prior),r.outbox&&(o.outbox=r.outbox)),s.frameworks[this.scope.frameworkId]=o,o}getConsent(){let e=this.readFramework(this.readStore());if(!(!e?.consent||!Y(e,this.scope)))return En(e.consent)}getLatestConsent(){let e=this.readFramework(this.readStore()),n=e?.consent??e?.prior;return n?En(n):void 0}getContents(){let e=this.getConsent();return e?[e]:[]}getConsentId(){return this.readApp(this.readStore())?.consentId}setConsentId(e){let n=W();this.mutate(s=>{this.ensureApp(s,n).consentId=e})}updateConsent(e,n){if(!this.readApp(this.readStore())?.consentId)throw new Error("[OneConsentStorage] Cannot store consent without consentId. Call setConsentId() first.");let r=W(),o={...e,firstSeenAt:r,lastSeenAt:r};Tn(o)&&this.mutate(i=>{let c=this.ensureFramework(i,r),a=c.consent;c.machine=this.scope.machine,c.configVersion=this.scope.configVersion,c.consentEpoch=this.scope.consentEpoch,this.scope.tcfPolicyVersion===void 0?delete c.tcfPolicyVersion:c.tcfPolicyVersion=this.scope.tcfPolicyVersion,c.primaryLanguage=this.scope.primaryLanguage,c.consent=Ts({...o,firstSeenAt:a?.firstSeenAt??r,lastSeenAt:r}),n&&(c.fastPath=n),delete c.prior})}setFastPath(e){let n=W();this.mutate(s=>{this.ensureFramework(s,n).fastPath=e})}getFastPath(){let e=this.readFramework(this.readStore());if(e&&Y(e,this.scope)&&He(e.fastPath))return e.fastPath}removeFastPath(){let e=W();this.mutate(n=>{let s=this.readFramework(n);!s||!Y(s,this.scope)||(delete s.fastPath,s.updatedAt=e,this.ensureApp(n,e))})}invalidateConsent(){let e=W();this.mutate(n=>{let s=this.readFramework(n);!s||!Y(s,this.scope)||(delete s.consent,delete s.fastPath,s.updatedAt=e,this.ensureApp(n,e))})}removeAll(){this.mutate(e=>{let n=this.readApp(e),s=this.readFramework(e);!n||!s||!Y(s,this.scope)||(delete n.frameworks[this.scope.frameworkId],n.updatedAt=W(),Object.keys(n.frameworks).length===0&&!n.experiment&&delete e.apps[this.scope.appId])})}getPendingEvents(){let e=this.readFramework(this.readStore())?.outbox?.consentEvents;return Array.isArray(e)?e.filter(As):[]}queuePendingEvent(e){let n=this.getPendingEvents().filter(r=>r.eventId!==e.eventId);n.push(e),n.length>this.MAX_PENDING&&console.warn(`[OneConsentStorage] Event queue full \u2014 dropping ${n.length-this.MAX_PENDING} oldest`);let s=W();this.mutate(r=>{this.ensureFramework(r,s).outbox={consentEvents:n.slice(-this.MAX_PENDING)}})}removePendingEvent(e){let n=this.getPendingEvents().filter(s=>s.eventId!==e);this.mutate(s=>{let r=this.readFramework(s);r&&(n.length?r.outbox={consentEvents:n}:delete r.outbox)})}};function As(t){return le(t)&&typeof t.url=="string"&&typeof t.eventId=="string"&&le(t.payload)}function Tn(t){return!le(t)||typeof t.consent!="string"||t.consent.length<5||typeof t.firstSeenAt!="number"||typeof t.lastSeenAt!="number"||t.tcString!==void 0&&typeof t.tcString!="string"||t.uspString!==void 0&&typeof t.uspString!="string"||t.gppString!==void 0&&typeof t.gppString!="string"||t.limitSensitiveUse!==void 0&&typeof t.limitSensitiveUse!="boolean"?!1:!(t.tcString!==void 0&&(t.uspString!==void 0||t.gppString!==void 0))}function An(t,e){let n=de(e,N(t));return Ae(t,n?.fastPath)}function Ft(t,e){let n=de(e,N(t)),s=n?.consent??(t.framework.type==="us"?n?.prior:void 0);if(!s)return;let r=s.value;try{T.decodeForConfig(s.value,t),r=s.value.replace(/\.[^.]+(\.[^.]+)$/,"$1")}catch{r=`!${r}`}return JSON.stringify([r,s.tcString,s.uspString,s.gppString,s.limitSensitiveUse])}var Oe=class{bus;storage;config;constructor(e,n,s){this.bus=e,this.storage=n,this.config=s}getConfig(){return this.config}getDisplayLocale(){return this.config.languages.primary}getExternalConsentSnapshot(e){return An(this.config,e)}getCurrentExternalConsentSnapshot(){let e=this.getEnforcementConsentState();if(e.hasConsent)return B(this.config,{...e.categories,...e.services})}shouldReloadForExternalConsentChange(e,n){if(ae(this.config)!=="reload")return!1;let s=e===null&&n===null?this.getCurrentExternalConsentSnapshot():this.getExternalConsentSnapshot(e);if(!s)return!1;let r=this.getExternalConsentSnapshot(n)??{};return oe(s,r)}hasExternalConsentChange(e,n){return e!==null||n!==null?Ft(this.config,e)!==Ft(this.config,n):this.getCurrentExternalConsentSnapshot()!==void 0}emit(e,n){this.bus.emit({type:e,payload:n})}on(e,n){this.bus.on(e,n)}getEnforcementConsentState(){return this.getConsentState()}};function Ye(t){if(typeof window>"u")return;let e=window.__1CONSENT_REACT_FASTPATH__;if(e)try{return typeof e.apply!="function"||typeof e.resolve!="function"||typeof e.reconcile!="function"||typeof e.destroy!="function"||e.appId!==t.appId||e.frameworkId!==t.framework.id||e.frameworkType!==t.framework.type||e.machine!==t.machine||e.primaryLanguage!==t.languages.primary||e.consentEpoch!==(t.consentEpoch??0)||e.structuralVersion!==R(t.services,t.categories)?void 0:e.reconcile()?e:void 0}catch{return}}function Os(){let t=globalThis;return typeof t.scheduler=="object"?t.scheduler:void 0}function Xe(t){let e=Os();if(e?.postTask)try{e.postTask(t,{priority:"user-visible"});return}catch{}setTimeout(t,0)}function On(t,e={}){let n=document.createElement("script");for(let s of t.attributes)n.setAttribute(s.name,s.value);t.src?t.hasAttribute("async")||(n.async=!1):n.text=t.text||t.textContent||"";for(let s of e.removeAttributes??[])n.removeAttribute(s);return n}var Ps=[...Ce,ve].map(t=>`template[${t}]:not([${Pt}])`).join(",");function _s(){return document.readyState==="loading"?new Promise(t=>document.addEventListener("DOMContentLoaded",()=>t(),{once:!0})):Promise.resolve()}var Je=class{config;constructor(e){this.config=e}async unblockTemplates(e){await _s();let n=be(this.config.services,this.config.categories,e.services,e.categories),s=document.querySelectorAll(Ps);if(!s.length)return[];let r=new Set;for(let o=0;o<s.length;o++){let i=s[o];if(!i)continue;let c=this.grantedKey(i,n.services,n.categories);if(!c)continue;r.add(c);let a=i.content.cloneNode(!0);if(!(a instanceof DocumentFragment))continue;let l=a.querySelectorAll("script");for(let d=0;d<l.length;d++){let p=l[d];if(!p)continue;let m=On(p,{removeAttributes:[...Ce,ve]});p.replaceWith(m)}i.replaceWith(a)}return Array.from(r)}grantedKey(e,n,s){for(let o of Ce){let i=e.getAttribute(o);if(i!==null)return n[i]===!0?i:void 0}let r=e.getAttribute(ve);if(r!==null&&s[r]===!0)return r}};function Ds(t){return typeof t=="object"&&t!==null&&"translations"in t&&"themeCSS"in t}var Ls=250;function Pe(t,e){return`${t}::${e}`}function Ze(t){return t==="details"?"details":t==="trigger"?"trigger":"notice"}var k=class{config;services;bus;storage;viewEngine;currentLocale;translations=null;translationsCache=new Map;uiDataRequests=new Map;uiDataThemeCSS=null;_themeMode="auto";analytics;blockingAttached=!1;constructor(e,n){this.config=e,this.services=n,this.bus=n.bus,this.storage=n.storage,this.viewEngine=n.viewEngine,this.currentLocale=e.languages.primary,e.analytics&&(this.analytics=new qe(e.analytics,this.bus,this.storage,e.framework.type),ce.onPersistenceFailure(()=>{this.bus.emit({type:"monitoring:error",payload:{code:"optout_write_error"}})}))}attachBlocking(e){if(this.blockingAttached)throw new Error("[1ConsentController] blocking is already attached");this.blockingAttached=!0;let n=new Je(this.config),s=(r=!1)=>{let o=e.getEnforcementConsentState(),i=this.getAutoblocker();i&&i.updateConsent(o.services);let c=Ye(this.config);if(r&&c)try{let a=be(this.config.services,this.config.categories,o.services,o.categories);c.apply(a.services,a.categories)}catch{}Xe(()=>{i?.unblock(),!c&&n.unblockTemplates(o).catch(a=>{console.error("Template promotion failed",a)})})};this.bus.on("consent:saved",()=>s()),this.bus.on("consent:external",()=>{s(!0),e.isConsentRequired()&&this.openNotice().catch(()=>{})}),s()}getAutoblocker(){if(typeof window>"u"||!this.config.autoblocker?.enabled)return;let e=window.__1CONSENT_AUTOBLOCKER__;if(!e){console.error("Autoblocker missing");return}if(!(e.scope.appId!==this.config.appId||e.scope.frameworkId!==this.config.framework.id))return e}resolveInitialLocale(e){if(!e||e===this.currentLocale)return;let n=this.config.languages.supported.find(s=>s===e);n&&(this.currentLocale=n,this.bus.emit({type:"language:changed",payload:{locale:n}}))}getLanguage(){return this.currentLocale}getTranslations(){return this.translations}async setLanguage(e){if(e===this.currentLocale&&this.translations)return;let n=Ze(this.viewEngine?.getCurrentView()),s=this.translationsCache.get(Pe(e,n));if(s){this.translations=s,this.currentLocale=e,this.bus.emit({type:"language:changed",payload:{locale:e}});return}let r=await this.requestUiData(e,n);if(r===null)throw new Error(`[1Consent] ui-data for ${e}/${n} unavailable`);this.translations=r.translations,this.currentLocale=e,this.bus.emit({type:"language:changed",payload:{locale:e}})}hasViewData(e){return e==="none"?!0:this.translationsCache.has(Pe(this.currentLocale,Ze(e)))}async ensureViewData(e){if(e==="none")return;let n=this.currentLocale,s=Ze(e),r=this.translationsCache.get(Pe(n,s));if(r){this.translations=r;return}let o=await this.requestUiData(n,s);o?.translations&&n===this.currentLocale&&(this.translations=o.translations)}requestUiData(e,n){let s=Pe(e,n),r=this.uiDataRequests.get(s);if(r)return r;let o=(async()=>{try{let i=await this.fetchUiDataWithRetry(e,n);return this.applyUiData(e,n,i),i}catch(i){return this.uiDataRequests.delete(s),console.error(`[1Consent] ui-data for ${s} unavailable after retry \u2014 the consent UI will render WITHOUT translations/theme:`,i),null}})();return this.uiDataRequests.set(s,o),o}async fetchUiDataWithRetry(e,n){try{return await this.fetchUiData(e,n)}catch{return await new Promise(s=>setTimeout(s,Ls)),await this.fetchUiData(e,n)}}async fetchUiData(e,n){let s=this.config.cmp.uiData.replace("{locale}",e).replace("{view}",n),r=await fetch(s);if(!r.ok)throw new Error(`HTTP ${r.status}`);let o=await r.json();if(!Ds(o))throw new Error(`unexpected ui-data payload shape for ${e}/${n}`);return o.translations?{...o,translations:this.normalizeTranslations(o.translations,e,o.contentLanguage)}:o}normalizeTranslations(e,n,s){return e}applyUiData(e,n,s){s.translations&&this.translationsCache.set(Pe(e,n),s.translations),s.themeCSS!==this.uiDataThemeCSS&&(this.uiDataThemeCSS=s.themeCSS,this.viewEngine?.setThemeCSS(s.themeCSS)),s.translations&&e===this.currentLocale&&this.translations===null&&this.viewEngine&&this.viewEngine.getCurrentView()!=="none"&&Ze(this.viewEngine.getCurrentView())===n&&(this.translations=s.translations,this.viewEngine.refreshCurrentView())}getThemeMode(){return this._themeMode}setThemeMode(e){this._themeMode=e,this.bus.emit({type:"theme:changed",payload:{mode:e}})}viewEngineFactory;viewEngineCreation;setViewEngine(e){this.viewEngine=e,this.uiDataThemeCSS!==null&&e.setThemeCSS(this.uiDataThemeCSS)}setViewEngineFactory(e){this.viewEngineFactory=e}async ensureViewEngine(){if(!this.viewEngine&&this.viewEngineFactory){this.viewEngineCreation??=this.viewEngineFactory().catch(n=>{throw this.viewEngineCreation=void 0,n});let e=await this.viewEngineCreation;this.viewEngine||(this.viewEngine=e,this.uiDataThemeCSS!==null&&e.setThemeCSS(this.uiDataThemeCSS))}return this.viewEngine}get activeViewEngine(){return this.viewEngine}async showReturningVisitorTrigger(){if(!wt(this.config))return;let e=this.ensureViewData("trigger"),n=await this.ensureViewEngine();n&&(await Promise.all([this.ensureViewLoaded("trigger"),e]),await n.transitionTo("trigger","consent-given"))}async openNotice(){let e=await this.ensureViewEngine();e&&await e.transitionTo("main","programmatic")}async openDetails(){let e=await this.ensureViewEngine();e&&await e.transitionTo("details","programmatic")}async close(){this.viewEngine&&await this.viewEngine.transitionTo("none","programmatic")}async ensureViewLoaded(e){let n=await this.ensureViewEngine();!n||n.hasDesign(e)||await n.ensureViewBundle(e)}};var _e=class{handlers=new Map;on(e,n){let s=this.handlers.get(e);return s||(s=new Set,this.handlers.set(e,s)),s.add(n),()=>this.off(e,n)}off(e,n){let s=this.handlers.get(e);s&&s.delete(n)}emit(e){let n=this.handlers.get(e.type);if(n)for(let s of n)s(e)}};function Pn(t,e){let n=[...t.services.filter(s=>!s.essential).map(s=>s.id),...t.categories.filter(s=>!s.essential).map(s=>s.id)];return n.length===0||n.every(s=>e[s]===!0)?"A":n.every(s=>!e[s])?"D":"G"}function De(t,e,n,s){let r=_t(t.services,t.categories,e,e,n),o={structuralVersion:r.v,consentEpoch:t.consentEpoch??0,expiresAt:r.e,services:r.s,categories:r.c,...n?.decisionIntegrity?{decisionIntegrity:n.decisionIntegrity}:{},...n?.tcfCmpId!==void 0?{tcfCmpId:n.tcfCmpId}:{},...n?.tcfValidationVersion!==void 0?{tcfValidationVersion:n.tcfValidationVersion}:{},...n?.tcfDisclosedVendorKey!==void 0?{tcfDisclosedVendorKey:n.tcfDisclosedVendorKey}:{},...n?.tcfApiData!==void 0?{tcfApiData:n.tcfApiData}:{},...n?.tcfApiDataIntegrity!==void 0?{tcfApiDataIntegrity:n.tcfApiDataIntegrity}:{},...r.g===1?{gpcRevocable:!0}:{},...r.p===1?{posture:!0}:{}};if(s)s(o);else try{if(typeof localStorage>"u")throw new Error("localStorage unavailable");new J(new X,N(t)).setFastPath(o)}catch{}return n?.cookieMode==="clear"?U(t):n?.cookieMode!=="omit"&&Vs(t,e,r),Xe(()=>xs(t,r)),r}function xs(t,e){try{Ye(t)?.apply(e.s,e.c)}catch{}}function Qe(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0).toString(36)}function U(t){if(!(typeof document>"u"))try{let e=`${ie}=`,s=document.cookie.split(";").map(o=>o.trim()).find(o=>o.startsWith(e))?.slice(e.length),r=xt(s);if(r&&Se(r.expiresAt)&&(r.appId!==t.appId||r.frameworkId!==t.framework.id||r.frameworkType!==t.framework.type||r.machine!==t.machine||r.primaryLanguage!==t.languages.primary))return;document.cookie=`${ie}=; Path=/; SameSite=Lax; Max-Age=0`}catch{}}function Vs(t,e,n){if(!(typeof document>"u")){if(!t.syncCookie||!Se(n.e)){U(t);return}try{let s=Lt({decision:Pn(t,e),appId:t.appId,frameworkId:t.framework.id,frameworkType:t.framework.type,machine:t.machine,primaryLanguage:t.languages.primary,structuralVersion:n.v,consentEpoch:t.consentEpoch??0,expiresAt:n.e}),r=typeof location<"u"&&location.protocol==="https:",o=[`${ie}=${s}`,"Path=/","SameSite=Lax",`Expires=${new Date(n.e).toUTCString()}`];r&&o.push("Secure"),document.cookie=o.join("; ")}catch{}}}function Nt(t){return{config:t.config,init:t.init.bind(t),openNotice:t.openNotice.bind(t),openDetails:t.openDetails.bind(t),close:t.close.bind(t),acceptAll:t.acceptAll.bind(t),rejectAll:t.rejectAll.bind(t),getLanguage:t.getLanguage.bind(t),getTranslations:t.getTranslations.bind(t),setLanguage:t.setLanguage.bind(t),getThemeMode:t.getThemeMode.bind(t),setThemeMode:t.setThemeMode.bind(t),bus:t.bus,cmp:{getState:()=>t.activeViewEngine?.getCurrentView()||"none",openCmp:t.openNotice.bind(t),openDetails:t.openDetails.bind(t),close:t.close.bind(t),acceptAll:t.acceptAll.bind(t),rejectAll:t.rejectAll.bind(t)},registerDesign:(e,n)=>t.activeViewEngine?.registerDesign(e,n),getView:()=>{let e="engine"in t?t.engine:void 0;return e&&typeof e=="object"&&"isConsentRequired"in e&&typeof e.isConsentRequired=="function"&&e.isConsentRequired()?"main":null},get engine(){return"engine"in t?t.engine:void 0},get viewEngine(){return t.activeViewEngine}}}var $n=["center-center","bottom-left","bottom-right","bottom-center"],ks=[...$n,"panel-right"];new Set($n),new Set(ks);function Fs(t){return"tcf"in t&&t.tcf!=null&&typeof t.tcf=="object"}var _n="ar.bg.bs.ca.cs.cy.da.de.el.en.es.et.eu.fi.fr.gl.he.hi.hr.hu.id.is.it.ja.ka.ko.lt.lv.mk.ms.mt.nl.no.pl.pt-br.pt-pt.ro.ru.sk.sl.sq.sr-latn.sr-cyrl.sv.sw.th.tl.tr.uk.vi.zh.zh-hant".split(".");new Set(_n),_n.filter(t=>t.includes("-")).sort((t,e)=>e.length-t.length);function Ns(t){if(typeof t!="string")return null;let e=t.trim();if(e.length<2||e.length>255)return null;try{return Intl.getCanonicalLocales(e)[0]??null}catch{return null}}function Dn(t){return typeof t=="string"&&Ns(t)===t}function O(t){return typeof t=="object"&&!!t&&!Array.isArray(t)}function Gn(t){if(!O(t))return!1;let e=t;return!(!(typeof e.appId=="string"&&typeof e.version=="number"&&typeof e.machine=="string"&&O(e.languages)&&typeof e.languages.primary=="string"&&Array.isArray(e.languages.supported)&&e.languages.supported.length>0&&Dn(e.languages.primary)&&e.languages.supported.every(Dn)&&new Set(e.languages.supported).size===e.languages.supported.length&&e.languages.supported.includes(e.languages.primary)&&O(e.cmp)&&typeof e.cmp.main=="string"&&typeof e.cmp.uiData=="string"&&typeof e.cmp.serviceDetails=="string"&&Array.isArray(e.categories)&&Array.isArray(e.services)&&Array.isArray(e.scripts)&&typeof e.appearance=="object"&&e.appearance!==null&&typeof e.framework=="object"&&e.framework!==null)||!["P","S","D"].includes(e.machine))}function Rs(t){return t.cmp.trigger?t.framework.type==="us"||!!t.appearance?.trigger:!1}function Rt(t){if(!Gn(t)||t.framework.type!=="tcf"||!("vendorListVersion"in t.framework)||!Number.isSafeInteger(t.framework.vendorListVersion)||t.framework.vendorListVersion<=0||!("vendors"in t)||!Array.isArray(t.vendors))return!1;let e=s=>Array.isArray(s)&&s.every(r=>Number.isSafeInteger(r)&&r>0)&&new Set(s).size===s.length,n=[];for(let s of t.vendors){if(!O(s))return!1;let r=s.id;if(typeof r!="number"||!Number.isSafeInteger(r)||r<=0||!e(s.consentPurposeIds)||!e(s.legitimateInterestPurposeIds)||!e(s.flexiblePurposeIds)||!e(s.specialFeatureIds))return!1;n.push(r)}return new Set(n).size===n.length}function Ms(t){return Gn(t)&&t.framework.type==="us"}function Ln(t){return["openMain","openDetails","close","acceptAll","rejectAll","save","reset"].includes(t)}var Bt={open:"openMain",openNotice:"openMain"};function Bs(t,e=Bt){if(Ln(t))return t;let n=e[t];if(!n)throw Error(`[1CL] Unknown command: ${t}. No alias mapping found.`);if(!Ln(n))throw Error(`[1CL] Invalid alias target: ${t} \u2192 ${n}. Alias targets must be canonical commands.`);return n}function Us(t){return t?{...Bt,...t}:Bt}function Mt(t){return Array.isArray(t)&&t.every(e=>typeof e=="string")}function jn(t){return!t||typeof t!="object"||Object.entries(t).every(([e,n])=>e.endsWith("Url")?/^(https?:\/\/|mailto:[^@\s]+@[^@\s]+$)/i.test(String(n)):jn(n))}function et(t,e){return Array.isArray(t)&&t.every(n=>O(n)&&e.every(s=>typeof n[s]=="string"))}function $s(t){if(!O(t)||typeof t.id!="string"||typeof t.name!="string")return!1;let e=t.declaration;if(!O(e))return!1;let n=e.deviceStorage,s=e.legalProfile,r=[[e.parties,["key","name","kind"]],[e.dataSources,["name"]],[e.recipients,["name"]],[e.processingLocations,["name"]],[e.retention,["period"]],[e.transfers,["destination"]]].every(([a,l])=>a===void 0||et(a,l)),o=s==null||O(s)&&typeof s.label=="string"&&[[s.processingGrounds,["basis","label"]],[s.partyRoles,["partyKey","role"]]].every(([a,l])=>et(a,l))&&Mt(s.rights),i=t.operational,c=i==null||O(i)&&(i.domains===void 0||Array.isArray(i.domains)&&i.domains.every(a=>O(a)&&typeof a.domain=="string"&&typeof a.use=="string"))&&(i.sdks===void 0||Array.isArray(i.sdks)&&i.sdks.every(a=>O(a)&&typeof a.name=="string"&&typeof a.use=="string"));return(t.description==null||typeof t.description=="string")&&c&&r&&jn(t)&&et(e.purposes,["key","name"])&&Mt(e.dataCategories)&&Mt(e.technologies)&&(n===null||O(n)&&et(n.items,["key","type"]))&&O(e.links)&&Object.values(e.links).every(a=>typeof a=="string")&&o}function Kn(t,e){let n=r=>{let o=r.base?[r.base,...r.path]:r.path;if(o[0]!=="ui"||o[1]!=="templateLabels"||!o[2])return;let i=o[2],c=e.templateLabels?.[i];if(typeof c!="string"||!c.trim())throw Error(`[TemplateLabels] Translate ui.templateLabels.${i} before using this design`)},s=r=>{for(let o of r){if(o.t==="bind"&&n(o.p),o.t==="el"){for(let i of o.attrs)if(i.k==="bind"&&n(i.value),i.k==="concat")for(let c of i.parts)c.k==="bind"&&n(c.v);s(o.kids)}if((o.t==="each"||o.t==="if"||o.t==="if-not")&&s(o.body),o.t==="use"){for(let i of Object.values(o.props))i.k==="path"&&n(i.v);o.children&&s(o.children)}}};for(let r of[...Object.values(t.views),...Object.values(t.components)])s(r)}var Gs=["a[href]","area[href]","button:not([disabled])","input:not([disabled]):not([type='hidden'])","select:not([disabled])","textarea:not([disabled])","iframe","[contenteditable='true']","[tabindex]:not([tabindex='-1'])"].join(",");function Hn(t){return Array.from(t.querySelectorAll(Gs)).filter(e=>e instanceof HTMLElement&&e.getAttribute("tabindex")!=="-1"&&!e.closest("[hidden], [inert], [aria-hidden='true']"))}function js(t){let e=t.querySelector("[data-1c-initial-focus]");if(e instanceof HTMLElement)return e;let n=t.querySelector("h1, h2, h3, h4, h5, h6");return n instanceof HTMLElement?(n.hasAttribute("tabindex")||(n.tabIndex=-1),n):Hn(t)[0]||(t.hasAttribute("tabindex")||(t.tabIndex=-1),t)}function Ks(t){let e=[],n=t;for(;;){let s=n.parentElement;if(s){for(let o of Array.from(s.children))!(o instanceof HTMLElement)||o===n||(e.push({element:o,inert:o.inert}),o.inert=!0);if(s===document.body)break;n=s;continue}let r=n.getRootNode();if(!(r instanceof ShadowRoot))break;for(let o of Array.from(r.children))!(o instanceof HTMLElement)||o===n||(e.push({element:o,inert:o.inert}),o.inert=!0);if(!(r.host instanceof HTMLElement))break;n=r.host}return e}function zn(t,e){let n=Ks(e),s=document.documentElement.style,r=s.getPropertyValue("overflow"),o=s.getPropertyPriority("overflow");s.setProperty("overflow","hidden");let i=a=>{if(a.key!=="Tab")return;let l=Hn(t);if(l.length===0){a.preventDefault(),t.focus({preventScroll:!0});return}let d=l[0],p=l[l.length-1];if(!d||!p)return;let m=t.getRootNode(),y=m instanceof ShadowRoot?m.activeElement:document.activeElement;a.shiftKey&&(y===d||!t.contains(y))?(a.preventDefault(),p.focus({preventScroll:!0})):!a.shiftKey&&(y===p||!t.contains(y))&&(a.preventDefault(),d.focus({preventScroll:!0}))};t.addEventListener("keydown",i),js(t).focus({preventScroll:!0});let c=!0;return()=>{if(c){c=!1,t.removeEventListener("keydown",i);for(let a of n)a.element.inert=a.inert;r?s.setProperty("overflow",r,o):s.removeProperty("overflow")}}}var xn=new Map,ue=null,Ut=null,$t=0;async function Vn(t,e,n,s,r,o){if(ue?.dataset.serviceId===t)return;let i=r||document.body,c=(i instanceof ShadowRoot?i.activeElement:null)??document.activeElement,a=c instanceof HTMLElement?c:null;Le();let l=++$t,d=e.cmp.serviceDetails.replace("{serviceId}",encodeURIComponent(t)),p=`${d}${d.includes("?")?"&":"?"}schema=2`,m=o??xn.get(p);if(!m){let h=await Hs(t,p);if(!h)return;xn.set(p,h),m=h}if(l!==$t)return;let y=s();if(!y)throw Error("[Modal] Missing i18n");Kn(n,y);let u=document.createElement("div");u.dataset.serviceId=t,gt(n,{service:m,ui:y},u,{view:"service-detail"}),ue=u,i.appendChild(ue);let S=u.querySelector('[role="dialog"]'),C=S instanceof HTMLElement?zn(S,u):()=>{},g=u.querySelector(".oc-service-modal__overlay");g?.addEventListener("click",h=>{h.target===g&&Le()}),u.querySelector('[data-1c="command:closeServiceDetail"]')?.addEventListener("click",h=>{h.preventDefault(),Le()});let b=h=>{h.key==="Escape"&&Le()};document.addEventListener("keydown",b),Ut=()=>{C(),document.removeEventListener("keydown",b),a?.isConnected&&a.focus({preventScroll:!0})},requestAnimationFrame(()=>{g?.classList.add("oc-service-modal--visible")})}function Le(){if($t+=1,!ue)return;let t=ue,e=Ut;ue=null,Ut=null,e?.(),t.remove()}async function Hs(t,e){try{let n=await fetch(e);if(n.ok){let s=await n.json();if($s(s))return s}}catch{}return console.error(`[ServiceDetail] Request failed for ${t}`),null}function zs(t,e){let n=e.split("-")[0]==="de";if(t===null)return n?"Nicht zutreffend":"Not applicable";if(t===0)return n?"Sitzung":"Session";let s=[{unit:"day",seconds:86400},{unit:"hour",seconds:3600},{unit:"minute",seconds:60},{unit:"second",seconds:1}],r=t,o=[];for(let i of s){let c=Math.floor(r/i.seconds);r%=i.seconds,c>0&&o.push(new Intl.NumberFormat(e,{style:"unit",unit:i.unit,unitDisplay:"short"}).format(c))}return o.join(" ")}function kn(t){let e=t.indexOf(":");return e===-1?(console.warn(`[1CL] Invalid command binding format: ${t}`),null):{type:t.substring(0,e).trim(),name:t.substring(e+1).trim()}}function Fn(t,e){let n=Bs(e,Us()),s={openMain:()=>t.cmp.openCmp(),openDetails:()=>t.cmp.openDetails(),close:()=>t.cmp.close(),acceptAll:()=>t.cmp.acceptAll(),rejectAll:()=>t.cmp.rejectAll(),save:()=>t.cmp.save?.(),reset:()=>t.cmp.reset?.(),closeServiceDetail:()=>Le()}[n];s?s():console.warn(`[1CL] Unknown canonical command: ${n}`)}function Nn(t,e){let n={notice:()=>t.cmp?.openCmp(),details:()=>t.cmp?.openDetails(),close:()=>t.cmp?.close()}[e];n?n():console.warn(`[1CL] Unknown view command: ${e}`)}function qs(t,e,n){if(!t.engine){console.error("[1CL] SDK engine not available");return}let s=n.querySelector('input[type="checkbox"]');if(s){let r=s.checked;if(e.startsWith("category:")){let o=e.substring(9);Rn(t.engine,`category:${o}`,r)}else if(e.startsWith("service:")){let o=e.substring(8);Rn(t.engine,`service:${o}`,r)}}}function Rn(t,e,n){return e.startsWith("category:")?(t.setCategoryConsent(e.substring(9),n),!0):e.startsWith("service:")?(t.setServiceConsent(e.substring(8),n),!0):!1}function Ws(t,e){let n=s=>{let r=s.target,o=r.getAttribute?.("data-1c-backdrop");if(o){let l=kn(o);l&&(s.preventDefault(),l.type==="view"?Nn(e,l.name):Fn(e,l.name));return}let i=r.closest("[data-1c]");if(!i)return;let c=i.getAttribute("data-1c");if(!c)return;let a=kn(c);if(a)switch(a.type){case"command":s.preventDefault(),Fn(e,a.name);break;case"view":s.preventDefault(),Nn(e,a.name);break;case"consent":qs(e,a.name,i);break;case"dataset":s.preventDefault(),Ys(e,a.name,i);break;default:console.warn(`[1CL] Unknown command type: ${a.type}`)}};return t.addEventListener("click",n),()=>{t.removeEventListener("click",n)}}function Ys(t,e,n){let s=t.viewEngine,r=t.getShadowRoot?.();switch(e){case"serviceDetail":{let o=n.getAttribute("data-1c-id");if(!o){console.warn("[1CL] dataset:serviceDetail missing data-1c-id");return}let i=s?.getCompiledView?.("service-detail");if(!i){console.warn("[1CL] No compiled service-detail template found");return}Vn(o,t.config,i,t.getTranslations,r??void 0).catch(c=>{console.error("[1CL] Failed to open service detail modal:",c)});break}case"vendorStorage":{let o=n.getAttribute("data-1c-id");if(!o){console.warn("[1CL] dataset:vendorStorage missing data-1c-id");return}let i=n.getAttribute("data-1c-name")??`Vendor ${o}`,c=s?.getCompiledView?.("service-detail");if(!c){console.warn("[1CL] No compiled service-detail template found");return}Xs(o,i,t.config,t.getLanguage()).then(a=>{a&&Vn(`vendor-${o}`,t.config,c,t.getTranslations,r??void 0,a).catch(l=>{console.error("[1CL] Failed to open vendor storage modal:",l)})}).catch(a=>{console.error("[1CL] Failed to fetch vendor storage:",a)});break}default:console.warn(`[1CL] Unknown dataset command: ${e}`)}}async function Xs(t,e,n,s=n.languages.primary){let r=new URL(n.cmp.serviceDetails.replace("{serviceId}","__tcf_vendor_selector__"),window.location.href),o=r.pathname.match(/^\/v\/([^/]+)\/services\/__tcf_vendor_selector__(?:\.json)?$/)?.[1];if(!o)return null;let i=new URL(`/v/${o}/tcf-vendors/${encodeURIComponent(t)}/storage.json`,r.origin),c=r.searchParams.get("version"),a=r.searchParams.get("stage");if(c)i.searchParams.set("version",c);else if(a==="preview")i.searchParams.set("stage",a);else return null;let l=await fetch(i);if(!l.ok)return null;let d=await l.json();if(!At(d))return null;let p=d.disclosures,m=d.domains??[],y=d.sdks??[];if(p.length===0&&m.length===0&&y.length===0)return null;let u=p.map(g=>{let b=zs(g.maxAgeSeconds,s),h=[g.description,g.domains.length>0?`Domains: ${g.domains.join(", ")}`:void 0,g.purposes.length>0?`Purposes: ${g.purposes.map(f=>`P${f}`).join(", ")}`:g.specialPurposes.length===0?"Non-TCF purpose":void 0,g.specialPurposes.length>0?`Special purposes: ${g.specialPurposes.map(f=>`SP${f}`).join(", ")}`:void 0,g.optOut?"Opt-out mechanism":void 0,g.cookieRefresh?"Refreshed":void 0].filter(f=>!!f);return{key:g.identifier,type:g.type,duration:b,description:h.join(" \xB7 ")}}),S=Array.from(new Set(p.flatMap(g=>g.purposes).map(g=>`Purpose ${g}`))),C=Array.from(new Set([...p.map(g=>g.type),...y.map(g=>`SDK: ${g.name}`)]));return{id:`vendor-${t}`,name:e,...S.length>0&&{purposes:S},...C.length>0&&{technologiesUsed:C},...u.length>0&&{storage:{items:u}},operational:m.length>0||y.length>0?{...m.length>0&&{domains:m},...y.length>0&&{sdks:y}}:null,declaration:{purposes:S.map((g,b)=>({key:String(b),name:g})),dataCategories:[],technologies:C,deviceStorage:u.length>0?{items:u.map(g=>({...g,type:g.type==="cookie"?"cookie":"other"}))}:null,links:{}}}}var Js=class tt{index=new Map;static makeKey(e,n){return`${e}::${n??""}`}add(e,n,s){let r=tt.makeKey(e,n);this.index.has(r)||this.index.set(r,new Set),this.index.get(r)?.add(s)}remove(e,n,s){let r=tt.makeKey(e,n),o=this.index.get(r);o&&(o.delete(s),o.size===0&&this.index.delete(r))}get(e,n){let s=tt.makeKey(e,n);return this.index.get(s)??new Set}getAllBindings(){let e=[];for(let[n,s]of this.index.entries()){let[r,o]=n.split("::");for(let i of s){let c={element:i,bindingKey:r};o&&(c.id=o),e.push(c)}}return e}clear(){this.index.clear()}get size(){let e=0;for(let n of this.index.values())e+=n.size;return e}},Mn=new WeakMap;function xe(t){let e=Mn.get(t);return e||(e=new Js,Mn.set(t,e)),e}function Zs(t,e){let n=[],s=xe(e),r='[data-1c^="consent:"][data-1c-id]',o='[data-1c="consent:us.sale"], [data-1c="consent:us.share"], [data-1c="consent:us.saleAndShare"]',i=[...t.querySelectorAll(r),...t.querySelectorAll(o)];(t.matches(r)||t.matches(o))&&i.push(t);for(let c of i){if(!(c instanceof HTMLInputElement))continue;let a=c.getAttribute("data-1c");if(!a)continue;let l=c.getAttribute("data-1c-id")||void 0;s.add(a,l,c);let d={element:c,bindingKey:a};l&&(d.id=l),n.push(d)}return n}function Qs(t,e){let n=xe(e),s='[data-1c^="consent:"][data-1c-id]',r='[data-1c="consent:us.sale"], [data-1c="consent:us.share"], [data-1c="consent:us.saleAndShare"]',o=[...t.querySelectorAll(s),...t.querySelectorAll(r)];(t.matches(s)||t.matches(r))&&o.push(t);for(let i of o){if(!(i instanceof HTMLInputElement))continue;let c=i.getAttribute("data-1c");if(!c)continue;let a=i.getAttribute("data-1c-id")||void 0;n.remove(c,a,i)}}function Gt(t,e){t.checked=e.value,t.disabled=e.disabled,t.setAttribute("aria-checked",String(e.value)),t.setAttribute("aria-disabled",String(e.disabled))}function jt(t,e,n){let s=xe(e);for(let r of t){let o=s.get(r.bindingKey,r.id);for(let i of o)Gt(i,{value:r.value??i.checked,disabled:r.disabled??i.disabled})}}function qn(t,e,n){let s=Zs(t,e);if(s.length===0)return;let r=s.map(o=>({bindingKey:o.bindingKey,id:o.id}));try{let o=n.engine;if(n.engine&&typeof o.resolveMany=="function"){let i=o.resolveMany(r);jt(i.patches,e,i.version)}else for(let i of s)try{if(!n.engine?.resolve||!Vt(i.bindingKey))continue;let c=i.id?{bindingKey:i.bindingKey,id:i.id}:{bindingKey:i.bindingKey},a=n.engine.resolve(c);a&&Gt(i.element,a)}catch(c){console.error("[1CL] Failed to resolve binding:",i,c)}}catch(o){console.error("[1CL] Failed to hydrate bindings:",o)}}function er(t,e){Qs(t,e)}function tr(t,e){let n=new MutationObserver(s=>{for(let r of s){for(let o of r.addedNodes)o instanceof HTMLElement&&qn(o,t,e);for(let o of r.removedNodes)o instanceof HTMLElement&&er(o,t)}});return n.observe(t,{childList:!0,subtree:!0}),()=>{n.disconnect()}}function nr(t,e){let n=!1,s=r=>{if(n)return;let o=r.target;if(!(o instanceof HTMLInputElement))return;let i=o.getAttribute("data-1c");if(!i?.startsWith("consent:"))return;let c=o.getAttribute("data-1c-id")||"",a=o.checked;try{if(!e.engine)return;let l=e.engine.apply({ref:{bindingKey:i,id:c},value:a,source:"ui"});n=!0,jt(l.patches,t,l.version),n=!1}catch(l){console.error("[1CL] Failed to apply consent change:",l);try{let d=e.engine.resolve({bindingKey:i,id:c});n=!0,Gt(o,d),n=!1}catch(d){console.error("[1CL] Failed to revert state:",d)}}};return t.addEventListener("change",s,!0),()=>{t.removeEventListener("change",s,!0)}}function sr(t,e){qn(t,t,e);let n=nr(t,e),s=tr(t,e),r=e.bus.on("consent:changed",()=>{let o=xe(t).getAllBindings().map(i=>({bindingKey:i.bindingKey,id:i.id}));try{let i=e.engine;if(e.engine&&typeof i.resolveMany=="function"){let c=i.resolveMany(o);jt(c.patches,t,c.version)}}catch(i){console.error("[1CL] Failed to reconcile on consent:changed:",i)}});return()=>{n(),s(),r(),xe(t).clear()}}function rr(t){if(!t)throw Error("[1CL State] SDK instance is missing");if(!t.viewEngine)throw Error("[1CL State] SDK viewEngine is missing");if(!t.viewEngine.getCurrentView)throw Error("[1CL State] viewEngine.getCurrentView method is missing");let e=t.viewEngine.getCurrentView(),n=or(e),{position:s,spacing:r,logoAlign:o,buttonOrder:i,buttonAlign:c,buttonEmphasis:a}=cr(t,n);return{state:e==="none"?"closed":"open",load:"ready",theme:ir(t),layer:n,framework:ar(t),position:s,spacing:r,logoAlign:o,buttonOrder:i,buttonAlign:c,buttonEmphasis:a}}function ir(t){if(!t.config)throw Error("[1CL State] SDK config is missing");let e=typeof t.getThemeMode=="function"?t.getThemeMode():"auto";return e==="light"||e==="dark"?e:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function or(t){return t==="main"?"notice":t==="details"?"details":"trigger"}function ar(t){if(!t.config)throw Error("[1CL State] SDK config is missing");if(!t.config.framework)throw Error("[1CL State] Framework configuration is missing");if(!t.config.framework.type)throw Error("[1CL State] Framework type is missing");let e=t.config.framework.type.toLowerCase();if(e==="tcf"||e==="us"||e==="gdpr")return e;throw Error(`[1CL State] Unknown framework type: ${e}`)}function cr(t,e){let n=t.config?.appearance,s=n?.notice,r={logoAlign:s?.logoAlignment||"left",buttonOrder:s?.buttonOrder||"reject-first",buttonAlign:s?.buttonAlignment||"right",buttonEmphasis:s?.buttonEmphasis||"equal"};if(!n)return{position:"bottom-center",spacing:"default",...r};if(e==="trigger"&&n.trigger)return{position:n.trigger.position||"bottom-right",spacing:n.trigger.size||"default",...r};let o=e==="details"?n.details:n.notice;return{position:o?.position||"bottom-center",spacing:o?.size||"default",...r}}function lr(t,e){let n=t.getRootNode(),s=n instanceof ShadowRoot?n.host:t;s.setAttribute("data-1c-state",e.state),s.setAttribute("data-1c-load",e.load),s.setAttribute("data-1c-theme",e.theme),s.setAttribute("data-1c-layer",e.layer),s.setAttribute("data-1c-framework",e.framework),s.setAttribute("data-1c-position",e.position),s.setAttribute("data-1c-spacing",e.spacing),s.setAttribute("data-1c-logo-align",e.logoAlign),s.setAttribute("data-1c-button-order",e.buttonOrder),s.setAttribute("data-1c-button-align",e.buttonAlign),s.setAttribute("data-1c-button-emphasis",e.buttonEmphasis)}function Bn(t,e){lr(t,rr(e))}function dr(t,e){Bn(t,e);let n=()=>{Bn(t,e)},s=["view:transition","consent:changed","theme:changed"];return s.forEach(r=>{e.bus.on(r,n)}),()=>{s.forEach(r=>{e.bus.off(r,n)})}}function ur(t){return"getOptOutOfSale"in t&&"getOptOutOfShare"in t&&"isGpcDetected"in t&&"getLimitSensitiveUse"in t&&"getSensitivePIInUse"in t}function pr(t,e,n){let s=Object.values(t.stacks),r=new Set(s.flatMap(u=>u.purposes)),o=new Set(s.flatMap(u=>u.specialFeatures)),i=new Set(n.flatMap(u=>u.specialFeatureIds)),c=Object.values(t.specialFeatures).filter(u=>i.has(u.id)),a=n.map(u=>{let S=t.vendors[u.id];if(!S)throw Error(`TCF UI data is missing configured vendor ${u.id}`);let C=new Set(u.consentPurposeIds),g=new Set(u.legitimateInterestPurposeIds),b=new Set(u.flexiblePurposeIds),h=new Set(u.specialFeatureIds);return{...S,purposes:S.purposes.filter(f=>C.has(f)),purposes_data:S.purposes_data.filter(f=>C.has(f.id)),legIntPurposes:S.legIntPurposes.filter(f=>g.has(f)),legIntPurposes_data:S.legIntPurposes_data.filter(f=>g.has(f.id)),flexiblePurposes:S.flexiblePurposes.filter(f=>b.has(f)),flexiblePurposes_data:S.flexiblePurposes_data.filter(f=>b.has(f.id)),specialFeatures:S.specialFeatures.filter(f=>h.has(f)),specialFeatures_data:S.specialFeatures_data.filter(f=>h.has(f.id))}}),l=Object.values(t.purposes).map(u=>{let S=a.filter(g=>g.purposes.includes(u.id)).length,C=a.filter(g=>g.legIntPurposes.includes(u.id)).length;return{...u,consentVendorCount:S,legitimateInterestVendorCount:C,hasConsentVendors:S>0,hasLegitimateInterestVendors:C>0}}),d=new Set(l.filter(u=>u.hasConsentVendors).map(u=>u.id)),p=s.map(u=>({...u,hasConsentControls:u.purposes.some(S=>d.has(S))||u.specialFeatures.length>0})),m=l.filter(u=>u.hasLegitimateInterestVendors),y=a.filter(u=>u.legIntPurposes.length>0).length;return{standardTexts:t.standardTexts,...e==="main"?{stacks:p,purposes:l.filter(u=>!r.has(u.id))}:{purposes:l},specialPurposes:Object.values(t.specialPurposes),dataCategories:Object.values(t.dataCategories),features:Object.values(t.features),specialFeatures:e==="main"?c.filter(u=>!o.has(u.id)):c,vendors:a,vendorCount:a.length,legitimateInterestPurposes:m,legitimateInterestVendorCount:y,hasLegitimateInterests:y>0}}function hr(t){try{let e=t.split("-")[0];return new Intl.DisplayNames([e],{type:"language"}).of(e)??t}catch{return t}}function Un(t,e,n){let s=t?.[e];return{name:s?.name??n??e,...s?.description&&{description:s.description}}}var fr=["data-1c","data-1c-action"],Wn=class{getThemeMode;currentView="none";bus;consentEngine;config;container=null;shadowRoot=null;renderTarget=null;cleanupFunctions=[];focusReturnTarget=null;currentLocale;viewLoadPromises=new Map;transitionIntent=0;pendingDismissalWork=null;translationsProvider;themeCSS=null;controllerOpenDetails;controllerSetLanguage;languageChangePending=!1;ensureViewData;hasViewData;constructor(t,e,n,s,r,o,i,c=()=>"auto"){this.getThemeMode=c,this.bus=t,this.consentEngine=e,this.translationsProvider=n??(()=>null),this.controllerOpenDetails=s,this.ensureViewData=r??(async()=>{}),this.hasViewData=o??(()=>!0),this.controllerSetLanguage=i,this.config=e.getConfig(),this.currentLocale=e.getDisplayLocale(),this.consentEngine.on("consent:changed",()=>this.handleConsentChange()),this.bus.on("view:change",a=>{if(a&&typeof a=="object"&&"payload"in a){let l=a.payload?.view;l&&this.transitionTo(l)}}),this.consentEngine.on("consent:saved",()=>this.handleConsentSaved()),this.consentEngine.on("consent:external",()=>{this.consentEngine.hasValidConsent()&&this.handleConsentSaved()}),this.consentEngine.on("consent:accepted-all",()=>this.handleConsentSaved()),this.consentEngine.on("consent:rejected-all",()=>this.handleConsentSaved()),this.bus.on("language:changed",a=>{if(a&&typeof a=="object"&&"payload"in a){let l=a.payload;l?.locale&&(this.currentLocale=l.locale)}this.currentView!=="none"&&this.mount(this.currentView)})}getCurrentView(){return this.currentView}hasDesign(t){return this.bundles.has(t)}setThemeCSS(t){if(this.themeCSS=t,!this.shadowRoot)return;let e=this.shadowRoot.getElementById("1c-style-theme");if(t===null){e?.remove();return}if(e)e.textContent=t;else{let n=document.createElement("style");n.id="1c-style-theme",n.textContent=t,this.shadowRoot.append(n)}}refreshCurrentView(){this.currentView!=="none"&&this.mount(this.currentView)}getCompiledView(t){return this.bundles.get(t)}canCloseView(t){switch(t){case"main":return this.config.showClose===!0||!this.consentEngine.isConsentRequired();case"details":return!0;case"trigger":return!0;case"none":return!0}}async transitionTo(t,e="programmatic"){let n=this.currentView;if(n===t)return this.pendingDismissalWork&&(this.transitionIntent+=1),!0;if(!this.isValidTransition(n,t))return console.warn(`[ViewEngine] Invalid transition: ${n} \u2192 ${t}`),!1;if(t==="trigger"&&!this.triggerEnabled())return console.warn("[ViewEngine] Trigger view is disabled for this configuration"),!1;if((t==="none"||t==="trigger")&&e!=="consent-given"&&!this.canCloseView(n))return console.warn(`[ViewEngine] Cannot close current view: ${n}`),!1;let s=++this.transitionIntent;if(t!=="none"&&this.pendingDismissalWork&&(await this.pendingDismissalWork,s!==this.transitionIntent))return!1;if(t!=="none"){let a=!this.bundles.has(t),l=this.ensureViewData(t);if(a||!this.hasViewData(t)){let[d]=await Promise.all([a?this.ensureViewBundle(t):Promise.resolve(!0),l]);if(s!==this.transitionIntent)return console.warn(`[ViewEngine] Transition ${n} \u2192 ${t} superseded by a newer transition`),!1;if(!d)return console.error(`[ViewEngine] View bundle unavailable: ${t}`),this.bus.emit({type:"monitoring:error",payload:{code:"render_error"}}),t==="trigger"&&this.transitionTo("none",e)}}let r=this.isModalView(n),o=this.isModalView(t);o&&!r&&this.captureFocusReturnTarget();let i={from:n,to:t,reason:e};this.bus.emit({type:"view:before-transition",payload:i}),this.currentView=t;let c=!0;if(t==="none"){for(let a of this.cleanupFunctions)a();this.cleanupFunctions=[],this.renderTarget&&(this.renderTarget.innerHTML="")}else c=this.mountSafely(t);return c?(this.bus.emit({type:"view:transition",payload:i}),r&&!o&&this.restoreFocusAfterModal(),!0):(this.currentView=n,n==="none"||this.mountSafely(n)||(this.currentView="none",this.renderTarget&&(this.renderTarget.innerHTML=""),this.bus.emit({type:"view:transition",payload:{from:n,to:"none"}})),o&&!r&&this.restoreFocusAfterModal(),!1)}isModalView(t){return t==="details"||t==="main"&&this.config.appearance?.showOverlay===!0}activeHTMLElement(){let t=this.shadowRoot?.activeElement;return t instanceof HTMLElement?t:document.activeElement instanceof HTMLElement?document.activeElement:null}captureFocusReturnTarget(){if(this.focusReturnTarget)return;let t=this.activeHTMLElement();if(!(!t||t===document.body||t===document.documentElement)){for(let e of fr){let n=t.getAttribute(e);if(n){this.focusReturnTarget={element:t,binding:{attribute:e,value:n}};return}}this.focusReturnTarget={element:t}}}restoreFocusAfterModal(){let t=this.focusReturnTarget;if(this.focusReturnTarget=null,!t)return;if(t.element.isConnected){t.element.focus({preventScroll:!0});return}if(!t.binding||!this.renderTarget)return;let e=this.renderTarget.querySelectorAll(`[${t.binding.attribute}]`);for(let n of e)if(n instanceof HTMLElement&&n.getAttribute(t.binding.attribute)===t.binding.value){n.focus({preventScroll:!0});return}}isValidTransition(t,e){return{none:["main","details","trigger"],main:["details","trigger","none"],details:["main","trigger","none"],trigger:["main","details","none"]}[t]?.includes(e)??!1}triggerEnabled(){return Rs(this.config)}initialize(){this.consentEngine.isConsentRequired()?this.transitionTo("main","consent-required"):this.triggerEnabled()&&this.transitionTo("trigger","consent-given")}handleConsentChange(){if(this.currentView==="trigger"&&this.consentEngine.isConsentRequired()){this.transitionTo("main","consent-required");return}}handleConsentSaved(){(this.currentView==="main"||this.currentView==="details")&&this.dismissModalThenTransition(this.triggerEnabled()?"trigger":"none","consent-given")}dismissModalThenTransition(t,e,n){let s=this.currentView;if(s!=="main"&&s!=="details"){let c=n?.()??{to:t,reason:e};this.transitionTo(c.to,c.reason);return}let r=this.transitionIntent+1,o=new Promise(c=>window.setTimeout(c,0)).then(async()=>{try{return await i?n?.()??{to:t,reason:e}:void 0}finally{this.pendingDismissalWork===o&&(this.pendingDismissalWork=null)}});n&&(this.pendingDismissalWork=o);let i=this.transitionTo("none",e);o.then(c=>{c&&c.to!=="none"&&r===this.transitionIntent&&this.currentView==="none"&&this.transitionTo(c.to,c.reason)})}saveDecision(t){this.dismissModalThenTransition(this.triggerEnabled()?"trigger":"none","consent-given",()=>{t?.(),this.consentEngine.save()})}openNotice(){this.transitionTo("main","user-action")}openDetails(){this.transitionTo("details","user-action")}closeCurrentView(){let t=this.currentView;if(!this.canCloseView(t)){console.warn(`[ViewEngine] Cannot close ${t} - consent required`),this.bus.emit({type:"view:close-blocked",payload:{view:t,reason:"consent-required"}});return}if(t==="main"&&this.config.showClose===!0&&this.config.closeMeans==="reject"){this.saveDecision(()=>this.consentEngine.rejectAll());return}if(t==="main"&&this.config.showClose===!0){this.dismissModalThenTransition(this.triggerEnabled()?"trigger":"none","user-action");return}if(t==="details"){this.dismissModalThenTransition("none","user-action",()=>{if(this.consentEngine.reconcileExternalConsentChange(null,null,!0),this.consentEngine.isConsentRequired())return{to:"main",reason:"consent-required"};if(this.consentEngine.hasValidConsent()&&this.triggerEnabled())return{to:"trigger",reason:"consent-given"}});return}this.consentEngine.hasValidConsent()?this.dismissModalThenTransition(this.triggerEnabled()?"trigger":"none","consent-given"):this.transitionTo("main","consent-required")}bundles=new Map;registerDesign(t,e){let n=Object.keys(t.views);if(n.length===0){console.error("[ViewEngine] Registered design has no views");return}for(let s of n){let r=s.split(".").pop()||"main",o={version:t.version,views:{[r]:t.views[s]},components:t.components},i=e||t.css;i&&(o.css=i),this.bundles.set(r,o),this.currentView===r&&this.mount(r)}}viewBundleUrl(t){let e=this.config.cmp;if(t==="main")return e.main;if(t==="details")return e.details;if(t==="trigger")return e.trigger}loadViewScript(t){return new Promise((e,n)=>{let s=document.createElement("script");s.src=t,s.async=!0,s.onload=()=>e(),s.onerror=r=>{s.remove(),n(r)},(document.head||document.documentElement).appendChild(s)})}ensureViewBundle(t){if(this.bundles.has(t))return Promise.resolve(!0);let e=this.viewBundleUrl(t);if(!e)return Promise.resolve(!1);let n=this.viewLoadPromises.get(t);return n||(n=this.loadViewScript(e).then(()=>{let s=this.bundles.has(t);return s||this.viewLoadPromises.delete(t),s}).catch(s=>(console.error(`[ViewEngine] Failed to load view '${t}':`,s),this.viewLoadPromises.delete(t),!1)),this.viewLoadPromises.set(t,n)),n}closeToNone(){this.renderTarget&&(this.renderTarget.innerHTML=""),this.currentView="none",this.bus.emit({type:"view:change",payload:{view:"none"}})}mountSafely(t){try{return this.mount(t)}catch(e){return console.error(`[ViewEngine] Failed to mount view ${t}:`,e),this.bus.emit({type:"monitoring:error",payload:{code:"render_error"}}),!1}}mount(t){for(let h of this.cleanupFunctions)h();this.cleanupFunctions=[];let e=this.bundles.get(t);if(!e)return t!=="none"&&(console.warn(`[ViewEngine] No bundle found for view: ${t}`),this.closeToNone()),!1;if(this.container||(this.container=document.getElementById("1c-cmp-container"),this.container||(this.container=document.createElement("div"),this.container.id="1c-cmp-container",(document.body||document.documentElement).appendChild(this.container))),this.shadowRoot||(this.shadowRoot=this.container.attachShadow({mode:"open"}),this.renderTarget=document.createElement("div"),this.renderTarget.id="1c-cmp-root",this.shadowRoot.appendChild(this.renderTarget)),this.themeCSS){let h=this.shadowRoot.getElementById("1c-style-theme");h||(h=document.createElement("style"),h.id="1c-style-theme",this.shadowRoot.prepend(h)),h.textContent=this.themeCSS}if(e.css){let h=`1c-style-${t}`,f=this.shadowRoot.getElementById(h);f||(f=document.createElement("style"),f.id=h,this.shadowRoot.prepend(f)),f.textContent=e.css}let n=this.translationsProvider()??{},s=Fs(n)?n.tcf.gvl:void 0,r=(Rt(this.config)?this.config.vendors??[]:[]).length,o=h=>{let f={};for(let[E,w]of Object.entries(h))typeof w=="string"?f[E]=w.replace(/%VENDORS_COUNT%/g,String(r)):Array.isArray(w)?f[E]=w:w&&typeof w=="object"?f[E]=o(w):f[E]=w;return f},i=Rt(this.config)?o(n):n,c=Ms(this.config)?this.config.us?.doNotSellLinkUrl:void 0,a=c&&Array.isArray(i.legalLinks)&&i.legalLinks.some(h=>h.url==="/do-not-sell")?i.legalLinks.map(h=>h.url==="/do-not-sell"?{...h,url:c}:h):i.legalLinks,l=(this.config.services||[]).map(h=>({...h,...Un(i.vendors?.services,h.id,h.name??h.tag)}));Kn(e,i);let d={config:this.config,consent:{categories:this.consentEngine.getCategoryConsents(),services:this.consentEngine.getServiceConsents()},ui:{view:t,...i,...a===i.legalLinks?{}:{legalLinks:a}},categories:(this.config.categories||[]).map(h=>({...h,...Un(i.vendors?.categories,h.id,h.name),services:l.filter(f=>f.categoryId===h.id)})).filter(h=>h.services.length>0),services:l,appearance:{...this.config.appearance,useSwitchCategories:this.config.appearance?.categoryToggleType==="switch",useCheckboxCategories:this.config.appearance?.categoryToggleType!=="switch",useSwitchServices:this.config.appearance?.serviceToggleType!=="checkbox",useCheckboxServices:this.config.appearance?.serviceToggleType==="checkbox",showClose:this.config.showClose===!0},framework:this.config.framework,languages:{...this.config.languages,current:this.currentLocale,showSelector:this.config.languages.supported.length>1,options:this.config.languages.supported.map(h=>({code:h,label:this.config.languages.labels?.[h]??hr(h)}))},...s?{tcf:pr(s,t,Rt(this.config)?this.config.vendors??[]:[])}:{},...ur(this.consentEngine)?{us:{optedOutOfSale:this.consentEngine.getOptOutOfSale(),optedOutOfShare:this.consentEngine.getOptOutOfShare(),gpcDetected:this.consentEngine.isGpcDetected(),sensitivePIInUse:this.consentEngine.getSensitivePIInUse(),limitSensitiveUse:this.consentEngine.getLimitSensitiveUse()}}:{}},p=this.renderTarget;if(!p)return console.error("[ViewEngine] Shadow root render target is missing"),!1;try{gt(e,d,p,{view:t})}catch(h){return console.error(`[ViewEngine] Failed to mount view ${t}:`,h),this.bus.emit({type:"monitoring:error",payload:{code:"render_error"}}),!1}let m=p.querySelector('[role="dialog"]'),y=this.isModalView(t);m instanceof HTMLElement&&(m.setAttribute("aria-modal",y?"true":"false"),y&&this.cleanupFunctions.push(zn(m,this.container)));let u=p.querySelector("select[data-1c-lang]");if(u instanceof HTMLSelectElement&&(u.value=this.currentLocale,u.disabled=this.languageChangePending,u.onchange=()=>{if(this.languageChangePending)return;let h=this.config.languages.supported.find(w=>w===u.value),f=this.controllerSetLanguage;if(!h||!f)return;u.disabled=!0,this.languageChangePending=!0;let E;try{E=f(h)}catch(w){E=Promise.reject(w)}E.catch(w=>{let _=this.renderTarget?.querySelector("select[data-1c-lang]");_ instanceof HTMLSelectElement&&(_.value=this.currentLocale),console.error("[ViewEngine] Language switch failed",w)}).finally(()=>{this.languageChangePending=!1;let w=this.renderTarget?.querySelector("select[data-1c-lang]");w instanceof HTMLSelectElement&&(w.disabled=!1)})}),p.textContent?.includes("[")){if(p.textContent?.includes("[ul]")){let _=/\[ul]([\s\S]*?)\[\/ul]/g,L=/\[li]([\s\S]*?)\[\/li]/g,x=document.createTreeWalker(p,NodeFilter.SHOW_TEXT),P=[],A;for(;A=x.nextNode();)A.textContent?.includes("[ul]")&&P.push(A);for(let Z of P){let j=Z.textContent||"",Q=document.createDocumentFragment(),V=0;_.lastIndex=0;let I;for(;(I=_.exec(j))!==null;){I.index>V&&Q.appendChild(document.createTextNode(j.slice(V,I.index)));let ee=document.createElement("ul");ee.className="oc-list";let Ge=I[1];L.lastIndex=0;let en;for(;(en=L.exec(Ge))!==null;){let tn=document.createElement("li");tn.textContent=en[1],ee.appendChild(tn)}Q.appendChild(ee),V=I.index+I[0].length}V<j.length&&Q.appendChild(document.createTextNode(j.slice(V))),Z.parentNode?.replaceChild(Q,Z)}}let h=/\[([abi])(?:\s+([^\]]*))?](.*?)\[\/\1]/g,f=document.createTreeWalker(p,NodeFilter.SHOW_TEXT),E=[],w;for(;w=f.nextNode();)w.textContent&&h.test(w.textContent)&&(E.push(w),h.lastIndex=0);for(let _ of E){let L=_.textContent||"",x=document.createDocumentFragment(),P=0;h.lastIndex=0;let A;for(;(A=h.exec(L))!==null;){A.index>P&&x.appendChild(document.createTextNode(L.slice(P,A.index)));let Z=A[1],j=A[2]||"",Q=A[3],V;if(Z==="a"){let I=document.createElement("a");I.className="oc-link";let ee=j.match(/href="([^"]*)"/),Ge=j.match(/action="([^"]*)"/);Ge?(I.href="#",I.setAttribute("data-1c-action",Ge[1])):ee?(I.href=ee[1],I.target="_blank",I.rel="noopener noreferrer"):I.href="#",V=I}else V=Z==="b"?document.createElement("strong"):document.createElement("em");V.textContent=Q,x.appendChild(V),P=A.index+A[0].length}P<L.length&&x.appendChild(document.createTextNode(L.slice(P))),_.parentNode?.replaceChild(x,_)}}let S={config:this.config,engine:this.consentEngine,getLanguage:()=>this.currentLocale,getTranslations:()=>this.translationsProvider(),cmp:{getState:()=>this.currentView,openCmp:()=>this.transitionTo("main","programmatic"),openDetails:()=>this.controllerOpenDetails?this.controllerOpenDetails().then(()=>!0):this.transitionTo("details","programmatic"),close:()=>this.closeCurrentView(),acceptAll:()=>this.saveDecision(()=>this.consentEngine.acceptAll()),rejectAll:()=>this.saveDecision(()=>this.consentEngine.rejectAll()),save:()=>this.saveDecision(),reset:()=>this.consentEngine.reset?.()},viewEngine:this,bus:this.bus,getThemeMode:this.getThemeMode,getShadowRoot:()=>this.shadowRoot},C=sr(p,S),g=Ws(p,S),b=dr(this.container,S);return this.cleanupFunctions.push(C,g,b),!0}};var nt=class extends Oe{on(e,n){return this.bus.on(e,n)}off(e,n){this.bus.off(e,n)}emit(e,n){this.bus.emit({type:e,payload:n})}};var $=class extends nt{state;versionTracker=new Te;lastPersistedConsent;hasDowngradeBaseline;loadedStoredConsent=!1;storedLocale;displayLocale;constructor(e,n,s){super(e,n,s),this.displayLocale=s.languages.primary,this.state=this.loadInitialState();let r=Ae(s,n.getFastPath());this.hasDowngradeBaseline=r!==void 0||this.loadedStoredConsent,this.lastPersistedConsent=r??(this.loadedStoredConsent?B(this.config,this.rawConsentSnapshot()):{}),this.state.hasConsent&&this.isConsentExpired()&&this.invalidateStoredConsent(),this.bus.on("language:changed",o=>{this.setDisplayLocale(o.payload.locale)});try{this.bootSyncsFastPath()&&(this.state.hasConsent&&this.hasValidConsent()?(this.syncFastPath(),this.mergeConsentDowngradeBaseline(B(this.config,this.rawConsentSnapshot()))):(this.storage.removeFastPath(),U(this.config)))}catch{}this.flushPendingConsentEvents()}bootSyncsFastPath(){return!0}syncFastPath(e){De(this.config,this.getFastPathConsentMap(),this.getFastPathSyncOptions(),e)}reconcileExternalConsentChange(e,n,s=!1){!s&&!this.hasExternalConsentChange(e,n)||(this.reloadExternalConsentState(s),this.versionTracker.increment(),s||this.mergeConsentDowngradeBaseline(this.getConsentDowngradeSnapshot()),this.emit("consent:changed"),s||this.emit("consent:external"))}reloadExternalConsentState(e=!1){let n=this.storage.getConsent(),s=this.storage.getFastPath();this.loadedStoredConsent=!1,this.storedLocale=void 0,this.state=this.loadInitialState(),(!this.state.hasConsent||!this.hasValidConsent())&&(n||s?this.invalidateStoredConsent():(this.state=this.freshVisitorState(),this.loadedStoredConsent=!1,this.storedLocale=void 0,U(this.config)))}getFastPathSyncOptions(){let e=this.getConsentTimestamp();return{...e===null?{}:{decisionTimestamp:e}}}getStoredLocale(){return this.storedLocale}getDisplayLocale(){return this.displayLocale}setDisplayLocale(e){this.displayLocale=e;try{this.persistDisplayLocale(e)}catch{}}persistDisplayLocale(e){if(!this.state.hasConsent)return;let n=this.storage.getConsent();if(!n)return;let s=T.decodeForConfig(n.consent,this.config);if(s.language===e)return;let r=T.encode({...s,language:e});this.storage.updateConsent({...n,consent:r}),this.storedLocale=e}getFastPathConsentMap(){return this.getConsent()}getConsentDowngradeSnapshot(){return B(this.config,this.getFastPathConsentMap())}extendConsentDowngradeBaseline(e){this.hasDowngradeBaseline&&(this.lastPersistedConsent={...this.lastPersistedConsent,...e})}mergeConsentDowngradeBaseline(e){let n={...this.lastPersistedConsent};for(let[s,r]of Object.entries(e))n[s]=n[s]===!0||r===!0;this.lastPersistedConsent=n,this.hasDowngradeBaseline=!0}loadInitialState(){let e=this.storage.getConsent();if(!e)return this.freshVisitorState();try{return this.stateFromStoredEntry(e)}catch(n){return console.error("[GdprEngine]",n),this.freshVisitorState()}}freshVisitorState(){return{hasConsent:!1,acceptedAll:!1,rejectedAll:!1,categories:this.getDefaultCategoryConsents(),services:this.getDefaultServiceConsents(),timestamp:Date.now()}}invalidateStoredConsent(){this.state=this.freshVisitorState(),this.storedLocale=void 0,this.loadedStoredConsent=!1,this.lastPersistedConsent={},this.hasDowngradeBaseline=!1;try{this.storage.invalidateConsent()}catch{}U(this.config)}clearFastPathSignals(){try{this.storage.removeFastPath()}catch{}U(this.config)}stateFromStoredEntry(e){let n=T.decodeForConfig(e.consent,this.config);this.storedLocale=n.language;let s=this.getDefaultCategoryConsents(),r=this.getDefaultServiceConsents(),o=this.changedSurfaceProjection();if(o){for(let l of this.config.categories)!l.essential&&typeof o.categories[l.id]=="boolean"&&(s[l.id]=o.categories[l.id]===!0);for(let l of this.config.services)!l.essential&&typeof o.services[l.id]=="boolean"&&(r[l.id]=o.services[l.id]===!0)}else if(n.state==="A")Object.keys(s).forEach(l=>{s[l]=!0}),Object.keys(r).forEach(l=>{r[l]=!0});else if(n.state!=="D"){if(n.state==="G"&&n.payload){let l=this.config.categories.filter(p=>!p.essential),d=T.decodeBitset(n.payload,l.length);l.forEach((p,m)=>{s[p.id]=d[m]??!1}),this.config.services.forEach(p=>{if(p.essential)r[p.id]=!0;else{let m=p.categoryId;r[p.id]=m?s[m]??!1:!1}})}}let i=this.config.categories.filter(l=>!l.essential),c=i.every(l=>s[l.id]===!0),a=i.every(l=>!s[l.id]);return this.loadedStoredConsent=!0,{hasConsent:!0,acceptedAll:c,rejectedAll:a,categories:s,services:r,timestamp:n.timestamp*1e3}}changedSurfaceProjection(){let e=this.storage.getFastPath();if(!e||e.consentEpoch<(this.config.consentEpoch??0))return;let n=R(this.config.services,this.config.categories);return e.structuralVersion===n?void 0:e}getDefaultCategoryConsents(){let e={};return this.config.categories.forEach(n=>{e[n.id]=n.essential===!0}),e}getDefaultServiceConsents(){let e={};return this.config.services.forEach(n=>{e[n.id]=n.essential===!0}),e}acceptAll(){this.config.categories.forEach(e=>{this.state.categories[e.id]=!0}),this.config.services.forEach(e=>{this.state.services[e.id]=!0}),this.state.acceptedAll=!0,this.state.rejectedAll=!1,this.state.hasConsent=!0,this.state.timestamp=Date.now(),this.emit("consent:accepted-all"),this.emit("consent:changed")}rejectAll(){this.config.categories.forEach(e=>{this.state.categories[e.id]=e.essential===!0}),this.config.services.forEach(e=>{this.state.services[e.id]=e.essential===!0}),this.state.acceptedAll=!1,this.state.rejectedAll=!0,this.state.hasConsent=!0,this.state.timestamp=Date.now(),this.emit("consent:rejected-all"),this.emit("consent:changed")}getConsent(){return this.rawConsentSnapshot()}rawConsentSnapshot(){return{...this.state.categories,...this.state.services}}setConsent(e){Object.keys(this.state.categories).forEach(n=>{typeof e[n]=="boolean"&&(this.state.categories[n]=e[n])}),Object.keys(this.state.services).forEach(n=>{typeof e[n]=="boolean"&&(this.state.services[n]=e[n])}),this.state.timestamp=Date.now(),this.emit("consent:changed"),this.save()}getConsentState(){return{...this.state}}getEnforcementConsentState(){let e=this.getFastPathConsentMap(),n={},s={};for(let r of this.config.categories)n[r.id]=e[r.id]===!0;for(let r of this.config.services)s[r.id]=e[r.id]===!0;return{...this.state,categories:n,services:s}}getCategoryConsent(e){return this.state.categories[e]||!1}setCategoryConsent(e,n){let s=this.config.categories.find(r=>r.id===e);s&&(s.essential&&!n||(this.state.categories[e]=n,this.state.timestamp=Date.now(),this.config.services.filter(r=>r.categoryId===e).forEach(r=>{this.setServiceConsent(r.id,n)}),this.emit("category:toggled",{id:e,value:n}),this.emit("consent:changed")))}getServiceConsent(e){return this.state.services[e]||!1}setServiceConsent(e,n){let s=this.config.services.find(r=>r.id===e);s&&(s.essential&&!n||(this.state.services[e]=n,this.state.timestamp=Date.now(),this.emit("service:toggled",{id:e,value:n}),this.emit("consent:changed")))}getCategoryConsents(){return{...this.state.categories}}getServiceConsents(){return{...this.state.services}}save(){this.state.hasConsent=!0,this.state.timestamp=Date.now();let e=this.getConsentDowngradeSnapshot(),n=this.hasDowngradeBaseline&&oe(this.lastPersistedConsent,e);this.saveToStorage(),this.lastPersistedConsent=e,this.hasDowngradeBaseline=!0,this.emit("consent:saved"),n&&ae(this.config)==="reload"&&window.location.reload()}saveToStorage(){let e=this.encodeConsentString(),n=this.storage.getConsentId();n||(n=crypto.randomUUID(),this.storage.setConsentId(n)),this.syncFastPath(r=>{this.persistToLocalStorage(e,r)});let s=this.buildConsentEvent(e,n);s&&(this.storage.queuePendingEvent(s),this.sendConsentEvent(s).then(r=>{r&&this.storage.removePendingEvent(s.eventId)}))}flushPendingConsentEvents(){for(let e of this.storage.getPendingEvents())this.sendConsentEvent(e).then(n=>{n&&this.storage.removePendingEvent(e.eventId)})}buildConsentEntry(e){let n=this.getFrameworkPrefix();return n==="gdpr"||n==="us"?{consent:e}:null}persistToLocalStorage(e,n){let s=this.buildConsentEntry(e);s&&this.storage.updateConsent(s,n)}encodeConsentString(){let e=this.config.categories.filter(i=>!i.essential),n=e.every(i=>this.state.categories[i.id]===!0),s=e.every(i=>!this.state.categories[i.id]),r,o;if(n)r="A";else if(s)r="D";else{r="G";let i=e.map(c=>this.state.categories[c.id]===!0);o=T.encodeBitset(i)}return T.encode({machine:this.config.machine,configId:this.config.appId,version:1,framework:this.getFrameworkPrefix(),state:r,payload:o,language:this.displayLocale,timestamp:Math.floor(Date.now()/1e3)})}buildConsentEvent(e,n){let s=this.config.cmp?.consentApiUrl;if(!s)return null;let r=this.config.consentPublicationToken;if(!r)return console.error("[Consent] Missing signed publication context"),null;let o=this.getEvidenceConsentValues(),i=o.length>0&&o.every(Boolean)?"accept_all":o.length>0&&o.every(a=>!a)?"deny_all":"granular",c=crypto.randomUUID();return{url:s,eventId:c,payload:{publicationToken:r,eventId:c,consentId:n,action:i,consentString:e}}}getEvidenceConsentValues(){let e=this.getFastPathConsentMap();return[...this.config.categories.filter(n=>!n.essential),...this.config.services.filter(n=>!n.essential)].map(n=>e[n.id]===!0)}async sendConsentEvent(e){try{let n=await fetch(`${e.url}/v1/consent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e.payload),keepalive:!0});return n.status>=400&&n.status<500?(console.error("permanently rejected"),!0):n.ok}catch(n){return console.error("Consent failed",n),!1}}isConsentRequired(){return!!(!this.getConsentState().hasConsent||this.isConsentExpired()||this.hasNewCategories())}hasValidConsent(){return!this.isConsentRequired()}getConsentTimestamp(){return this.state.timestamp||null}isConsentExpired(){let e=this.getConsentTimestamp(),n=Date.now();return e===null||!Number.isSafeInteger(e)||e<=0||!Number.isSafeInteger(n)||n<0||e>n?!0:n-e>33696e6}hasNewCategories(){let e=Object.keys(this.state.categories);return(this.config.categories.map(s=>s.id)||[]).some(s=>!e.includes(s))}resolve(e){let n=D(e.bindingKey);if(n?.framework!=="gdpr")throw new Error(`[GDPR Engine] Invalid binding key: ${e.bindingKey}`);if(!e.id)throw new Error(`[GDPR Engine] ID required for GDPR bindings: ${e.bindingKey}`);let{entity:s}=n;if(s==="category")return this.resolveCategoryBinding(e.id);if(s==="service")return this.resolveServiceBinding(e.id);throw new Error(`[GDPR Engine] Unknown entity type: ${s}`)}resolveMany(e){let n=[];for(let s of e)try{let r=this.resolve(s);if(!s.id)continue;n.push({bindingKey:s.bindingKey,id:s.id,value:r.value,disabled:r.disabled})}catch(r){console.error("GDPR binding",s,r)}return{patches:n,version:this.versionTracker.getVersion()}}getFrameworkPrefix(){return"gdpr"}apply(e){let n=D(e.ref.bindingKey);if(n?.framework!=="gdpr")throw new Error(`[GDPR Engine] Invalid binding key: ${e.ref.bindingKey}`);if(!e.ref.id)throw new Error(`[GDPR Engine] ID required for GDPR bindings: ${e.ref.bindingKey}`);let{entity:s}=n,r=[];if(s==="category"){this.setCategoryConsent(e.ref.id,e.value);let i=this.resolveCategoryBinding(e.ref.id);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:i.value,disabled:i.disabled});let c=this.config.services.filter(a=>a.categoryId===e.ref.id);for(let a of c){let l=this.resolveServiceBinding(a.id);r.push({bindingKey:`consent:${this.getFrameworkPrefix()}.service`,id:a.id,value:l.value,disabled:l.disabled})}}else if(s==="service"){this.setServiceConsent(e.ref.id,e.value);let i=this.resolveServiceBinding(e.ref.id);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:i.value,disabled:i.disabled});let c=this.config.services.find(a=>a.id===e.ref.id);if(c?.categoryId){let a=this.resolveCategoryBinding(c.categoryId);r.push({bindingKey:`consent:${this.getFrameworkPrefix()}.category`,id:c.categoryId,value:a.value,disabled:a.disabled})}}else throw new Error(`[GDPR Engine] Unknown entity type: ${s}`);let o=this.versionTracker.increment();return{patches:r,version:o}}resolveCategoryBinding(e){let n=this.config.categories.find(o=>o.id===e);if(!n)throw new Error(`[GDPR Engine] Category not found: ${e}`);if(n.essential)return{value:!0,disabled:!0};let s=this.config.services.filter(o=>o.categoryId===e),r;return s.length===0?r=this.state.categories[e]||!1:r=s.every(o=>this.state.services[o.id]),{value:r,disabled:!1}}resolveServiceBinding(e){let n=this.config.services.find(r=>r.id===e);if(!n)throw new Error(`[GDPR Engine] Service not found: ${e}`);return n.essential?{value:!0,disabled:!0}:this.config.categories.find(r=>r.id===n.categoryId)?.essential?{value:!0,disabled:!0}:{value:this.state.services[e]||!1,disabled:!1}}};var Ve=class extends k{engine;constructor(e,n){super(e,n),this.engine=new $(this.bus,this.storage,e),this.attachBlocking(this.engine),this.resolveInitialLocale(this.engine.getStoredLocale())}async init(){if(this.engine.isConsentRequired()){let n=this.ensureViewData("main");await this.ensureViewEngine(),await Promise.all([this.ensureViewLoaded("main"),n])}else await this.showReturningVisitorTrigger(),this.bus.emit({type:"consent:ready"})}async acceptAll(){this.engine.acceptAll(),this.engine.save(),await this.close()}async rejectAll(){this.engine.rejectAll(),this.engine.save(),await this.close()}};var Kt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function st(t){if(!/^[A-Za-z0-9_-]*$/.test(t)||t.length%4===1)throw new Error("invalid base64url");let e=t.length,n=new Uint8Array(Math.floor(e*6/8)),s=0,r=0,o=0;for(let i=0;i<e;i++)s=s<<6|Kt.indexOf(t[i]),r+=6,r>=8&&(r-=8,n[o++]=s>>r&255);if(rt(n)!==t)throw new Error("invalid base64url");return n}function rt(t){let e="",n=0,s=0;for(let r=0;r<t.length;r++)for(n=n<<8|(t[r]??0),s+=8;s>=6;)s-=6,e+=Kt[n>>s&63];return s>0&&(e+=Kt[n<<6-s&63]??""),e}function F(){throw new Error("invalid TC")}function it(t,e,n){for(let s of n){let r=e*65536+s;t.has(r)&&F(),t.add(r)}}var Ht=53;function zt(t){if(!Number.isSafeInteger(t)||t<1||t>Ht)throw new Error(`Bit length must be an integer from 1 to ${Ht}`)}var pe=class{buffer;pointer=0;constructor(e){this.buffer=e}readBits(e){if(zt(e),e>32){let s=0;for(let r=0;r<e;r++)s=s*2+(this.readBit()?1:0);return s}let n=0;for(let s=0;s<e;s++)n=n<<1|(this.readBit()?1:0);return n>>>0}readBit(){if(this.pointer>=this.buffer.length*8)throw new Error("BitReader: Unexpected end of stream");let e=Math.floor(this.pointer/8),n=7-this.pointer%8,s=(this.buffer[e]??0)>>n&1;return this.pointer++,s===1}readBool(){return this.readBit()}readLanguage(){let e=this.readBits(6),n=this.readBits(6);if(e>25||n>25)throw new Error("BitReader: invalid alpha-2 language field");let s=String.fromCharCode(e+65),r=String.fromCharCode(n+65);return(s+r).toLowerCase()}hasMore(){return this.hasMoreBits(1)}hasMoreBits(e){return zt(e),this.pointer+e<=this.buffer.length*8}assertOnlyPadding(){let e=this.buffer.length*8-this.pointer;for(;e>0;)(e-- >7||this.readBit())&&F()}},ke=class{bits=[];writeBits(e,n){zt(n);let s=n===Ht?Number.MAX_SAFE_INTEGER:2**n-1;if(!Number.isSafeInteger(e)||e<0||e>s)throw new Error(`BitWriter: value ${e} does not fit in ${n} bits`);let r=e.toString(2).padStart(n,"0");for(let o=0;o<n;o++)this.bits.push(r[o]==="1"?1:0)}writeBit(e){if(typeof e!="boolean")throw new Error("BitWriter: bit value must be boolean");this.bits.push(e?1:0)}writeBool(e){this.writeBit(e)}writeLanguage(e){if(!/^[A-Za-z]{2}$/.test(e))throw new Error("BitWriter: language must be exactly two ASCII letters");let n=e.toUpperCase();this.writeBits(n.charCodeAt(0)-65,6),this.writeBits(n.charCodeAt(1)-65,6)}toUint8Array(){let e=Math.ceil(this.bits.length/8),n=new Uint8Array(e);for(let s=0;s<this.bits.length;s++){let r=Math.floor(s/8),o=7-s%8;if(this.bits[s]===1){let i=n[r];i!==void 0&&(n[r]=i|1<<o)}}return n}};function Fe(t){let e=st(t);if(e.length!==0)return new pe(e).readBits(3)}function ot(t){let e=t.split("."),n=e[0]??"",s=st(n),r=new pe(s),o=r.readBits(6);if(o!==2)throw new Error(`TCF: unsupported TC string version ${o}`);let i=r.readBits(36),c=r.readBits(36),a=r.readBits(12),l=r.readBits(12),d=r.readBits(6),p=r.readLanguage(),m=r.readBits(12),y=r.readBits(6),u=r.readBool(),S=r.readBool(),C=qt(r,12),g=qt(r,24),b=qt(r,24),h=r.readBool(),f=r.readLanguage(),E=Wt(r),w=Wt(r),_=gr(r);r.assertOnlyPadding();let L={version:o,created:i,lastUpdated:c,cmpId:a,cmpVersion:l,consentScreen:d,consentLanguage:p,vendorListVersion:m,tcfPolicyVersion:y,isServiceSpecific:u,useNonStandardStacks:S,specialFeatureOptIns:C,purposeConsents:g,purposeLegitimateInterests:b,purposeOneTreatment:h,publisherCC:f,vendorConsents:E,vendorLegitimateInterests:w,publisherRestrictions:_};for(let x=1;x<e.length;x++){let P=new pe(st(e[x]??""));P.readBits(3)===1&&(L.disclosedVendors=Wt(P),P.assertOnlyPadding())}return L}function qt(t,e){let n=new Set;for(let s=1;s<=e;s++)t.readBool()&&n.add(s);return n}function Wt(t){let e=t.readBits(16);if(!t.readBool()){let r=new Set;for(let o=1;o<=e;o++)t.readBool()&&r.add(o);return r}let s=Xn(t,t.readBits(12),e);return s.some(r=>r.end===e)||F(),Jn(s)}function Xn(t,e,n){let s=[];for(let r=0;r<e;r++){let o=t.readBool(),i=t.readBits(16);if(Yn(i,n),!o){s.push({start:i,end:i});continue}let c=t.readBits(16);Yn(c,n),c<=i&&F(),s.push({start:i,end:c})}return s}function Yn(t,e){(t<1||t>e)&&F()}function Jn(t){let e=new Set;t.sort((s,r)=>s.start-r.start||s.end-r.end);let n=0;for(let s of t){let r=Math.max(s.start,n+1);for(let o=r;o<=s.end;o++)e.add(o);n=Math.max(n,s.end)}return e}function gr(t){let e=t.readBits(12),n=[],s=new Set;for(let r=0;r<e;r++){let o=t.readBits(6);(o<1||o>24)&&F();let i=t.readBits(2);i>2&&F();let c=t.readBits(12),a=Jn(Xn(t,c,65535));it(s,o,a),n.push({purposeId:o,restrictionType:i,vendorIds:a})}return n}function at(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("TCF: invalid millisecond timestamp");let e=new Date(t),n=Math.round(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())/100);try{he(n,"derived")}catch{throw new Error("TCF: invalid millisecond timestamp")}return n}function he(t,e){if(!Number.isSafeInteger(t)||t<0||t>68719476735||t%864e3!==0)throw new Error(`TCF: invalid ${e} timestamp`)}function ct(t,e){try{return he(t,"Created"),he(e,"LastUpdated"),t===e}catch{return!1}}function Zn(t){return{resolve(e){let n=t.stacks[e];return n?{purposes:n.purposes,specialFeatures:n.specialFeatures}:null}}}var lt=class t{decode;encode;opts;tc=null;originalSegments=[];constructor(e,n,s={}){this.decode=e,this.encode=n,this.opts=s,!this.opts.stackResolver&&this.opts.base&&(this.opts.stackResolver=Zn(this.opts.base))}static withBase(e,n,s,r={}){return new t(e,n,{...r,base:s,stackResolver:Zn(s)})}static raw(e,n,s={}){return new t(e,n,s)}load(e){let n=this.decode(e);if(this.tc=n,this.originalSegments=e.split("."),!ct(this.tc.created,this.tc.lastUpdated))throw new Error("TCF: invalid Created/LastUpdated timestamps");return this.tc}startNew(){this.originalSegments=[];let e=this.currentTimestamp();return this.tc={version:2,created:e,lastUpdated:e,cmpId:this.opts.base?.cmpId??0,cmpVersion:this.opts.base?.cmpVersion??1,consentScreen:1,consentLanguage:"en",vendorListVersion:this.opts.base?.vendorListVersion||0,tcfPolicyVersion:this.opts.base?.tcfPolicyVersion??5,isServiceSpecific:!0,useNonStandardStacks:!1,specialFeatureOptIns:new Set(this.opts.base?.specialFeatureOptins||[]),purposeConsents:new Set(this.opts.base?.purposeConsents||[]),purposeLegitimateInterests:new Set(this.opts.base?.purposeLegitimateInterests||[]),purposeOneTreatment:!1,publisherCC:"AA",vendorConsents:new Set(this.opts.base?.vendorConsents||[]),vendorLegitimateInterests:new Set(this.opts.base?.vendorLegitimateInterests||[]),disclosedVendors:new Set(this.opts.base?.disclosedVendors??[])},this.tc}getDecoded(){if(!this.tc)throw new Error("TCF: call load(tcString) first");return this.tc}toTcString(){let e=this.encode(this.getDecoded()).split(".");if(this.originalSegments.length<=1)return e.join(".");let n=new Set;for(let r of e.slice(1)){let o=Fe(r);o!==void 0&&n.add(o)}let s=this.originalSegments.slice(1).filter(r=>{let o=Fe(r);return o!==void 0&&!n.has(o)});return[...e,...s].join(".")}getPurposeConsent(e){return this.assertPurposeId(e),this.getDecoded().purposeConsents.has(e)}getPurposeConsents(){let e={},n=this.getDecoded().purposeConsents;for(let s=1;s<=24;s++)e[s]=n.has(s);return e}getPurposeLegitimateInterest(e){return this.assertPurposeId(e),this.getDecoded().purposeLegitimateInterests.has(e)}getSpecialFeatureOptIn(e){return this.assertSpecialFeatureId(e),this.getDecoded().specialFeatureOptIns.has(e)}getSpecialFeatureOptIns(){let e={},n=this.getDecoded().specialFeatureOptIns;for(let s=1;s<=12;s++)e[s]=n.has(s);return e}getVendorConsent(e){return this.assertVendorId(e),this.getDecoded().vendorConsents.has(e)}getVendorLegitimateInterest(e){return this.assertVendorId(e),this.getDecoded().vendorLegitimateInterests.has(e)}setConsentLanguage(e){let n=e.toLowerCase();if(!/^[a-z]{2}$/.test(n))throw new Error("TCF: consentLanguage must be a two-letter ISO 639-1 code");let s=this.getDecoded();return s.consentLanguage===n?this:(s.consentLanguage=n,this.touch())}setPurposeConsent(e,n){return this.assertPurposeId(e),this.setInSet(this.getDecoded().purposeConsents,e,n)?this.touch():this}setPurposeLegitimateInterest(e,n){if(this.assertPurposeId(e),n&&this.shouldEnforceTcfPolicy()){if(e===1)throw new Error("TCF Policy: Purpose 1 requires consent, not legitimate interest");if(e>=3&&e<=6)throw new Error(`TCF 2.4: Purpose ${e} requires consent and cannot use legitimate interest`)}return this.setInSet(this.getDecoded().purposeLegitimateInterests,e,n)?this.touch():this}setVendorConsent(e,n){return this.assertVendorId(e),this.setInSet(this.getDecoded().vendorConsents,e,n)?this.touch():this}setVendorLegitimateInterest(e,n){return this.assertVendorId(e),this.setInSet(this.getDecoded().vendorLegitimateInterests,e,n)?this.touch():this}setSpecialFeatureOptIn(e,n){return this.assertSpecialFeatureId(e),this.setInSet(this.getDecoded().specialFeatureOptIns,e,n)?this.touch():this}setPurposeConsents(e,n){for(let s of e)this.setPurposeConsent(s,n);return this}setPurposeLegitimateInterests(e,n){for(let s of e)this.setPurposeLegitimateInterest(s,n);return this}setVendorConsents(e,n){for(let s of e)this.setVendorConsent(s,n);return this}setVendorLegitimateInterests(e,n){for(let s of e)this.setVendorLegitimateInterest(s,n);return this}setSpecialFeatureOptIns(e,n){for(let s of e)this.setSpecialFeatureOptIn(s,n);return this}applyStack(e,n){let s=this.opts.stackResolver;if(!s)throw new Error("TCF: applyStack requires opts.base or opts.stackResolver");let r=s.resolve(e);if(!r)throw new Error(`TCF: unknown stackId ${e}`);return r.purposes?.length&&this.setPurposeConsents(r.purposes,n),r.purposeLI?.length&&this.setPurposeLegitimateInterests(r.purposeLI,n),r.vendors?.length&&this.setVendorConsents(r.vendors,n),r.vendorLI?.length&&this.setVendorLegitimateInterests(r.vendorLI,n),r.specialFeatures?.length&&this.setSpecialFeatureOptIns(r.specialFeatures,n),this}setPublisherRestriction(e,n,s){this.assertPurposeId(e);let r=this.getDecoded(),o=new Set;for(let a of s)this.assertVendorId(a),o.add(a);let i=r.publisherRestrictions?.find(a=>a.purposeId===e);if(i?.restrictionType===n&&this.setsEqual(i.vendorIds,o))return this;r.publisherRestrictions||(r.publisherRestrictions=[]);let c=i;return c?(c.restrictionType=n,c.vendorIds.clear()):(c={purposeId:e,restrictionType:n,vendorIds:new Set},r.publisherRestrictions.push(c)),c.vendorIds=o,this.touch()}removePublisherRestrictionVendors(e,n){this.assertPurposeId(e);let s=this.getDecoded(),r=s.publisherRestrictions;if(!r?.length)return this;let o=r.findIndex(a=>a.purposeId===e);if(o===-1)return this;let i=r[o];if(!i)return this;let c=!1;for(let a of n)this.assertVendorId(a),c=i.vendorIds.delete(a)||c;return c?(i.vendorIds.size===0&&(r.splice(o,1),r.length===0&&delete s.publisherRestrictions),this.touch()):this}clearPublisherRestriction(e){this.assertPurposeId(e);let n=this.getDecoded(),s=n.publisherRestrictions;if(!s?.length)return this;let r=s.findIndex(o=>o.purposeId===e);return r===-1?this:(s.splice(r,1),s.length===0&&delete n.publisherRestrictions,this.touch())}setInSet(e,n,s){return e.has(n)===s?!1:(s?e.add(n):e.delete(n),!0)}setsEqual(e,n){return e.size===n.size&&[...e].every(s=>n.has(s))}touch(){let e=this.getDecoded(),n=this.currentTimestamp();return e.created=n,e.lastUpdated=n,this}currentTimestamp(){return at(this.opts.now?this.opts.now():Date.now())}shouldEnforceTcfPolicy(){return this.opts.enforceTcfPolicy!==!1}assertPurposeId(e){if(!this.opts.validateIds)return;let n=this.opts.maxPurposeId??24;if(!Number.isInteger(e)||e<1||e>n)throw new Error(`TCF: invalid purposeId ${e} (expected 1..${n})`)}assertVendorId(e){if(!this.opts.validateIds)return;let n=this.opts.maxVendorId;if(!Number.isInteger(e)||e<1||n!=null&&e>n)throw new Error(`TCF: invalid vendorId ${e} (expected >=1${n!=null?` and <=${n}`:""})`)}assertSpecialFeatureId(e){if(!this.opts.validateIds)return;let n=this.opts.maxSpecialFeatureId??12;if(!Number.isInteger(e)||e<1||e>n)throw new Error(`TCF: invalid specialFeatureId ${e} (expected 1..${n})`)}};function Qn(t){let e=new ke,n=t.created??t.lastUpdated??at(Date.now()),s=t.created??n,r=t.lastUpdated??n;if(he(s,"Created"),he(r,"LastUpdated"),s!==r)throw new Error("TCF: Created and LastUpdated must be equal");let o=t.version??2;if(o!==2)throw new Error(`TCF: unsupported TC string version ${o}`);e.writeBits(o,6),e.writeBits(s,36),e.writeBits(r,36),e.writeBits(t.cmpId??0,12),e.writeBits(t.cmpVersion??0,12),e.writeBits(t.consentScreen??0,6),e.writeLanguage(t.consentLanguage??"en"),e.writeBits(t.vendorListVersion??0,12);let i=t.tcfPolicyVersion??5;if(i!==5)throw new Error(`TCF 2.4: unsupported policy version ${i}`);e.writeBits(i,6),e.writeBool(t.isServiceSpecific??!1),e.writeBool(t.useNonStandardStacks??!1),Yt(e,t.specialFeatureOptIns??new Set,12,"special-feature"),Yt(e,t.purposeConsents??new Set,24,"purpose-consent"),Yt(e,t.purposeLegitimateInterests??new Set,24,"purpose-legitimate-interest"),e.writeBool(t.purposeOneTreatment??!1),e.writeLanguage(t.publisherCC??"aa"),Xt(e,t.vendorConsents,"vendor-consent"),Xt(e,t.vendorLegitimateInterests,"vendor-legitimate-interest"),mr(e,t.publisherRestrictions??[]);let c=e.toUint8Array(),a=rt(c);if(t.disclosedVendors===void 0)throw new Error("TCF 2.4: disclosed vendors are required");let l=new ke;l.writeBits(1,3),Xt(l,t.disclosedVendors,"disclosed-vendor");let d=l.toUint8Array();return`${a}.${rt(d)}`}function Yt(t,e,n,s){for(let r of e)G(r,1,n,s);for(let r=1;r<=n;r++)t.writeBool(e.has(r))}function Xt(t,e,n){if(e.size===0){t.writeBits(0,16),t.writeBool(!1);return}let s=Array.from(e).sort((a,l)=>a-l);for(let a of s)G(a,1,65535,n);let r=s[s.length-1]??0,o=es(s),i=r,c=12+o.reduce((a,l)=>a+1+16+(l.start===l.end?0:16),0);if(i<=c){t.writeBits(r,16),t.writeBool(!1);for(let a=1;a<=r;a++)t.writeBool(e.has(a))}else{t.writeBits(r,16),t.writeBool(!0),G(o.length,0,2**12-1,`${n} range count`),t.writeBits(o.length,12);for(let a of o)a.start===a.end?(t.writeBool(!1),t.writeBits(a.start,16)):(t.writeBool(!0),t.writeBits(a.start,16),t.writeBits(a.end,16))}}function es(t){let e=[];if(t.length===0)return e;let n=t[0]??0,s=n;for(let r=1;r<t.length;r++){let o=t[r]??0;o===s+1?s=o:(e.push({start:n,end:s}),n=o,s=n)}return e.push({start:n,end:s}),e}function mr(t,e){G(e.length,0,2**12-1,"publisher restriction count");let n=new Set;t.writeBits(e.length,12);for(let s of e){G(s.purposeId,1,24,"publisher restriction purpose"),G(s.restrictionType,0,2,"publisher restriction type"),t.writeBits(s.purposeId,6),t.writeBits(s.restrictionType,2);let r=Array.from(s.vendorIds).sort((i,c)=>i-c);for(let i of r)G(i,1,65535,"publisher restriction vendor");it(n,s.purposeId,r);let o=es(r);G(o.length,0,2**12-1,"publisher restriction range count"),t.writeBits(o.length,12);for(let i of o)i.start===i.end?(t.writeBool(!1),t.writeBits(i.start,16)):(t.writeBool(!0),t.writeBits(i.start,16),t.writeBits(i.end,16))}}function G(t,e,n,s){if(!Number.isSafeInteger(t)||t<e||t>n)throw new Error(`TCF: invalid ${s} ${t} (expected ${e}..${n})`)}function fe(t){return Object.fromEntries([...t].map(e=>[e.toString(),!0]))}function ts(t){try{let e=t.split(".").slice(1).map(n=>Fe(n));return e.length===1&&e[0]===1}catch{return!1}}function Sr(t,e){if(t.version!==2||!ct(t.created,t.lastUpdated)||t.cmpId!==Ie||t.tcfPolicyVersion!==z||!t.isServiceSpecific||!/^[a-z]{2}$/.test(t.consentLanguage)||!/^[a-z]{2}$/i.test(t.publisherCC)||!t.disclosedVendors)return;let n={};for(let r of t.publisherRestrictions??[]){if(r.restrictionType!==0&&r.restrictionType!==1&&r.restrictionType!==2)return;let o=r.purposeId.toString(),i=n[o]??{};for(let c of r.vendorIds){let a=c.toString();if(a in i)return;i[a]=r.restrictionType}n[o]=i}let s={...e?{enableAdvertiserConsentMode:!0}:{},tcfPolicyVersion:t.tcfPolicyVersion,cmpId:t.cmpId,cmpVersion:t.cmpVersion,isServiceSpecific:t.isServiceSpecific,useNonStandardTexts:t.useNonStandardStacks,publisherCC:t.publisherCC.toUpperCase(),purposeOneTreatment:t.purposeOneTreatment,purpose:{consents:fe(t.purposeConsents),legitimateInterests:fe(t.purposeLegitimateInterests)},vendor:{consents:fe(t.vendorConsents),legitimateInterests:fe(t.vendorLegitimateInterests),disclosedVendors:fe(t.disclosedVendors)},specialFeatureOptins:fe(t.specialFeatureOptIns),publisher:{consents:{},legitimateInterests:{},customPurpose:{consents:{},legitimateInterests:{}},restrictions:n}};return yn(s)?s:void 0}var dt=class extends ${tcfController;tcfConfig;consentPurposeIds;legitimateInterestPurposeIds;specialFeatureIds;consentVendorIds;legitimateInterestVendorIds;legitimateInterestDisclosurePending=!1;constructor(e,n,s){super(e,n,s),this.tcfConfig=s;let r=s.vendors.map(c=>c.id);this.consentPurposeIds=[...new Set(s.vendors.flatMap(c=>c.consentPurposeIds))],this.legitimateInterestPurposeIds=[...new Set(s.vendors.flatMap(c=>c.legitimateInterestPurposeIds))],this.specialFeatureIds=[...new Set(s.vendors.flatMap(c=>c.specialFeatureIds))],this.consentVendorIds=s.vendors.filter(c=>c.consentPurposeIds.length>0).map(c=>c.id),this.legitimateInterestVendorIds=s.vendors.filter(c=>c.legitimateInterestPurposeIds.length>0).map(c=>c.id);let o={cmpId:Ie,cmpVersion:Cn,vendorListVersion:"vendorListVersion"in s.framework?s.framework.vendorListVersion:0,tcfPolicyVersion:z,purposeConsents:[],purposeLegitimateInterests:this.legitimateInterestPurposeIds,specialFeatureOptins:[],vendorConsents:[],vendorLegitimateInterests:this.legitimateInterestVendorIds,disclosedVendors:r,purposes:[...new Set([...this.consentPurposeIds,...this.legitimateInterestPurposeIds])],stacks:{}};this.tcfController=lt.withBase(ot,Qn,o);let i=this.restoreStoredTcDecision(r);if(i&&this.hasValidConsent())try{this.syncFastPath(),this.mergeConsentDowngradeBaseline(this.getConsentDowngradeSnapshot())}catch{}else this.clearFastPathSignals();i&&this.extendConsentDowngradeBaseline(this.getTcfDowngradeSnapshot())}bootSyncsFastPath(){return!1}reloadExternalConsentState(e=!1){super.reloadExternalConsentState(e);let n=this.tcfConfig.vendors.map(r=>r.id),s=this.restoreStoredTcDecision(n);this.legitimateInterestDisclosurePending=!e&&!s,this.legitimateInterestDisclosurePending&&(this.tcfController.setPurposeLegitimateInterests(this.legitimateInterestPurposeIds,!1),this.tcfController.setVendorLegitimateInterests(this.legitimateInterestVendorIds,!1))}markLegitimateInterestDisclosuresVisible(){!this.legitimateInterestDisclosurePending||this.state.hasConsent||(this.legitimateInterestDisclosurePending=!1,this.tcfController.setPurposeLegitimateInterests(this.legitimateInterestPurposeIds,!0),this.tcfController.setVendorLegitimateInterests(this.legitimateInterestVendorIds,!0),this.emit("consent:changed"))}restoreStoredTcDecision(e){let n=this.storage.getConsent(),s=!1;if(this.state.hasConsent&&n?.tcString&&ts(n.tcString))try{this.tcfController.load(n.tcString);let r=this.getTcfApiDecisionData();s=ze(Object.keys(r.vendor.disclosedVendors).map(Number))===ze(e)&&this.isApiDataCompatibleWithCurrentGvl(r)}catch{}return s||(this.startFreshTcModel(),n&&this.invalidateStoredConsent()),s}isApiDataCompatibleWithCurrentGvl(e){let n=(r,o)=>Object.keys(r).every(i=>o.includes(Number(i)));if(!n(e.purpose.consents,this.consentPurposeIds)||!n(e.purpose.legitimateInterests,this.legitimateInterestPurposeIds)||!n(e.vendor.consents,this.consentVendorIds)||!n(e.vendor.legitimateInterests,this.legitimateInterestVendorIds)||!n(e.specialFeatureOptins,this.specialFeatureIds))return!1;let s=new Map(this.tcfConfig.vendors.map(r=>[r.id,r]));for(let[r,o]of Object.entries(e.publisher.restrictions)){let i=Number(r);for(let[c,a]of Object.entries(o)){let l=s.get(Number(c));if(!l||!(l.consentPurposeIds.includes(i)||l.legitimateInterestPurposeIds.includes(i))||a!==0&&!l.flexiblePurposeIds.includes(i)||a===2&&!l.legitimateInterestPurposeIds.includes(i))return!1}}return!0}getFastPathSyncOptions(){let e=this.getTcString(),n=this.getTcfApiDecisionData();return{...super.getFastPathSyncOptions(),decisionIntegrity:Qe(e),tcfCmpId:Ie,tcfValidationVersion:vn,tcfDisclosedVendorKey:ze(this.tcfConfig.vendors.map(s=>s.id)),tcfApiData:n,tcfApiDataIntegrity:Qe(wn(e,n))}}getConsentDowngradeSnapshot(){return{...super.getConsentDowngradeSnapshot(),...this.getTcfDowngradeSnapshot()}}getEvidenceConsentValues(){return[...super.getEvidenceConsentValues(),...Object.values(this.getTcfDowngradeSnapshot())]}getExternalConsentSnapshot(e){let n=super.getExternalConsentSnapshot(e),r=de(e,this.storage.getScope())?.consent?.tcString;if(!r)return n;try{let o=ot(r);if(o.version!==2||o.tcfPolicyVersion!==z||o.cmpId!==Ie)return n;let i={...n??{}};for(let c of this.consentPurposeIds)i[`tcf:purpose:${c}`]=o.purposeConsents.has(c);for(let c of this.legitimateInterestPurposeIds)i[`tcf:purposeLI:${c}`]=o.purposeLegitimateInterests.has(c);for(let c of this.specialFeatureIds)i[`tcf:specialFeature:${c}`]=o.specialFeatureOptIns.has(c);for(let c of this.consentVendorIds)i[`tcf:vendor:${c}`]=o.vendorConsents.has(c);for(let c of this.legitimateInterestVendorIds)i[`tcf:vendorLI:${c}`]=o.vendorLegitimateInterests.has(c);return i}catch{return n}}getCurrentExternalConsentSnapshot(){let e=super.getCurrentExternalConsentSnapshot();return e?{...e,...this.getTcfDowngradeSnapshot()}:void 0}getTcfDowngradeSnapshot(){let e={};for(let n of this.consentPurposeIds)e[`tcf:purpose:${n}`]=this.tcfController.getPurposeConsent(n);for(let n of this.legitimateInterestPurposeIds)e[`tcf:purposeLI:${n}`]=this.tcfController.getPurposeLegitimateInterest(n);for(let n of this.specialFeatureIds)e[`tcf:specialFeature:${n}`]=this.tcfController.getSpecialFeatureOptIn(n);for(let n of this.consentVendorIds)e[`tcf:vendor:${n}`]=this.tcfController.getVendorConsent(n);for(let n of this.legitimateInterestVendorIds)e[`tcf:vendorLI:${n}`]=this.tcfController.getVendorLegitimateInterest(n);return e}acceptAll(){super.acceptAll(),this.tcfController.setPurposeConsents(this.consentPurposeIds,!0),this.tcfController.setPurposeLegitimateInterests(this.legitimateInterestPurposeIds,!0),this.tcfController.setSpecialFeatureOptIns(this.specialFeatureIds,!0),this.tcfController.setVendorConsents(this.consentVendorIds,!0),this.tcfController.setVendorLegitimateInterests(this.legitimateInterestVendorIds,!0)}rejectAll(){super.rejectAll(),this.tcfController.setPurposeConsents(this.consentPurposeIds,!1),this.tcfController.setPurposeLegitimateInterests(this.legitimateInterestPurposeIds,!1),this.tcfController.setSpecialFeatureOptIns(this.specialFeatureIds,!1),this.tcfController.setVendorConsents(this.consentVendorIds,!1),this.tcfController.setVendorLegitimateInterests(this.legitimateInterestVendorIds,!1)}getPurposeConsent(e){return this.tcfController.getPurposeConsent(e)}setPurposeConsent(e,n){if(!this.consentPurposeIds.includes(e))throw new Error(`[TCF Engine] Purpose ${e} was not disclosed for consent`);this.tcfController.setPurposeConsent(e,n),this.state.timestamp=Date.now(),this.emit("purpose:toggled",{id:e,value:n}),this.emit("consent:changed")}getPurposeLegitimateInterest(e){return this.tcfController.getPurposeLegitimateInterest(e)}setPurposeLegitimateInterest(e,n){if(!this.legitimateInterestPurposeIds.includes(e))throw new Error(`[TCF Engine] Purpose ${e} was not disclosed for legitimate interest`);this.tcfController.setPurposeLegitimateInterest(e,n),this.state.timestamp=Date.now(),this.emit("purpose-legitimate-interest:toggled",{id:e,value:n}),this.emit("consent:changed")}getSpecialFeatureOptIn(e){return this.tcfController.getSpecialFeatureOptIn(e)}setSpecialFeatureOptIn(e,n){if(!this.specialFeatureIds.includes(e))throw new Error(`[TCF Engine] Special Feature ${e} was not disclosed`);this.tcfController.setSpecialFeatureOptIn(e,n),this.state.timestamp=Date.now(),this.emit("special-feature:toggled",{id:e,value:n}),this.emit("consent:changed")}getVendorConsent(e){return this.tcfController.getVendorConsent(e)}setVendorConsent(e,n){if(!this.consentVendorIds.includes(e))throw new Error(`[TCF Engine] Vendor ${e} was not disclosed for consent`);this.tcfController.setVendorConsent(e,n),this.state.timestamp=Date.now(),this.emit("vendor:toggled",{id:e,value:n}),this.emit("consent:changed")}getVendorLegitimateInterest(e){return this.tcfController.getVendorLegitimateInterest(e)}setVendorLegitimateInterest(e,n){if(!this.legitimateInterestVendorIds.includes(e))throw new Error(`[TCF Engine] Vendor ${e} was not disclosed for legitimate interest`);this.tcfController.setVendorLegitimateInterest(e,n),this.state.timestamp=Date.now(),this.emit("vendor-legitimate-interest:toggled",{id:e,value:n}),this.emit("consent:changed")}getTcString(){return this.tcfController.toTcString()}getTcfApiDecisionData(){let e=this.getTcString(),n=ot(e),s=ts(e)?Sr(n,this.tcfConfig.gcm!==void 0):void 0;if(!s||!this.isApiDataCompatibleWithCurrentGvl(s))throw new Error("Current TC model cannot produce complete current-GVL web TCData");return s}save(){this.syncTcConsentLanguage(),super.save()}getPurposes(){let e=[];for(let n of new Set([...this.consentPurposeIds,...this.legitimateInterestPurposeIds]))e.push({id:n,consent:this.getPurposeConsent(n),legitimateInterest:this.getPurposeLegitimateInterest(n)});return e}getSpecialFeatures(){let e=[];for(let n of this.specialFeatureIds)e.push({id:n,optIn:this.getSpecialFeatureOptIn(n)});return e}buildConsentEntry(e){return{consent:e,tcString:this.tcfController.toTcString()}}startFreshTcModel(){this.tcfController.startNew(),this.syncTcConsentLanguage()}syncTcConsentLanguage(){let e=rn(this.getDisplayLocale());e&&this.tcfController.setConsentLanguage(e)}getFrameworkPrefix(){return"tcf"}resolve(e){let n=D(e.bindingKey);if(n?.framework==="gdpr")return super.resolve(e);if(n?.framework!=="tcf")throw new Error(`[TCF Engine] Invalid binding key: ${e.bindingKey}`);let{entity:s}=n;if(!e.id)throw new Error(`[TCF Engine] ID required for TCF bindings: ${e.bindingKey}`);let r=parseInt(e.id,10);if(Number.isNaN(r))throw new Error(`[TCF Engine] Invalid numeric ID for TCF binding: ${e.id}`);switch(s){case"purpose":return this.resolvePurposeBinding(r);case"purposeLegitimateInterest":return this.resolvePurposeLegitimateInterestBinding(r);case"specialPurpose":return this.resolveSpecialPurposeBinding(r);case"feature":return this.resolveFeatureBinding(r);case"specialFeature":return this.resolveSpecialFeatureBinding(r);case"vendor":return this.resolveVendorBinding(r);case"vendorLegitimateInterest":return this.resolveVendorLegitimateInterestBinding(r);case"stack":return this.resolveStackBinding(r);default:throw new Error(`[TCF Engine] Unknown entity type: ${s}`)}}resolveMany(e){return{patches:e.map(s=>{let r=this.resolve(s);if(!s.id)throw new Error(`[TCF Engine] ID required for ${s.bindingKey}`);return{bindingKey:s.bindingKey,id:s.id,value:r.value,disabled:r.disabled}}),version:this.versionTracker.getVersion()}}apply(e){let n=D(e.ref.bindingKey);if(n?.framework==="gdpr")return super.apply(e);if(n?.framework!=="tcf")throw new Error(`[TCF Engine] Invalid binding key: ${e.ref.bindingKey}`);if(!e.ref.id)throw new Error(`[TCF Engine] ID required for TCF bindings: ${e.ref.bindingKey}`);let{entity:s}=n,r=[];if(s==="purpose"){let i=parseInt(e.ref.id,10);this.setPurposeConsent(i,e.value);let c=this.resolvePurposeBinding(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled})}else if(s==="purposeLegitimateInterest"){let i=parseInt(e.ref.id,10);this.setPurposeLegitimateInterest(i,e.value);let c=this.resolvePurposeLegitimateInterestBinding(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled})}else if(s==="specialFeature"){let i=parseInt(e.ref.id,10);this.setSpecialFeatureOptIn(i,e.value);let c=this.resolveSpecialFeatureBinding(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled})}else if(s==="vendor"){let i=parseInt(e.ref.id,10);this.setVendorConsent(i,e.value);let c=this.resolveVendorBinding(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled})}else if(s==="vendorLegitimateInterest"){let i=parseInt(e.ref.id,10);this.setVendorLegitimateInterest(i,e.value);let c=this.resolveVendorLegitimateInterestBinding(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled})}else if(s==="stack"){let i=parseInt(e.ref.id,10),c=this.getStackDefinition(i);for(let l of c.purposes)this.consentPurposeIds.includes(l)&&(this.tcfController.setPurposeConsent(l,e.value),this.emit("purpose:toggled",{id:l,value:e.value}));for(let l of c.specialFeatures)this.specialFeatureIds.includes(l)&&(this.tcfController.setSpecialFeatureOptIn(l,e.value),this.emit("special-feature:toggled",{id:l,value:e.value}));this.state.timestamp=Date.now(),this.emit("consent:changed");let a=this.resolveStackBinding(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:a.value,disabled:a.disabled});for(let l of c.purposes){if(!this.consentPurposeIds.includes(l))continue;let d=this.resolvePurposeBinding(l);r.push({bindingKey:"consent:tcf.purpose",id:String(l),value:d.value,disabled:d.disabled})}for(let l of c.specialFeatures){if(!this.specialFeatureIds.includes(l))continue;let d=this.resolveSpecialFeatureBinding(l);r.push({bindingKey:"consent:tcf.specialFeature",id:String(l),value:d.value,disabled:d.disabled})}}else throw new Error(`[TCF Engine] Cannot apply changes to entity type: ${s}`);let o=this.versionTracker.increment();return{patches:r,version:o}}resolvePurposeBinding(e){if(!this.consentPurposeIds.includes(e))throw new Error(`[TCF Engine] Purpose ${e} has no consent legal basis`);return{value:this.getPurposeConsent(e),disabled:!1}}resolvePurposeLegitimateInterestBinding(e){if(!this.legitimateInterestPurposeIds.includes(e))throw new Error(`[TCF Engine] Purpose ${e} has no legitimate-interest legal basis`);return{value:this.getPurposeLegitimateInterest(e),disabled:!1}}resolveSpecialPurposeBinding(e){return{value:!0,disabled:!0}}resolveFeatureBinding(e){return{value:!0,disabled:!0}}resolveSpecialFeatureBinding(e){if(!this.specialFeatureIds.includes(e))throw new Error(`[TCF Engine] Special Feature ${e} was not disclosed`);return{value:this.getSpecialFeatureOptIn(e),disabled:!1}}resolveVendorBinding(e){if(!this.consentVendorIds.includes(e))throw new Error(`[TCF Engine] Vendor ${e} has no consent legal basis`);return{value:this.getVendorConsent(e),disabled:!1}}resolveVendorLegitimateInterestBinding(e){if(!this.legitimateInterestVendorIds.includes(e))throw new Error(`[TCF Engine] Vendor ${e} has no legitimate-interest legal basis`);return{value:this.getVendorLegitimateInterest(e),disabled:!1}}getStackDefinition(e){if(typeof window>"u")throw new Error("[TCF Engine] Stack UI data is unavailable outside the browser");let n=window.__1consent?.getTranslations();if(!n||!("tcf"in n))throw new Error("[TCF Engine] Stack UI data is unavailable");let s=n.tcf?.gvl?.stacks?.[e];if(!s)throw new Error(`[TCF Engine] Unknown stack id: ${e}`);if(s.purposes.length+s.specialFeatures.length<2)throw new Error(`[TCF Engine] Invalid stack membership for id: ${e}`);return{purposes:s.purposes,specialFeatures:s.specialFeatures}}resolveStackBinding(e){let n=this.getStackDefinition(e),s=n.purposes.filter(a=>this.consentPurposeIds.includes(a)),r=n.specialFeatures.filter(a=>this.specialFeatureIds.includes(a)),o=s.length+r.length>0,i=s.every(a=>this.getPurposeConsent(a)),c=r.every(a=>this.getSpecialFeatureOptIn(a));return{value:o&&i&&c,disabled:!o}}};var yr="Your choices for IAB vendors apply only to Purposes and Special Features. You cannot object here to processing for the Special Purposes disclosed by a vendor. Vendors may use Special Features for Special Purpose 1 (ensuring security, preventing and detecting fraud, and fixing errors), regardless of your Special Feature choices.",wr="Ihre Auswahl f\xFCr IAB-Anbieter gilt nur f\xFCr Zwecke und Besondere Funktionen. Der Verarbeitung f\xFCr die von einem Anbieter offengelegten Besonderen Zwecke k\xF6nnen Sie hier nicht widersprechen. Anbieter d\xFCrfen Besondere Funktionen f\xFCr den Besonderen Zweck 1 (Sicherheit gew\xE4hrleisten, Betrug verhindern und erkennen sowie Fehler beheben) unabh\xE4ngig von Ihrer Auswahl zu Besonderen Funktionen verwenden.",ss="Your choices apply only to this service.",rs="Ihre Auswahl gilt nur f\xFCr diesen Dienst.",is="1Consent stores the TC String in first-party browser local storage (\u201C1consent\u201D) for up to 390 days. With server sync enabled, the \u201C1consent\u201D cookie stores only a compact decision signal until then.",os="1Consent speichert den TC String bis zu 390 Tage im lokalen Erstanbieter-Browserspeicher (\u201E1consent\u201C). Bei aktivierter Server-Synchronisierung enth\xE4lt das \u201E1consent\u201C-Cookie bis dahin nur ein kompaktes Entscheidungssignal.",Cr="These choices and objections apply only to this service.",vr="Diese Auswahl und Widerspr\xFCche gelten nur f\xFCr diesen Dienst.",br="1Consent stores your privacy choices and TC String in first-party browser local storage under the key \u201C1consent\u201D for up to 390 days. If this service enables server-readable consent synchronisation, 1Consent also stores a compact first-party decision signal (not the TC String) in a cookie named \u201C1consent\u201D until the same expiry.",Er="1Consent speichert Ihre Datenschutzauswahl und den TC String bis zu 390 Tage lang im lokalen Erstanbieter-Browserspeicher unter dem Schl\xFCssel \u201E1consent\u201C. Falls dieser Dienst die serverlesbare Einwilligungssynchronisierung aktiviert, speichert 1Consent au\xDFerdem bis zum selben Ablaufdatum ein kompaktes Erstanbieter-Entscheidungssignal (nicht den TC String) in einem Cookie namens \u201E1consent\u201C.";function ns(t){return t==="de"?rs:ss}function Ir(t){return t==="de"?os:is}function Tr(t){return t.split("-")[0]?.toLowerCase()==="de"?"de":"en"}function ut(t,e,n){let s=t.toLowerCase();if(n.some(o=>s.includes(o.toLowerCase())))return t;let r=t.trimEnd();return r.length===0?e:`${r} ${e}`}function Ar(t){return t==="de"?[rs,vr]:[ss,Cr]}function Or(t){return t==="de"?[os,Er]:[is,br]}function Pr(t,e,n=e){let s=Tr(n),r=s==="de"?wr:yr,o=Ar(s),i=Or(s),c=ut(t.description,ns(s),o),a=t.details,l=ut(ut(a?.description??"",ns(s),o),Ir(s),i),d=ut(l,r,[r]);return c===t.description&&a?.description===d?t:{...t,description:c,details:a?{...a,description:d}:{title:t.title,description:d,button:t.button,legalLinks:t.legalLinks}}}var Ne=class extends k{engine;constructor(e,n){super(e,n),this.engine=new dt(this.bus,this.storage,e),this.attachBlocking(this.engine),this.resolveInitialLocale(this.engine.getStoredLocale())}normalizeTranslations(e,n,s){return Pr(e,n,s)}async init(){if(this.engine.isConsentRequired()){let n=this.ensureViewData("main");await this.ensureViewEngine(),await Promise.all([this.ensureViewLoaded("main"),n])}else await this.showReturningVisitorTrigger(),this.bus.emit({type:"consent:ready"})}async acceptAll(){this.engine.acceptAll(),this.engine.save(),await this.close()}async rejectAll(){this.engine.rejectAll(),this.engine.save(),await this.close()}};var Jt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",Re=class{bits=[];writeBit(e){this.bits.push(e?1:0)}writeInt(e,n){for(let s=n-1;s>=0;s--)this.bits.push(e>>>s&1)}writeBoolean(e){this.writeBit(e)}writeFibonacciRange(e){if(e.length===0){this.writeInt(0,12);return}let n=[],s=e[0],r=s;for(let i=1;i<e.length;i++){let c=e[i];c===r+1||(n.push({start:s,end:r}),s=c),r=c}n.push({start:s,end:r}),this.writeInt(n.length,12);let o=0;for(let i of n)i.start===i.end?(this.writeBit(!1),this.writeFibonacci(i.start-o),o=i.start):(this.writeBit(!0),this.writeFibonacci(i.start-o),this.writeFibonacci(i.end-i.start),o=i.end)}writeFibonacci(e){let n=_r(e),s=new Array(n.length).fill(!1),r=e;for(let i=n.length-1;i>=0&&r>0;i--)n[i]<=r&&(s[i]=!0,r-=n[i]);let o=s.length-1;for(;o>=0&&!s[o];)o--;for(let i=0;i<=o;i++)this.writeBit(s[i]===!0);this.writeBit(!0)}get length(){return this.bits.length}toBase64(){for(;this.bits.length%6!==0;)this.bits.push(0);let e="";for(let n=0;n<this.bits.length;n+=6){let s=this.bits[n]<<5|this.bits[n+1]<<4|this.bits[n+2]<<3|this.bits[n+3]<<2|this.bits[n+4]<<1|this.bits[n+5];e+=Jt[s]}return e}};function _r(t){let e=[1,2];for(;e[e.length-1]<t;)e.push(e[e.length-1]+e[e.length-2]);return e}var v={US_NATIONAL:7,US_CA:8,US_VA:9,US_CO:10,US_CT:12,US_FL:13},Zt={CA:v.US_CA,VA:v.US_VA,CO:v.US_CO,CT:v.US_CT,FL:v.US_FL};function as(t){let e=t.mspaMode??"not_covered",n=e==="service_provider";return{mode:e,sp:n,notice:n?0:1,optOut:s=>n?0:s?1:2,sensitiveInUse:!n&&t.sensitivePIInUse===!0,knownMinor:!n&&t.knownMinor===!0,mspaFields:{MspaCoveredTransaction:e==="not_covered"?2:1,MspaOptOutOptionMode:e==="opt_out"?1:0,MspaServiceProviderMode:n?1:0}}}function cs(t){let{notice:e,optOut:n,sensitiveInUse:s,knownMinor:r,mspaFields:o}=as(t),i=s?t.limitSensitiveUse===!0?1:2:0;return{Version:1,SharingNotice:e,SaleOptOutNotice:e,SharingOptOutNotice:e,TargetedAdvertisingOptOutNotice:e,SensitiveDataProcessingOptOutNotice:0,SensitiveDataLimitUseNotice:s?1:0,SaleOptOut:n(t.saleOptOut),SharingOptOut:n(t.sharingOptOut),TargetedAdvertisingOptOut:n(t.sharingOptOut),SensitiveDataProcessing:new Array(16).fill(i),KnownChildSensitiveDataConsents:r?[1,1,1]:[0,0,0],PersonalDataConsents:0,...o,Gpc:t.gpcDetected,GpcSegmentType:1,GpcSegmentIncluded:!0}}var ge=[{name:"MspaCoveredTransaction",bits:2},{name:"MspaOptOutOptionMode",bits:2},{name:"MspaServiceProviderMode",bits:2}],me={[v.US_NATIONAL]:{prefix:"usnat",hasGpc:!0,fields:[{name:"Version",bits:6},{name:"SharingNotice",bits:2},{name:"SaleOptOutNotice",bits:2},{name:"SharingOptOutNotice",bits:2},{name:"TargetedAdvertisingOptOutNotice",bits:2},{name:"SensitiveDataProcessingOptOutNotice",bits:2},{name:"SensitiveDataLimitUseNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"SharingOptOut",bits:2},{name:"TargetedAdvertisingOptOut",bits:2},{name:"SensitiveDataProcessing",array:16},{name:"KnownChildSensitiveDataConsents",array:3},{name:"PersonalDataConsents",bits:2},...ge]},[v.US_CA]:{prefix:"usca",hasGpc:!0,fields:[{name:"Version",bits:6},{name:"SaleOptOutNotice",bits:2},{name:"SharingOptOutNotice",bits:2},{name:"SensitiveDataLimitUseNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"SharingOptOut",bits:2},{name:"SensitiveDataProcessing",array:9},{name:"KnownChildSensitiveDataConsents",array:2},{name:"PersonalDataConsents",bits:2},...ge]},[v.US_VA]:{prefix:"usva",hasGpc:!1,fields:[{name:"Version",bits:6},{name:"SharingNotice",bits:2},{name:"SaleOptOutNotice",bits:2},{name:"TargetedAdvertisingOptOutNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"TargetedAdvertisingOptOut",bits:2},{name:"SensitiveDataProcessing",array:8},{name:"KnownChildSensitiveDataConsents",bits:2},...ge]},[v.US_CO]:{prefix:"usco",hasGpc:!0,fields:[{name:"Version",bits:6},{name:"SharingNotice",bits:2},{name:"SaleOptOutNotice",bits:2},{name:"TargetedAdvertisingOptOutNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"TargetedAdvertisingOptOut",bits:2},{name:"SensitiveDataProcessing",array:7},{name:"KnownChildSensitiveDataConsents",bits:2},...ge]},[v.US_CT]:{prefix:"usct",hasGpc:!0,fields:[{name:"Version",bits:6},{name:"SharingNotice",bits:2},{name:"SaleOptOutNotice",bits:2},{name:"TargetedAdvertisingOptOutNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"TargetedAdvertisingOptOut",bits:2},{name:"SensitiveDataProcessing",array:8},{name:"KnownChildSensitiveDataConsents",array:3},...ge]},[v.US_FL]:{prefix:"usfl",hasGpc:!1,fields:[{name:"Version",bits:6},{name:"ProcessingNotice",bits:2},{name:"SaleOptOutNotice",bits:2},{name:"TargetedAdvertisingOptOutNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"TargetedAdvertisingOptOut",bits:2},{name:"SensitiveDataProcessing",array:8},{name:"KnownChildSensitiveDataConsents",array:3},{name:"AdditionalDataProcessingConsent",bits:2},...ge]}};function ls(t,e){if(t===v.US_NATIONAL)return{...cs(e)};let{notice:n,optOut:s,sensitiveInUse:r,knownMinor:o,mspaFields:i}=as(e),c={Gpc:e.gpcDetected,GpcSegmentType:1,GpcSegmentIncluded:!0};if(t===v.US_CA){let p=r?e.limitSensitiveUse===!0?1:2:0;return{Version:1,SaleOptOutNotice:n,SharingOptOutNotice:n,SensitiveDataLimitUseNotice:r?1:0,SaleOptOut:s(e.saleOptOut),SharingOptOut:s(e.sharingOptOut),SensitiveDataProcessing:new Array(9).fill(p),KnownChildSensitiveDataConsents:o?[1,1]:[0,0],PersonalDataConsents:0,...i,...c}}let a=me[t];if(!a)throw new Error(`[GPP Encoder] Unsupported section id: ${t}`);let l={Version:1,SharingNotice:n,ProcessingNotice:n,SaleOptOutNotice:n,TargetedAdvertisingOptOutNotice:n,SaleOptOut:s(e.saleOptOut),TargetedAdvertisingOptOut:s(e.sharingOptOut),SensitiveDataProcessing:r?1:0,KnownChildSensitiveDataConsents:o?1:0,AdditionalDataProcessingConsent:0,...i},d={};for(let p of a.fields){let m=l[p.name];if(m===void 0)throw new Error(`[GPP Encoder] No value mapping for field: ${p.name}`);d[p.name]="array"in p?new Array(p.array).fill(m):m}return{...d,...a.hasGpc?c:{}}}var Me=class t{static encode(e,n){let s=[...n].sort((i,c)=>i-c),r=t.encodeHeader(s),o=s.map(i=>t.encodeSection(i,e));return[r,...o].join("~")}static encodeHeader(e){let n=new Re;return n.writeInt(3,6),n.writeInt(1,6),n.writeFibonacciRange(e),n.toBase64()}static encodeSection(e,n){let s=me[e];if(!s)return"";let r=ls(e,n),o=new Re;for(let c of s.fields){let a=r[c.name];if("array"in c){let l=Array.isArray(a)?a:[];for(let d=0;d<c.array;d++){let p=l[d];o.writeInt(typeof p=="number"?p:0,2)}}else o.writeInt(typeof a=="number"?a:0,c.bits)}if(!s.hasGpc)return o.toBase64();let i=new Re;return i.writeInt(1,2),i.writeBoolean(r.Gpc===!0),`${o.toBase64()}.${i.toBase64()}`}};var Be=class{bits=[];pos=0;constructor(e){for(let n of e){let s=Jt.indexOf(n);if(s<0)throw new Error(`[GPP Decoder] Invalid base64 character: ${n}`);for(let r=5;r>=0;r--)this.bits.push(s>>>r&1)}}readBit(){let e=this.bits[this.pos];if(e===void 0)throw new Error("[GPP Decoder] Read past end of segment");return this.pos++,e===1}readInt(e){let n=0;for(let s=0;s<e;s++)n=n<<1|(this.readBit()?1:0);return n}readFibonacci(){let e=[],n=!1;for(;;){let i=this.readBit();if(i&&n)break;e.push(i),n=i}let s=0,r=1,o=2;for(let i of e)i&&(s+=r),[r,o]=[o,r+o];return s}readFibonacciRange(){let e=this.readInt(12),n=[],s=0;for(let r=0;r<e;r++){let o=this.readBit(),i=this.readFibonacci()+s;if(o){let c=this.readFibonacci()+i;for(let a=i;a<=c;a++)n.push(a);s=c}else n.push(i),s=i}return n}},Ue=class t{static decode(e){let n=e.split("~"),s=n[0];if(!s)throw new Error("[GPP Decoder] Empty GPP string");let r=t.decodeHeader(s);if(r.length!==n.length-1)throw new Error(`[GPP Decoder] Header lists ${r.length} section(s) but ${n.length-1} present`);for(let o=0;o<r.length;o++){let i=r[o],c=n[o+1];if(i!==void 0&&c!==void 0&&me[i])return{sectionIds:r,data:t.decodeSection(i,c)}}throw new Error("[GPP Decoder] No supported US section present")}static decodeHeader(e){let n=new Be(e),s=n.readInt(6);if(s!==3)throw new Error(`[GPP Decoder] Not a GPP header (type ${s})`);let r=n.readInt(6);if(r!==1)throw new Error(`[GPP Decoder] Unsupported GPP version ${r}`);return n.readFibonacciRange()}static decodeSection(e,n){let s=me[e];if(!s)throw new Error(`[GPP Decoder] Unsupported section id ${e}`);let[r,o]=n.split(".");if(!r)throw new Error("[GPP Decoder] Missing core subsection");let i=new Be(r),c={};for(let u of s.fields)if("array"in u){let S=[];for(let C=0;C<u.array;C++)S.push(i.readInt(2));c[u.name]=S}else c[u.name]=i.readInt(u.bits);if(c.Version!==1)throw new Error(`[GPP Decoder] Unsupported ${s.prefix} version ${String(c.Version)}`);let l=c.SaleOptOut===1,p=(c.SharingOptOut??c.TargetedAdvertisingOptOut)===1,m=!1;if(e===v.US_NATIONAL||e===v.US_CA){let u=c.SensitiveDataProcessing;m=Array.isArray(u)&&u.some(S=>S===1)}let y=!1;if(s.hasGpc&&o){let u=new Be(o);u.readInt(2)===1&&(y=u.readBit())}return{saleOptOut:l,sharingOptOut:p,gpcDetected:y,limitSensitiveUse:m}}};function pt(){return{optedOutOfSale:!1,optedOutOfShare:!1,limitSensitiveUse:!1,gpcDetected:!1,timestamp:0,lastOptOutAt:0}}var Dr=365*24*60*60*1e3;function Lr(){return Ee()}function ds(){if(typeof globalThis>"u")return;let t=globalThis.__1C_GEO;if(t?.country!=="US"||typeof t.region!="string")return;let e=t.region.toUpperCase();return/^[A-Z]{2}$/.test(e)?e:void 0}function xr(){if(typeof globalThis>"u")return;let t=globalThis.__1C_GEO;return typeof t?.sensitiveOptIn=="boolean"?t.sensitiveOptIn:void 0}var ht=class extends ${usState=pt();gpcActive;mspaMode;sensitivePIInUse;knownMinors;visitorUsState;denyAllPosture;storedOptOut=!1;rawConsentStaged=!1;injectedSensitiveVerdict;constructor(e,n,s){super(e,n,s),this.gpcActive=Lr(),this.visitorUsState=ds(),this.injectedSensitiveVerdict=xr();let r=s.us;this.mspaMode=r?.mspaMode??"not_covered",this.sensitivePIInUse=r?.sensitivePIInUse===!0,this.knownMinors=r?.minorsPosture==="known_minors",this.denyAllPosture=r?.denyAll===!0,this.reloadUsProjectionFromStorage();try{this.syncFastPath()}catch{}this.mergeConsentDowngradeBaseline(this.getConsentDowngradeSnapshot())}bootSyncsFastPath(){return!1}reloadExternalConsentState(e=!1){let n=this.state.hasConsent||this.storage.getConsent()!==void 0||this.storage.getFastPath()!==void 0,s=this.hasValidStoredUsDecision();if(super.reloadExternalConsentState(e),!e&&n&&!s){this.failClosedForInvalidExternalDecision();return}this.reloadUsProjectionFromStorage(),e&&(this.rawConsentStaged=!1)}hasValidStoredUsDecision(){let e=this.storage.getConsent();if(!e)return!1;try{T.decodeForConfig(e.consent,this.config)}catch{return!1}if(e.gppString)try{return Ue.decode(e.gppString),!0}catch{}return typeof e.uspString=="string"&&/^1[YN-][YN-][YN-]$/.test(e.uspString)}failClosedForInvalidExternalDecision(){(this.storage.getConsent()||this.storage.getFastPath())&&this.invalidateStoredConsent(),this.usState={...pt(),optedOutOfSale:!0,optedOutOfShare:!0,gpcDetected:this.gpcActive},this.storedOptOut=!1}reloadUsProjectionFromStorage(){this.usState=this.loadUsState(),this.storedOptOut=(this.usState.optedOutOfSale||this.usState.optedOutOfShare)&&!this.knownMinors,this.gpcActive&&(this.usState.gpcDetected=!0),this.isSuppressed()&&(this.usState.optedOutOfSale=!0,this.usState.optedOutOfShare=!0)}isSuppressed(){return this.gpcActive||this.knownMinors}loadUsState(){let e=this.storage.getConsent()??this.storage.getLatestConsent();if(e){let n=0;try{let r=T.decodeForConfig(e.consent,this.config).timestamp*1e3;Number.isSafeInteger(r)&&r>0&&(n=r)}catch(s){console.warn("[US Engine] Stored consent timestamp invalid; fastpath stays cold:",s)}if(e.gppString)try{let{data:s}=Ue.decode(e.gppString),r=s.saleOptOut||s.sharingOptOut;return{optedOutOfSale:s.saleOptOut,optedOutOfShare:s.sharingOptOut,limitSensitiveUse:this.sensitivePIInUse&&(e.limitSensitiveUse??s.limitSensitiveUse)===!0,gpcDetected:!1,timestamp:n,lastOptOutAt:r?n:0}}catch(s){console.warn("[US Engine] Stored GPP string invalid, trying uspString:",s)}if(e.uspString){let s=e.uspString.charAt(2)==="Y";return{optedOutOfSale:s,optedOutOfShare:s,limitSensitiveUse:!1,gpcDetected:!1,timestamp:n,lastOptOutAt:s?n:0}}}return{...pt(),timestamp:Date.now()}}getFrameworkPrefix(){return"us"}acceptAll(){console.log("[US Engine] acceptAll()"),this.isSuppressed()||(this.usState.optedOutOfSale=!1,this.usState.optedOutOfShare=!1,this.usState.limitSensitiveUse=!1),super.acceptAll(),this.usState.timestamp=Date.now()}setCategoryConsent(e,n){this.rawConsentStaged=!0,super.setCategoryConsent(e,n)}setServiceConsent(e,n){this.rawConsentStaged=!0,super.setServiceConsent(e,n)}setConsent(e){this.rawConsentStaged=!0,super.setConsent(e)}save(){if(!this.state.hasConsent&&!this.rawConsentStaged){for(let e of this.config.categories)this.state.categories[e.id]=!0;for(let e of this.config.services)this.state.services[e.id]=!0}super.save(),this.rawConsentStaged=!1}getEvidenceConsentValues(){let e=this.currentUsState();return[...super.getEvidenceConsentValues(),!e.optedOutOfSale,!e.optedOutOfShare,...this.sensitivePIInUse?[!e.limitSensitiveUse]:[]]}rejectAll(){console.log("[US Engine] rejectAll()"),super.rejectAll(),this.usState.optedOutOfSale=!0,this.usState.optedOutOfShare=!0,this.sensitivePIInUse&&(this.usState.limitSensitiveUse=!0),this.markOptOut()}markOptOut(){let e=Date.now();this.usState.timestamp=e,this.usState.lastOptOutAt=e}isWithinReconsentWindow(){let{lastOptOutAt:e}=this.currentUsState();return e>0&&Date.now()-e<Dr}getOptOutOfSale(){return this.usState.optedOutOfSale}setOptOutOfSale(e){if(!e&&this.isSuppressed()){console.warn("[US Engine] Cannot opt back in to sale \u2014 opt-out is locked");return}console.log(`[US Engine] setOptOutOfSale(${e})`),this.usState.optedOutOfSale=e,e?this.markOptOut():this.usState.timestamp=Date.now(),this.emit("consent:changed")}getOptOutOfShare(){return this.usState.optedOutOfShare}setOptOutOfShare(e){if(!e&&this.isSuppressed()){console.warn("[US Engine] Cannot opt back in to sharing \u2014 opt-out is locked");return}console.log(`[US Engine] setOptOutOfShare(${e})`),this.usState.optedOutOfShare=e,e?this.markOptOut():this.usState.timestamp=Date.now(),this.emit("consent:changed")}setOptOutOfSaleAndShare(e){if(!e&&this.isSuppressed()){console.warn("[US Engine] Cannot opt back in to sale/sharing \u2014 opt-out is locked");return}console.log(`[US Engine] setOptOutOfSaleAndShare(${e})`),this.usState.optedOutOfSale=e,this.usState.optedOutOfShare=e,e?this.markOptOut():this.usState.timestamp=Date.now(),this.emit("consent:changed")}getLimitSensitiveUse(){return this.usState.limitSensitiveUse}getSensitivePIInUse(){return this.sensitivePIInUse}setLimitSensitiveUse(e){if(!this.sensitivePIInUse){console.warn("[US Engine] setLimitSensitiveUse ignored \u2014 sensitive PI not in use");return}console.log(`[US Engine] setLimitSensitiveUse(${e})`),this.usState.limitSensitiveUse=e,e?this.markOptOut():this.usState.timestamp=Date.now(),this.emit("consent:changed")}isGpcDetected(){return this.gpcActive}getUsPrivacyState(){return{...this.usState}}getFastPathConsentMap(){return this.projectFastPath().map}projectFastPath(){let e=this.currentUsState(),n=this.state.hasConsent&&this.hasValidConsent(),s=this.sensitivePIInUse&&e.limitSensitiveUse,r=n||this.storedOptOut||this.gpcActive||e.limitSensitiveUse,i=(n?this.getConsentTimestamp():null)??(this.storedOptOut||e.limitSensitiveUse?e.timestamp:0);return e.optedOutOfSale||e.optedOutOfShare||this.isSuppressed()?{map:this.getEssentialOnlyConsents(),decided:r,posture:!r,decisionTimestamp:i}:s?{map:this.sensitiveSuppressedMap(n?super.getFastPathConsentMap():this.getAllGrantedConsents()),decided:r,posture:!r,decisionTimestamp:i}:n?{map:super.getFastPathConsentMap(),decided:!0,posture:!1,decisionTimestamp:i}:this.denyAllPosture?{map:this.getEssentialOnlyConsents(),decided:r,posture:!r,decisionTimestamp:i}:this.sensitivePIInUse&&(this.injectedSensitiveVerdict??yt(this.visitorUsState))?{map:this.sensitiveSuppressedMap(this.getAllGrantedConsents()),decided:r,posture:!r,decisionTimestamp:i}:{map:this.getAllGrantedConsents(),decided:r,posture:!r,decisionTimestamp:i}}getTaggedDenials(){let e=this.config.services.filter(r=>r.usSensitive===!0&&r.essential!==!0);if(e.length===0)return;let n={};for(let r of e)n[r.id]=!1;let s=new Set(e.map(r=>r.categoryId).filter(r=>r!==void 0));return this.config.categories.forEach(r=>{s.has(r.id)&&r.essential!==!0&&(n[r.id]=!1)}),n}sensitiveSuppressedMap(e){let n=this.getTaggedDenials();return n?{...e,...n}:this.getEssentialOnlyConsents()}getEssentialOnlyConsents(){return{...this.getDefaultCategoryConsents(),...this.getDefaultServiceConsents()}}getAllGrantedConsents(){let e={};return this.config.categories.forEach(n=>{e[n.id]=!0}),this.config.services.forEach(n=>{e[n.id]=!0}),e}syncFastPath(e){let n=this.projectFastPath(),s=n.decided&&n.decisionTimestamp>0;De(this.config,n.map,{gpcRevocable:!0,posture:n.posture,decisionTimestamp:n.decisionTimestamp,cookieMode:s?"decision":"clear"},e)}buildConsentEntry(e){return{consent:e,uspString:this.getUsPrivacyString(),gppString:this.getGppString(),limitSensitiveUse:this.usState?.limitSensitiveUse===!0}}currentUsState(){return this.usState??pt()}getApplicableGppSections(){let n=we(this.config)&&this.config.us?.stateGeo===!0?ds():void 0;return[(n?Zt[n]:void 0)??v.US_NATIONAL]}getUsNationalSectionData(){let e=this.currentUsState();return{saleOptOut:e.optedOutOfSale,sharingOptOut:e.optedOutOfShare,gpcDetected:e.gpcDetected,mspaMode:this.mspaMode,sensitivePIInUse:this.sensitivePIInUse,limitSensitiveUse:e.limitSensitiveUse,knownMinor:this.knownMinors}}getGppString(){return Me.encode(this.getUsNationalSectionData(),this.getApplicableGppSections())}resolve(e){let n=D(e.bindingKey);if(n?.framework!=="us")throw new Error(`[US Engine] Invalid binding key: ${e.bindingKey}`);let{entity:s}=n;switch(s){case"sale":return this.resolveSaleBinding();case"share":return this.resolveShareBinding();case"saleAndShare":return this.resolveSaleAndShareBinding();case"limitSensitiveUse":return this.resolveLimitSensitiveUseBinding();default:throw new Error(`[US Engine] Unknown entity type: ${s}`)}}resolveMany(e){let n=[];for(let s of e)try{let r=this.resolve(s);n.push({bindingKey:s.bindingKey,value:r.value,disabled:r.disabled})}catch(r){console.error("[US Engine] Failed to resolve binding:",s,r)}return{patches:n,version:this.versionTracker.getVersion()}}apply(e){let n=D(e.ref.bindingKey);if(n?.framework!=="us")throw new Error(`[US Engine] Invalid binding key: ${e.ref.bindingKey}`);let{entity:s}=n,r=[];if(s==="sale"){this.setOptOutOfSale(e.value);let i=this.resolveSaleBinding();r.push({bindingKey:e.ref.bindingKey,value:i.value,disabled:i.disabled})}else if(s==="share"){this.setOptOutOfShare(e.value);let i=this.resolveShareBinding();r.push({bindingKey:e.ref.bindingKey,value:i.value,disabled:i.disabled})}else if(s==="limitSensitiveUse"){this.setLimitSensitiveUse(e.value);let i=this.resolveLimitSensitiveUseBinding();r.push({bindingKey:e.ref.bindingKey,value:i.value,disabled:i.disabled})}else if(s==="saleAndShare"){this.setOptOutOfSaleAndShare(e.value);let i=this.resolveSaleAndShareBinding();r.push({bindingKey:e.ref.bindingKey,value:i.value,disabled:i.disabled});let c=this.resolveSaleBinding();r.push({bindingKey:"consent:us.sale",value:c.value,disabled:c.disabled});let a=this.resolveShareBinding();r.push({bindingKey:"consent:us.share",value:a.value,disabled:a.disabled})}else throw new Error(`[US Engine] Unknown entity type: ${s}`);let o=this.versionTracker.increment();return{patches:r,version:o}}resolveSaleBinding(){return{value:this.usState.optedOutOfSale,disabled:this.isSuppressed()}}resolveShareBinding(){return{value:this.usState.optedOutOfShare,disabled:this.isSuppressed()}}resolveSaleAndShareBinding(){return{value:this.usState.optedOutOfSale&&this.usState.optedOutOfShare,disabled:this.isSuppressed()}}resolveLimitSensitiveUseBinding(){return{value:this.usState.limitSensitiveUse,disabled:!this.sensitivePIInUse}}getUsPrivacyString(){return`1Y${this.currentUsState().optedOutOfSale?"Y":"N"}-`}};var $e=class extends k{engine;constructor(e,n){super(e,n),this.engine=new ht(this.bus,this.storage,e),this.attachBlocking(this.engine),this.resolveInitialLocale(this.engine.getStoredLocale())}async init(){this.bus.emit({type:"consent:ready"});let e=!this.engine.isGpcDetected()&&this.engine.isConsentRequired();if(e&&this.config.cmp.main){let n=this.ensureViewData("main");await this.ensureViewEngine(),await Promise.all([this.ensureViewLoaded("main"),n])}else e||await this.showReturningVisitorTrigger()}async acceptAll(){this.engine.acceptAll(),this.engine.save(),await this.close()}async rejectAll(){this.engine.rejectAll(),this.engine.save(),await this.close()}};var Qt=window.__1CONSENT_CONFIG__;if(te(Qt)){let t=Qt,e=new _e,n=new J(new X,N(t)),s=Ct(t)?new Ve(t,{bus:e,storage:n}):vt(t)?new Ne(t,{bus:e,storage:n}):we(t)?new $e(t,{bus:e,storage:n}):null;if(!s)throw new Error("[Design Kit] Unsupported CMP framework config.");let r=Nt(s),o=new Wn(e,s.engine,()=>s.getTranslations(),()=>s.openDetails(),void 0,void 0,i=>s.setLanguage(i),()=>s.getThemeMode());window.__1consent=r,s.setViewEngine(o),s.init().catch(i=>console.error("[Design Kit] Controller init failed",i))}else Qt!==void 0&&console.error("[Design Kit] Refusing to initialize an invalid CMP runtime config.");
1
+ function W(t,e){let n=t.base?e[t.base]:e;t.root==="scope"&&(n=e);for(let s of t.path){if(n==null)return;n=n[s]}return n}function Us(t,e){switch(t.k){case"bool":return t.v;case"str":return t.v;case"path":return W(t.v,e)}}function xt(t,e,n){if(n==null||n===!1){t.removeAttribute(e);return}if(n===!0){t.setAttribute(e,"");return}let s=String(n);if(e==="class"&&(s=s.trim().replace(/\s+/g," ")),s===""&&!e.startsWith("data-1c-")){t.removeAttribute(e);return}t.setAttribute(e,s)}function Cn(t){return t==null||t===!1||t===0||t===""?!1:Array.isArray(t)?t.length>0:!0}function Y(t,e,n,s,r,o){switch(t.t){case"text":r.appendChild(document.createTextNode(t.v));break;case"bind":{let i=W(t.p,e);if(i!=null){let c=String(i);r.appendChild(document.createTextNode(c))}break}case"children":if(o)for(let i of o.nodes)Y(i,o.scope,n,s,r);break;case"each":{let i=W(t.list,e);if(Array.isArray(i))for(let c of i){let a={...e,[t.item]:c},l=document.createDocumentFragment();for(let d of t.body)Y(d,a,n,s,l,o);r.appendChild(l)}break}case"if":if(Cn(W(t.path,e))){let i=document.createDocumentFragment();for(let c of t.body)Y(c,e,n,s,i,o);r.appendChild(i)}break;case"if-not":if(!Cn(W(t.path,e))){let i=document.createDocumentFragment();for(let c of t.body)Y(c,e,n,s,i,o);r.appendChild(i)}break;case"use":{let i=n[t.name];if(!i){console.warn(`[1CL Executor] Component not found: ${t.name}`);return}let c={};for(let[u,p]of Object.entries(t.props))c[u]=Us(p,e);let a={...e,props:c},l=t.children&&t.children.length>0?{nodes:t.children,scope:e}:void 0,d=document.createDocumentFragment();for(let u of i)Y(u,a,n,s,d,l);r.appendChild(d);break}case"el":{let i=["svg","path","g","circle","rect","line","polyline","polygon","defs","clipPath"].includes(t.tag)?document.createElementNS("http://www.w3.org/2000/svg",t.tag):document.createElement(t.tag);for(let a of t.attrs)if(a.k==="static")xt(i,a.name,a.value);else if(a.k==="bind"){let l=W(a.value,e);xt(i,a.name,l)}else if(a.k==="concat"){let l=a.parts.map(d=>d.k==="str"?d.v:String(W(d.v,e)??"")).join("");xt(i,a.name,l)}let c=document.createDocumentFragment();for(let a of t.kids)Y(a,e,n,s,c,o);i.appendChild(c),r.appendChild(i);break}}}function $s(t,e,n={}){let s=document.createDocumentFragment(),r=n.view||"main",o=t.views[r];if(!o)return console.error(`[1CL Executor] View not found: ${r}`),s;for(let i of o)Y(i,e,t.components,n,s);return s}function _t(t,e,n,s={}){let r=$s(t,e,s);n.innerHTML="",n.appendChild(r)}function Ie(t,e=Date.now()){if(!Number.isSafeInteger(t)||t<=0||!Number.isSafeInteger(e)||e<0)return!1;let n=e+33696e6;return Number.isSafeInteger(n)?t>=e&&t<=n:!1}var vn=["ar","bg","bs","ca","cs","cy","da","de","el","en","es","et","eu","fi","fr","gl","he","hi","hr","hu","id","is","it","ja","ka","ko","lt","lv","mk","ms","mt","nl","no","pl","pt-br","pt-pt","ro","ru","sk","sl","sq","sr-latn","sr-cyrl","sv","sw","th","tl","tr","uk","vi","zh","zh-hant"],pi=new Set(vn),gi=vn.filter(t=>t.includes("-")).sort((t,e)=>e.length-t.length);function Gs(t){if(typeof t!="string")return null;let e=t.trim();if(e.length<2||e.length>255)return null;try{return Intl.getCanonicalLocales(e)[0]??null}catch{return null}}function Pt(t){return typeof t=="string"&&Gs(t)===t}function js(t){return t.split("-")[0]||"en"}function En(t){let e=js(t).toLowerCase();return/^[a-z]{2}$/.test(e)?e:null}var Ks=1440*60*1e3;var Dt="reload";var X=5;var bn=["VA","CO","CT","MT","TX","OR","DE","NH","NJ","MN","NE","MD","TN","FL","IN","KY","RI"];function Lt(t){return t===void 0?!0:bn.indexOf(t.toUpperCase())!==-1}function Ae(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function re(t){if(!Ae(t))return!1;let e=t;return!(!(typeof e.appId=="string"&&typeof e.version=="number"&&typeof e.machine=="string"&&Ae(e.languages)&&typeof e.languages.primary=="string"&&Array.isArray(e.languages.supported)&&e.languages.supported.length>0&&Pt(e.languages.primary)&&e.languages.supported.every(Pt)&&new Set(e.languages.supported).size===e.languages.supported.length&&e.languages.supported.includes(e.languages.primary)&&Ae(e.cmp)&&typeof e.cmp.main=="string"&&typeof e.cmp.uiData=="string"&&typeof e.cmp.serviceDetails=="string"&&Array.isArray(e.categories)&&Array.isArray(e.services)&&Array.isArray(e.scripts)&&typeof e.appearance=="object"&&e.appearance!==null&&typeof e.framework=="object"&&e.framework!==null)||!["P","S","D"].includes(e.machine))}function kt(t){return t.cmp.trigger?t.framework.type==="us"?!0:!!t.appearance?.trigger:!1}function Nt(t){return re(t)&&t.framework.type==="gdpr"}function Vt(t){if(!re(t)||t.framework.type!=="tcf"||!("vendorListVersion"in t.framework)||!Number.isSafeInteger(t.framework.vendorListVersion)||t.framework.vendorListVersion<=0||!("vendors"in t)||!Array.isArray(t.vendors))return!1;let e=s=>Array.isArray(s)&&s.every(r=>Number.isSafeInteger(r)&&r>0)&&new Set(s).size===s.length,n=[];for(let s of t.vendors){if(!Ae(s))return!1;let r=s.id;if(typeof r!="number"||!Number.isSafeInteger(r)||r<=0||!e(s.consentPurposeIds)||!e(s.legitimateInterestPurposeIds)||!e(s.flexiblePurposeIds)||!e(s.specialFeatureIds))return!1;n.push(r)}return new Set(n).size===n.length}function Oe(t){return re(t)&&t.framework.type==="us"}var oe="1consent",Rt=1;function ae(t){return{...t.consentContinuity?{consentContinuityRevision:t.consentContinuity.revision}:{},appId:t.appId,frameworkId:t.framework.id,type:t.framework.type,machine:t.machine,configVersion:t.version,consentEpoch:t.consentEpoch??0,...t.framework.type==="tcf"?{tcfPolicyVersion:X}:{},primaryLanguage:t.languages.primary}}function ie(){return{schemaVersion:Rt,apps:{}}}function st(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Tn(t){return st(t)&&t.schemaVersion===Rt&&st(t.apps)}function rt(t){if(!t)return ie();try{let e=JSON.parse(t);return Tn(e)?e:ie()}catch{return ie()}}function Ft(t){return st(t)?Object.values(t).every(e=>typeof e=="boolean"):!1}function it(t){return st(t)?typeof t.structuralVersion=="string"&&typeof t.consentEpoch=="number"&&Number.isSafeInteger(t.consentEpoch)&&t.consentEpoch>=0&&typeof t.expiresAt=="number"&&Number.isSafeInteger(t.expiresAt)&&t.expiresAt>=0&&Ft(t.services)&&Ft(t.categories)&&(t.decisionIntegrity===void 0||typeof t.decisionIntegrity=="string")&&(t.tcfCmpId===void 0||typeof t.tcfCmpId=="number"&&Number.isSafeInteger(t.tcfCmpId)&&t.tcfCmpId>=0&&t.tcfCmpId<=4095)&&(t.tcfValidationVersion===void 0||typeof t.tcfValidationVersion=="number"&&Number.isSafeInteger(t.tcfValidationVersion)&&t.tcfValidationVersion>0)&&(t.tcfDisclosedVendorKey===void 0||typeof t.tcfDisclosedVendorKey=="string"&&/^(?:[1-9]\d*(?:,[1-9]\d*)*)?$/.test(t.tcfDisclosedVendorKey))&&(t.tcfApiDataIntegrity===void 0||typeof t.tcfApiDataIntegrity=="string")&&(t.gpcRevocable===void 0||t.gpcRevocable===!0)&&(t.posture===void 0||t.posture===!0):!1}function Mt(t,e=Date.now()){return it(t)?Ie(t.expiresAt,e):!1}var Hs="1consent:browser-store",xe=new WeakSet,In=Promise.resolve();function An(t){let e=In.then(()=>{let n={owner:Symbol("memory-storage-owner")};xe.add(n);try{return t(n)}finally{xe.delete(n)}});return In=e.then(()=>{},()=>{}),e}function Bt(t){return t!==void 0&&xe.has(t)}async function On(t){if(typeof navigator>"u"||!navigator.locks)throw new Error("[BrowserStorage] Native writer is unavailable; initialize the runtime coordinator.");return navigator.locks.request(Hs,async()=>{let e={owner:Symbol("browser-storage-owner")};xe.add(e);try{return await t(e)}finally{xe.delete(e)}})}var Ut=["center-center","bottom-left","bottom-right","bottom-center"],xn=[...Ut,"panel-right"],_n=["left","center"],Pn=["accept-first","reject-first"],Dn=["left","right","center","full"],Ln=["equal","emphasize-accept"];var bi=new Set(Ut),Ti=new Set(xn);var Ii=new Set(_n),Ai=new Set(Pn),Oi=new Set(Dn),xi=new Set(Ln);function $t(t){let e=a=>typeof a=="object"&&a!==null&&!Array.isArray(a);if(!e(t))return!1;let n=t,s=a=>Array.isArray(a)&&a.every(l=>typeof l=="number"&&Number.isSafeInteger(l)&&l>0),r=a=>Array.isArray(a)&&a.every(l=>typeof l=="string"),o=n.disclosures;if(!Array.isArray(o)||!o.every(a=>{if(!e(a))return!1;let l=a;return typeof l.identifier=="string"&&["cookie","web","app"].includes(String(l.type))&&(l.maxAgeSeconds===null||typeof l.maxAgeSeconds=="number"&&Number.isSafeInteger(l.maxAgeSeconds)&&l.maxAgeSeconds>=0)&&typeof l.cookieRefresh=="boolean"&&r(l.domains)&&s(l.purposes)&&s(l.specialPurposes)&&(l.description===void 0||typeof l.description=="string")&&typeof l.optOut=="boolean"}))return!1;let i=n.domains;if(i!==void 0&&(!Array.isArray(i)||!i.every(a=>e(a)&&typeof a.domain=="string"&&typeof a.use=="string")))return!1;let c=n.sdks;return c===void 0||Array.isArray(c)&&c.every(a=>e(a)&&typeof a.name=="string"&&typeof a.use=="string")}function J(t){return t.map(e=>e?"1":"0").join("")}function kn(t){let e=t.categories+t.services+t.framework;return e.length===0||e.includes("0")&&e.includes("1")?"granular":e.includes("1")?"accept_all":"deny_all"}function Nn(t){return[[...new Set(t.flatMap(e=>e.consentPurposeIds))],[...new Set(t.flatMap(e=>e.legitimateInterestPurposeIds))],[...new Set(t.flatMap(e=>e.specialFeatureIds))],t.filter(e=>e.consentPurposeIds.length>0).map(e=>e.id),t.filter(e=>e.legitimateInterestPurposeIds.length>0).map(e=>e.id)]}var le="1consent";var _e=["data-1c-service","data-1c-service-tag","data-1c-tag"],Pe="data-1c-category",jt="data-1c-resolved";function Fn(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=e+((e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24))>>>0;return e.toString(36)}function D(t,e){let n=t.map(r=>`${r.id}\0${r.name??""}\0${r.tag??""}\0${r.categoryId??""}\0${r.essential?1:0}${r.catalogServiceKey?`\0k\0${r.catalogServiceKey}`:""}${r.usSensitive?"\x001":""}`).sort(),s=e.map(r=>`${r.id}\0${r.name}\0${r.essential?1:0}`).sort();return Fn(`s:${n.join("")}|c:${s.join("")}`)}function ce(t,e,n){t[e]=e in t?t[e]===!0&&n:n}function De(t,e,n,s){let r=Rn(t,e,n,s);return{services:r.services,categories:r.categories}}function Rn(t,e,n,s){let r={},o=new Map,i=!1;for(let a of t){let l=a.essential===!0||n[a.id]===!0;if(l&&a.essential!==!0&&(i=!0),ce(r,a.id,l),a.catalogServiceKey&&ce(r,a.catalogServiceKey,l),a.tag&&ce(r,a.tag,l),a.name&&ce(r,a.name,l),a.categoryId){let d=o.get(a.categoryId)??{total:0,granted:0};d.total+=1,l&&(d.granted+=1),o.set(a.categoryId,d)}}let c={};for(let a of e){let l=o.get(a.id),d=l!==void 0&&l.total>0&&l.granted===l.total,u=a.essential===!0||s[a.id]===!0||d;u&&a.essential!==!0&&s[a.id]===!0&&(i=!0),ce(c,a.id,u),ce(c,a.name,u)}return{services:r,categories:c,nonEssentialGranted:i}}function Kt(t,e,n,s,r){let o=Rn(t,e,n,s),i=r?.decisionTimestamp,c=i!==void 0&&Number.isSafeInteger(i)&&i>0?i+33696e6:0,a={v:D(t,e),e:Number.isSafeInteger(c)?c:0,s:o.services,c:o.categories};return r?.gpcRevocable===!0&&o.nonEssentialGranted&&(a.g=1),r?.posture===!0&&(a.p=1),a}function Le(){return typeof navigator>"u"?!1:navigator.globalPrivacyControl===!0}var Ht=2;function Mn(t){return t==="A"||t==="D"||t==="G"}var qs=/^[A-Za-z0-9_-]+$/,Ws=/^[a-z0-9]+$/;function Gt(t){return t.length>0&&qs.test(t)}function Ys(t){return t.length>0&&Ws.test(t)}function Xs(t){return t==="gdpr"||t==="tcf"||t==="us"}function Js(t){return t==="P"||t==="S"||t==="D"}function Bn(t){return Mn(t.decision)&&typeof t.appId=="string"&&Gt(t.appId)&&typeof t.frameworkId=="string"&&Gt(t.frameworkId)&&Xs(t.frameworkType)&&Js(t.machine)&&typeof t.primaryLanguage=="string"&&Gt(t.primaryLanguage)&&typeof t.structuralVersion=="string"&&Ys(t.structuralVersion)&&typeof t.consentEpoch=="number"&&Number.isSafeInteger(t.consentEpoch)&&t.consentEpoch>=0&&typeof t.expiresAt=="number"&&Number.isSafeInteger(t.expiresAt)&&t.expiresAt>0}function Vn(t){if(!/^(0|[1-9]\d*)$/.test(t))return null;let e=Number(t);return Number.isSafeInteger(e)&&String(e)===t?e:null}function zt(t){if(!Bn(t))throw new TypeError(le);return[Ht,t.decision,t.appId,t.frameworkId,t.frameworkType,t.machine,t.primaryLanguage,t.structuralVersion,t.consentEpoch,t.expiresAt].join(".")}function qt(t){if(!t)return null;let e=t.split(".");if(e.length!==10||e[0]!==String(Ht))return null;let n=e[1],s=e[2],r=e[3],o=e[4],i=e[5],c=e[6],a=e[7],l=e[8],d=e[9];if(!l||!d)return null;let u=Vn(l),p=Vn(d),y={decision:n,appId:s,frameworkId:r,frameworkType:o,machine:i,primaryLanguage:c,structuralVersion:a,consentEpoch:u,expiresAt:p};return Bn(y)?y:null}function $(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Z(t,e){return $(t)&&Object.entries(t).every(([n,s])=>/^[1-9]\d*$/.test(n)&&s===!0&&(typeof e=="number"?+n<=e:e[n]===!0))}function Zs(t){return $(t)&&Object.entries(t).every(([e,n])=>/^(1[01]|[1-9])$/.test(e)&&$(n)&&Object.entries(n).every(([s,r])=>/^[1-9]\d*$/.test(s)&&+s<=65535&&(r===0||r===1||r===2)))}function Un(t){if(!$(t)||!$(t.purpose)||!$(t.vendor))return!1;let e=t.publisher;return!$(e)||!$(e.customPurpose)?!1:(t.enableAdvertiserConsentMode===void 0||t.enableAdvertiserConsentMode===!0)&&[t.tcfPolicyVersion,t.cmpId,t.cmpVersion].every(n=>typeof n=="number"&&Number.isSafeInteger(n)&&n>=0&&n<2**12)&&[t.isServiceSpecific,t.useNonStandardTexts,t.purposeOneTreatment].every(n=>typeof n=="boolean")&&typeof t.publisherCC=="string"&&/^[A-Z]{2}$/.test(t.publisherCC)&&Z(t.purpose.consents,11)&&Z(t.purpose.legitimateInterests,11)&&Object.keys(t.purpose.legitimateInterests).every(n=>/^(2|[789]|1[01])$/.test(n))&&Z(t.vendor.disclosedVendors,65535)&&Z(t.vendor.consents,t.vendor.disclosedVendors)&&Z(t.vendor.legitimateInterests,t.vendor.disclosedVendors)&&Z(t.specialFeatureOptins,2)&&[e.consents,e.legitimateInterests,e.customPurpose.consents,e.customPurpose.legitimateInterests].every(n=>Z(n,0))&&Zs(e.restrictions)}function $n(t,e){return`${t}\0${JSON.stringify(e)}`}var ke=4095,Gn=1,jn=10;function ot(t){return[...new Set(t)].sort((e,n)=>e-n).join(",")}var at=class{config;framework;#e;#t;#s=[];#n=null;#r=!1;#i="granular";#c=new Set;#o;constructor(e,n,s,r){this.config=e,this.framework=r,this.#e=Math.random()<e.sampleRate,this.#t=s.getConsentId()!==void 0;let o=typeof window<"u"?window.__1C_AB:void 0;if(this.#o=o?{abTestId:o.testId,abVariant:o.variant}:void 0,typeof document>"u"||(n.on("monitoring:error",c=>this.#f(c.payload.code)),!this.#e))return;n.on("view:transition",c=>{c.payload.to!=="none"&&this.#a()}),n.on("view:change",c=>{c.payload.view!=="none"&&this.#a()}),n.on("consent:accepted-all",()=>{this.#i="accept_all"}),n.on("consent:rejected-all",()=>{this.#i="deny_all"}),n.on("consent:rejected",()=>{this.#i="deny_all"}),n.on("consent:saved",()=>this.#d());let i=()=>{document.visibilityState==="hidden"&&this.#u()};document.addEventListener("visibilitychange",i),window.addEventListener("pagehide",()=>this.#u())}#a(){if(this.#n!==null)return;let e=Date.now();this.#n=e,this.#s.push({type:"impression",ts:e,hasConsentStored:this.#t,framework:this.framework,...this.#o})}#d(){if(this.#n===null||this.#r)return;this.#r=!0;let e=Date.now();this.#s.push({type:"decision",ts:e,hasConsentStored:this.#t,framework:this.framework,action:this.#i,tToConsentMs:e-this.#n,...this.#o}),this.#u()}#f(e){this.#c.has(e)||(this.#c.add(e),this.#s.push({type:"monitoring",ts:Date.now(),hasConsentStored:this.#t,framework:this.framework,code:e,...this.#o}),this.#u())}#u(){if(this.#s.length===0)return;let e=JSON.stringify({id:crypto.randomUUID(),token:this.config.token,events:this.#s});this.#s=[];let n=`${this.config.url}/v1/analytics`;typeof navigator.sendBeacon=="function"&&navigator.sendBeacon(n,new Blob([e],{type:"text/plain"}))||fetch(n,{method:"POST",body:e,keepalive:!0}).catch(()=>{})}};function L(t){if(!t.startsWith("consent:"))return null;let e=t.slice(8).split(".");if(e.length!==2)return null;let[n,s]=e;return n!=="gdpr"&&n!=="tcf"&&n!=="us"||!s?null:{framework:n,entity:s}}function Wt(t){return L(t)!==null}var Ne=class{version=0;getVersion(){return this.version}increment(){return++this.version}reset(){this.version=0}};function G(t,e){let n={};for(let s of t.categories)n[`category:${s.id}`]=e[s.id]===!0;for(let s of t.services)n[`service:${s.id}`]=e[s.id]===!0;return n}function Ve(t,e){if(!Mt(e)||e.consentEpoch<(t.consentEpoch??0)||e.structuralVersion!==D(t.services,t.categories))return;if(e.gpcRevocable&&Le())return G(t,{});let n={};for(let s of t.categories)n[`category:${s.id}`]=e.categories[s.id]===!0;for(let s of t.services)n[`service:${s.id}`]=e.services[s.id]===!0;return n}function de(t,e){for(let n of Object.keys(t))if(t[n]===!0&&e[n]!==!0)return!0;return!1}function ue(t){return t.consentDowngradeBehavior??Dt}function Kn(t,e){if(!/^[0-9a-z]+$/.test(t))throw new Error(`Invalid consent string: ${e} is not canonical base36`);let n=Number.parseInt(t,36);if(!Number.isSafeInteger(n)||n.toString(36)!==t)throw new Error(`Invalid consent string: ${e} is not a safe canonical integer`);return n}function er(t){if(!/^[A-Za-z0-9_-]*$/.test(t)||t.length%4===1)return!1;try{let e=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=atob(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")===t}catch{return!1}}var b=class t{static encode(e){let n=[e.machine,e.configId,e.version.toString(36),e.framework,e.state];return e.state==="G"&&e.payload&&n.push(`${e.payload.mode}${e.payload.bits}`),n.push(e.language),n.push(e.timestamp.toString(36)),n.join(".")}static decode(e,n={}){let s=e.split("."),r=s[0],o=s[1],i=s[2],c=s[3],a=s[4];if(r!=="P"&&r!=="S"&&r!=="D")throw new Error("Invalid consent string: unsupported machine");if(!o)throw new Error("Invalid consent string: missing config id");if(!i)throw new Error("Invalid consent string: missing codec version");let l=Kn(i,"codec version");if(l!==1)throw new Error("Invalid consent string: unsupported codec version");if(c!=="gdpr"&&c!=="tcf"&&c!=="us")throw new Error("Invalid consent string: unsupported framework");if(a!=="A"&&a!=="D"&&a!=="G")throw new Error("Invalid consent string: unsupported state");let d=a==="G"?8:7;if(s.length!==d)throw new Error("Invalid consent string: noncanonical component count");let u,p=5;if(a==="G"){let h=s[5];if(!h)throw new Error("Invalid consent string: missing granular payload");let g=h[0],I=h.slice(1);if(g!=="a"&&g!=="d"||!er(I))throw new Error("Invalid consent string: malformed granular payload");u={mode:g,bits:I},p=6}let y=s[p],f=s[p+1];if(!y||!f)throw new Error("Invalid consent string: missing language or timestamp");let S=Kn(f,"timestamp"),v=Math.floor(Date.now()/1e3),m=n.maxFutureSkewSeconds??0;if(S<=0||!Number.isSafeInteger(v)||v<0||!Number.isSafeInteger(m)||m<0||S>v+m)throw new Error("Invalid consent string: timestamp is not a past positive instant");let T={machine:r,configId:o,version:l,framework:c,state:a,...u?{payload:u}:{},language:y,timestamp:S};if(t.encode(T)!==e)throw new Error("Invalid consent string: noncanonical encoding");return T}static decodeForConfig(e,n){let s=t.decode(e);if(s.machine!==n.machine||s.configId!==n.appId||s.framework!==n.framework.type)throw new Error("Invalid consent string: decision identity does not match live config");return s}static encodeBitset(e){let n=e.filter(Boolean).length,s=e.length-n,r=n<=s?"a":"d",o=r==="a",i=new Uint8Array(Math.ceil(e.length/8));for(let a=0;a<e.length;a++)if(e[a]===o){let l=Math.floor(a/8),d=a%8;i[l]|=1<<d}let c=btoa(String.fromCharCode(...i)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return{mode:r,bits:c}}static decodeBitset(e,n){let s=e.bits.replace(/-/g,"+").replace(/_/g,"/"),r=atob(s),o=new Uint8Array(r.length);for(let a=0;a<r.length;a++)o[a]=r.charCodeAt(a);let i=e.mode,c=new Array(n).fill(i!=="a");for(let a=0;a<n;a++){let l=Math.floor(a/8),d=a%8;l<o.length&&o[l]&1<<d&&(c[a]=i==="a")}return c}};var Yt=class{#e;#t=new Map;#s=[];#n=!1;constructor(){this.#e=this.#r()}#r(){let e="__1c_storage_test__";try{localStorage.setItem(e,"test");let n=localStorage.getItem(e);return localStorage.removeItem(e),n==="test"}catch{return!1}}getItem(e){if(this.#e)try{return localStorage.getItem(e)}catch{this.#e=!1}return this.#t.get(e)??null}setItem(e,n){if(this.#e)try{localStorage.setItem(e,n);return}catch{this.#e=!1}this.#t.set(e,n),this.#i()}onPersistenceFailure(e){this.#s.push(e),this.#n&&e()}#i(){if(!this.#n){this.#n=!0;for(let e of this.#s)e()}}removeItem(e){if(this.#e)try{localStorage.removeItem(e)}catch{this.#e=!1}this.#t.delete(e)}isLocalStorageAvailable(){return this.#e}},Q=new Yt;var ee=Symbol(),Fe=Symbol(),Hn=Symbol(),j=Symbol(),zn=Symbol(),F=Symbol(),fe=Symbol(),R=Symbol(),Re=Symbol(),Me=Symbol(),ct=Symbol(),qn=Symbol(),he=Symbol(),w=Symbol(),tr={run:On,isActive:Bt},ge=class{lease;coordinator;constructor(e,n=tr){this.lease=e,this.coordinator=n}withExclusiveAccess(e){return(Q.isLocalStorageAvailable()?this.coordinator.run:An)(s=>{let r=this.lease;this.lease=s;try{let o=e();if(o instanceof Promise)throw new Error("[OneConsentStorage] Writes must be synchronous.");return o}finally{this.lease=r}})}isExclusiveAccessHeld(){return Bt(this.lease)||this.coordinator.isActive(this.lease)}assertExclusiveAccess(){if(!this.isExclusiveAccessHeld())throw new Error("[OneConsentStorage] Write requires exclusive access.")}read(){return Q.getItem(oe)}write(e){this.assertExclusiveAccess(),Q.setItem(oe,e)}remove(){this.assertExclusiveAccess(),Q.removeItem(oe)}};function K(){return Math.floor(Date.now()/1e3)}function me(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Wn(t){return me(t)&&typeof t.updatedAt=="number"&&me(t.frameworks)&&(t.consentContinuityRevision===void 0||typeof t.consentContinuityRevision=="number"&&Number.isSafeInteger(t.consentContinuityRevision)&&t.consentContinuityRevision>=0)&&(t.consentId===void 0||typeof t.consentId=="string")}function lt(t){return me(t)&&(t.type==="gdpr"||t.type==="tcf"||t.type==="us")&&(t.machine==="P"||t.machine==="S"||t.machine==="D")&&typeof t.configVersion=="number"&&(t.consentEpoch===void 0||typeof t.consentEpoch=="number"&&Number.isSafeInteger(t.consentEpoch)&&t.consentEpoch>=0)&&(t.tcfPolicyVersion===void 0||typeof t.tcfPolicyVersion=="number"&&Number.isSafeInteger(t.tcfPolicyVersion)&&t.tcfPolicyVersion>=0)&&typeof t.primaryLanguage=="string"&&typeof t.updatedAt=="number"&&(t.consentContinuityKey===void 0||typeof t.consentContinuityKey=="string")&&[t.consentDecisionAt,t.consentInvalidatedAt].every(e=>e===void 0||typeof e=="number"&&Number.isSafeInteger(e)&&e>=0)}function pe(t,e){return t.type===e.type&&t.machine===e.machine&&(t.consentEpoch??0)>=e.consentEpoch&&(e.tcfPolicyVersion===void 0||t.tcfPolicyVersion===e.tcfPolicyVersion)&&t.primaryLanguage===e.primaryLanguage}function Se(t,e){let s=rt(t).apps[e.appId];if(!Wn(s)||e.consentContinuityRevision!==void 0&&(s.consentContinuityRevision??0)>e.consentContinuityRevision)return;let r=s.frameworks[e.frameworkId];return lt(r)&&pe(r,e)?r:void 0}function Yn(t){let e={};return t.tcString!==void 0&&(e.tcString=t.tcString),t.uspString!==void 0&&(e.uspString=t.uspString),t.gppString!==void 0&&(e.gppString=t.gppString),t.limitSensitiveUse!==void 0&&(e.limitSensitiveUse=t.limitSensitiveUse),e}function Xt(t){let e={consent:t.value,firstSeenAt:t.firstSeenAt,lastSeenAt:t.lastSeenAt,...Yn(t)};return Xn(e)?e:void 0}function nr(t){return{value:t.consent,firstSeenAt:t.firstSeenAt,lastSeenAt:t.lastSeenAt,...Yn(t)}}var Jt=10,Be=class{[he];[w];constructor(e,n){this[he]=e,this[w]=n}withExclusiveAccess(e){return this[he].withExclusiveAccess?this[he].withExclusiveAccess(e):Promise.resolve(e())}[ee](e){return e.consentDecisionAt??(e.consent?.lastSeenAt??0)*1e3}[Fe](e){let n=this[R](e);return n&&pe(n,this[w])?n:void 0}[Hn](e,n,s){}getContinuityScopes(){return[]}getScope(){return this[w]}[j](){try{return rt(this[he].read())}catch{return ie()}}[zn](e){this[he].write(JSON.stringify(e))}[F](e){let n=this[j](),s=e(n);return this[zn](n),s}[fe](e){let n=e.apps[this[w].appId];return Wn(n)?n:void 0}[R](e){let n=this[fe](e)?.frameworks[this[w].frameworkId];return lt(n)&&n.type===this[w].type?n:void 0}[Re](e,n){let s=this[fe](e);if(s)return s.updatedAt=n,s;let r={updatedAt:n,frameworks:{}};return e.apps[this[w].appId]=r,r}[Me](e,n){let s=this[Re](e,n),r=s.frameworks[this[w].frameworkId];if(lt(r)&&pe(r,this[w]))return r.updatedAt=n,r;let o={type:this[w].type,machine:this[w].machine,configVersion:this[w].configVersion,consentEpoch:this[w].consentEpoch,tcfPolicyVersion:this[w].tcfPolicyVersion,primaryLanguage:this[w].primaryLanguage,updatedAt:n};return lt(r)&&(r.type===this[w].type&&(o.prior=r.consent??r.prior),r.outbox&&(o.outbox=r.outbox)),s.frameworks[this[w].frameworkId]=o,o}[ct](e){let n=this[R](e);if(n&&(n.consentEpoch??0)>this[w].consentEpoch)throw new Error("[OneConsentStorage] A newer consent epoch is already stored.")}getConsent(){return this.getConsentSnapshot()?.content}getConsentSnapshot(){let e=this[Fe](this[j]());if(!e?.consent)return;let n=Xt(e.consent);return n?{content:n,decisionAt:this[ee](e)}:void 0}getLatestConsent(){return this.getLatestConsentSnapshot()?.content}getLatestConsentSnapshot(){let e=this[R](this[j]()),n=e?.consent??e?.prior;if(e&&(e.consentInvalidatedAt??0)>=Math.max(this[ee](e),(n?.lastSeenAt??0)*1e3))return;let s=n?Xt(n):void 0;return s&&e?{content:s,decisionAt:this[ee](e),prior:!0}:void 0}getContents(){let e=this.getConsent();return e?[e]:[]}getConsentId(){return this[fe](this[j]())?.consentId}setConsentId(e){let n=K();this[F](s=>{this[Re](s,n).consentId=e})}updateConsent(e,n){if(!this[fe](this[j]())?.consentId)throw new Error("[OneConsentStorage] Call setConsentId() before storing consent.");let s=K(),r={...e,firstSeenAt:s,lastSeenAt:s};Xn(r)&&this[F](o=>this[qn](o,r,n,s))}[qn](e,n,s,r){this[ct](e);let o=this[Fe](e)?.consent,i=this[Me](e,r);return i.machine=this[w].machine,i.configVersion=this[w].configVersion,i.consentEpoch=this[w].consentEpoch,this[w].tcfPolicyVersion===void 0?delete i.tcfPolicyVersion:i.tcfPolicyVersion=this[w].tcfPolicyVersion,i.primaryLanguage=this[w].primaryLanguage,i.consent=nr({...n,firstSeenAt:o?.firstSeenAt??r,lastSeenAt:r}),s&&(i.fastPath=s),i.consentDecisionAt=Math.max(Date.now(),this[ee](i)+1,(i.consentInvalidatedAt??0)+1),delete i.consentInvalidatedAt,delete i.prior,i}refreshFastPath(e,n){this.setFastPath(e)}updateConsentLocale(e,n){let s=K();this[F](r=>{this[ct](r);let o=this[Fe](r),i=o?.consent?Xt(o.consent):void 0;if(!o||!i||JSON.stringify({content:i,decisionAt:this[ee](o)})!==JSON.stringify(e))throw new Error("[OneConsentStorage] Consent changed during locale refresh.");let c=this[Me](r,s);c.consent={...o.consent,value:n,firstSeenAt:i.firstSeenAt,lastSeenAt:i.lastSeenAt},c.consentDecisionAt=this[ee](o),o.fastPath&&(c.fastPath=o.fastPath),this[Hn](r,c,s)})}setFastPath(e){let n=K();this[F](s=>{this[ct](s),this[Me](s,n).fastPath=e})}getFastPath(){let e=this[Fe](this[j]());if(e&&it(e.fastPath))return e.fastPath}removeFastPath(){let e=K();this[F](n=>{let s=this[R](n);!s||!pe(s,this[w])||(s.consentEpoch??0)!==this[w].consentEpoch||(delete s.fastPath,s.updatedAt=e,this[Re](n,e))})}invalidateConsent(){let e=K();return this[F](n=>{let s=this[R](n);return!s||!pe(s,this[w])||(s.consentEpoch??0)!==this[w].consentEpoch?!1:(delete s.consent,delete s.fastPath,s.updatedAt=e,this[Re](n,e),!0)})}removeAll(){this[F](e=>{let n=this[fe](e),s=this[R](e);!n||!s||!pe(s,this[w])||(delete n.frameworks[this[w].frameworkId],n.updatedAt=K(),Object.keys(n.frameworks).length===0&&!n.experiment&&delete e.apps[this[w].appId])})}getPendingEvents(){let e=this[R](this[j]())?.outbox?.consentEvents;return Array.isArray(e)?e.filter(sr):[]}queuePendingEvent(e){let n=this.getPendingEvents().filter(r=>r.eventId!==e.eventId);n.push(e),n.length>Jt&&console.warn(`[OneConsentStorage] Event queue full \u2014 dropping ${n.length-Jt} oldest`);let s=K();this[F](r=>{this[Me](r,s).outbox={consentEvents:n.slice(-Jt)}})}removePendingEvent(e){let n=this.getPendingEvents().filter(s=>s.eventId!==e);this[F](s=>{let r=this[R](s);r&&(n.length?r.outbox={consentEvents:n}:delete r.outbox)})}};function sr(t){return me(t)&&typeof t.url=="string"&&typeof t.eventId=="string"&&me(t.payload)}function Xn(t){return!me(t)||typeof t.consent!="string"||t.consent.length<5||typeof t.firstSeenAt!="number"||typeof t.lastSeenAt!="number"||t.tcString!==void 0&&typeof t.tcString!="string"||t.uspString!==void 0&&typeof t.uspString!="string"||t.gppString!==void 0&&typeof t.gppString!="string"||t.limitSensitiveUse!==void 0&&typeof t.limitSensitiveUse!="boolean"?!1:!(t.tcString!==void 0&&(t.uspString!==void 0||t.gppString!==void 0))}function Jn(t,e){let n=Se(e,ae(t));return Ve(t,n?.fastPath)}function Zt(t,e){let n=Se(e,ae(t)),s=n?.consent??(t.framework.type==="us"?n?.prior:void 0);if(!s)return;let r=s.value;try{b.decodeForConfig(s.value,t),r=s.value.replace(/\.[^.]+(\.[^.]+)$/,"$1")}catch{r=`!${r}`}return JSON.stringify([r,s.tcString,s.uspString,s.gppString,s.limitSensitiveUse])}var Ue=class{externalReconciliationPending=!1;beginExternalConsentReconciliation(e,n){return this.hasExternalConsentChange(e,n)?(this.externalReconciliationPending=!0,this.bus.emit({type:"consent:pending"}),!0):!1}isExternalConsentReconciliationPending(){return this.externalReconciliationPending}bus;storage;config;constructor(e,n,s){this.bus=e,this.storage=n,this.config=s}withExclusiveAccess(e){return this.storage.withExclusiveAccess(e)}getConfig(){return this.config}getDisplayLocale(){return this.config.languages.primary}getExternalConsentSnapshot(e){return Jn(this.config,e)}getCurrentExternalConsentSnapshot(){let e=this.getEnforcementConsentState();if(e.hasConsent)return G(this.config,{...e.categories,...e.services})}shouldReloadForExternalConsentChange(e,n){if(ue(this.config)!=="reload")return!1;let s=e===null&&n===null?this.getCurrentExternalConsentSnapshot():this.getExternalConsentSnapshot(e);if(!s)return!1;let r=this.getExternalConsentSnapshot(n)??{};return de(s,r)}hasExternalConsentChange(e,n){return e!==null||n!==null?Zt(this.config,e)!==Zt(this.config,n):this.getCurrentExternalConsentSnapshot()!==void 0}emit(e,n){this.bus.emit({type:e,payload:n})}on(e,n){this.bus.on(e,n)}getEnforcementConsentState(){return this.getConsentState()}};function $e(t){if(typeof window>"u")return;let e=window.__1CONSENT_REACT_FASTPATH__;if(e)try{if(typeof e.apply!="function"||typeof e.resolve!="function"||typeof e.reconcile!="function"||typeof e.destroy!="function"||e.appId!==t.appId||e.frameworkId!==t.framework.id||e.frameworkType!==t.framework.type||e.machine!==t.machine||e.primaryLanguage!==t.languages.primary||e.consentEpoch!==(t.consentEpoch??0)||e.structuralVersion!==D(t.services,t.categories))return;if(e.supportsPendingConsent!==!0||typeof e.updateConsent!="function"||typeof e.promote!="function"){e.destroy();return}return e.reconcile()?e:void 0}catch{return}}function rr(){let t=globalThis;return typeof t.scheduler=="object"?t.scheduler:void 0}function dt(t){let e=rr();if(e?.postTask)try{e.postTask(t,{priority:"user-visible"});return}catch{}setTimeout(t,0)}function Zn(){let t=[],e=!1,n=!1,s,r,o=()=>{if(!(e||n)){for(e=!0;!n&&t.length>0;){let i=t.shift();if(!i)break;if(!i.slot.isConnected||!i.allowed())continue;let c=i.recreate(i.source),a=c.hasAttribute("type")?c.type.trim().toLowerCase():c.getAttribute("language")?`text/${c.getAttribute("language")?.trim().toLowerCase()}`:"",l=a===""||/^(?:application|text)\/(?:x-)?(?:java|ecma)script$/.test(a)||/^text\/(?:javascript1\.[0-5]|jscript|livescript)$/.test(a);if(c.src&&l&&!c.hasAttribute("async")&&!c.defer&&!c.noModule){let d=new MutationObserver(()=>{c.isConnected||u()}),u=()=>{s===p&&(p(),e=!1,o())},p=()=>{d.disconnect(),c.removeEventListener("load",u),c.removeEventListener("error",u),s=void 0,r=void 0};s=p,r=()=>{(!c.isConnected||!i.allowed())&&(p(),e=!1)},c.addEventListener("load",u),c.addEventListener("error",u),d.observe(i.slot.ownerDocument,{childList:!0,subtree:!0}),i.slot.replaceWith(c),c.isConnected||u();return}i.slot.replaceWith(c)}e=!1}};return{activate(i,c,a,l){let d=Array.from(i.querySelectorAll("script"),p=>{let y=document.createComment("1c-script");return p.replaceWith(y),{source:p,slot:y,allowed:a,recreate:l}}),u=!e;e=!0,t.push(...d);try{c(i)}finally{u&&(e=!1),o()}},setPaused(i){n=i},recheck(){if(!n){r?.();for(let i=t.length-1;i>=0;i--){let c=t[i];c&&(!c.slot.isConnected||!c.allowed())&&t.splice(i,1)}}},flush:o,clear(){t.length=0,s?.(),e=!1}}}function Qn(){return typeof window>"u"?void 0:window.__1CONSENT_CONFIG__}function es(t,e={}){let n=document.createElement("script");for(let s of t.attributes)n.setAttribute(s.name,s.value);t.src?t.hasAttribute("async")||(n.async=!1):n.text=t.text||t.textContent||"";for(let s of e.removeAttributes??[])n.removeAttribute(s);return n}var ir=[..._e,Pe].map(t=>`template[${t}]:not([${jt}])`).join(",");function or(){return document.readyState==="loading"?new Promise(t=>document.addEventListener("DOMContentLoaded",()=>t(),{once:!0})):Promise.resolve()}function ts(t){return JSON.stringify([t.appId,t.framework.id,t.framework.type,t.machine,t.languages.primary,t.consentEpoch??0])}var ut=class{config;#e=Zn();#t;#s;#n=!1;#r;#i={services:{},categories:{}};constructor(e){this.config=e,this.#t=D(e.services,e.categories),this.#s=ts(e)}setConsent(e,n,s=!1){this.#e.setPaused(s),this.#n=s,n!==void 0&&(this.#r=n===0?void 0:n),this.#i=De(this.config.services,this.config.categories,e.services,e.categories),this.#e.recheck()}#c(){let e=Qn();return e!==void 0&&ts(e)===this.#s&&D(e.services,e.categories)===this.#t}async unblockTemplates(e){if(this.#n)return[];if(this.setConsent(e),await or(),this.#n||!this.#c())return[];this.#e.flush();let n=document.querySelectorAll(ir);if(!n.length)return[];let s=new Set;for(let r=0;r<n.length;r++){let o=n[r];if(!o)continue;let i=this.#o(o,this.#i.services,this.#i.categories);if(!i)continue;s.add(i);let c=o.content.cloneNode(!0);c instanceof DocumentFragment&&this.#e.activate(c,a=>o.replaceWith(a),()=>this.#c()&&this.#o(o,this.#i.services,this.#i.categories)!==void 0,a=>es(a,{removeAttributes:[..._e,Pe]}))}return Array.from(s)}#o(e,n,s){if(this.#r!==void 0&&Date.now()>this.#r)return;for(let o of _e){let i=e.getAttribute(o);if(i!==null)return n[i]===!0?i:void 0}let r=e.getAttribute(Pe);if(r!==null&&s[r]===!0)return r}};function ar(t){return typeof t=="object"&&t!==null&&"translations"in t&&"themeCSS"in t}var cr=250;function Ge(t,e){return`${t}::${e}`}function ft(t){return t==="details"?"details":t==="trigger"?"trigger":"notice"}var M=class{config;services;bus;storage;viewEngine;#e;#t=null;#s=new Map;#n=new Map;#r=null;#i="auto";analytics;#c=!1;constructor(e,n){this.config=e,this.services=n,this.bus=n.bus,this.storage=n.storage,this.viewEngine=n.viewEngine,this.#e=e.languages.primary,e.analytics&&(this.analytics=new at(e.analytics,this.bus,this.storage,e.framework.type),Q.onPersistenceFailure(()=>{this.bus.emit({type:"monitoring:error",payload:{code:"optout_write_error"}})}))}attachBlocking(e){if(this.#c)throw new Error("[1ConsentController] blocking is already attached");this.#c=!0;let n=new ut(this.config),s=()=>{let r=e.getEnforcementConsentState(),o=this.storage.getFastPath()?.expiresAt??0,i=e.isExternalConsentReconciliationPending();n.setConsent(r,o,i);let c=this.#o();c&&c.updateConsent(r.services);let a=$e(this.config);if(a)try{let l=De(this.config.services,this.config.categories,r.services,r.categories);a.updateConsent(l.services,l.categories,o,i)}catch{}dt(()=>{if(c?.unblock(),a){a.promote();return}n.unblockTemplates(e.getEnforcementConsentState()).catch(l=>{console.error("Template promotion failed",l)})})};this.bus.on("consent:saved",()=>s()),this.bus.on("consent:pending",()=>s()),this.bus.on("consent:external",()=>{s(),e.isConsentRequired()&&this.openNotice().catch(()=>{})}),s()}#o(){if(typeof window>"u"||!this.config.autoblocker?.enabled)return;let e=window.__1CONSENT_AUTOBLOCKER__;if(!e){console.error("Autoblocker missing");return}if(!(e.scope.appId!==this.config.appId||e.scope.frameworkId!==this.config.framework.id))return e}resolveInitialLocale(e){if(!e||e===this.#e)return;let n=this.config.languages.supported.find(s=>s===e);n&&(this.#e=n,this.bus.emit({type:"language:changed",payload:{locale:n}}))}getLanguage(){return this.#e}getTranslations(){return this.#t}async setLanguage(e){if(e===this.#e&&this.#t)return;let n=ft(this.viewEngine?.getCurrentView()),s=this.#s.get(Ge(e,n));if(s){this.#t=s,this.#e=e,await this.storage.withExclusiveAccess(()=>this.bus.emit({type:"language:changed",payload:{locale:e}}));return}let r=await this.#a(e,n);if(r===null)throw new Error(`[1Consent] ui-data for ${e}/${n} unavailable`);this.#t=r.translations,this.#e=e,await this.storage.withExclusiveAccess(()=>this.bus.emit({type:"language:changed",payload:{locale:e}}))}hasViewData(e){return e==="none"?!0:this.#s.has(Ge(this.#e,ft(e)))}async ensureViewData(e){if(e==="none")return;let n=this.#e,s=ft(e),r=this.#s.get(Ge(n,s));if(r){this.#t=r;return}let o=await this.#a(n,s);o?.translations&&n===this.#e&&(this.#t=o.translations)}#a(e,n){let s=Ge(e,n),r=this.#n.get(s);if(r)return r;let o=(async()=>{try{let i=await this.#d(e,n);return this.#u(e,n,i),i}catch(i){return this.#n.delete(s),console.error(`[1Consent] ui-data for ${s} unavailable after retry \u2014 the consent UI will render WITHOUT translations/theme:`,i),null}})();return this.#n.set(s,o),o}async#d(e,n){try{return await this.#f(e,n)}catch{return await new Promise(s=>setTimeout(s,cr)),await this.#f(e,n)}}async#f(e,n){let s=this.config.cmp.uiData.replace("{locale}",e).replace("{view}",n),r=await fetch(s);if(!r.ok)throw new Error(`HTTP ${r.status}`);let o=await r.json();if(!ar(o))throw new Error(`unexpected ui-data payload shape for ${e}/${n}`);return o.translations?{...o,translations:this.normalizeTranslations(o.translations,e,o.contentLanguage)}:o}normalizeTranslations(e,n,s){return e}#u(e,n,s){s.translations&&this.#s.set(Ge(e,n),s.translations),s.themeCSS!==this.#r&&(this.#r=s.themeCSS,this.viewEngine?.setThemeCSS(s.themeCSS)),s.translations&&e===this.#e&&this.#t===null&&this.viewEngine&&this.viewEngine.getCurrentView()!=="none"&&ft(this.viewEngine.getCurrentView())===n&&(this.#t=s.translations,this.viewEngine.refreshCurrentView())}getThemeMode(){return this.#i}setThemeMode(e){this.#i=e,this.bus.emit({type:"theme:changed",payload:{mode:e}})}#h;#l;setViewEngine(e){this.viewEngine=e,this.#r!==null&&e.setThemeCSS(this.#r)}setViewEngineFactory(e){this.#h=e}async ensureViewEngine(){if(!this.viewEngine&&this.#h){this.#l??=this.#h().catch(n=>{throw this.#l=void 0,n});let e=await this.#l;this.viewEngine||(this.viewEngine=e,this.#r!==null&&e.setThemeCSS(this.#r))}return this.viewEngine}get activeViewEngine(){return this.viewEngine}async showReturningVisitorTrigger(){if(!kt(this.config))return;let e=this.ensureViewData("trigger"),n=await this.ensureViewEngine();n&&(await Promise.all([this.ensureViewLoaded("trigger"),e]),await n.transitionTo("trigger","consent-given"))}async openNotice(){let e=await this.ensureViewEngine();e&&await e.transitionTo("main","programmatic")}async openDetails(){let e=await this.ensureViewEngine();e&&await e.transitionTo("details","programmatic")}async close(){this.viewEngine&&await this.viewEngine.transitionTo("none","programmatic")}async ensureViewLoaded(e){let n=await this.ensureViewEngine();!n||n.hasDesign(e)||await n.ensureViewBundle(e)}};var je=class{#e=new Map;on(e,n){let s=this.#e.get(e);return s||(s=new Set,this.#e.set(e,s)),s.add(n),()=>this.off(e,n)}off(e,n){let s=this.#e.get(e);s&&s.delete(n)}emit(e){let n=this.#e.get(e.type);if(n)for(let s of n)s(e)}};function ns(t,e,n){let s=e();return s?Promise.resolve(s):new Promise((r,o)=>{let i=document.createElement("script");i.src=t,i.async=!0,i.onload=()=>{let c=e();c?r(c):(i.remove(),o(new Error(`[1consent] ${n} bundle loaded but did not register runtime`)))},i.onerror=()=>{i.remove(),o(new Error(`[1consent] failed to load ${n} bundle: ${i.src}`))},(document.head||document.documentElement).appendChild(i)})}async function ht(t){let e=typeof navigator<"u"&&!!navigator.locks;if(t.consentContinuity===void 0&&e)return new Be(new ge,ae(t));let n=new URL(`${t.cmp.base}/runtime/experiment.v${t.signalsVersion||"1.0.0"}.js`,document.baseURI).href,s=await ns(n,()=>{let r=window.__1CONSENT_EXPERIMENT_STORAGE__;return r?.source===n?r:void 0},"experiment storage");return s.create(t,new ge(void 0,e?void 0:s.coordinator))}function ss(t,e){let n=[...t.services.filter(s=>!s.essential).map(s=>s.id),...t.categories.filter(s=>!s.essential).map(s=>s.id)];return n.length===0||n.every(s=>e[s]===!0)?"A":n.every(s=>!e[s])?"D":"G"}function Ke(t,e,n,s){let r=Kt(t.services,t.categories,e,e,n),o={structuralVersion:r.v,consentEpoch:t.consentEpoch??0,expiresAt:r.e,services:r.s,categories:r.c,...n?.decisionIntegrity?{decisionIntegrity:n.decisionIntegrity}:{},...n?.tcfCmpId!==void 0?{tcfCmpId:n.tcfCmpId}:{},...n?.tcfValidationVersion!==void 0?{tcfValidationVersion:n.tcfValidationVersion}:{},...n?.tcfDisclosedVendorKey!==void 0?{tcfDisclosedVendorKey:n.tcfDisclosedVendorKey}:{},...n?.tcfApiData!==void 0?{tcfApiData:n.tcfApiData}:{},...n?.tcfApiDataIntegrity!==void 0?{tcfApiDataIntegrity:n.tcfApiDataIntegrity}:{},...r.g===1?{gpcRevocable:!0}:{},...r.p===1?{posture:!0}:{}};if(s)s(o);else try{if(typeof localStorage>"u")throw new Error("localStorage unavailable");ht(t).then(i=>i.withExclusiveAccess(()=>i.setFastPath(o))).catch(i=>console.error("[1Consent] Fast-path persistence failed",i))}catch{}return n?.cookieMode==="clear"?B(t):n?.cookieMode!=="omit"&&dr(t,e,r),$e(t)?.updateConsent(r.s,r.c,r.e),dt(()=>lr(t)),r}function lr(t){try{$e(t)?.promote()}catch{}}function pt(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0).toString(36)}function B(t){if(!(typeof document>"u"))try{let e=`${le}=`,s=document.cookie.split(";").map(o=>o.trim()).find(o=>o.startsWith(e))?.slice(e.length),r=qt(s);if(r&&Ie(r.expiresAt)&&(r.appId!==t.appId||r.frameworkId!==t.framework.id||r.frameworkType!==t.framework.type||r.machine!==t.machine||r.primaryLanguage!==t.languages.primary||r.consentEpoch>(t.consentEpoch??0)))return;document.cookie=`${le}=; Path=/; SameSite=Lax; Max-Age=0`}catch{}}function dr(t,e,n){if(!(typeof document>"u")){if(!t.syncCookie||!Ie(n.e)){B(t);return}try{let s=zt({decision:ss(t,e),appId:t.appId,frameworkId:t.framework.id,frameworkType:t.framework.type,machine:t.machine,primaryLanguage:t.languages.primary,structuralVersion:n.v,consentEpoch:t.consentEpoch??0,expiresAt:n.e}),r=typeof location<"u"&&location.protocol==="https:",o=[`${le}=${s}`,"Path=/","SameSite=Lax",`Expires=${new Date(n.e).toUTCString()}`];r&&o.push("Secure"),document.cookie=o.join("; ")}catch{}}}function ur(t){return typeof t=="object"&&t!==null&&"getConsent"in t&&typeof t.getConsent=="function"&&"setConsent"in t&&typeof t.setConsent=="function"&&"acceptAll"in t&&typeof t.acceptAll=="function"&&"rejectAll"in t&&typeof t.rejectAll=="function"&&"setCategoryConsent"in t&&typeof t.setCategoryConsent=="function"&&"setServiceConsent"in t&&typeof t.setServiceConsent=="function"}function Qt(t){let e="engine"in t?t.engine:void 0,n=ur(e)?e:void 0,s=n?new Proxy({...n,setConsent:r=>t.storage.withExclusiveAccess(()=>n.setConsent(r))},{has(r,o){return Reflect.has(n,o)||Reflect.has(r,o)},get(r,o){if(o==="setConsent")return r.setConsent;let i=Reflect.get(n,o,n);if(typeof i!="function")return i;let c=i.bind(n);return["save","reconcileExternalConsentChange"].includes(String(o))?(...a)=>t.storage.withExclusiveAccess(()=>c(...a)):c}}):void 0;return{config:t.config,init:t.init.bind(t),openNotice:t.openNotice.bind(t),openDetails:t.openDetails.bind(t),close:t.close.bind(t),acceptAll:t.acceptAll.bind(t),rejectAll:t.rejectAll.bind(t),getLanguage:t.getLanguage.bind(t),getTranslations:t.getTranslations.bind(t),setLanguage:t.setLanguage.bind(t),getThemeMode:t.getThemeMode.bind(t),setThemeMode:t.setThemeMode.bind(t),bus:t.bus,cmp:{getState:()=>t.activeViewEngine?.getCurrentView()||"none",openCmp:t.openNotice.bind(t),openDetails:t.openDetails.bind(t),close:t.close.bind(t),acceptAll:t.acceptAll.bind(t),rejectAll:t.rejectAll.bind(t)},registerDesign:(r,o)=>t.activeViewEngine?.registerDesign(r,o),getView:()=>{let r="engine"in t?t.engine:void 0;return r&&typeof r=="object"&&"isConsentRequired"in r&&typeof r.isConsentRequired=="function"&&r.isConsentRequired()?"main":null},get engine(){return s},get viewEngine(){return t.activeViewEngine}}}var ms=["center-center","bottom-left","bottom-right","bottom-center"],fr=[...ms,"panel-right"];new Set(ms),new Set(fr);function hr(t){return"tcf"in t&&t.tcf!=null&&typeof t.tcf=="object"}var rs="ar.bg.bs.ca.cs.cy.da.de.el.en.es.et.eu.fi.fr.gl.he.hi.hr.hu.id.is.it.ja.ka.ko.lt.lv.mk.ms.mt.nl.no.pl.pt-br.pt-pt.ro.ru.sk.sl.sq.sr-latn.sr-cyrl.sv.sw.th.tl.tr.uk.vi.zh.zh-hant".split(".");new Set(rs),rs.filter(t=>t.includes("-")).sort((t,e)=>e.length-t.length);function pr(t){if(typeof t!="string")return null;let e=t.trim();if(e.length<2||e.length>255)return null;try{return Intl.getCanonicalLocales(e)[0]??null}catch{return null}}function is(t){return typeof t=="string"&&pr(t)===t}function x(t){return typeof t=="object"&&!!t&&!Array.isArray(t)}function Ss(t){if(!x(t))return!1;let e=t;return!(!(typeof e.appId=="string"&&typeof e.version=="number"&&typeof e.machine=="string"&&x(e.languages)&&typeof e.languages.primary=="string"&&Array.isArray(e.languages.supported)&&e.languages.supported.length>0&&is(e.languages.primary)&&e.languages.supported.every(is)&&new Set(e.languages.supported).size===e.languages.supported.length&&e.languages.supported.includes(e.languages.primary)&&x(e.cmp)&&typeof e.cmp.main=="string"&&typeof e.cmp.uiData=="string"&&typeof e.cmp.serviceDetails=="string"&&Array.isArray(e.categories)&&Array.isArray(e.services)&&Array.isArray(e.scripts)&&typeof e.appearance=="object"&&e.appearance!==null&&typeof e.framework=="object"&&e.framework!==null)||!["P","S","D"].includes(e.machine))}function gr(t){return t.cmp.trigger?t.framework.type==="us"||!!t.appearance?.trigger:!1}function en(t){if(!Ss(t)||t.framework.type!=="tcf"||!("vendorListVersion"in t.framework)||!Number.isSafeInteger(t.framework.vendorListVersion)||t.framework.vendorListVersion<=0||!("vendors"in t)||!Array.isArray(t.vendors))return!1;let e=s=>Array.isArray(s)&&s.every(r=>Number.isSafeInteger(r)&&r>0)&&new Set(s).size===s.length,n=[];for(let s of t.vendors){if(!x(s))return!1;let r=s.id;if(typeof r!="number"||!Number.isSafeInteger(r)||r<=0||!e(s.consentPurposeIds)||!e(s.legitimateInterestPurposeIds)||!e(s.flexiblePurposeIds)||!e(s.specialFeatureIds))return!1;n.push(r)}return new Set(n).size===n.length}function mr(t){return Ss(t)&&t.framework.type==="us"}function os(t){return["openMain","openDetails","close","acceptAll","rejectAll","save","reset"].includes(t)}var nn={open:"openMain",openNotice:"openMain"};function Sr(t,e=nn){if(os(t))return t;let n=e[t];if(!n)throw Error(`[1CL] Unknown command: ${t}. No alias mapping found.`);if(!os(n))throw Error(`[1CL] Invalid alias target: ${t} \u2192 ${n}. Alias targets must be canonical commands.`);return n}function yr(t){return t?{...nn,...t}:nn}function tn(t){return Array.isArray(t)&&t.every(e=>typeof e=="string")}function ys(t){return!t||typeof t!="object"||Object.entries(t).every(([e,n])=>e.endsWith("Url")?/^(https?:\/\/|mailto:[^@\s]+@[^@\s]+$)/i.test(String(n)):ys(n))}function gt(t,e){return Array.isArray(t)&&t.every(n=>x(n)&&e.every(s=>typeof n[s]=="string"))}function wr(t){if(!x(t)||typeof t.id!="string"||typeof t.name!="string")return!1;let e=t.declaration;if(!x(e))return!1;let n=e.deviceStorage,s=e.legalProfile,r=[[e.parties,["key","name","kind"]],[e.dataSources,["name"]],[e.recipients,["name"]],[e.processingLocations,["name"]],[e.retention,["period"]],[e.transfers,["destination"]]].every(([a,l])=>a===void 0||gt(a,l)),o=s==null||x(s)&&typeof s.label=="string"&&[[s.processingGrounds,["basis","label"]],[s.partyRoles,["partyKey","role"]]].every(([a,l])=>gt(a,l))&&tn(s.rights),i=t.operational,c=i==null||x(i)&&(i.domains===void 0||Array.isArray(i.domains)&&i.domains.every(a=>x(a)&&typeof a.domain=="string"&&typeof a.use=="string"))&&(i.sdks===void 0||Array.isArray(i.sdks)&&i.sdks.every(a=>x(a)&&typeof a.name=="string"&&typeof a.use=="string"));return(t.description==null||typeof t.description=="string")&&c&&r&&ys(t)&&gt(e.purposes,["key","name"])&&tn(e.dataCategories)&&tn(e.technologies)&&(n===null||x(n)&&gt(n.items,["key","type"]))&&x(e.links)&&Object.values(e.links).every(a=>typeof a=="string")&&o}function ws(t,e){let n=r=>{let o=r.base?[r.base,...r.path]:r.path;if(o[0]!=="ui"||o[1]!=="templateLabels"||!o[2])return;let i=o[2],c=e.templateLabels?.[i];if(typeof c!="string"||!c.trim())throw Error(`[TemplateLabels] Translate ui.templateLabels.${i} before using this design`)},s=r=>{for(let o of r){if(o.t==="bind"&&n(o.p),o.t==="el"){for(let i of o.attrs)if(i.k==="bind"&&n(i.value),i.k==="concat")for(let c of i.parts)c.k==="bind"&&n(c.v);s(o.kids)}if((o.t==="each"||o.t==="if"||o.t==="if-not")&&s(o.body),o.t==="use"){for(let i of Object.values(o.props))i.k==="path"&&n(i.v);o.children&&s(o.children)}}};for(let r of[...Object.values(t.views),...Object.values(t.components)])s(r)}var Cr=["a[href]","area[href]","button:not([disabled])","input:not([disabled]):not([type='hidden'])","select:not([disabled])","textarea:not([disabled])","iframe","[contenteditable='true']","[tabindex]:not([tabindex='-1'])"].join(",");function Cs(t){return Array.from(t.querySelectorAll(Cr)).filter(e=>e instanceof HTMLElement&&e.getAttribute("tabindex")!=="-1"&&!e.closest("[hidden], [inert], [aria-hidden='true']"))}function vr(t){let e=t.querySelector("[data-1c-initial-focus]");if(e instanceof HTMLElement)return e;let n=t.querySelector("h1, h2, h3, h4, h5, h6");return n instanceof HTMLElement?(n.hasAttribute("tabindex")||(n.tabIndex=-1),n):Cs(t)[0]||(t.hasAttribute("tabindex")||(t.tabIndex=-1),t)}function Er(t){let e=[],n=t;for(;;){let s=n.parentElement;if(s){for(let o of Array.from(s.children))!(o instanceof HTMLElement)||o===n||(e.push({element:o,inert:o.inert}),o.inert=!0);if(s===document.body)break;n=s;continue}let r=n.getRootNode();if(!(r instanceof ShadowRoot))break;for(let o of Array.from(r.children))!(o instanceof HTMLElement)||o===n||(e.push({element:o,inert:o.inert}),o.inert=!0);if(!(r.host instanceof HTMLElement))break;n=r.host}return e}function vs(t,e){let n=Er(e),s=document.documentElement.style,r=s.getPropertyValue("overflow"),o=s.getPropertyPriority("overflow");s.setProperty("overflow","hidden");let i=a=>{if(a.key!=="Tab")return;let l=Cs(t);if(l.length===0){a.preventDefault(),t.focus({preventScroll:!0});return}let d=l[0],u=l[l.length-1];if(!d||!u)return;let p=t.getRootNode(),y=p instanceof ShadowRoot?p.activeElement:document.activeElement;a.shiftKey&&(y===d||!t.contains(y))?(a.preventDefault(),u.focus({preventScroll:!0})):!a.shiftKey&&(y===u||!t.contains(y))&&(a.preventDefault(),d.focus({preventScroll:!0}))};t.addEventListener("keydown",i),vr(t).focus({preventScroll:!0});let c=!0;return()=>{if(c){c=!1,t.removeEventListener("keydown",i);for(let a of n)a.element.inert=a.inert;r?s.setProperty("overflow",r,o):s.removeProperty("overflow")}}}var as=new Map,ye=null,sn=null,rn=0;async function cs(t,e,n,s,r,o){if(ye?.dataset.serviceId===t)return;let i=r||document.body,c=(i instanceof ShadowRoot?i.activeElement:null)??document.activeElement,a=c instanceof HTMLElement?c:null;He();let l=++rn,d=e.cmp.serviceDetails.replace("{serviceId}",encodeURIComponent(t)),u=`${d}${d.includes("?")?"&":"?"}schema=2`,p=o??as.get(u);if(!p){let h=await br(t,u);if(!h)return;as.set(u,h),p=h}if(l!==rn)return;let y=s();if(!y)throw Error("[Modal] Missing i18n");ws(n,y);let f=document.createElement("div");f.dataset.serviceId=t,_t(n,{service:p,ui:y},f,{view:"service-detail"}),ye=f,i.appendChild(ye);let S=f.querySelector('[role="dialog"]'),v=S instanceof HTMLElement?vs(S,f):()=>{},m=f.querySelector(".oc-service-modal__overlay");m?.addEventListener("click",h=>{h.target===m&&He()}),f.querySelector('[data-1c="command:closeServiceDetail"]')?.addEventListener("click",h=>{h.preventDefault(),He()});let T=h=>{h.key==="Escape"&&He()};document.addEventListener("keydown",T),sn=()=>{v(),document.removeEventListener("keydown",T),a?.isConnected&&a.focus({preventScroll:!0})},requestAnimationFrame(()=>{m?.classList.add("oc-service-modal--visible")})}function He(){if(rn+=1,!ye)return;let t=ye,e=sn;ye=null,sn=null,e?.(),t.remove()}async function br(t,e){try{let n=await fetch(e);if(n.ok){let s=await n.json();if(wr(s))return s}}catch{}return console.error(`[ServiceDetail] Request failed for ${t}`),null}function Tr(t,e){let n=e.split("-")[0]==="de";if(t===null)return n?"Nicht zutreffend":"Not applicable";if(t===0)return n?"Sitzung":"Session";let s=[{unit:"day",seconds:86400},{unit:"hour",seconds:3600},{unit:"minute",seconds:60},{unit:"second",seconds:1}],r=t,o=[];for(let i of s){let c=Math.floor(r/i.seconds);r%=i.seconds,c>0&&o.push(new Intl.NumberFormat(e,{style:"unit",unit:i.unit,unitDisplay:"short"}).format(c))}return o.join(" ")}function ls(t){let e=t.indexOf(":");return e===-1?(console.warn(`[1CL] Invalid command binding format: ${t}`),null):{type:t.substring(0,e).trim(),name:t.substring(e+1).trim()}}function ds(t,e){let n=Sr(e,yr()),s={openMain:()=>t.cmp.openCmp(),openDetails:()=>t.cmp.openDetails(),close:()=>t.cmp.close(),acceptAll:()=>t.cmp.acceptAll(),rejectAll:()=>t.cmp.rejectAll(),save:()=>t.cmp.save?.(),reset:()=>t.cmp.reset?.(),closeServiceDetail:()=>He()}[n];s?s():console.warn(`[1CL] Unknown canonical command: ${n}`)}function us(t,e){let n={notice:()=>t.cmp?.openCmp(),details:()=>t.cmp?.openDetails(),close:()=>t.cmp?.close()}[e];n?n():console.warn(`[1CL] Unknown view command: ${e}`)}function Ir(t,e,n){if(!t.engine){console.error("[1CL] SDK engine not available");return}let s=n.querySelector('input[type="checkbox"]');if(s){let r=s.checked;if(e.startsWith("category:")){let o=e.substring(9);fs(t.engine,`category:${o}`,r)}else if(e.startsWith("service:")){let o=e.substring(8);fs(t.engine,`service:${o}`,r)}}}function fs(t,e,n){return e.startsWith("category:")?(t.setCategoryConsent(e.substring(9),n),!0):e.startsWith("service:")?(t.setServiceConsent(e.substring(8),n),!0):!1}function Ar(t,e){let n=s=>{let r=s.target,o=r.getAttribute?.("data-1c-backdrop");if(o){let l=ls(o);l&&(s.preventDefault(),l.type==="view"?us(e,l.name):ds(e,l.name));return}let i=r.closest("[data-1c]");if(!i)return;let c=i.getAttribute("data-1c");if(!c)return;let a=ls(c);if(a)switch(a.type){case"command":s.preventDefault(),ds(e,a.name);break;case"view":s.preventDefault(),us(e,a.name);break;case"consent":Ir(e,a.name,i);break;case"dataset":s.preventDefault(),Or(e,a.name,i);break;default:console.warn(`[1CL] Unknown command type: ${a.type}`)}};return t.addEventListener("click",n),()=>{t.removeEventListener("click",n)}}function Or(t,e,n){let s=t.viewEngine,r=t.getShadowRoot?.();switch(e){case"serviceDetail":{let o=n.getAttribute("data-1c-id");if(!o){console.warn("[1CL] dataset:serviceDetail missing data-1c-id");return}let i=s?.getCompiledView?.("service-detail");if(!i){console.warn("[1CL] No compiled service-detail template found");return}cs(o,t.config,i,t.getTranslations,r??void 0).catch(c=>{console.error("[1CL] Failed to open service detail modal:",c)});break}case"vendorStorage":{let o=n.getAttribute("data-1c-id");if(!o){console.warn("[1CL] dataset:vendorStorage missing data-1c-id");return}let i=n.getAttribute("data-1c-name")??`Vendor ${o}`,c=s?.getCompiledView?.("service-detail");if(!c){console.warn("[1CL] No compiled service-detail template found");return}xr(o,i,t.config,t.getLanguage()).then(a=>{a&&cs(`vendor-${o}`,t.config,c,t.getTranslations,r??void 0,a).catch(l=>{console.error("[1CL] Failed to open vendor storage modal:",l)})}).catch(a=>{console.error("[1CL] Failed to fetch vendor storage:",a)});break}default:console.warn(`[1CL] Unknown dataset command: ${e}`)}}async function xr(t,e,n,s=n.languages.primary){let r=new URL(n.cmp.serviceDetails.replace("{serviceId}","__tcf_vendor_selector__"),window.location.href),o=r.pathname.match(/^\/v\/([^/]+)\/services\/__tcf_vendor_selector__(?:\.json)?$/)?.[1];if(!o)return null;let i=new URL(`/v/${o}/tcf-vendors/${encodeURIComponent(t)}/storage.json`,r.origin),c=r.searchParams.get("version"),a=r.searchParams.get("stage");if(c)i.searchParams.set("version",c);else if(a==="preview")i.searchParams.set("stage",a);else return null;let l=await fetch(i);if(!l.ok)return null;let d=await l.json();if(!$t(d))return null;let u=d.disclosures,p=d.domains??[],y=d.sdks??[];if(u.length===0&&p.length===0&&y.length===0)return null;let f=u.map(m=>{let T=Tr(m.maxAgeSeconds,s),h=[m.description,m.domains.length>0?`Domains: ${m.domains.join(", ")}`:void 0,m.purposes.length>0?`Purposes: ${m.purposes.map(g=>`P${g}`).join(", ")}`:m.specialPurposes.length===0?"Non-TCF purpose":void 0,m.specialPurposes.length>0?`Special purposes: ${m.specialPurposes.map(g=>`SP${g}`).join(", ")}`:void 0,m.optOut?"Opt-out mechanism":void 0,m.cookieRefresh?"Refreshed":void 0].filter(g=>!!g);return{key:m.identifier,type:m.type,duration:T,description:h.join(" \xB7 ")}}),S=Array.from(new Set(u.flatMap(m=>m.purposes).map(m=>`Purpose ${m}`))),v=Array.from(new Set([...u.map(m=>m.type),...y.map(m=>`SDK: ${m.name}`)]));return{id:`vendor-${t}`,name:e,...S.length>0&&{purposes:S},...v.length>0&&{technologiesUsed:v},...f.length>0&&{storage:{items:f}},operational:p.length>0||y.length>0?{...p.length>0&&{domains:p},...y.length>0&&{sdks:y}}:null,declaration:{purposes:S.map((m,T)=>({key:String(T),name:m})),dataCategories:[],technologies:v,deviceStorage:f.length>0?{items:f.map(m=>({...m,type:m.type==="cookie"?"cookie":"other"}))}:null,links:{}}}}var _r=class mt{index=new Map;static makeKey(e,n){return`${e}::${n??""}`}add(e,n,s){let r=mt.makeKey(e,n);this.index.has(r)||this.index.set(r,new Set),this.index.get(r)?.add(s)}remove(e,n,s){let r=mt.makeKey(e,n),o=this.index.get(r);o&&(o.delete(s),o.size===0&&this.index.delete(r))}get(e,n){let s=mt.makeKey(e,n);return this.index.get(s)??new Set}getAllBindings(){let e=[];for(let[n,s]of this.index.entries()){let[r,o]=n.split("::");for(let i of s){let c={element:i,bindingKey:r};o&&(c.id=o),e.push(c)}}return e}clear(){this.index.clear()}get size(){let e=0;for(let n of this.index.values())e+=n.size;return e}},hs=new WeakMap;function ze(t){let e=hs.get(t);return e||(e=new _r,hs.set(t,e)),e}function Pr(t,e){let n=[],s=ze(e),r='[data-1c^="consent:"][data-1c-id]',o='[data-1c="consent:us.sale"], [data-1c="consent:us.share"], [data-1c="consent:us.saleAndShare"]',i=[...t.querySelectorAll(r),...t.querySelectorAll(o)];(t.matches(r)||t.matches(o))&&i.push(t);for(let c of i){if(!(c instanceof HTMLInputElement))continue;let a=c.getAttribute("data-1c");if(!a)continue;let l=c.getAttribute("data-1c-id")||void 0;s.add(a,l,c);let d={element:c,bindingKey:a};l&&(d.id=l),n.push(d)}return n}function Dr(t,e){let n=ze(e),s='[data-1c^="consent:"][data-1c-id]',r='[data-1c="consent:us.sale"], [data-1c="consent:us.share"], [data-1c="consent:us.saleAndShare"]',o=[...t.querySelectorAll(s),...t.querySelectorAll(r)];(t.matches(s)||t.matches(r))&&o.push(t);for(let i of o){if(!(i instanceof HTMLInputElement))continue;let c=i.getAttribute("data-1c");if(!c)continue;let a=i.getAttribute("data-1c-id")||void 0;n.remove(c,a,i)}}function on(t,e){t.checked=e.value,t.disabled=e.disabled,t.setAttribute("aria-checked",String(e.value)),t.setAttribute("aria-disabled",String(e.disabled))}function an(t,e,n){let s=ze(e);for(let r of t){let o=s.get(r.bindingKey,r.id);for(let i of o)on(i,{value:r.value??i.checked,disabled:r.disabled??i.disabled})}}function Es(t,e,n){let s=Pr(t,e);if(s.length===0)return;let r=s.map(o=>({bindingKey:o.bindingKey,id:o.id}));try{let o=n.engine;if(n.engine&&typeof o.resolveMany=="function"){let i=o.resolveMany(r);an(i.patches,e,i.version)}else for(let i of s)try{if(!n.engine?.resolve||!Wt(i.bindingKey))continue;let c=i.id?{bindingKey:i.bindingKey,id:i.id}:{bindingKey:i.bindingKey},a=n.engine.resolve(c);a&&on(i.element,a)}catch(c){console.error("[1CL] Failed to resolve binding:",i,c)}}catch(o){console.error("[1CL] Failed to hydrate bindings:",o)}}function Lr(t,e){Dr(t,e)}function kr(t,e){let n=new MutationObserver(s=>{for(let r of s){for(let o of r.addedNodes)o instanceof HTMLElement&&Es(o,t,e);for(let o of r.removedNodes)o instanceof HTMLElement&&Lr(o,t)}});return n.observe(t,{childList:!0,subtree:!0}),()=>{n.disconnect()}}function Nr(t,e){let n=!1,s=r=>{if(n)return;let o=r.target;if(!(o instanceof HTMLInputElement))return;let i=o.getAttribute("data-1c");if(!i?.startsWith("consent:"))return;let c=o.getAttribute("data-1c-id")||"",a=o.checked;try{if(!e.engine)return;let l=e.engine.apply({ref:{bindingKey:i,id:c},value:a,source:"ui"});n=!0,an(l.patches,t,l.version),n=!1}catch(l){console.error("[1CL] Failed to apply consent change:",l);try{let d=e.engine.resolve({bindingKey:i,id:c});n=!0,on(o,d),n=!1}catch(d){console.error("[1CL] Failed to revert state:",d)}}};return t.addEventListener("change",s,!0),()=>{t.removeEventListener("change",s,!0)}}function Vr(t,e){Es(t,t,e);let n=Nr(t,e),s=kr(t,e),r=e.bus.on("consent:changed",()=>{let o=ze(t).getAllBindings().map(i=>({bindingKey:i.bindingKey,id:i.id}));try{let i=e.engine;if(e.engine&&typeof i.resolveMany=="function"){let c=i.resolveMany(o);an(c.patches,t,c.version)}}catch(i){console.error("[1CL] Failed to reconcile on consent:changed:",i)}});return()=>{n(),s(),r(),ze(t).clear()}}function Fr(t){if(!t)throw Error("[1CL State] SDK instance is missing");if(!t.viewEngine)throw Error("[1CL State] SDK viewEngine is missing");if(!t.viewEngine.getCurrentView)throw Error("[1CL State] viewEngine.getCurrentView method is missing");let e=t.viewEngine.getCurrentView(),n=Mr(e),{position:s,spacing:r,logoAlign:o,buttonOrder:i,buttonAlign:c,buttonEmphasis:a}=Ur(t,n);return{state:e==="none"?"closed":"open",load:"ready",theme:Rr(t),layer:n,framework:Br(t),position:s,spacing:r,logoAlign:o,buttonOrder:i,buttonAlign:c,buttonEmphasis:a}}function Rr(t){if(!t.config)throw Error("[1CL State] SDK config is missing");let e=typeof t.getThemeMode=="function"?t.getThemeMode():"auto";return e==="light"||e==="dark"?e:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Mr(t){return t==="main"?"notice":t==="details"?"details":"trigger"}function Br(t){if(!t.config)throw Error("[1CL State] SDK config is missing");if(!t.config.framework)throw Error("[1CL State] Framework configuration is missing");if(!t.config.framework.type)throw Error("[1CL State] Framework type is missing");let e=t.config.framework.type.toLowerCase();if(e==="tcf"||e==="us"||e==="gdpr")return e;throw Error(`[1CL State] Unknown framework type: ${e}`)}function Ur(t,e){let n=t.config?.appearance,s=n?.notice,r={logoAlign:s?.logoAlignment||"left",buttonOrder:s?.buttonOrder||"reject-first",buttonAlign:s?.buttonAlignment||"right",buttonEmphasis:s?.buttonEmphasis||"equal"};if(!n)return{position:"bottom-center",spacing:"default",...r};if(e==="trigger"&&n.trigger)return{position:n.trigger.position||"bottom-right",spacing:n.trigger.size||"default",...r};let o=e==="details"?n.details:n.notice;return{position:o?.position||"bottom-center",spacing:o?.size||"default",...r}}function $r(t,e){let n=t.getRootNode(),s=n instanceof ShadowRoot?n.host:t;s.setAttribute("data-1c-state",e.state),s.setAttribute("data-1c-load",e.load),s.setAttribute("data-1c-theme",e.theme),s.setAttribute("data-1c-layer",e.layer),s.setAttribute("data-1c-framework",e.framework),s.setAttribute("data-1c-position",e.position),s.setAttribute("data-1c-spacing",e.spacing),s.setAttribute("data-1c-logo-align",e.logoAlign),s.setAttribute("data-1c-button-order",e.buttonOrder),s.setAttribute("data-1c-button-align",e.buttonAlign),s.setAttribute("data-1c-button-emphasis",e.buttonEmphasis)}function ps(t,e){$r(t,Fr(e))}function Gr(t,e){ps(t,e);let n=()=>{ps(t,e)},s=["view:transition","consent:changed","theme:changed"];return s.forEach(r=>{e.bus.on(r,n)}),()=>{s.forEach(r=>{e.bus.off(r,n)})}}function jr(t){return"getOptOutOfSale"in t&&"getOptOutOfShare"in t&&"isGpcDetected"in t&&"getLimitSensitiveUse"in t&&"getSensitivePIInUse"in t}function Kr(t,e,n){let s=Object.values(t.stacks),r=new Set(s.flatMap(f=>f.purposes)),o=new Set(s.flatMap(f=>f.specialFeatures)),i=new Set(n.flatMap(f=>f.specialFeatureIds)),c=Object.values(t.specialFeatures).filter(f=>i.has(f.id)),a=n.map(f=>{let S=t.vendors[f.id];if(!S)throw Error(`TCF UI data is missing configured vendor ${f.id}`);let v=new Set(f.consentPurposeIds),m=new Set(f.legitimateInterestPurposeIds),T=new Set(f.flexiblePurposeIds),h=new Set(f.specialFeatureIds);return{...S,purposes:S.purposes.filter(g=>v.has(g)),purposes_data:S.purposes_data.filter(g=>v.has(g.id)),legIntPurposes:S.legIntPurposes.filter(g=>m.has(g)),legIntPurposes_data:S.legIntPurposes_data.filter(g=>m.has(g.id)),flexiblePurposes:S.flexiblePurposes.filter(g=>T.has(g)),flexiblePurposes_data:S.flexiblePurposes_data.filter(g=>T.has(g.id)),specialFeatures:S.specialFeatures.filter(g=>h.has(g)),specialFeatures_data:S.specialFeatures_data.filter(g=>h.has(g.id))}}),l=Object.values(t.purposes).map(f=>{let S=a.filter(m=>m.purposes.includes(f.id)).length,v=a.filter(m=>m.legIntPurposes.includes(f.id)).length;return{...f,consentVendorCount:S,legitimateInterestVendorCount:v,hasConsentVendors:S>0,hasLegitimateInterestVendors:v>0}}),d=new Set(l.filter(f=>f.hasConsentVendors).map(f=>f.id)),u=s.map(f=>({...f,hasConsentControls:f.purposes.some(S=>d.has(S))||f.specialFeatures.length>0})),p=l.filter(f=>f.hasLegitimateInterestVendors),y=a.filter(f=>f.legIntPurposes.length>0).length;return{standardTexts:t.standardTexts,...e==="main"?{stacks:u,purposes:l.filter(f=>!r.has(f.id))}:{purposes:l},specialPurposes:Object.values(t.specialPurposes),dataCategories:Object.values(t.dataCategories),features:Object.values(t.features),specialFeatures:e==="main"?c.filter(f=>!o.has(f.id)):c,vendors:a,vendorCount:a.length,legitimateInterestPurposes:p,legitimateInterestVendorCount:y,hasLegitimateInterests:y>0}}function Hr(t){try{let e=t.split("-")[0];return new Intl.DisplayNames([e],{type:"language"}).of(e)??t}catch{return t}}function gs(t,e,n){let s=t?.[e];return{name:s?.name??n??e,...s?.description&&{description:s.description}}}var zr=["data-1c","data-1c-action"],bs=class{getThemeMode;currentView="none";bus;consentEngine;config;container=null;shadowRoot=null;renderTarget=null;cleanupFunctions=[];focusReturnTarget=null;currentLocale;viewLoadPromises=new Map;transitionIntent=0;pendingDismissalWork=null;translationsProvider;themeCSS=null;controllerOpenDetails;controllerSetLanguage;languageChangePending=!1;ensureViewData;hasViewData;constructor(t,e,n,s,r,o,i,c=()=>"auto"){this.getThemeMode=c,this.bus=t,this.consentEngine=e,this.translationsProvider=n??(()=>null),this.controllerOpenDetails=s,this.ensureViewData=r??(async()=>{}),this.hasViewData=o??(()=>!0),this.controllerSetLanguage=i,this.config=e.getConfig(),this.currentLocale=e.getDisplayLocale(),this.consentEngine.on("consent:changed",()=>this.handleConsentChange()),this.bus.on("view:change",a=>{if(a&&typeof a=="object"&&"payload"in a){let l=a.payload?.view;l&&this.transitionTo(l)}}),this.consentEngine.on("consent:saved",()=>this.handleConsentSaved()),this.consentEngine.on("consent:external",()=>{this.consentEngine.hasValidConsent()&&this.handleConsentSaved()}),this.consentEngine.on("consent:accepted-all",()=>this.handleConsentSaved()),this.consentEngine.on("consent:rejected-all",()=>this.handleConsentSaved()),this.bus.on("language:changed",a=>{if(a&&typeof a=="object"&&"payload"in a){let l=a.payload;l?.locale&&(this.currentLocale=l.locale)}this.currentView!=="none"&&this.mount(this.currentView)})}getCurrentView(){return this.currentView}hasDesign(t){return this.bundles.has(t)}setThemeCSS(t){if(this.themeCSS=t,!this.shadowRoot)return;let e=this.shadowRoot.getElementById("1c-style-theme");if(t===null){e?.remove();return}if(e)e.textContent=t;else{let n=document.createElement("style");n.id="1c-style-theme",n.textContent=t,this.shadowRoot.append(n)}}refreshCurrentView(){this.currentView!=="none"&&this.mount(this.currentView)}getCompiledView(t){return this.bundles.get(t)}canCloseView(t){switch(t){case"main":return this.config.showClose===!0||!this.consentEngine.isConsentRequired();case"details":return!0;case"trigger":return!0;case"none":return!0}}async transitionTo(t,e="programmatic"){let n=this.currentView;if(n===t)return this.pendingDismissalWork&&(this.transitionIntent+=1),!0;if(!this.isValidTransition(n,t))return console.warn(`[ViewEngine] Invalid transition: ${n} \u2192 ${t}`),!1;if(t==="trigger"&&!this.triggerEnabled())return console.warn("[ViewEngine] Trigger view is disabled for this configuration"),!1;if((t==="none"||t==="trigger")&&e!=="consent-given"&&!this.canCloseView(n))return console.warn(`[ViewEngine] Cannot close current view: ${n}`),!1;let s=++this.transitionIntent;if(t!=="none"&&this.pendingDismissalWork&&(await this.pendingDismissalWork,s!==this.transitionIntent))return!1;if(t!=="none"){let a=!this.bundles.has(t),l=this.ensureViewData(t);if(a||!this.hasViewData(t)){let[d]=await Promise.all([a?this.ensureViewBundle(t):Promise.resolve(!0),l]);if(s!==this.transitionIntent)return console.warn(`[ViewEngine] Transition ${n} \u2192 ${t} superseded by a newer transition`),!1;if(!d)return console.error(`[ViewEngine] View bundle unavailable: ${t}`),this.bus.emit({type:"monitoring:error",payload:{code:"render_error"}}),t==="trigger"&&this.transitionTo("none",e)}}let r=this.isModalView(n),o=this.isModalView(t);o&&!r&&this.captureFocusReturnTarget();let i={from:n,to:t,reason:e};this.bus.emit({type:"view:before-transition",payload:i}),this.currentView=t;let c=!0;if(t==="none"){for(let a of this.cleanupFunctions)a();this.cleanupFunctions=[],this.renderTarget&&(this.renderTarget.innerHTML="")}else c=this.mountSafely(t);return c?(this.bus.emit({type:"view:transition",payload:i}),r&&!o&&this.restoreFocusAfterModal(),!0):(this.currentView=n,n==="none"||this.mountSafely(n)||(this.currentView="none",this.renderTarget&&(this.renderTarget.innerHTML=""),this.bus.emit({type:"view:transition",payload:{from:n,to:"none"}})),o&&!r&&this.restoreFocusAfterModal(),!1)}isModalView(t){return t==="details"||t==="main"&&this.config.appearance?.showOverlay===!0}activeHTMLElement(){let t=this.shadowRoot?.activeElement;return t instanceof HTMLElement?t:document.activeElement instanceof HTMLElement?document.activeElement:null}captureFocusReturnTarget(){if(this.focusReturnTarget)return;let t=this.activeHTMLElement();if(!(!t||t===document.body||t===document.documentElement)){for(let e of zr){let n=t.getAttribute(e);if(n){this.focusReturnTarget={element:t,binding:{attribute:e,value:n}};return}}this.focusReturnTarget={element:t}}}restoreFocusAfterModal(){let t=this.focusReturnTarget;if(this.focusReturnTarget=null,!t)return;if(t.element.isConnected){t.element.focus({preventScroll:!0});return}if(!t.binding||!this.renderTarget)return;let e=this.renderTarget.querySelectorAll(`[${t.binding.attribute}]`);for(let n of e)if(n instanceof HTMLElement&&n.getAttribute(t.binding.attribute)===t.binding.value){n.focus({preventScroll:!0});return}}isValidTransition(t,e){return{none:["main","details","trigger"],main:["details","trigger","none"],details:["main","trigger","none"],trigger:["main","details","none"]}[t]?.includes(e)??!1}triggerEnabled(){return gr(this.config)}initialize(){this.consentEngine.isConsentRequired()?this.transitionTo("main","consent-required"):this.triggerEnabled()&&this.transitionTo("trigger","consent-given")}handleConsentChange(){if(this.currentView==="trigger"&&this.consentEngine.isConsentRequired()){this.transitionTo("main","consent-required");return}}handleConsentSaved(){(this.currentView==="main"||this.currentView==="details")&&this.dismissModalThenTransition(this.triggerEnabled()?"trigger":"none","consent-given")}dismissModalThenTransition(t,e,n){let s=this.currentView,r=s==="main"||s==="details";if(!r&&!n){this.transitionTo(t,e);return}let o=this.transitionIntent+ +!!r,i=(r?new Promise(a=>window.setTimeout(a,0)):Promise.resolve()).then(async()=>{try{return await c?await n?.()??{to:t,reason:e}:void 0}finally{this.pendingDismissalWork===i&&(this.pendingDismissalWork=null)}});n&&(this.pendingDismissalWork=i);let c=r?this.transitionTo("none",e):Promise.resolve(!0);i.then(a=>{a&&(a.to!=="none"||!r)&&o===this.transitionIntent&&(this.currentView==="none"||!r)&&this.transitionTo(a.to,a.reason)}).catch(a=>{console.error("[1Consent] Consent action failed",a),this.transitionTo("main","user-action")})}saveDecision(t){this.dismissModalThenTransition(this.triggerEnabled()?"trigger":"none","consent-given",()=>this.consentEngine.withExclusiveAccess(()=>{t?.(),this.consentEngine.save()}))}openNotice(){this.transitionTo("main","user-action")}openDetails(){this.transitionTo("details","user-action")}closeCurrentView(){let t=this.currentView;if(!this.canCloseView(t)){console.warn(`[ViewEngine] Cannot close ${t} - consent required`),this.bus.emit({type:"view:close-blocked",payload:{view:t,reason:"consent-required"}});return}if(t==="main"&&this.config.showClose===!0&&this.config.closeMeans==="reject"){this.saveDecision(()=>this.consentEngine.rejectAll());return}if(t==="main"&&this.config.showClose===!0){this.dismissModalThenTransition(this.triggerEnabled()?"trigger":"none","user-action");return}if(t==="details"){this.dismissModalThenTransition("none","user-action",()=>this.consentEngine.withExclusiveAccess(()=>{if(this.consentEngine.reconcileExternalConsentChange(null,null,!0),this.consentEngine.isConsentRequired())return{to:"main",reason:"consent-required"};if(this.consentEngine.hasValidConsent()&&this.triggerEnabled())return{to:"trigger",reason:"consent-given"}}));return}this.consentEngine.hasValidConsent()?this.dismissModalThenTransition(this.triggerEnabled()?"trigger":"none","consent-given"):this.transitionTo("main","consent-required")}bundles=new Map;registerDesign(t,e){let n=Object.keys(t.views);if(n.length===0){console.error("[ViewEngine] Registered design has no views");return}for(let s of n){let r=s.split(".").pop()||"main",o={version:t.version,views:{[r]:t.views[s]},components:t.components},i=e||t.css;i&&(o.css=i),this.bundles.set(r,o),this.currentView===r&&this.mount(r)}}viewBundleUrl(t){let e=this.config.cmp;if(t==="main")return e.main;if(t==="details")return e.details;if(t==="trigger")return e.trigger}loadViewScript(t){return new Promise((e,n)=>{let s=document.createElement("script");s.src=t,s.async=!0,s.onload=()=>e(),s.onerror=r=>{s.remove(),n(r)},(document.head||document.documentElement).appendChild(s)})}ensureViewBundle(t){if(this.bundles.has(t))return Promise.resolve(!0);let e=this.viewBundleUrl(t);if(!e)return Promise.resolve(!1);let n=this.viewLoadPromises.get(t);return n||(n=this.loadViewScript(e).then(()=>{let s=this.bundles.has(t);return s||this.viewLoadPromises.delete(t),s}).catch(s=>(console.error(`[ViewEngine] Failed to load view '${t}':`,s),this.viewLoadPromises.delete(t),!1)),this.viewLoadPromises.set(t,n)),n}closeToNone(){this.renderTarget&&(this.renderTarget.innerHTML=""),this.currentView="none",this.bus.emit({type:"view:change",payload:{view:"none"}})}mountSafely(t){try{return this.mount(t)}catch(e){return console.error(`[ViewEngine] Failed to mount view ${t}:`,e),this.bus.emit({type:"monitoring:error",payload:{code:"render_error"}}),!1}}mount(t){for(let h of this.cleanupFunctions)h();this.cleanupFunctions=[];let e=this.bundles.get(t);if(!e)return t!=="none"&&(console.warn(`[ViewEngine] No bundle found for view: ${t}`),this.closeToNone()),!1;if(this.container||(this.container=document.getElementById("1c-cmp-container"),this.container||(this.container=document.createElement("div"),this.container.id="1c-cmp-container",(document.body||document.documentElement).appendChild(this.container))),this.shadowRoot||(this.shadowRoot=this.container.attachShadow({mode:"open"}),this.renderTarget=document.createElement("div"),this.renderTarget.id="1c-cmp-root",this.shadowRoot.appendChild(this.renderTarget)),this.themeCSS){let h=this.shadowRoot.getElementById("1c-style-theme");h||(h=document.createElement("style"),h.id="1c-style-theme",this.shadowRoot.prepend(h)),h.textContent=this.themeCSS}if(e.css){let h=`1c-style-${t}`,g=this.shadowRoot.getElementById(h);g||(g=document.createElement("style"),g.id=h,this.shadowRoot.prepend(g)),g.textContent=e.css}let n=this.translationsProvider()??{},s=hr(n)?n.tcf.gvl:void 0,r=(en(this.config)?this.config.vendors??[]:[]).length,o=h=>{let g={};for(let[I,C]of Object.entries(h))typeof C=="string"?g[I]=C.replace(/%VENDORS_COUNT%/g,String(r)):Array.isArray(C)?g[I]=C:C&&typeof C=="object"?g[I]=o(C):g[I]=C;return g},i=en(this.config)?o(n):n,c=mr(this.config)?this.config.us?.doNotSellLinkUrl:void 0,a=c&&Array.isArray(i.legalLinks)&&i.legalLinks.some(h=>h.url==="/do-not-sell")?i.legalLinks.map(h=>h.url==="/do-not-sell"?{...h,url:c}:h):i.legalLinks,l=(this.config.services||[]).map(h=>({...h,...gs(i.vendors?.services,h.id,h.name??h.tag)}));ws(e,i);let d={config:this.config,consent:{categories:this.consentEngine.getCategoryConsents(),services:this.consentEngine.getServiceConsents()},ui:{view:t,...i,...a===i.legalLinks?{}:{legalLinks:a}},categories:(this.config.categories||[]).map(h=>({...h,...gs(i.vendors?.categories,h.id,h.name),services:l.filter(g=>g.categoryId===h.id)})).filter(h=>h.services.length>0),services:l,appearance:{...this.config.appearance,useSwitchCategories:this.config.appearance?.categoryToggleType==="switch",useCheckboxCategories:this.config.appearance?.categoryToggleType!=="switch",useSwitchServices:this.config.appearance?.serviceToggleType!=="checkbox",useCheckboxServices:this.config.appearance?.serviceToggleType==="checkbox",showClose:this.config.showClose===!0},framework:this.config.framework,languages:{...this.config.languages,current:this.currentLocale,showSelector:this.config.languages.supported.length>1,options:this.config.languages.supported.map(h=>({code:h,label:this.config.languages.labels?.[h]??Hr(h)}))},...s?{tcf:Kr(s,t,en(this.config)?this.config.vendors??[]:[])}:{},...jr(this.consentEngine)?{us:{optedOutOfSale:this.consentEngine.getOptOutOfSale(),optedOutOfShare:this.consentEngine.getOptOutOfShare(),gpcDetected:this.consentEngine.isGpcDetected(),sensitivePIInUse:this.consentEngine.getSensitivePIInUse(),limitSensitiveUse:this.consentEngine.getLimitSensitiveUse()}}:{}},u=this.renderTarget;if(!u)return console.error("[ViewEngine] Shadow root render target is missing"),!1;try{_t(e,d,u,{view:t})}catch(h){return console.error(`[ViewEngine] Failed to mount view ${t}:`,h),this.bus.emit({type:"monitoring:error",payload:{code:"render_error"}}),!1}let p=u.querySelector('[role="dialog"]'),y=this.isModalView(t);p instanceof HTMLElement&&(p.setAttribute("aria-modal",y?"true":"false"),y&&this.cleanupFunctions.push(vs(p,this.container)));let f=u.querySelector("select[data-1c-lang]");if(f instanceof HTMLSelectElement&&(f.value=this.currentLocale,f.disabled=this.languageChangePending,f.onchange=()=>{if(this.languageChangePending)return;let h=this.config.languages.supported.find(C=>C===f.value),g=this.controllerSetLanguage;if(!h||!g)return;f.disabled=!0,this.languageChangePending=!0;let I;try{I=g(h)}catch(C){I=Promise.reject(C)}I.catch(C=>{let P=this.renderTarget?.querySelector("select[data-1c-lang]");P instanceof HTMLSelectElement&&(P.value=this.currentLocale),console.error("[ViewEngine] Language switch failed",C)}).finally(()=>{this.languageChangePending=!1;let C=this.renderTarget?.querySelector("select[data-1c-lang]");C instanceof HTMLSelectElement&&(C.disabled=!1)})}),u.textContent?.includes("[")){if(u.textContent?.includes("[ul]")){let P=/\[ul]([\s\S]*?)\[\/ul]/g,k=/\[li]([\s\S]*?)\[\/li]/g,N=document.createTreeWalker(u,NodeFilter.SHOW_TEXT),_=[],O;for(;O=N.nextNode();)O.textContent?.includes("[ul]")&&_.push(O);for(let te of _){let q=te.textContent||"",ne=document.createDocumentFragment(),V=0;P.lastIndex=0;let A;for(;(A=P.exec(q))!==null;){A.index>V&&ne.appendChild(document.createTextNode(q.slice(V,A.index)));let se=document.createElement("ul");se.className="oc-list";let nt=A[1];k.lastIndex=0;let yn;for(;(yn=k.exec(nt))!==null;){let wn=document.createElement("li");wn.textContent=yn[1],se.appendChild(wn)}ne.appendChild(se),V=A.index+A[0].length}V<q.length&&ne.appendChild(document.createTextNode(q.slice(V))),te.parentNode?.replaceChild(ne,te)}}let h=/\[([abi])(?:\s+([^\]]*))?](.*?)\[\/\1]/g,g=document.createTreeWalker(u,NodeFilter.SHOW_TEXT),I=[],C;for(;C=g.nextNode();)C.textContent&&h.test(C.textContent)&&(I.push(C),h.lastIndex=0);for(let P of I){let k=P.textContent||"",N=document.createDocumentFragment(),_=0;h.lastIndex=0;let O;for(;(O=h.exec(k))!==null;){O.index>_&&N.appendChild(document.createTextNode(k.slice(_,O.index)));let te=O[1],q=O[2]||"",ne=O[3],V;if(te==="a"){let A=document.createElement("a");A.className="oc-link";let se=q.match(/href="([^"]*)"/),nt=q.match(/action="([^"]*)"/);nt?(A.href="#",A.setAttribute("data-1c-action",nt[1])):se?(A.href=se[1],A.target="_blank",A.rel="noopener noreferrer"):A.href="#",V=A}else V=te==="b"?document.createElement("strong"):document.createElement("em");V.textContent=ne,N.appendChild(V),_=O.index+O[0].length}_<k.length&&N.appendChild(document.createTextNode(k.slice(_))),P.parentNode?.replaceChild(N,P)}}let S={config:this.config,engine:this.consentEngine,getLanguage:()=>this.currentLocale,getTranslations:()=>this.translationsProvider(),cmp:{getState:()=>this.currentView,openCmp:()=>this.transitionTo("main","programmatic"),openDetails:()=>this.controllerOpenDetails?this.controllerOpenDetails().then(()=>!0):this.transitionTo("details","programmatic"),close:()=>this.closeCurrentView(),acceptAll:()=>this.saveDecision(()=>this.consentEngine.acceptAll()),rejectAll:()=>this.saveDecision(()=>this.consentEngine.rejectAll()),save:()=>this.saveDecision(),reset:()=>this.consentEngine.reset?.()},viewEngine:this,bus:this.bus,getThemeMode:this.getThemeMode,getShadowRoot:()=>this.shadowRoot},v=Vr(u,S),m=Ar(u,S),T=Gr(this.container,S);return this.cleanupFunctions.push(v,m,T),!0}};var St=class extends Ue{on(e,n){return this.bus.on(e,n)}off(e,n){this.bus.off(e,n)}emit(e,n){this.bus.emit({type:e,payload:n})}};var H=class extends St{validatedStoredDecision;state;versionTracker=new Ne;#e;#t;#s=!1;#n;#r;constructor(e,n,s){super(e,n,s),this.#r=s.languages.primary,this.state=this.#o();let r=Ve(s,n.getFastPath());this.#t=r!==void 0||this.#s,this.#e=r??(this.#s?G(this.config,this.#f()):{}),this.state.hasConsent&&this.#p()&&this.invalidateStoredConsent(),this.bus.on("language:changed",o=>{this.#i(o.payload.locale)});try{this.bootSyncsFastPath()&&(this.state.hasConsent&&this.hasValidConsent()?(this.syncFastPath(),this.mergeConsentDowngradeBaseline(G(this.config,this.#f()))):(this.storage.removeFastPath(),B(this.config)))}catch{}this.#h()}bootSyncsFastPath(){return!0}syncFastPath(e){Ke(this.config,this.getFastPathConsentMap(),this.getFastPathSyncOptions(),e??(n=>this.storage.refreshFastPath(n,this.validatedStoredDecision)))}reconcileExternalConsentChange(e,n,s=!1){if(!(!s&&!this.hasExternalConsentChange(e,n))){this.externalReconciliationPending=!1;try{this.reloadExternalConsentState(s)}catch(r){throw this.externalReconciliationPending=!0,r}this.versionTracker.increment(),s||this.mergeConsentDowngradeBaseline(this.getConsentDowngradeSnapshot()),this.emit("consent:changed"),s||this.emit("consent:external")}}reloadExternalConsentState(e=!1){let n=this.storage.getConsent(),s=this.storage.getFastPath();this.#s=!1,this.#n=void 0,this.state=this.#o(),(!this.state.hasConsent||!this.hasValidConsent())&&(n||s?this.invalidateStoredConsent():(this.state=this.freshVisitorState(),this.#s=!1,this.#n=void 0,B(this.config)))}getFastPathSyncOptions(){let e=this.getConsentTimestamp();return{...e===null?{}:{decisionTimestamp:e}}}getStoredLocale(){return this.#n}getDisplayLocale(){return this.#r}#i(e){this.#r=e;try{this.#c(e)}catch{}}#c(e){if(!this.state.hasConsent)return;let n=this.storage.getConsent();if(!n)return;let s=b.decodeForConfig(n.consent,this.config);if(s.language===e)return;let r=b.encode({...s,language:e}),o=this.storage.getConsentSnapshot();o&&(this.storage.updateConsentLocale(o,r),this.validatedStoredDecision=this.storage.getConsentSnapshot(),this.#n=e)}getFastPathConsentMap(){return this.getConsent()}getConsentDowngradeSnapshot(){return G(this.config,this.getFastPathConsentMap())}extendConsentDowngradeBaseline(e){this.#t&&(this.#e={...this.#e,...e})}mergeConsentDowngradeBaseline(e){let n={...this.#e};for(let[s,r]of Object.entries(e))n[s]=n[s]===!0||r===!0;this.#e=n,this.#t=!0}#o(){this.validatedStoredDecision=void 0;let e=this.storage.getConsentSnapshot(),n=e?.content;if(!n)return this.freshVisitorState();try{let s=this.#a(n);return this.validatedStoredDecision=e,s}catch(s){return console.error("[GdprEngine]",s),this.freshVisitorState()}}freshVisitorState(){return{hasConsent:!1,acceptedAll:!1,rejectedAll:!1,categories:this.getDefaultCategoryConsents(),services:this.getDefaultServiceConsents(),timestamp:Date.now()}}invalidateStoredConsent(){this.validatedStoredDecision=void 0,this.state=this.freshVisitorState(),this.#n=void 0,this.#s=!1,this.#e={},this.#t=!1;let e=!1;try{e=this.storage.invalidateConsent()}catch{}if(B(this.config),e)for(let n of this.storage.getContinuityScopes())n.frameworkId!==this.config.framework.id&&B({appId:n.appId,framework:{id:n.frameworkId,type:n.type},machine:n.machine,languages:{primary:n.primaryLanguage},consentEpoch:n.consentEpoch})}clearFastPathSignals(){try{this.storage.removeFastPath()}catch{}B(this.config)}#a(e){let n=b.decodeForConfig(e.consent,this.config);this.#n=n.language;let s=this.getDefaultCategoryConsents(),r=this.getDefaultServiceConsents(),o=this.#d();if(o){for(let l of this.config.categories)!l.essential&&typeof o.categories[l.id]=="boolean"&&(s[l.id]=o.categories[l.id]===!0);for(let l of this.config.services)!l.essential&&typeof o.services[l.id]=="boolean"&&(r[l.id]=o.services[l.id]===!0)}else if(n.state==="A")Object.keys(s).forEach(l=>{s[l]=!0}),Object.keys(r).forEach(l=>{r[l]=!0});else if(n.state!=="D"){if(n.state==="G"&&n.payload){let l=this.config.categories.filter(u=>!u.essential),d=b.decodeBitset(n.payload,l.length);l.forEach((u,p)=>{s[u.id]=d[p]??!1}),this.config.services.forEach(u=>{if(u.essential)r[u.id]=!0;else{let p=u.categoryId;r[u.id]=p?s[p]??!1:!1}})}}let i=this.config.categories.filter(l=>!l.essential),c=i.every(l=>s[l.id]===!0),a=i.every(l=>!s[l.id]);return this.#s=!0,{hasConsent:!0,acceptedAll:c,rejectedAll:a,categories:s,services:r,timestamp:n.timestamp*1e3}}#d(){let e=this.storage.getFastPath();if(!e||e.consentEpoch<(this.config.consentEpoch??0))return;let n=D(this.config.services,this.config.categories);return e.structuralVersion===n?void 0:e}getDefaultCategoryConsents(){let e={};return this.config.categories.forEach(n=>{e[n.id]=n.essential===!0}),e}getDefaultServiceConsents(){let e={};return this.config.services.forEach(n=>{e[n.id]=n.essential===!0}),e}acceptAll(){this.config.categories.forEach(e=>{this.state.categories[e.id]=!0}),this.config.services.forEach(e=>{this.state.services[e.id]=!0}),this.state.acceptedAll=!0,this.state.rejectedAll=!1,this.state.hasConsent=!0,this.state.timestamp=Date.now(),this.emit("consent:accepted-all"),this.emit("consent:changed")}rejectAll(){this.config.categories.forEach(e=>{this.state.categories[e.id]=e.essential===!0}),this.config.services.forEach(e=>{this.state.services[e.id]=e.essential===!0}),this.state.acceptedAll=!1,this.state.rejectedAll=!0,this.state.hasConsent=!0,this.state.timestamp=Date.now(),this.emit("consent:rejected-all"),this.emit("consent:changed")}getConsent(){return this.#f()}#f(){return{...this.state.categories,...this.state.services}}setConsent(e){Object.keys(this.state.categories).forEach(n=>{typeof e[n]=="boolean"&&(this.state.categories[n]=e[n])}),Object.keys(this.state.services).forEach(n=>{typeof e[n]=="boolean"&&(this.state.services[n]=e[n])}),this.state.timestamp=Date.now(),this.emit("consent:changed"),this.save()}getConsentState(){return{...this.state}}getEnforcementConsentState(){if(this.externalReconciliationPending)return this.freshVisitorState();let e=this.getFastPathConsentMap(),n={},s={};for(let r of this.config.categories)n[r.id]=e[r.id]===!0;for(let r of this.config.services)s[r.id]=e[r.id]===!0;return{...this.state,categories:n,services:s}}getCategoryConsent(e){return this.state.categories[e]||!1}setCategoryConsent(e,n){let s=this.config.categories.find(r=>r.id===e);s&&(s.essential&&!n||(this.state.categories[e]=n,this.state.timestamp=Date.now(),this.config.services.filter(r=>r.categoryId===e).forEach(r=>{this.setServiceConsent(r.id,n)}),this.emit("category:toggled",{id:e,value:n}),this.emit("consent:changed")))}getServiceConsent(e){return this.state.services[e]||!1}setServiceConsent(e,n){let s=this.config.services.find(r=>r.id===e);s&&(s.essential&&!n||(this.state.services[e]=n,this.state.timestamp=Date.now(),this.emit("service:toggled",{id:e,value:n}),this.emit("consent:changed")))}getCategoryConsents(){return{...this.state.categories}}getServiceConsents(){return{...this.state.services}}save(){this.state.hasConsent=!0,this.state.timestamp=Date.now();let e=this.getConsentDowngradeSnapshot(),n=this.#t&&de(this.#e,e);this.#u(),this.#e=e,this.#t=!0,this.emit("consent:saved"),n&&ue(this.config)==="reload"&&window.location.reload()}#u(){let e=this.#l();this.state.timestamp=b.decodeForConfig(e,this.config).timestamp*1e3;let n=this.storage.getConsentId();n||(n=crypto.randomUUID(),this.storage.setConsentId(n)),this.syncFastPath(r=>{this.persistToLocalStorage(e,r)}),this.validatedStoredDecision=this.storage.getConsentSnapshot();let s=this.#w(e,n);s&&(this.storage.queuePendingEvent(s),this.#g(s).then(async r=>{r&&await this.storage.withExclusiveAccess(()=>this.storage.removePendingEvent(s.eventId))}).catch(r=>console.error("[1Consent] Consent receipt cleanup failed",r)))}#h(){for(let e of this.storage.getPendingEvents())this.#g(e).then(async n=>{n&&await this.storage.withExclusiveAccess(()=>this.storage.removePendingEvent(e.eventId))}).catch(n=>console.error("[1Consent] Consent receipt retry cleanup failed",n))}buildConsentEntry(e){let n=this.getFrameworkPrefix();return n==="gdpr"||n==="us"?{consent:e}:null}persistToLocalStorage(e,n){let s=this.buildConsentEntry(e);s&&this.storage.updateConsent(s,n)}#l(){let e=this.config.categories.filter(i=>!i.essential),n=e.every(i=>this.state.categories[i.id]===!0),s=e.every(i=>!this.state.categories[i.id]),r,o;if(n)r="A";else if(s)r="D";else{r="G";let i=e.map(c=>this.state.categories[c.id]===!0);o=b.encodeBitset(i)}return b.encode({machine:this.config.machine,configId:this.config.appId,version:1,framework:this.getFrameworkPrefix(),state:r,payload:o,language:this.#r,timestamp:Math.floor(Date.now()/1e3)})}#w(e,n){let s=this.config.cmp?.consentApiUrl;if(!s)return null;let r=this.config.consentPublicationToken;if(!r)return console.error("[Consent] Missing signed publication context"),null;let o=this.getEvidenceConsentDecision(),i=kn(o),c=crypto.randomUUID();return{url:s,eventId:c,payload:{publicationToken:r,eventId:c,consentId:n,action:i,decision:o,consentString:e}}}getEvidenceConsentDecision(){let e=this.getFastPathConsentMap(),n=r=>J(r.filter(o=>!o.essential).map(o=>e[o.id]===!0)),s=n(this.config.categories);return{version:1,categoryProjection:s,categories:s,services:n(this.config.services),framework:""}}async#g(e){try{let n=await fetch(`${e.url}/v1/consent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e.payload),keepalive:!0});return n.status>=400&&n.status<500?(console.error("permanently rejected"),!0):n.ok}catch(n){return console.error("Consent failed",n),!1}}isConsentRequired(){return!!(this.externalReconciliationPending||!this.getConsentState().hasConsent||this.#p()||this.#m())}hasValidConsent(){return!this.isConsentRequired()}getConsentTimestamp(){return this.state.timestamp||null}#p(){let e=this.getConsentTimestamp(),n=Date.now();return e===null||!Number.isSafeInteger(e)||e<=0||!Number.isSafeInteger(n)||n<0||e>n?!0:n-e>33696e6}#m(){let e=Object.keys(this.state.categories);return(this.config.categories.map(s=>s.id)||[]).some(s=>!e.includes(s))}resolve(e){let n=L(e.bindingKey);if(n?.framework!=="gdpr")throw new Error(`[GDPR Engine] Invalid binding key: ${e.bindingKey}`);if(!e.id)throw new Error(`[GDPR Engine] ID required for GDPR bindings: ${e.bindingKey}`);let{entity:s}=n;if(s==="category")return this.resolveCategoryBinding(e.id);if(s==="service")return this.resolveServiceBinding(e.id);throw new Error(`[GDPR Engine] Unknown entity type: ${s}`)}resolveMany(e){let n=[];for(let s of e)try{let r=this.resolve(s);if(!s.id)continue;n.push({bindingKey:s.bindingKey,id:s.id,value:r.value,disabled:r.disabled})}catch(r){console.error("GDPR binding",s,r)}return{patches:n,version:this.versionTracker.getVersion()}}getFrameworkPrefix(){return"gdpr"}apply(e){let n=L(e.ref.bindingKey);if(n?.framework!=="gdpr")throw new Error(`[GDPR Engine] Invalid binding key: ${e.ref.bindingKey}`);if(!e.ref.id)throw new Error(`[GDPR Engine] ID required for GDPR bindings: ${e.ref.bindingKey}`);let{entity:s}=n,r=[];if(s==="category"){this.setCategoryConsent(e.ref.id,e.value);let i=this.resolveCategoryBinding(e.ref.id);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:i.value,disabled:i.disabled});let c=this.config.services.filter(a=>a.categoryId===e.ref.id);for(let a of c){let l=this.resolveServiceBinding(a.id);r.push({bindingKey:`consent:${this.getFrameworkPrefix()}.service`,id:a.id,value:l.value,disabled:l.disabled})}}else if(s==="service"){this.setServiceConsent(e.ref.id,e.value);let i=this.resolveServiceBinding(e.ref.id);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:i.value,disabled:i.disabled});let c=this.config.services.find(a=>a.id===e.ref.id);if(c?.categoryId){let a=this.resolveCategoryBinding(c.categoryId);r.push({bindingKey:`consent:${this.getFrameworkPrefix()}.category`,id:c.categoryId,value:a.value,disabled:a.disabled})}}else throw new Error(`[GDPR Engine] Unknown entity type: ${s}`);let o=this.versionTracker.increment();return{patches:r,version:o}}resolveCategoryBinding(e){let n=this.config.categories.find(o=>o.id===e);if(!n)throw new Error(`[GDPR Engine] Category not found: ${e}`);if(n.essential)return{value:!0,disabled:!0};let s=this.config.services.filter(o=>o.categoryId===e),r;return s.length===0?r=this.state.categories[e]||!1:r=s.every(o=>this.state.services[o.id]),{value:r,disabled:!1}}resolveServiceBinding(e){let n=this.config.services.find(r=>r.id===e);if(!n)throw new Error(`[GDPR Engine] Service not found: ${e}`);return n.essential?{value:!0,disabled:!0}:this.config.categories.find(r=>r.id===n.categoryId)?.essential?{value:!0,disabled:!0}:{value:this.state.services[e]||!1,disabled:!1}}};var qe=class extends M{engine;constructor(e,n){super(e,n),this.engine=new H(this.bus,this.storage,e),this.attachBlocking(this.engine),this.resolveInitialLocale(this.engine.getStoredLocale())}async init(){if(this.engine.isConsentRequired()){let n=this.ensureViewData("main");await this.ensureViewEngine(),await Promise.all([this.ensureViewLoaded("main"),n])}else await this.showReturningVisitorTrigger(),this.bus.emit({type:"consent:ready"})}async acceptAll(){await this.storage.withExclusiveAccess(()=>{this.engine.acceptAll(),this.engine.save()}),await this.close()}async rejectAll(){await this.storage.withExclusiveAccess(()=>{this.engine.rejectAll(),this.engine.save()}),await this.close()}};var cn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function yt(t){if(!/^[A-Za-z0-9_-]*$/.test(t)||t.length%4===1)throw new Error("invalid base64url");let e=t.length,n=new Uint8Array(Math.floor(e*6/8)),s=0,r=0,o=0;for(let i=0;i<e;i++)s=s<<6|cn.indexOf(t[i]),r+=6,r>=8&&(r-=8,n[o++]=s>>r&255);if(wt(n)!==t)throw new Error("invalid base64url");return n}function wt(t){let e="",n=0,s=0;for(let r=0;r<t.length;r++)for(n=n<<8|(t[r]??0),s+=8;s>=6;)s-=6,e+=cn[n>>s&63];return s>0&&(e+=cn[n<<6-s&63]??""),e}function U(){throw new Error("invalid TC")}function Ct(t,e,n){for(let s of n){let r=e*65536+s;t.has(r)&&U(),t.add(r)}}var ln=53;function dn(t){if(!Number.isSafeInteger(t)||t<1||t>ln)throw new Error(`Bit length must be an integer from 1 to ${ln}`)}var we=class{buffer;#e=0;constructor(e){this.buffer=e}readBits(e){if(dn(e),e>32){let s=0;for(let r=0;r<e;r++)s=s*2+(this.readBit()?1:0);return s}let n=0;for(let s=0;s<e;s++)n=n<<1|(this.readBit()?1:0);return n>>>0}readBit(){if(this.#e>=this.buffer.length*8)throw new Error("BitReader: Unexpected end of stream");let e=Math.floor(this.#e/8),n=7-this.#e%8,s=(this.buffer[e]??0)>>n&1;return this.#e++,s===1}readBool(){return this.readBit()}readLanguage(){let e=this.readBits(6),n=this.readBits(6);if(e>25||n>25)throw new Error("BitReader: invalid alpha-2 language field");let s=String.fromCharCode(e+65),r=String.fromCharCode(n+65);return(s+r).toLowerCase()}hasMore(){return this.hasMoreBits(1)}hasMoreBits(e){return dn(e),this.#e+e<=this.buffer.length*8}assertOnlyPadding(){let e=this.buffer.length*8-this.#e;for(;e>0;)(e-- >7||this.readBit())&&U()}},We=class{#e=[];writeBits(e,n){dn(n);let s=n===ln?Number.MAX_SAFE_INTEGER:2**n-1;if(!Number.isSafeInteger(e)||e<0||e>s)throw new Error(`BitWriter: value ${e} does not fit in ${n} bits`);let r=e.toString(2).padStart(n,"0");for(let o=0;o<n;o++)this.#e.push(r[o]==="1"?1:0)}writeBit(e){if(typeof e!="boolean")throw new Error("BitWriter: bit value must be boolean");this.#e.push(e?1:0)}writeBool(e){this.writeBit(e)}writeLanguage(e){if(!/^[A-Za-z]{2}$/.test(e))throw new Error("BitWriter: language must be exactly two ASCII letters");let n=e.toUpperCase();this.writeBits(n.charCodeAt(0)-65,6),this.writeBits(n.charCodeAt(1)-65,6)}toUint8Array(){let e=Math.ceil(this.#e.length/8),n=new Uint8Array(e);for(let s=0;s<this.#e.length;s++){let r=Math.floor(s/8),o=7-s%8;if(this.#e[s]===1){let i=n[r];i!==void 0&&(n[r]=i|1<<o)}}return n}};function Ye(t){let e=yt(t);if(e.length!==0)return new we(e).readBits(3)}function vt(t){let e=t.split("."),n=e[0]??"",s=yt(n),r=new we(s),o=r.readBits(6);if(o!==2)throw new Error(`TCF: unsupported TC string version ${o}`);let i=r.readBits(36),c=r.readBits(36),a=r.readBits(12),l=r.readBits(12),d=r.readBits(6),u=r.readLanguage(),p=r.readBits(12),y=r.readBits(6),f=r.readBool(),S=r.readBool(),v=un(r,12),m=un(r,24),T=un(r,24),h=r.readBool(),g=r.readLanguage(),I=fn(r),C=fn(r),P=qr(r);r.assertOnlyPadding();let k={version:o,created:i,lastUpdated:c,cmpId:a,cmpVersion:l,consentScreen:d,consentLanguage:u,vendorListVersion:p,tcfPolicyVersion:y,isServiceSpecific:f,useNonStandardStacks:S,specialFeatureOptIns:v,purposeConsents:m,purposeLegitimateInterests:T,purposeOneTreatment:h,publisherCC:g,vendorConsents:I,vendorLegitimateInterests:C,publisherRestrictions:P};for(let N=1;N<e.length;N++){let _=new we(yt(e[N]??""));_.readBits(3)===1&&(k.disclosedVendors=fn(_),_.assertOnlyPadding())}return k}function un(t,e){let n=new Set;for(let s=1;s<=e;s++)t.readBool()&&n.add(s);return n}function fn(t){let e=t.readBits(16);if(!t.readBool()){let r=new Set;for(let o=1;o<=e;o++)t.readBool()&&r.add(o);return r}let s=Is(t,t.readBits(12),e);return s.some(r=>r.end===e)||U(),As(s)}function Is(t,e,n){let s=[];for(let r=0;r<e;r++){let o=t.readBool(),i=t.readBits(16);if(Ts(i,n),!o){s.push({start:i,end:i});continue}let c=t.readBits(16);Ts(c,n),c<=i&&U(),s.push({start:i,end:c})}return s}function Ts(t,e){(t<1||t>e)&&U()}function As(t){let e=new Set;t.sort((s,r)=>s.start-r.start||s.end-r.end);let n=0;for(let s of t){let r=Math.max(s.start,n+1);for(let o=r;o<=s.end;o++)e.add(o);n=Math.max(n,s.end)}return e}function qr(t){let e=t.readBits(12),n=[],s=new Set;for(let r=0;r<e;r++){let o=t.readBits(6);(o<1||o>24)&&U();let i=t.readBits(2);i>2&&U();let c=t.readBits(12),a=As(Is(t,c,65535));Ct(s,o,a),n.push({purposeId:o,restrictionType:i,vendorIds:a})}return n}function Et(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("TCF: invalid millisecond timestamp");let e=new Date(t),n=Math.round(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())/100);try{Ce(n,"derived")}catch{throw new Error("TCF: invalid millisecond timestamp")}return n}function Ce(t,e){if(!Number.isSafeInteger(t)||t<0||t>68719476735||t%864e3!==0)throw new Error(`TCF: invalid ${e} timestamp`)}function bt(t,e){try{return Ce(t,"Created"),Ce(e,"LastUpdated"),t===e}catch{return!1}}function Os(t){return{resolve(e){let n=t.stacks[e];return n?{purposes:n.purposes,specialFeatures:n.specialFeatures}:null}}}var Tt=class t{decode;encode;opts;#e=null;#t=[];constructor(e,n,s={}){this.decode=e,this.encode=n,this.opts=s,!this.opts.stackResolver&&this.opts.base&&(this.opts.stackResolver=Os(this.opts.base))}static withBase(e,n,s,r={}){return new t(e,n,{...r,base:s,stackResolver:Os(s)})}static raw(e,n,s={}){return new t(e,n,s)}load(e){let n=this.decode(e);if(this.#e=n,this.#t=e.split("."),!bt(this.#e.created,this.#e.lastUpdated))throw new Error("TCF: invalid Created/LastUpdated timestamps");return this.#e}startNew(){this.#t=[];let e=this.#i();return this.#e={version:2,created:e,lastUpdated:e,cmpId:this.opts.base?.cmpId??0,cmpVersion:this.opts.base?.cmpVersion??1,consentScreen:1,consentLanguage:"en",vendorListVersion:this.opts.base?.vendorListVersion||0,tcfPolicyVersion:this.opts.base?.tcfPolicyVersion??5,isServiceSpecific:!0,useNonStandardStacks:!1,specialFeatureOptIns:new Set(this.opts.base?.specialFeatureOptins||[]),purposeConsents:new Set(this.opts.base?.purposeConsents||[]),purposeLegitimateInterests:new Set(this.opts.base?.purposeLegitimateInterests||[]),purposeOneTreatment:!1,publisherCC:"AA",vendorConsents:new Set(this.opts.base?.vendorConsents||[]),vendorLegitimateInterests:new Set(this.opts.base?.vendorLegitimateInterests||[]),disclosedVendors:new Set(this.opts.base?.disclosedVendors??[])},this.#e}getDecoded(){if(!this.#e)throw new Error("TCF: call load(tcString) first");return this.#e}toTcString(){let e=this.encode(this.getDecoded()).split(".");if(this.#t.length<=1)return e.join(".");let n=new Set;for(let r of e.slice(1)){let o=Ye(r);o!==void 0&&n.add(o)}let s=this.#t.slice(1).filter(r=>{let o=Ye(r);return o!==void 0&&!n.has(o)});return[...e,...s].join(".")}getPurposeConsent(e){return this.#o(e),this.getDecoded().purposeConsents.has(e)}getPurposeConsents(){let e={},n=this.getDecoded().purposeConsents;for(let s=1;s<=24;s++)e[s]=n.has(s);return e}getPurposeLegitimateInterest(e){return this.#o(e),this.getDecoded().purposeLegitimateInterests.has(e)}getSpecialFeatureOptIn(e){return this.#d(e),this.getDecoded().specialFeatureOptIns.has(e)}getSpecialFeatureOptIns(){let e={},n=this.getDecoded().specialFeatureOptIns;for(let s=1;s<=12;s++)e[s]=n.has(s);return e}getVendorConsent(e){return this.#a(e),this.getDecoded().vendorConsents.has(e)}getVendorLegitimateInterest(e){return this.#a(e),this.getDecoded().vendorLegitimateInterests.has(e)}setConsentLanguage(e){let n=e.toLowerCase();if(!/^[a-z]{2}$/.test(n))throw new Error("TCF: consentLanguage must be a two-letter ISO 639-1 code");let s=this.getDecoded();return s.consentLanguage===n?this:(s.consentLanguage=n,this.#r())}setPurposeConsent(e,n){return this.#o(e),this.#s(this.getDecoded().purposeConsents,e,n)?this.#r():this}setPurposeLegitimateInterest(e,n){if(this.#o(e),n&&this.#c()){if(e===1)throw new Error("TCF Policy: Purpose 1 requires consent, not legitimate interest");if(e>=3&&e<=6)throw new Error(`TCF 2.4: Purpose ${e} requires consent and cannot use legitimate interest`)}return this.#s(this.getDecoded().purposeLegitimateInterests,e,n)?this.#r():this}setVendorConsent(e,n){return this.#a(e),this.#s(this.getDecoded().vendorConsents,e,n)?this.#r():this}setVendorLegitimateInterest(e,n){return this.#a(e),this.#s(this.getDecoded().vendorLegitimateInterests,e,n)?this.#r():this}setSpecialFeatureOptIn(e,n){return this.#d(e),this.#s(this.getDecoded().specialFeatureOptIns,e,n)?this.#r():this}setPurposeConsents(e,n){for(let s of e)this.setPurposeConsent(s,n);return this}setPurposeLegitimateInterests(e,n){for(let s of e)this.setPurposeLegitimateInterest(s,n);return this}setVendorConsents(e,n){for(let s of e)this.setVendorConsent(s,n);return this}setVendorLegitimateInterests(e,n){for(let s of e)this.setVendorLegitimateInterest(s,n);return this}setSpecialFeatureOptIns(e,n){for(let s of e)this.setSpecialFeatureOptIn(s,n);return this}applyStack(e,n){let s=this.opts.stackResolver;if(!s)throw new Error("TCF: applyStack requires opts.base or opts.stackResolver");let r=s.resolve(e);if(!r)throw new Error(`TCF: unknown stackId ${e}`);return r.purposes?.length&&this.setPurposeConsents(r.purposes,n),r.purposeLI?.length&&this.setPurposeLegitimateInterests(r.purposeLI,n),r.vendors?.length&&this.setVendorConsents(r.vendors,n),r.vendorLI?.length&&this.setVendorLegitimateInterests(r.vendorLI,n),r.specialFeatures?.length&&this.setSpecialFeatureOptIns(r.specialFeatures,n),this}setPublisherRestriction(e,n,s){this.#o(e);let r=this.getDecoded(),o=new Set;for(let a of s)this.#a(a),o.add(a);let i=r.publisherRestrictions?.find(a=>a.purposeId===e);if(i?.restrictionType===n&&this.#n(i.vendorIds,o))return this;r.publisherRestrictions||(r.publisherRestrictions=[]);let c=i;return c?(c.restrictionType=n,c.vendorIds.clear()):(c={purposeId:e,restrictionType:n,vendorIds:new Set},r.publisherRestrictions.push(c)),c.vendorIds=o,this.#r()}removePublisherRestrictionVendors(e,n){this.#o(e);let s=this.getDecoded(),r=s.publisherRestrictions;if(!r?.length)return this;let o=r.findIndex(a=>a.purposeId===e);if(o===-1)return this;let i=r[o];if(!i)return this;let c=!1;for(let a of n)this.#a(a),c=i.vendorIds.delete(a)||c;return c?(i.vendorIds.size===0&&(r.splice(o,1),r.length===0&&delete s.publisherRestrictions),this.#r()):this}clearPublisherRestriction(e){this.#o(e);let n=this.getDecoded(),s=n.publisherRestrictions;if(!s?.length)return this;let r=s.findIndex(o=>o.purposeId===e);return r===-1?this:(s.splice(r,1),s.length===0&&delete n.publisherRestrictions,this.#r())}#s(e,n,s){return e.has(n)===s?!1:(s?e.add(n):e.delete(n),!0)}#n(e,n){return e.size===n.size&&[...e].every(s=>n.has(s))}#r(){let e=this.getDecoded(),n=this.#i();return e.created=n,e.lastUpdated=n,this}#i(){return Et(this.opts.now?this.opts.now():Date.now())}#c(){return this.opts.enforceTcfPolicy!==!1}#o(e){if(!this.opts.validateIds)return;let n=this.opts.maxPurposeId??24;if(!Number.isInteger(e)||e<1||e>n)throw new Error(`TCF: invalid purposeId ${e} (expected 1..${n})`)}#a(e){if(!this.opts.validateIds)return;let n=this.opts.maxVendorId;if(!Number.isInteger(e)||e<1||n!=null&&e>n)throw new Error(`TCF: invalid vendorId ${e} (expected >=1${n!=null?` and <=${n}`:""})`)}#d(e){if(!this.opts.validateIds)return;let n=this.opts.maxSpecialFeatureId??12;if(!Number.isInteger(e)||e<1||e>n)throw new Error(`TCF: invalid specialFeatureId ${e} (expected 1..${n})`)}};function xs(t){let e=new We,n=t.created??t.lastUpdated??Et(Date.now()),s=t.created??n,r=t.lastUpdated??n;if(Ce(s,"Created"),Ce(r,"LastUpdated"),s!==r)throw new Error("TCF: Created and LastUpdated must be equal");let o=t.version??2;if(o!==2)throw new Error(`TCF: unsupported TC string version ${o}`);e.writeBits(o,6),e.writeBits(s,36),e.writeBits(r,36),e.writeBits(t.cmpId??0,12),e.writeBits(t.cmpVersion??0,12),e.writeBits(t.consentScreen??0,6),e.writeLanguage(t.consentLanguage??"en"),e.writeBits(t.vendorListVersion??0,12);let i=t.tcfPolicyVersion??5;if(i!==5)throw new Error(`TCF 2.4: unsupported policy version ${i}`);e.writeBits(i,6),e.writeBool(t.isServiceSpecific??!1),e.writeBool(t.useNonStandardStacks??!1),hn(e,t.specialFeatureOptIns??new Set,12,"special-feature"),hn(e,t.purposeConsents??new Set,24,"purpose-consent"),hn(e,t.purposeLegitimateInterests??new Set,24,"purpose-legitimate-interest"),e.writeBool(t.purposeOneTreatment??!1),e.writeLanguage(t.publisherCC??"aa"),pn(e,t.vendorConsents,"vendor-consent"),pn(e,t.vendorLegitimateInterests,"vendor-legitimate-interest"),Wr(e,t.publisherRestrictions??[]);let c=e.toUint8Array(),a=wt(c);if(t.disclosedVendors===void 0)throw new Error("TCF 2.4: disclosed vendors are required");let l=new We;l.writeBits(1,3),pn(l,t.disclosedVendors,"disclosed-vendor");let d=l.toUint8Array();return`${a}.${wt(d)}`}function hn(t,e,n,s){for(let r of e)z(r,1,n,s);for(let r=1;r<=n;r++)t.writeBool(e.has(r))}function pn(t,e,n){if(e.size===0){t.writeBits(0,16),t.writeBool(!1);return}let s=Array.from(e).sort((a,l)=>a-l);for(let a of s)z(a,1,65535,n);let r=s[s.length-1]??0,o=_s(s),i=r,c=12+o.reduce((a,l)=>a+1+16+(l.start===l.end?0:16),0);if(i<=c){t.writeBits(r,16),t.writeBool(!1);for(let a=1;a<=r;a++)t.writeBool(e.has(a))}else{t.writeBits(r,16),t.writeBool(!0),z(o.length,0,2**12-1,`${n} range count`),t.writeBits(o.length,12);for(let a of o)a.start===a.end?(t.writeBool(!1),t.writeBits(a.start,16)):(t.writeBool(!0),t.writeBits(a.start,16),t.writeBits(a.end,16))}}function _s(t){let e=[];if(t.length===0)return e;let n=t[0]??0,s=n;for(let r=1;r<t.length;r++){let o=t[r]??0;o===s+1?s=o:(e.push({start:n,end:s}),n=o,s=n)}return e.push({start:n,end:s}),e}function Wr(t,e){z(e.length,0,2**12-1,"publisher restriction count");let n=new Set;t.writeBits(e.length,12);for(let s of e){z(s.purposeId,1,24,"publisher restriction purpose"),z(s.restrictionType,0,2,"publisher restriction type"),t.writeBits(s.purposeId,6),t.writeBits(s.restrictionType,2);let r=Array.from(s.vendorIds).sort((i,c)=>i-c);for(let i of r)z(i,1,65535,"publisher restriction vendor");Ct(n,s.purposeId,r);let o=_s(r);z(o.length,0,2**12-1,"publisher restriction range count"),t.writeBits(o.length,12);for(let i of o)i.start===i.end?(t.writeBool(!1),t.writeBits(i.start,16)):(t.writeBool(!0),t.writeBits(i.start,16),t.writeBits(i.end,16))}}function z(t,e,n,s){if(!Number.isSafeInteger(t)||t<e||t>n)throw new Error(`TCF: invalid ${s} ${t} (expected ${e}..${n})`)}function ve(t){return Object.fromEntries([...t].map(e=>[e.toString(),!0]))}function Ps(t){try{let e=t.split(".").slice(1).map(n=>Ye(n));return e.length===1&&e[0]===1}catch{return!1}}function Yr(t,e){if(t.version!==2||!bt(t.created,t.lastUpdated)||t.cmpId!==ke||t.tcfPolicyVersion!==X||!t.isServiceSpecific||!/^[a-z]{2}$/.test(t.consentLanguage)||!/^[a-z]{2}$/i.test(t.publisherCC)||!t.disclosedVendors)return;let n={};for(let r of t.publisherRestrictions??[]){if(r.restrictionType!==0&&r.restrictionType!==1&&r.restrictionType!==2)return;let o=r.purposeId.toString(),i=n[o]??{};for(let c of r.vendorIds){let a=c.toString();if(a in i)return;i[a]=r.restrictionType}n[o]=i}let s={...e?{enableAdvertiserConsentMode:!0}:{},tcfPolicyVersion:t.tcfPolicyVersion,cmpId:t.cmpId,cmpVersion:t.cmpVersion,isServiceSpecific:t.isServiceSpecific,useNonStandardTexts:t.useNonStandardStacks,publisherCC:t.publisherCC.toUpperCase(),purposeOneTreatment:t.purposeOneTreatment,purpose:{consents:ve(t.purposeConsents),legitimateInterests:ve(t.purposeLegitimateInterests)},vendor:{consents:ve(t.vendorConsents),legitimateInterests:ve(t.vendorLegitimateInterests),disclosedVendors:ve(t.disclosedVendors)},specialFeatureOptins:ve(t.specialFeatureOptIns),publisher:{consents:{},legitimateInterests:{},customPurpose:{consents:{},legitimateInterests:{}},restrictions:n}};return Un(s)?s:void 0}var It=class extends H{tcfController;#e;#t;#s;#n;#r;#i;#c=!1;constructor(e,n,s){super(e,n,s),this.#e=s;let r=s.vendors.map(c=>c.id);[this.#t,this.#s,this.#n,this.#r,this.#i]=Nn(s.vendors);let o={cmpId:ke,cmpVersion:Gn,vendorListVersion:"vendorListVersion"in s.framework?s.framework.vendorListVersion:0,tcfPolicyVersion:X,purposeConsents:[],purposeLegitimateInterests:this.#s,specialFeatureOptins:[],vendorConsents:[],vendorLegitimateInterests:this.#i,disclosedVendors:r,purposes:[...new Set([...this.#t,...this.#s])],stacks:{}};this.tcfController=Tt.withBase(vt,xs,o);let i=this.#o(r);if(i&&this.hasValidConsent())try{this.syncFastPath(),this.mergeConsentDowngradeBaseline(this.getConsentDowngradeSnapshot())}catch{}else this.clearFastPathSignals();i&&this.extendConsentDowngradeBaseline(this.#d())}bootSyncsFastPath(){return!1}reloadExternalConsentState(e=!1){super.reloadExternalConsentState(e);let n=this.#e.vendors.map(r=>r.id),s=this.#o(n);this.#c=!e&&!s,this.#c&&(this.tcfController.setPurposeLegitimateInterests(this.#s,!1),this.tcfController.setVendorLegitimateInterests(this.#i,!1))}markLegitimateInterestDisclosuresVisible(){!this.#c||this.state.hasConsent||(this.#c=!1,this.tcfController.setPurposeLegitimateInterests(this.#s,!0),this.tcfController.setVendorLegitimateInterests(this.#i,!0),this.emit("consent:changed"))}#o(e){let n=this.storage.getConsent(),s=!1;if(this.state.hasConsent&&n?.tcString&&Ps(n.tcString))try{this.tcfController.load(n.tcString);let r=this.getTcfApiDecisionData();s=ot(Object.keys(r.vendor.disclosedVendors).map(Number))===ot(e)&&this.#a(r)}catch{}return s||(this.#f(),n&&this.invalidateStoredConsent()),s}#a(e){let n=(r,o)=>Object.keys(r).every(i=>o.includes(Number(i)));if(!n(e.purpose.consents,this.#t)||!n(e.purpose.legitimateInterests,this.#s)||!n(e.vendor.consents,this.#r)||!n(e.vendor.legitimateInterests,this.#i)||!n(e.specialFeatureOptins,this.#n))return!1;let s=new Map(this.#e.vendors.map(r=>[r.id,r]));for(let[r,o]of Object.entries(e.publisher.restrictions)){let i=Number(r);for(let[c,a]of Object.entries(o)){let l=s.get(Number(c));if(!l||!(l.consentPurposeIds.includes(i)||l.legitimateInterestPurposeIds.includes(i))||a!==0&&!l.flexiblePurposeIds.includes(i)||a===2&&!l.legitimateInterestPurposeIds.includes(i))return!1}}return!0}getFastPathSyncOptions(){let e=this.getTcString(),n=this.getTcfApiDecisionData();return{...super.getFastPathSyncOptions(),decisionIntegrity:pt(e),tcfCmpId:ke,tcfValidationVersion:jn,tcfDisclosedVendorKey:ot(this.#e.vendors.map(s=>s.id)),tcfApiData:n,tcfApiDataIntegrity:pt($n(e,n))}}getConsentDowngradeSnapshot(){return{...super.getConsentDowngradeSnapshot(),...this.#d()}}getEvidenceConsentDecision(){return{...super.getEvidenceConsentDecision(),framework:J(Object.values(this.#d()))}}getExternalConsentSnapshot(e){let n=super.getExternalConsentSnapshot(e),r=Se(e,this.storage.getScope())?.consent?.tcString;if(!r)return n;try{let o=vt(r);if(o.version!==2||o.tcfPolicyVersion!==X||o.cmpId!==ke)return n;let i={...n??{}};for(let c of this.#t)i[`tcf:purpose:${c}`]=o.purposeConsents.has(c);for(let c of this.#s)i[`tcf:purposeLI:${c}`]=o.purposeLegitimateInterests.has(c);for(let c of this.#n)i[`tcf:specialFeature:${c}`]=o.specialFeatureOptIns.has(c);for(let c of this.#r)i[`tcf:vendor:${c}`]=o.vendorConsents.has(c);for(let c of this.#i)i[`tcf:vendorLI:${c}`]=o.vendorLegitimateInterests.has(c);return i}catch{return n}}getCurrentExternalConsentSnapshot(){let e=super.getCurrentExternalConsentSnapshot();return e?{...e,...this.#d()}:void 0}#d(){let e={};for(let n of this.#t)e[`tcf:purpose:${n}`]=this.tcfController.getPurposeConsent(n);for(let n of this.#s)e[`tcf:purposeLI:${n}`]=this.tcfController.getPurposeLegitimateInterest(n);for(let n of this.#n)e[`tcf:specialFeature:${n}`]=this.tcfController.getSpecialFeatureOptIn(n);for(let n of this.#r)e[`tcf:vendor:${n}`]=this.tcfController.getVendorConsent(n);for(let n of this.#i)e[`tcf:vendorLI:${n}`]=this.tcfController.getVendorLegitimateInterest(n);return e}acceptAll(){super.acceptAll(),this.tcfController.setPurposeConsents(this.#t,!0),this.tcfController.setPurposeLegitimateInterests(this.#s,!0),this.tcfController.setSpecialFeatureOptIns(this.#n,!0),this.tcfController.setVendorConsents(this.#r,!0),this.tcfController.setVendorLegitimateInterests(this.#i,!0)}rejectAll(){super.rejectAll(),this.tcfController.setPurposeConsents(this.#t,!1),this.tcfController.setPurposeLegitimateInterests(this.#s,!1),this.tcfController.setSpecialFeatureOptIns(this.#n,!1),this.tcfController.setVendorConsents(this.#r,!1),this.tcfController.setVendorLegitimateInterests(this.#i,!1)}getPurposeConsent(e){return this.tcfController.getPurposeConsent(e)}setPurposeConsent(e,n){if(!this.#t.includes(e))throw new Error(`[TCF Engine] Purpose ${e} was not disclosed for consent`);this.tcfController.setPurposeConsent(e,n),this.state.timestamp=Date.now(),this.emit("purpose:toggled",{id:e,value:n}),this.emit("consent:changed")}getPurposeLegitimateInterest(e){return this.tcfController.getPurposeLegitimateInterest(e)}setPurposeLegitimateInterest(e,n){if(!this.#s.includes(e))throw new Error(`[TCF Engine] Purpose ${e} was not disclosed for legitimate interest`);this.tcfController.setPurposeLegitimateInterest(e,n),this.state.timestamp=Date.now(),this.emit("purpose-legitimate-interest:toggled",{id:e,value:n}),this.emit("consent:changed")}getSpecialFeatureOptIn(e){return this.tcfController.getSpecialFeatureOptIn(e)}setSpecialFeatureOptIn(e,n){if(!this.#n.includes(e))throw new Error(`[TCF Engine] Special Feature ${e} was not disclosed`);this.tcfController.setSpecialFeatureOptIn(e,n),this.state.timestamp=Date.now(),this.emit("special-feature:toggled",{id:e,value:n}),this.emit("consent:changed")}getVendorConsent(e){return this.tcfController.getVendorConsent(e)}setVendorConsent(e,n){if(!this.#r.includes(e))throw new Error(`[TCF Engine] Vendor ${e} was not disclosed for consent`);this.tcfController.setVendorConsent(e,n),this.state.timestamp=Date.now(),this.emit("vendor:toggled",{id:e,value:n}),this.emit("consent:changed")}getVendorLegitimateInterest(e){return this.tcfController.getVendorLegitimateInterest(e)}setVendorLegitimateInterest(e,n){if(!this.#i.includes(e))throw new Error(`[TCF Engine] Vendor ${e} was not disclosed for legitimate interest`);this.tcfController.setVendorLegitimateInterest(e,n),this.state.timestamp=Date.now(),this.emit("vendor-legitimate-interest:toggled",{id:e,value:n}),this.emit("consent:changed")}getTcString(){return this.tcfController.toTcString()}getTcfApiDecisionData(){let e=this.getTcString(),n=vt(e),s=Ps(e)?Yr(n,this.#e.gcm!==void 0):void 0;if(!s||!this.#a(s))throw new Error("Current TC model cannot produce complete current-GVL web TCData");return s}save(){this.#u(),super.save()}getPurposes(){let e=[];for(let n of new Set([...this.#t,...this.#s]))e.push({id:n,consent:this.getPurposeConsent(n),legitimateInterest:this.getPurposeLegitimateInterest(n)});return e}getSpecialFeatures(){let e=[];for(let n of this.#n)e.push({id:n,optIn:this.getSpecialFeatureOptIn(n)});return e}buildConsentEntry(e){return{consent:e,tcString:this.tcfController.toTcString()}}#f(){this.tcfController.startNew(),this.#u()}#u(){let e=En(this.getDisplayLocale());e&&this.tcfController.setConsentLanguage(e)}getFrameworkPrefix(){return"tcf"}resolve(e){let n=L(e.bindingKey);if(n?.framework==="gdpr")return super.resolve(e);if(n?.framework!=="tcf")throw new Error(`[TCF Engine] Invalid binding key: ${e.bindingKey}`);let{entity:s}=n;if(!e.id)throw new Error(`[TCF Engine] ID required for TCF bindings: ${e.bindingKey}`);let r=parseInt(e.id,10);if(Number.isNaN(r))throw new Error(`[TCF Engine] Invalid numeric ID for TCF binding: ${e.id}`);switch(s){case"purpose":return this.#h(r);case"purposeLegitimateInterest":return this.#l(r);case"specialPurpose":return this.#w(r);case"feature":return this.#g(r);case"specialFeature":return this.#p(r);case"vendor":return this.#m(r);case"vendorLegitimateInterest":return this.#v(r);case"stack":return this.#y(r);default:throw new Error(`[TCF Engine] Unknown entity type: ${s}`)}}resolveMany(e){return{patches:e.map(s=>{let r=this.resolve(s);if(!s.id)throw new Error(`[TCF Engine] ID required for ${s.bindingKey}`);return{bindingKey:s.bindingKey,id:s.id,value:r.value,disabled:r.disabled}}),version:this.versionTracker.getVersion()}}apply(e){let n=L(e.ref.bindingKey);if(n?.framework==="gdpr")return super.apply(e);if(n?.framework!=="tcf")throw new Error(`[TCF Engine] Invalid binding key: ${e.ref.bindingKey}`);if(!e.ref.id)throw new Error(`[TCF Engine] ID required for TCF bindings: ${e.ref.bindingKey}`);let{entity:s}=n,r=[];if(s==="purpose"){let i=parseInt(e.ref.id,10);this.setPurposeConsent(i,e.value);let c=this.#h(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled})}else if(s==="purposeLegitimateInterest"){let i=parseInt(e.ref.id,10);this.setPurposeLegitimateInterest(i,e.value);let c=this.#l(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled})}else if(s==="specialFeature"){let i=parseInt(e.ref.id,10);this.setSpecialFeatureOptIn(i,e.value);let c=this.#p(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled})}else if(s==="vendor"){let i=parseInt(e.ref.id,10);this.setVendorConsent(i,e.value);let c=this.#m(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled})}else if(s==="vendorLegitimateInterest"){let i=parseInt(e.ref.id,10);this.setVendorLegitimateInterest(i,e.value);let c=this.#v(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled})}else if(s==="stack"){let i=parseInt(e.ref.id,10),c=this.#C(i);for(let l of c.purposes)this.#t.includes(l)&&(this.tcfController.setPurposeConsent(l,e.value),this.emit("purpose:toggled",{id:l,value:e.value}));for(let l of c.specialFeatures)this.#n.includes(l)&&(this.tcfController.setSpecialFeatureOptIn(l,e.value),this.emit("special-feature:toggled",{id:l,value:e.value}));this.state.timestamp=Date.now(),this.emit("consent:changed");let a=this.#y(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:a.value,disabled:a.disabled});for(let l of c.purposes){if(!this.#t.includes(l))continue;let d=this.#h(l);r.push({bindingKey:"consent:tcf.purpose",id:String(l),value:d.value,disabled:d.disabled})}for(let l of c.specialFeatures){if(!this.#n.includes(l))continue;let d=this.#p(l);r.push({bindingKey:"consent:tcf.specialFeature",id:String(l),value:d.value,disabled:d.disabled})}}else throw new Error(`[TCF Engine] Cannot apply changes to entity type: ${s}`);let o=this.versionTracker.increment();return{patches:r,version:o}}#h(e){if(!this.#t.includes(e))throw new Error(`[TCF Engine] Purpose ${e} has no consent legal basis`);return{value:this.getPurposeConsent(e),disabled:!1}}#l(e){if(!this.#s.includes(e))throw new Error(`[TCF Engine] Purpose ${e} has no legitimate-interest legal basis`);return{value:this.getPurposeLegitimateInterest(e),disabled:!1}}#w(e){return{value:!0,disabled:!0}}#g(e){return{value:!0,disabled:!0}}#p(e){if(!this.#n.includes(e))throw new Error(`[TCF Engine] Special Feature ${e} was not disclosed`);return{value:this.getSpecialFeatureOptIn(e),disabled:!1}}#m(e){if(!this.#r.includes(e))throw new Error(`[TCF Engine] Vendor ${e} has no consent legal basis`);return{value:this.getVendorConsent(e),disabled:!1}}#v(e){if(!this.#i.includes(e))throw new Error(`[TCF Engine] Vendor ${e} has no legitimate-interest legal basis`);return{value:this.getVendorLegitimateInterest(e),disabled:!1}}#C(e){if(typeof window>"u")throw new Error("[TCF Engine] Stack UI data is unavailable outside the browser");let n=window.__1consent?.getTranslations();if(!n||!("tcf"in n))throw new Error("[TCF Engine] Stack UI data is unavailable");let s=n.tcf?.gvl?.stacks?.[e];if(!s)throw new Error(`[TCF Engine] Unknown stack id: ${e}`);if(s.purposes.length+s.specialFeatures.length<2)throw new Error(`[TCF Engine] Invalid stack membership for id: ${e}`);return{purposes:s.purposes,specialFeatures:s.specialFeatures}}#y(e){let n=this.#C(e),s=n.purposes.filter(a=>this.#t.includes(a)),r=n.specialFeatures.filter(a=>this.#n.includes(a)),o=s.length+r.length>0,i=s.every(a=>this.getPurposeConsent(a)),c=r.every(a=>this.getSpecialFeatureOptIn(a));return{value:o&&i&&c,disabled:!o}}};var Xr="Your choices for IAB vendors apply only to Purposes and Special Features. You cannot object here to processing for the Special Purposes disclosed by a vendor. Vendors may use Special Features for Special Purpose 1 (ensuring security, preventing and detecting fraud, and fixing errors), regardless of your Special Feature choices.",Jr="Ihre Auswahl f\xFCr IAB-Anbieter gilt nur f\xFCr Zwecke und Besondere Funktionen. Der Verarbeitung f\xFCr die von einem Anbieter offengelegten Besonderen Zwecke k\xF6nnen Sie hier nicht widersprechen. Anbieter d\xFCrfen Besondere Funktionen f\xFCr den Besonderen Zweck 1 (Sicherheit gew\xE4hrleisten, Betrug verhindern und erkennen sowie Fehler beheben) unabh\xE4ngig von Ihrer Auswahl zu Besonderen Funktionen verwenden.",Ls="Your choices apply only to this service.",ks="Ihre Auswahl gilt nur f\xFCr diesen Dienst.",Ns="1Consent stores the TC String in first-party browser local storage (\u201C1consent\u201D) for up to 390 days. With server sync enabled, the \u201C1consent\u201D cookie stores only a compact decision signal until then.",Vs="1Consent speichert den TC String bis zu 390 Tage im lokalen Erstanbieter-Browserspeicher (\u201E1consent\u201C). Bei aktivierter Server-Synchronisierung enth\xE4lt das \u201E1consent\u201C-Cookie bis dahin nur ein kompaktes Entscheidungssignal.",Zr="These choices and objections apply only to this service.",Qr="Diese Auswahl und Widerspr\xFCche gelten nur f\xFCr diesen Dienst.",ei="1Consent stores your privacy choices and TC String in first-party browser local storage under the key \u201C1consent\u201D for up to 390 days. If this service enables server-readable consent synchronisation, 1Consent also stores a compact first-party decision signal (not the TC String) in a cookie named \u201C1consent\u201D until the same expiry.",ti="1Consent speichert Ihre Datenschutzauswahl und den TC String bis zu 390 Tage lang im lokalen Erstanbieter-Browserspeicher unter dem Schl\xFCssel \u201E1consent\u201C. Falls dieser Dienst die serverlesbare Einwilligungssynchronisierung aktiviert, speichert 1Consent au\xDFerdem bis zum selben Ablaufdatum ein kompaktes Erstanbieter-Entscheidungssignal (nicht den TC String) in einem Cookie namens \u201E1consent\u201C.";function Ds(t){return t==="de"?ks:Ls}function ni(t){return t==="de"?Vs:Ns}function si(t){return t.split("-")[0]?.toLowerCase()==="de"?"de":"en"}function At(t,e,n){let s=t.toLowerCase();if(n.some(o=>s.includes(o.toLowerCase())))return t;let r=t.trimEnd();return r.length===0?e:`${r} ${e}`}function ri(t){return t==="de"?[ks,Qr]:[Ls,Zr]}function ii(t){return t==="de"?[Vs,ti]:[Ns,ei]}function oi(t,e,n=e){let s=si(n),r=s==="de"?Jr:Xr,o=ri(s),i=ii(s),c=At(t.description,Ds(s),o),a=t.details,l=At(At(a?.description??"",Ds(s),o),ni(s),i),d=At(l,r,[r]);return c===t.description&&a?.description===d?t:{...t,description:c,details:a?{...a,description:d}:{title:t.title,description:d,button:t.button,legalLinks:t.legalLinks}}}var Xe=class extends M{engine;constructor(e,n){super(e,n),this.engine=new It(this.bus,this.storage,e),this.attachBlocking(this.engine),this.resolveInitialLocale(this.engine.getStoredLocale())}normalizeTranslations(e,n,s){return oi(e,n,s)}async init(){if(this.engine.isConsentRequired()){let n=this.ensureViewData("main");await this.ensureViewEngine(),await Promise.all([this.ensureViewLoaded("main"),n])}else await this.showReturningVisitorTrigger(),this.bus.emit({type:"consent:ready"})}async acceptAll(){await this.storage.withExclusiveAccess(()=>{this.engine.acceptAll(),this.engine.save()}),await this.close()}async rejectAll(){await this.storage.withExclusiveAccess(()=>{this.engine.rejectAll(),this.engine.save()}),await this.close()}};var gn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",Je=class{bits=[];writeBit(e){this.bits.push(e?1:0)}writeInt(e,n){for(let s=n-1;s>=0;s--)this.bits.push(e>>>s&1)}writeBoolean(e){this.writeBit(e)}writeFibonacciRange(e){if(e.length===0){this.writeInt(0,12);return}let n=[],s=e[0],r=s;for(let i=1;i<e.length;i++){let c=e[i];c===r+1||(n.push({start:s,end:r}),s=c),r=c}n.push({start:s,end:r}),this.writeInt(n.length,12);let o=0;for(let i of n)i.start===i.end?(this.writeBit(!1),this.writeFibonacci(i.start-o),o=i.start):(this.writeBit(!0),this.writeFibonacci(i.start-o),this.writeFibonacci(i.end-i.start),o=i.end)}writeFibonacci(e){let n=ai(e),s=new Array(n.length).fill(!1),r=e;for(let i=n.length-1;i>=0&&r>0;i--)n[i]<=r&&(s[i]=!0,r-=n[i]);let o=s.length-1;for(;o>=0&&!s[o];)o--;for(let i=0;i<=o;i++)this.writeBit(s[i]===!0);this.writeBit(!0)}get length(){return this.bits.length}toBase64(){for(;this.bits.length%6!==0;)this.bits.push(0);let e="";for(let n=0;n<this.bits.length;n+=6){let s=this.bits[n]<<5|this.bits[n+1]<<4|this.bits[n+2]<<3|this.bits[n+3]<<2|this.bits[n+4]<<1|this.bits[n+5];e+=gn[s]}return e}};function ai(t){let e=[1,2];for(;e[e.length-1]<t;)e.push(e[e.length-1]+e[e.length-2]);return e}var E={US_NATIONAL:7,US_CA:8,US_VA:9,US_CO:10,US_CT:12,US_FL:13},mn={CA:E.US_CA,VA:E.US_VA,CO:E.US_CO,CT:E.US_CT,FL:E.US_FL};function Fs(t){let e=t.mspaMode??"not_covered",n=e==="service_provider";return{mode:e,sp:n,notice:n?0:1,optOut:s=>n?0:s?1:2,sensitiveInUse:!n&&t.sensitivePIInUse===!0,knownMinor:!n&&t.knownMinor===!0,mspaFields:{MspaCoveredTransaction:e==="not_covered"?2:1,MspaOptOutOptionMode:e==="opt_out"?1:0,MspaServiceProviderMode:n?1:0}}}function Rs(t){let{notice:e,optOut:n,sensitiveInUse:s,knownMinor:r,mspaFields:o}=Fs(t),i=s?t.limitSensitiveUse===!0?1:2:0;return{Version:1,SharingNotice:e,SaleOptOutNotice:e,SharingOptOutNotice:e,TargetedAdvertisingOptOutNotice:e,SensitiveDataProcessingOptOutNotice:0,SensitiveDataLimitUseNotice:s?1:0,SaleOptOut:n(t.saleOptOut),SharingOptOut:n(t.sharingOptOut),TargetedAdvertisingOptOut:n(t.sharingOptOut),SensitiveDataProcessing:new Array(16).fill(i),KnownChildSensitiveDataConsents:r?[1,1,1]:[0,0,0],PersonalDataConsents:0,...o,Gpc:t.gpcDetected,GpcSegmentType:1,GpcSegmentIncluded:!0}}var Ee=[{name:"MspaCoveredTransaction",bits:2},{name:"MspaOptOutOptionMode",bits:2},{name:"MspaServiceProviderMode",bits:2}],be={[E.US_NATIONAL]:{prefix:"usnat",hasGpc:!0,fields:[{name:"Version",bits:6},{name:"SharingNotice",bits:2},{name:"SaleOptOutNotice",bits:2},{name:"SharingOptOutNotice",bits:2},{name:"TargetedAdvertisingOptOutNotice",bits:2},{name:"SensitiveDataProcessingOptOutNotice",bits:2},{name:"SensitiveDataLimitUseNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"SharingOptOut",bits:2},{name:"TargetedAdvertisingOptOut",bits:2},{name:"SensitiveDataProcessing",array:16},{name:"KnownChildSensitiveDataConsents",array:3},{name:"PersonalDataConsents",bits:2},...Ee]},[E.US_CA]:{prefix:"usca",hasGpc:!0,fields:[{name:"Version",bits:6},{name:"SaleOptOutNotice",bits:2},{name:"SharingOptOutNotice",bits:2},{name:"SensitiveDataLimitUseNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"SharingOptOut",bits:2},{name:"SensitiveDataProcessing",array:9},{name:"KnownChildSensitiveDataConsents",array:2},{name:"PersonalDataConsents",bits:2},...Ee]},[E.US_VA]:{prefix:"usva",hasGpc:!1,fields:[{name:"Version",bits:6},{name:"SharingNotice",bits:2},{name:"SaleOptOutNotice",bits:2},{name:"TargetedAdvertisingOptOutNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"TargetedAdvertisingOptOut",bits:2},{name:"SensitiveDataProcessing",array:8},{name:"KnownChildSensitiveDataConsents",bits:2},...Ee]},[E.US_CO]:{prefix:"usco",hasGpc:!0,fields:[{name:"Version",bits:6},{name:"SharingNotice",bits:2},{name:"SaleOptOutNotice",bits:2},{name:"TargetedAdvertisingOptOutNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"TargetedAdvertisingOptOut",bits:2},{name:"SensitiveDataProcessing",array:7},{name:"KnownChildSensitiveDataConsents",bits:2},...Ee]},[E.US_CT]:{prefix:"usct",hasGpc:!0,fields:[{name:"Version",bits:6},{name:"SharingNotice",bits:2},{name:"SaleOptOutNotice",bits:2},{name:"TargetedAdvertisingOptOutNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"TargetedAdvertisingOptOut",bits:2},{name:"SensitiveDataProcessing",array:8},{name:"KnownChildSensitiveDataConsents",array:3},...Ee]},[E.US_FL]:{prefix:"usfl",hasGpc:!1,fields:[{name:"Version",bits:6},{name:"ProcessingNotice",bits:2},{name:"SaleOptOutNotice",bits:2},{name:"TargetedAdvertisingOptOutNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"TargetedAdvertisingOptOut",bits:2},{name:"SensitiveDataProcessing",array:8},{name:"KnownChildSensitiveDataConsents",array:3},{name:"AdditionalDataProcessingConsent",bits:2},...Ee]}};function Ms(t,e){if(t===E.US_NATIONAL)return{...Rs(e)};let{notice:n,optOut:s,sensitiveInUse:r,knownMinor:o,mspaFields:i}=Fs(e),c={Gpc:e.gpcDetected,GpcSegmentType:1,GpcSegmentIncluded:!0};if(t===E.US_CA){let u=r?e.limitSensitiveUse===!0?1:2:0;return{Version:1,SaleOptOutNotice:n,SharingOptOutNotice:n,SensitiveDataLimitUseNotice:r?1:0,SaleOptOut:s(e.saleOptOut),SharingOptOut:s(e.sharingOptOut),SensitiveDataProcessing:new Array(9).fill(u),KnownChildSensitiveDataConsents:o?[1,1]:[0,0],PersonalDataConsents:0,...i,...c}}let a=be[t];if(!a)throw new Error(`[GPP Encoder] Unsupported section id: ${t}`);let l={Version:1,SharingNotice:n,ProcessingNotice:n,SaleOptOutNotice:n,TargetedAdvertisingOptOutNotice:n,SaleOptOut:s(e.saleOptOut),TargetedAdvertisingOptOut:s(e.sharingOptOut),SensitiveDataProcessing:r?1:0,KnownChildSensitiveDataConsents:o?1:0,AdditionalDataProcessingConsent:0,...i},d={};for(let u of a.fields){let p=l[u.name];if(p===void 0)throw new Error(`[GPP Encoder] No value mapping for field: ${u.name}`);d[u.name]="array"in u?new Array(u.array).fill(p):p}return{...d,...a.hasGpc?c:{}}}var Ze=class t{static encode(e,n){let s=[...n].sort((i,c)=>i-c),r=t.encodeHeader(s),o=s.map(i=>t.encodeSection(i,e));return[r,...o].join("~")}static encodeHeader(e){let n=new Je;return n.writeInt(3,6),n.writeInt(1,6),n.writeFibonacciRange(e),n.toBase64()}static encodeSection(e,n){let s=be[e];if(!s)return"";let r=Ms(e,n),o=new Je;for(let c of s.fields){let a=r[c.name];if("array"in c){let l=Array.isArray(a)?a:[];for(let d=0;d<c.array;d++){let u=l[d];o.writeInt(typeof u=="number"?u:0,2)}}else o.writeInt(typeof a=="number"?a:0,c.bits)}if(!s.hasGpc)return o.toBase64();let i=new Je;return i.writeInt(1,2),i.writeBoolean(r.Gpc===!0),`${o.toBase64()}.${i.toBase64()}`}};var Qe=class{bits=[];pos=0;constructor(e){for(let n of e){let s=gn.indexOf(n);if(s<0)throw new Error(`[GPP Decoder] Invalid base64 character: ${n}`);for(let r=5;r>=0;r--)this.bits.push(s>>>r&1)}}readBit(){let e=this.bits[this.pos];if(e===void 0)throw new Error("[GPP Decoder] Read past end of segment");return this.pos++,e===1}readInt(e){let n=0;for(let s=0;s<e;s++)n=n<<1|(this.readBit()?1:0);return n}readFibonacci(){let e=[],n=!1;for(;;){let i=this.readBit();if(i&&n)break;e.push(i),n=i}let s=0,r=1,o=2;for(let i of e)i&&(s+=r),[r,o]=[o,r+o];return s}readFibonacciRange(){let e=this.readInt(12),n=[],s=0;for(let r=0;r<e;r++){let o=this.readBit(),i=this.readFibonacci()+s;if(o){let c=this.readFibonacci()+i;for(let a=i;a<=c;a++)n.push(a);s=c}else n.push(i),s=i}return n}},et=class t{static decode(e){let n=e.split("~"),s=n[0];if(!s)throw new Error("[GPP Decoder] Empty GPP string");let r=t.decodeHeader(s);if(r.length!==n.length-1)throw new Error(`[GPP Decoder] Header lists ${r.length} section(s) but ${n.length-1} present`);for(let o=0;o<r.length;o++){let i=r[o],c=n[o+1];if(i!==void 0&&c!==void 0&&be[i])return{sectionIds:r,data:t.decodeSection(i,c)}}throw new Error("[GPP Decoder] No supported US section present")}static decodeHeader(e){let n=new Qe(e),s=n.readInt(6);if(s!==3)throw new Error(`[GPP Decoder] Not a GPP header (type ${s})`);let r=n.readInt(6);if(r!==1)throw new Error(`[GPP Decoder] Unsupported GPP version ${r}`);return n.readFibonacciRange()}static decodeSection(e,n){let s=be[e];if(!s)throw new Error(`[GPP Decoder] Unsupported section id ${e}`);let[r,o]=n.split(".");if(!r)throw new Error("[GPP Decoder] Missing core subsection");let i=new Qe(r),c={};for(let f of s.fields)if("array"in f){let S=[];for(let v=0;v<f.array;v++)S.push(i.readInt(2));c[f.name]=S}else c[f.name]=i.readInt(f.bits);if(c.Version!==1)throw new Error(`[GPP Decoder] Unsupported ${s.prefix} version ${String(c.Version)}`);let l=c.SaleOptOut===1,u=(c.SharingOptOut??c.TargetedAdvertisingOptOut)===1,p=!1;if(e===E.US_NATIONAL||e===E.US_CA){let f=c.SensitiveDataProcessing;p=Array.isArray(f)&&f.some(S=>S===1)}let y=!1;if(s.hasGpc&&o){let f=new Qe(o);f.readInt(2)===1&&(y=f.readBit())}return{saleOptOut:l,sharingOptOut:u,gpcDetected:y,limitSensitiveUse:p}}};function Te(){return{optedOutOfSale:!1,optedOutOfShare:!1,limitSensitiveUse:!1,gpcDetected:!1,timestamp:0,lastOptOutAt:0}}var ci=365*24*60*60*1e3;function li(){return Le()}function Bs(){if(typeof globalThis>"u")return;let t=globalThis.__1C_GEO;if(t?.country!=="US"||typeof t.region!="string")return;let e=t.region.toUpperCase();return/^[A-Z]{2}$/.test(e)?e:void 0}function di(){if(typeof globalThis>"u")return;let t=globalThis.__1C_GEO;return typeof t?.sensitiveOptIn=="boolean"?t.sensitiveOptIn:void 0}var Ot=class extends H{#e=Te();#t;#s;#n;#r;#i;#c;#o=!1;#a=!1;#d;constructor(e,n,s){super(e,n,s),this.#t=li(),this.#i=Bs(),this.#d=di();let r=s.us;this.#s=r?.mspaMode??"not_covered",this.#n=r?.sensitivePIInUse===!0,this.#r=r?.minorsPosture==="known_minors",this.#c=r?.denyAll===!0,this.#h();try{this.syncFastPath()}catch{}this.mergeConsentDowngradeBaseline(this.getConsentDowngradeSnapshot())}bootSyncsFastPath(){return!1}reloadExternalConsentState(e=!1){let n=this.state.hasConsent||this.storage.getConsent()!==void 0||this.storage.getFastPath()!==void 0,s=this.#f();if(super.reloadExternalConsentState(e),!e&&n&&!s){this.#u();return}this.#h(),e&&(this.#a=!1)}#f(){let e=this.storage.getConsent();if(!e)return!1;try{b.decodeForConfig(e.consent,this.config)}catch{return!1}if(e.gppString)try{return et.decode(e.gppString),!0}catch{}return typeof e.uspString=="string"&&/^1[YN-][YN-][YN-]$/.test(e.uspString)}#u(){(this.storage.getConsent()||this.storage.getFastPath())&&this.invalidateStoredConsent(),this.#e={...Te(),optedOutOfSale:!0,optedOutOfShare:!0,gpcDetected:this.#t},this.#o=!1}#h(){this.#e=this.#w(),this.#o=this.validatedStoredDecision!==void 0&&(this.#e.optedOutOfSale||this.#e.optedOutOfShare)&&!this.#r,this.#t&&(this.#e.gpcDetected=!0),this.#l()&&(this.#e.optedOutOfSale=!0,this.#e.optedOutOfShare=!0)}#l(){return this.#t||this.#r}#w(){let e=this.storage.getConsentSnapshot()??this.storage.getLatestConsentSnapshot(),n=e?.content;if(this.validatedStoredDecision=void 0,n){let s=0;try{let r=e?.prior?b.decode(n.consent):b.decodeForConfig(n.consent,this.config);if(r.configId!==this.config.appId||r.framework!=="us")throw new Error("US decision belongs to a different application or framework.");let o=r.timestamp*1e3;Number.isSafeInteger(o)&&o>0&&(s=o)}catch(r){return console.warn("[US Engine] Stored consent timestamp invalid; fastpath stays cold:",r),this.#g()}if(n.gppString)try{let{data:r}=et.decode(n.gppString);this.validatedStoredDecision=e;let o=r.saleOptOut||r.sharingOptOut;return{optedOutOfSale:r.saleOptOut,optedOutOfShare:r.sharingOptOut,limitSensitiveUse:this.#n&&(n.limitSensitiveUse??r.limitSensitiveUse)===!0,gpcDetected:!1,timestamp:s,lastOptOutAt:o?s:0}}catch(r){console.warn("[US Engine] Stored GPP string invalid, trying uspString:",r)}if(typeof n.uspString=="string"&&/^1[YN-][YN-][YN-]$/.test(n.uspString)){let r=n.uspString.charAt(2)==="Y";return this.validatedStoredDecision=e,{optedOutOfSale:r,optedOutOfShare:r,limitSensitiveUse:!1,gpcDetected:!1,timestamp:s,lastOptOutAt:r?s:0}}return this.#g()}return{...Te(),timestamp:Date.now()}}#g(){return this.invalidateStoredConsent(),{...Te(),optedOutOfSale:!0,optedOutOfShare:!0}}getFrameworkPrefix(){return"us"}acceptAll(){console.log("[US Engine] acceptAll()"),this.#l()||(this.#e.optedOutOfSale=!1,this.#e.optedOutOfShare=!1,this.#e.limitSensitiveUse=!1),super.acceptAll(),this.#e.timestamp=Date.now()}setCategoryConsent(e,n){this.#a=!0,super.setCategoryConsent(e,n)}setServiceConsent(e,n){this.#a=!0,super.setServiceConsent(e,n)}setConsent(e){this.#a=!0,super.setConsent(e)}save(){if(!this.state.hasConsent&&!this.#a){for(let e of this.config.categories)this.state.categories[e.id]=!0;for(let e of this.config.services)this.state.services[e.id]=!0}super.save(),this.#a=!1}getEvidenceConsentDecision(){let e=this.#S();return{...super.getEvidenceConsentDecision(),categoryProjection:J(this.config.categories.filter(n=>!n.essential).map(n=>this.state.categories[n.id]===!0)),framework:J([!e.optedOutOfSale,!e.optedOutOfShare,...this.#n?[!e.limitSensitiveUse]:[]])}}rejectAll(){console.log("[US Engine] rejectAll()"),super.rejectAll(),this.#e.optedOutOfSale=!0,this.#e.optedOutOfShare=!0,this.#n&&(this.#e.limitSensitiveUse=!0),this.#p()}#p(){let e=Date.now();this.#e.timestamp=e,this.#e.lastOptOutAt=e}isWithinReconsentWindow(){let{lastOptOutAt:e}=this.#S();return e>0&&Date.now()-e<ci}getOptOutOfSale(){return this.#S().optedOutOfSale}setOptOutOfSale(e){if(!e&&this.#l()){console.warn("[US Engine] Cannot opt back in to sale \u2014 opt-out is locked");return}console.log(`[US Engine] setOptOutOfSale(${e})`),this.#e.optedOutOfSale=e,e?this.#p():this.#e.timestamp=Date.now(),this.emit("consent:changed")}getOptOutOfShare(){return this.#S().optedOutOfShare}setOptOutOfShare(e){if(!e&&this.#l()){console.warn("[US Engine] Cannot opt back in to sharing \u2014 opt-out is locked");return}console.log(`[US Engine] setOptOutOfShare(${e})`),this.#e.optedOutOfShare=e,e?this.#p():this.#e.timestamp=Date.now(),this.emit("consent:changed")}setOptOutOfSaleAndShare(e){if(!e&&this.#l()){console.warn("[US Engine] Cannot opt back in to sale/sharing \u2014 opt-out is locked");return}console.log(`[US Engine] setOptOutOfSaleAndShare(${e})`),this.#e.optedOutOfSale=e,this.#e.optedOutOfShare=e,e?this.#p():this.#e.timestamp=Date.now(),this.emit("consent:changed")}getLimitSensitiveUse(){return this.#e.limitSensitiveUse}getSensitivePIInUse(){return this.#n}setLimitSensitiveUse(e){if(!this.#n){console.warn("[US Engine] setLimitSensitiveUse ignored \u2014 sensitive PI not in use");return}console.log(`[US Engine] setLimitSensitiveUse(${e})`),this.#e.limitSensitiveUse=e,e?this.#p():this.#e.timestamp=Date.now(),this.emit("consent:changed")}isGpcDetected(){return this.#t}getUsPrivacyState(){return{...this.#e}}getFastPathConsentMap(){return this.#m().map}#m(){let e=this.#S(),n=this.state.hasConsent&&this.hasValidConsent(),s=this.#n&&e.limitSensitiveUse,r=n||this.#o||this.#t||e.limitSensitiveUse,i=(n?this.getConsentTimestamp():null)??(this.#o||e.limitSensitiveUse?e.timestamp:0);return e.optedOutOfSale||e.optedOutOfShare||this.#l()?{map:this.#y(),decided:r,posture:!r,decisionTimestamp:i}:s?{map:this.#C(n?super.getFastPathConsentMap():this.#E()),decided:r,posture:!r,decisionTimestamp:i}:n?{map:super.getFastPathConsentMap(),decided:!0,posture:!1,decisionTimestamp:i}:this.#c?{map:this.#y(),decided:r,posture:!r,decisionTimestamp:i}:this.#n&&(this.#d??Lt(this.#i))?{map:this.#C(this.#E()),decided:r,posture:!r,decisionTimestamp:i}:{map:this.#E(),decided:r,posture:!r,decisionTimestamp:i}}#v(){let e=this.config.services.filter(r=>r.usSensitive===!0&&r.essential!==!0);if(e.length===0)return;let n={};for(let r of e)n[r.id]=!1;let s=new Set(e.map(r=>r.categoryId).filter(r=>r!==void 0));return this.config.categories.forEach(r=>{s.has(r.id)&&r.essential!==!0&&(n[r.id]=!1)}),n}#C(e){let n=this.#v();return n?{...e,...n}:this.#y()}#y(){return{...this.getDefaultCategoryConsents(),...this.getDefaultServiceConsents()}}#E(){let e={};return this.config.categories.forEach(n=>{e[n.id]=!0}),this.config.services.forEach(n=>{e[n.id]=!0}),e}syncFastPath(e){let n=this.#m(),s=n.decided&&n.decisionTimestamp>0;Ke(this.config,n.map,{gpcRevocable:!0,posture:n.posture,decisionTimestamp:n.decisionTimestamp,cookieMode:s?"decision":"clear"},e??(r=>this.storage.refreshFastPath(r,this.validatedStoredDecision)))}buildConsentEntry(e){return{consent:e,uspString:this.getUsPrivacyString(),gppString:this.getGppString(),limitSensitiveUse:this.#e?.limitSensitiveUse===!0}}#S(){return this.externalReconciliationPending?{...Te(),optedOutOfSale:!0,optedOutOfShare:!0,limitSensitiveUse:!0}:this.#e??Te()}getApplicableGppSections(){let n=Oe(this.config)&&this.config.us?.stateGeo===!0?Bs():void 0;return[(n?mn[n]:void 0)??E.US_NATIONAL]}getUsNationalSectionData(){let e=this.#S();return{saleOptOut:e.optedOutOfSale,sharingOptOut:e.optedOutOfShare,gpcDetected:e.gpcDetected,mspaMode:this.#s,sensitivePIInUse:this.#n,limitSensitiveUse:e.limitSensitiveUse,knownMinor:this.#r}}getGppString(){return Ze.encode(this.getUsNationalSectionData(),this.getApplicableGppSections())}resolve(e){let n=L(e.bindingKey);if(n?.framework!=="us")throw new Error(`[US Engine] Invalid binding key: ${e.bindingKey}`);let{entity:s}=n;switch(s){case"sale":return this.#b();case"share":return this.#T();case"saleAndShare":return this.#I();case"limitSensitiveUse":return this.#A();default:throw new Error(`[US Engine] Unknown entity type: ${s}`)}}resolveMany(e){let n=[];for(let s of e)try{let r=this.resolve(s);n.push({bindingKey:s.bindingKey,value:r.value,disabled:r.disabled})}catch(r){console.error("[US Engine] Failed to resolve binding:",s,r)}return{patches:n,version:this.versionTracker.getVersion()}}apply(e){let n=L(e.ref.bindingKey);if(n?.framework!=="us")throw new Error(`[US Engine] Invalid binding key: ${e.ref.bindingKey}`);let{entity:s}=n,r=[];if(s==="sale"){this.setOptOutOfSale(e.value);let i=this.#b();r.push({bindingKey:e.ref.bindingKey,value:i.value,disabled:i.disabled})}else if(s==="share"){this.setOptOutOfShare(e.value);let i=this.#T();r.push({bindingKey:e.ref.bindingKey,value:i.value,disabled:i.disabled})}else if(s==="limitSensitiveUse"){this.setLimitSensitiveUse(e.value);let i=this.#A();r.push({bindingKey:e.ref.bindingKey,value:i.value,disabled:i.disabled})}else if(s==="saleAndShare"){this.setOptOutOfSaleAndShare(e.value);let i=this.#I();r.push({bindingKey:e.ref.bindingKey,value:i.value,disabled:i.disabled});let c=this.#b();r.push({bindingKey:"consent:us.sale",value:c.value,disabled:c.disabled});let a=this.#T();r.push({bindingKey:"consent:us.share",value:a.value,disabled:a.disabled})}else throw new Error(`[US Engine] Unknown entity type: ${s}`);let o=this.versionTracker.increment();return{patches:r,version:o}}#b(){return{value:this.#e.optedOutOfSale,disabled:this.#l()}}#T(){return{value:this.#e.optedOutOfShare,disabled:this.#l()}}#I(){return{value:this.#e.optedOutOfSale&&this.#e.optedOutOfShare,disabled:this.#l()}}#A(){return{value:this.#e.limitSensitiveUse,disabled:!this.#n}}getUsPrivacyString(){return`1Y${this.#S().optedOutOfSale?"Y":"N"}-`}};var tt=class extends M{engine;constructor(e,n){super(e,n),this.engine=new Ot(this.bus,this.storage,e),this.attachBlocking(this.engine),this.resolveInitialLocale(this.engine.getStoredLocale())}async init(){this.bus.emit({type:"consent:ready"});let e=!this.engine.isGpcDetected()&&this.engine.isConsentRequired();if(e&&this.config.cmp.main){let n=this.ensureViewData("main");await this.ensureViewEngine(),await Promise.all([this.ensureViewLoaded("main"),n])}else e||await this.showReturningVisitorTrigger()}async acceptAll(){await this.storage.withExclusiveAccess(()=>{this.engine.acceptAll(),this.engine.save()}),await this.close()}async rejectAll(){await this.storage.withExclusiveAccess(()=>{this.engine.rejectAll(),this.engine.save()}),await this.close()}};var Sn=window.__1CONSENT_CONFIG__;if(re(Sn)){let t=Sn,e=new je;ht(t).then(async n=>{let s=await n.withExclusiveAccess(()=>Nt(t)?new qe(t,{bus:e,storage:n}):Vt(t)?new Xe(t,{bus:e,storage:n}):Oe(t)?new tt(t,{bus:e,storage:n}):null);if(!s)throw new Error("[Design Kit] Unsupported CMP framework config.");let r=Qt(s),o=new bs(e,s.engine,()=>s.getTranslations(),()=>s.openDetails(),i=>s.ensureViewData(i),i=>s.hasViewData(i),i=>s.setLanguage(i),()=>s.getThemeMode());window.__1consent=r,s.setViewEngine(o),s.init().catch(i=>console.error("[Design Kit] Controller init failed",i))}).catch(n=>console.error("[Design Kit] Runtime initialization failed",n))}else Sn!==void 0&&console.error("[Design Kit] Refusing to initialize an invalid CMP runtime config.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1consent/cli",
3
- "version": "0.1.0-beta.1",
3
+ "version": "0.1.0-beta.2",
4
4
  "description": "The official 1Consent CLI for design sync, publishing, and generated React consent types.",
5
5
  "type": "module",
6
6
  "license": "MIT",