cdn.id5-sync.com
Open in
urlscan Pro
2606:4700:10::6816:3556
Public Scan
URL:
https://cdn.id5-sync.com/api/1.0/id5-api.js
Submission: On November 04 via api from IT — Scanned from IT
Submission: On November 04 via api from IT — Scanned from IT
Form analysis
0 forms found in the DOMText Content
/** * @id5io/id5-api.js * @version v1.0.72 * @link https://id5.io/ * @license Apache-2.0 */ !function(){"use strict";function r(t,e){var i,r=Object.keys(t);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(t),e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,i)),r}function d(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?r(Object(i),!0).forEach(function(e){h(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function c(e,t,i,r,s,n,o){try{var a=e[n](o),c=a.value}catch(e){return void i(e)}a.done?t(c):Promise.resolve(c).then(r,s)}function s(a){return function(){var e=this,o=arguments;return new Promise(function(t,i){var r=a.apply(e,o);function s(e){c(r,t,i,s,n,"next",e)}function n(e){c(r,t,i,s,n,"throw",e)}s(void 0)})}}function h(e,t,i){return(t=function(e){e=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);t=i.call(e,t||"default");if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"==typeof e?e:String(e)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function u(){return(u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i,r=arguments[t];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}).apply(this,arguments)}function t(e,t){if(null==e)return{};var i,r=function(e,t){if(null==e)return{};for(var i,r={},s=Object.keys(e),n=0;n<s.length;n++)i=s[n],0<=t.indexOf(i)||(r[i]=e[i]);return r}(e,t);if(Object.getOwnPropertySymbols)for(var s=Object.getOwnPropertySymbols(e),n=0;n<s.length;n++)i=s[n],0<=t.indexOf(i)||Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i]);return r}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var r,s,n,o,a=[],c=!0,l=!1;try{if(n=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;c=!1}else for(;!(c=(r=n.call(i)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){l=!0,s=e}finally{try{if(!c&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(l)throw s}}return a}}(e,t)||a(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){if(e){if("string"==typeof e)return n(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(i="Object"===i&&e.constructor?e.constructor.name:i)||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(e,t):void 0}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}function f(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=a(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var r=0,t=function(){};return{s:t,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,n=!0,o=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return n=e.done,e},e:function(e){o=!0,s=e},f:function(){try{n||null==i.return||i.return()}finally{if(o)throw s}}}}class e{debug(){}info(){}warn(){}error(){}}const g=new e;class p extends e{constructor(e,t){super(),this._prefix=e,this._delegate=t}debug(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this._delegate.debug((new Date).toISOString(),this._prefix,...t)}info(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this._delegate.info((new Date).toISOString(),this._prefix,...t)}warn(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this._delegate.warn((new Date).toISOString(),this._prefix,...t)}error(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this._delegate.error((new Date).toISOString(),this._prefix,...t)}}const o="*",_=void 0;class v{constructor(e,t,i,r,s,n){var o=6<arguments.length&&void 0!==arguments[6]?arguments[6]:void 0;h(this,"_isId5Message",!0),h(this,"id",void 0),h(this,"timestamp",void 0),h(this,"type",void 0),h(this,"src",void 0),h(this,"dst",void 0),h(this,"request",void 0),h(this,"payload",void 0),this.id=r,this.timestamp=e,this.src=t,this.dst=i,this.type=n,this.request=o,this.payload=s}}class m{constructor(e){h(this,"_senderId",void 0),h(this,"_messageSeqNb",0),this._senderId=e,this._messageSeqNb=0}createBroadcastMessage(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:e.constructor.name;return new v(Date.now(),this._senderId,_,++this._messageSeqNb,e,t||e.constructor.name)}createResponse(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:t.constructor.name;return new v(Date.now(),this._senderId,e.src,++this._messageSeqNb,t,i||t.constructor.name,e)}createUnicastMessage(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:t.constructor.name;return new v(Date.now(),this._senderId,e,++this._messageSeqNb,t,i||t.constructor.name)}}class I{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:void 0;h(this,"instance",void 0),h(this,"instanceState",void 0),h(this,"isResponse",void 0),this.instance=e,this.instanceState=i,this.isResponse=t}}h(I,"TYPE","HelloMessage");const i=Object.freeze({LEADER:"leader",FOLLOWER:"follower",STORAGE:"storage"});class w{constructor(e,t,i){h(this,"target",void 0),h(this,"methodName",void 0),h(this,"methodArguments",void 0),this.target=e,this.methodName=t,this.methodArguments=i}}h(w,"TYPE","RemoteMethodCallMessage");class y{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:g;h(this,"_targets",{}),h(this,"_log",void 0),this._log=e}registerTarget(e,t){return this._targets[e]=t,this}_handle(t){const e=this._targets[t.target];if(e)try{e[t.methodName](...t.methodArguments)}catch(e){this._log.error("Error while handling method call ",t,e)}}}class C{constructor(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:g;h(this,"_id",void 0),h(this,"_messageFactory",void 0),h(this,"_log",void 0),h(this,"_onMessageCallBackFunction",void 0),this._id=e,this._messageFactory=new m(this._id),this._log=i,this._window=t,this._handlers={},this._register()}_register(){const s=this;s._abortController="undefined"!=typeof AbortController?new AbortController:void 0;var e=null===(e=s._abortController)||void 0===e?void 0:e.signal;s._window.addEventListener("message",i=>{let r=i.data;if(void 0!==i.data&&i.data._isId5Message&&i.data.src!==s._id&&(void 0===i.data.dst||i.data.dst===s._id))try{[o,r.type].forEach(e=>{let t=s._handlers[e];t&&t.forEach(e=>e(r,i.source))})}catch(e){s._log.error("Error while handling message",r,e)}},{capture:!1,signal:e})}unregister(){this._abortController&&this._abortController.abort()}onAnyMessage(e){return this.onMessage(o,e)}onMessage(e,t){const i=this._handlers[e];return i?i.push(t):this._handlers[e]=[t],this}broadcastMessage(e,t){this._log.debug("Broadcasting message",t,e),this._postMessage(this._messageFactory.createBroadcastMessage(e,t))}sendResponseMessage(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:t.constructor.name;this._log.debug("Sending response message",e,i,t),this._postMessage(this._messageFactory.createResponse(e,t,i))}unicastMessage(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:t.constructor.name;this._log.debug("Sending message to",e,i,t),this._postMessage(this._messageFactory.createUnicastMessage(e,t,i))}_postToWindow(e,t){try{e.postMessage(t,"*")}catch(e){this._log.error("Could not post message to window",e)}}_postMessage(r){let s=this;(function t(e){try{s._postToWindow(e,r);var i=e.frames;if(i)for(let e=0;e<i.length;e++)t(i[e])}catch(e){s._log.error("Could not broadcast message",e)}})(s._window.top)}callProxyMethod(e,t,i,r){this._log.info("Calling ProxyMethodCall",{target:t,name:i,args:r}),this.unicastMessage(e,new w(t,i,r),w.TYPE)}onProxyMethodCall(t){return this.onMessage(w.TYPE,e=>{t._handle(u(new w,e.payload))})}}function S(e,t){var i="^\\d+(\\.\\d+(\\.\\d+){0,1}){0,1}$";if(e.match(i)&&t.match(i)){var r=e.split("."),s=t.split("."),i=e=>parseInt(e)||0,e=(e,t)=>{t=e-t;return 0==t?0:t<0?-1:1},t=e(i(r[0]),i(s[0]));if(0!==t)return t;t=e(i(r[1]),i(s[1]));return 0===t?e(i(r[2]),i(s[2])):t}}const b="Array",D="String",E="Function",T=Object.prototype.toString;function A(e,t){return T.call(e)==="[object "+t+"]"}function P(e){return A(e,E)}function O(e){return A(e,D)}function R(e){return A(e,b)}function x(e){return A(e,"Number")}function L(e){return A(e,"Object")}function N(e){return void 0!==e}function U(t,i){if(!function(e){if(!e)return 1;if(R(e)||O(e))return!(0<e.length);for(var t in e)if(hasOwnProperty.call(e,t))return;return 1}(t)){if(P(t.forEach))return t.forEach(i,this);let e=0;var r=t.length;if(0<r)for(;e<r;e++)i(t[e],e,t);else for(e in t)hasOwnProperty.call(t,e)&&i.call(this,t[e],e)}}function F(e,t){let i=document.createElement("a");t&&"noDecodeWholeURL"in t&&t.noDecodeWholeURL?i.href=e:i.href=decodeURIComponent(e);t=t&&"decodeSearchAsString"in t&&t.decodeSearchAsString;return{href:i.href,protocol:(i.protocol||"").replace(/:$/,""),hostname:i.hostname,port:+i.port,pathname:i.pathname.replace(/^(?!\/)/,"/"),search:t?i.search:(t=i.search||"")?t.replace(/^\?/,"").split("&").reduce((e,t)=>{let i=t.split("="),r=l(i,2),s=r[0],n=r[1];return/\[\]$/.test(s)?(s=s.replace("[]",""),e[s]=e[s]||[],e[s].push(n)):e[s]=n||"",e},{}):{},hash:(i.hash||"").replace(/^#/,""),host:i.host||window.location.host}}function k(e){return(e.protocol||"http")+"://"+(e.host||e.hostname+(e.port?":".concat(e.port):""))+(e.pathname||"")+(e.search?"?".concat((i=e.search||"",Object.keys(i).map(t=>Array.isArray(i[t])?i[t].map(e=>"".concat(t,"[]=").concat(e)).join("&"):"".concat(t,"=").concat(i[t])).join("&"))):"")+(e.hash?"#".concat(e.hash):"");var i}function M(i,e){function r(e,t){if(P(Math.imul))return Math.imul(e,t);var i=(4194303&e)*(t|=0);return 4290772992&e&&(i+=(4290772992&e)*t|0),0|i}e=1<arguments.length&&void 0!==e?e:0;let s=3735928559^e,n=1103547991^e;for(let e=0,t;e<i.length;e++)t=i.charCodeAt(e),s=r(s^t,2654435761),n=r(n^t,1597334677);return s=r(s^s>>>16,2246822507)^r(n^n>>>13,3266489909),n=r(n^n>>>16,2246822507)^r(s^s>>>13,3266489909),(4294967296*(2097151&n)+(s>>>0)).toString()}const j=Object.freeze({cmp:"cmp",partner:"partner",prebid:"prebid"}),V=["localStoragePurposeConsent","ccpaString"],G=Object.freeze({NONE:"none",TCF_V1:"TCFv1",TCF_V2:"TCFv2",USP_V1:"USPv1",ID5_ALLOWED_VENDORS:"ID5",PREBID:"PBJS",GPP_V1_0:"GPPv1.0",GPP_V1_1:"GPPv1.1"});class W{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:void 0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:void 0,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:void 0,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:void 0;h(this,"version",void 0),h(this,"localStoragePurposeConsent",void 0),h(this,"applicableSections",void 0),h(this,"gppString",void 0),this.version=e,this.localStoragePurposeConsent=t,this.applicableSections=i,this.gppString=r}isGranted(){return!this.applicableSections.includes(2)||!0===this.localStoragePurposeConsent}}class q{constructor(){h(this,"apiTypes",void 0),h(this,"gdprApplies",void 0),h(this,"consentString",void 0),h(this,"localStoragePurposeConsent",void 0),h(this,"allowedVendors",void 0),h(this,"ccpaString",void 0),h(this,"forcedGrantByConfig",void 0),h(this,"gppData",void 0),h(this,"source",void 0),this.apiTypes=[],this.gdprApplies=!1,this.consentString=void 0,this.localStoragePurposeConsent=!1,this.ccpaString=void 0,this.allowedVendors=void 0,this.forcedGrantByConfig=!1,this.gppData=void 0}localStorageGrant(){return!0===this.forcedGrantByConfig?new B(!0,H.FORCE_ALLOWED_BY_CONFIG):0===this.apiTypes.length?new B(!0,H.PROVISIONAL):this._getLocalStorageGrantFromApi()}_getLocalStorageGrantFromApi(){const e=this.apiTypes,t={};e.includes(G.TCF_V1)&&(t[G.TCF_V1]=!this.gdprApplies||!0===this.localStoragePurposeConsent),e.includes(G.TCF_V2)&&(t[G.TCF_V2]=!1===this.gdprApplies||!0===this.localStoragePurposeConsent),e.includes(G.ID5_ALLOWED_VENDORS)&&(t[G.ID5_ALLOWED_VENDORS]=this.allowedVendors.includes("131")),e.includes(G.USP_V1)&&(t[G.USP_V1]=!0),e.includes(G.GPP_V1_0)&&(t[G.GPP_V1_0]=this.gppData.isGranted()),e.includes(G.GPP_V1_1)&&(t[G.GPP_V1_1]=this.gppData.isGranted());var i=Object.keys(t).map(e=>t[e]).reduce((e,t)=>e&&t,!0);return new B(i,H.CONSENT_API,t)}hashCode(){this.localStoragePurposeConsent,this.ccpaString;var e=t(this,V);return M(JSON.stringify(e))}static createFrom(e){const t=u(new q,e);return N(t.api)&&(t.apiTypes=function(e){var t=e.api;if(t===G.NONE)return[];if(t!==G.PREBID)return[t];{const i=[];return(N(e.gdprApplies)||N(e.consentString))&&i.push(G.TCF_V2),N(e.ccpaString)&&i.push(G.USP_V1),N(e.gppData)&&N(e.gppData.version)&&i.push(e.gppData.version),i}}(e),t.api=void 0),L(t.gppData)&&(t.gppData=u(new W,t.gppData)),t}getApiTypeData(e){if(this.apiTypes.includes(e)){if(e===G.USP_V1)return{ccpaString:this.ccpaString};if(e===G.TCF_V2)return{consentString:this.consentString,gdprApplies:this.gdprApplies,localStoragePurposeConsent:this.localStoragePurposeConsent};if(e===G.GPP_V1_1||e===G.GPP_V1_0)return this.gppData;if(e===G.ID5_ALLOWED_VENDORS)return{allowedVendors:this.allowedVendors}}}}const H=Object.freeze({FORCE_ALLOWED_BY_CONFIG:"force_allowed_by_config",ID5_CONSENT:"id5_consent",PROVISIONAL:"provisional",JURISDICTION:"jurisdiction",CONSENT_API:"consent_api"});class B{constructor(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};h(this,"allowed",!1),h(this,"grantType",H.NONE),h(this,"api",{}),this.allowed=e,this.grantType=t,this.api=i}isDefinitivelyAllowed(){return this.allowed&&this.grantType!==H.PROVISIONAL}}var J=Object.freeze({STORAGE_CONFIG:{ID5:{name:"id5id",expiresDays:90},ID5_V2:{name:"id5id_v2",expiresDays:15},LAST:{name:"id5id_last",expiresDays:90},CONSENT_DATA:{name:"id5id_cached_consent_data",expiresDays:30},PRIVACY:{name:"id5id_privacy",expiresDays:30},EXTENSIONS:{name:"id5id_extensions",expiresDays:8/24}},LEGACY_COOKIE_NAMES:["id5.1st","id5id.1st"],PRIVACY:{JURISDICTIONS:{gdpr:!0,ccpa:!1,lgpd:!0,other:!1}},ID5_EIDS_SOURCE:"id5-sync.com"});class z{constructor(e,t){this.name=e,this.expiresDays=t}withNameSuffixed(){let e=this.name;for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];for(var s=0,n=i;s<n.length;s++){var o=n[s];e+="_".concat(o)}return new z(e,this.expiresDays)}}class K{constructor(){let i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:void 0;function e(e){var t=void 0!==i?Math.max(1,i):e.expiresDays;return new z(e.name,t)}var t=J.STORAGE_CONFIG;this.ID5=e(t.ID5),this.ID5_V2=e(t.ID5_V2),this.LAST=e(t.LAST),this.CONSENT_DATA=e(t.CONSENT_DATA),this.PRIVACY=e(t.PRIVACY),this.EXTENSIONS=new z(t.EXTENSIONS.name,t.EXTENSIONS.expiresDays)}}h(K,"DEFAULT",new K);class Y{constructor(e,t){h(this,"_clientStore",void 0),h(this,"_trueLinkAdapter",void 0),this._clientStore=e,this._trueLinkAdapter=t}hasConsentChanged(e){return e&&!this._clientStore.storedConsentDataMatchesConsentData(e)}storeConsent(e){this._clientStore.putHashedConsentData(e)}incNb(e){this._clientStore.incNbV2(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:1)}updateNbs(e){var t,i=f(e);try{for(i.s();!(t=i.n()).done;){var r=l(t.value,2),s=r[0],n=r[1],o=null==n?void 0:n.nb;0<o&&this.incNb(s,-o)}}catch(e){i.e(e)}finally{i.f()}}storeResponse(e,i){this._clientStore.putResponseV1(i.getGenericResponse()),this._clientStore.setResponseDateTimeV1(new Date(i.timestamp).toUTCString());const r=new Set;e.forEach(e=>{var t=e.cacheId;r.has(t)||(e=i.getResponseFor(e.integrationId))&&(this._clientStore.storeResponseV2(t,e,i.timestamp),r.add(t))}),this._trueLinkAdapter.setPrivacy(null===(e=i.getGenericResponse())||void 0===e?void 0:e.privacy)}clearAll(e){this._clientStore.clearResponse(),this._clientStore.clearDateTime(),e.forEach(e=>{e=e.cacheId;this._clientStore.clearResponseV2(e)}),this._clientStore.clearHashedConsentData(),this._trueLinkAdapter.clearPrivacy(),this._clientStore.clearExtensions()}getCachedResponse(e){e=this._clientStore.getStoredResponseV2(e);if(e)return new X(e.response,e.responseTimestamp,e.nb)}getCachedExtensions(){return this._clientStore.getExtensions()}storeExtensions(e){var t=x(e.ttl)?e.ttl/86400:K.DEFAULT.EXTENSIONS.expiresDays,t=new z(K.DEFAULT.EXTENSIONS.name,t);return this._clientStore.storeExtensions(e,t)}}class X{constructor(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;h(this,"response",void 0),h(this,"timestamp",void 0),h(this,"nb",void 0),this.response=e,this.timestamp=t,this.nb=i}isExpired(){var e=this.getMaxAge();return!(x(e)&&0<e)||this._isOlderThanSec(e)}_isOlderThanSec(e){return this.timestamp<=0||this.getAgeSec()>e}isStale(){return!this.timestamp||this._isOlderThanSec(1209600)}isResponseComplete(){return L(this.response)&&O(this.response.universal_uid)&&O(this.response.signature)}isValid(){return this.isResponseComplete()&&!this.isStale()}getMaxAge(){var e,t;return null===(e=this.response)||void 0===e||null===(t=e.cache_control)||void 0===t?void 0:t.max_age_sec}getAgeSec(){return(Date.now()-this.timestamp)/1e3|0}}const Q="_exp";class ${constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:g;h(this,"storage",void 0),h(this,"_log",void 0),this.storage=e,this._log=t}getItem(e){try{return this.storage.getItem(e)}catch(e){}}setItem(e,t){try{this.storage.setItem(e,t)}catch(e){}}removeItem(e){try{this.storage.removeItem(e)}catch(e){}}removeExpiredObjectWithPrefix(t){var i=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this._log.info("Check, prefix",t);try{var r=this.storage.getKeysWithPrefix(t);let e=0;var s,n=f(r);try{for(n.s();!(s=n.n()).done;){var o,a,c=s.value;i?(this._log.info("Found",c," remove it"),this.removeItem(c)):(a=null==(o=this.getObjectWithExpiration({name:c}))?void 0:o.expireAt)&&a<Date.now()&&(this._log.info("Found expired object",c,"expiration time",a,"It will be removed"),this.removeItem(c),e+=1)}}catch(e){n.e(e)}finally{n.f()}return{all:r.length,expired:e}}catch(e){}}getItemWithExpiration(e){var t=e.name,e=this.getItem(t+Q);return!e||new Date(e).getTime()-Date.now()<=0?(this.removeItemWithExpiration({name:t}),null):this.getItem(t)}setItemWithExpiration(e,t){var i=e.name,e=e.expiresDays,e=Date.now()+864e5*e,e=new Date(e).toUTCString();this.setItem(i+Q,e),this.setItem(i,t)}removeItemWithExpiration(e){e=e.name;this.removeItem(e),this.removeItem(e+Q)}setObjectWithExpiration(e,t){var i=e.name,e=e.expiresDays,e=Date.now()+864e5*e;this.setItem(i,JSON.stringify({data:t,expireAt:e}))}getObjectWithExpiration(t){t=t.name;try{var e=JSON.parse(this.getItem(t));if(null!=e&&e.expireAt&&0<e.expireAt-Date.now())return e.data;null!=e&&e.expireAt&&this.removeItem(t)}catch(e){this._log.error("Error while getting ",t,"object from storage",e)}}updateObjectWithExpiration(e,t){var i=e.name,e=e.expiresDays;try{var r=t(this.getObjectWithExpiration({name:i}));return this.setObjectWithExpiration({name:i,expiresDays:e},r),r}catch(e){this._log.error("Error while updating object with ",i,e)}}}class Z{getItem(){}removeItem(){}setItem(){}getKeysWithPrefix(){return[]}}const ee=new Z;class te extends Z{constructor(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];super(),h(this,"_writingEnabled",void 0),h(this,"_underlying",void 0),this._writingEnabled=t;try{this._underlying=e.localStorage}catch(e){}}getItem(e){try{return this._underlying.getItem(e)}catch(e){}}removeItem(e){try{this._underlying.removeItem(e)}catch(e){}}setItem(e,t){try{this._writingEnabled&&this._underlying.setItem(e,t)}catch(e){}}getKeysWithPrefix(t){try{var i=this._underlying.length;if(this._writingEnabled){const r=[];for(let e=0;e<i;e++){const s=this._underlying.key(e);s&&s.startsWith(t)&&r.push(s)}return r}}catch(e){}}static checkIfAccessible(){var e="__id5test";try{return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch(e){return!1}}}class ie{constructor(e){h(this,"_replicas",[]),h(this,"_lastKeyOperation",{}),h(this,"_primaryStorage",void 0),this._primaryStorage=e}getItem(e){return this._primaryStorage.getItem(e)}removeItem(t){this._primaryStorage.removeItem(t);var e=e=>{e.removeItem(t)};this._replicas.forEach(e),this._lastKeyOperation[t]=e}setItem(t,i){this._primaryStorage.setItem(t,i);var e=e=>{e.setItem(t,i)};this._replicas.forEach(e),this._lastKeyOperation[t]=e}addReplica(t){Object.values(this._lastKeyOperation).forEach(e=>e(t)),this._replicas.push(t)}getKeysWithPrefix(e){return this._primaryStorage.getKeysWithPrefix(e)}}const re="undefined"!=typeof Promise&&"undefined"!=typeof fetch;class se{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:void 0;this.url=e||"https://diagnostics.id5-sync.com/measurements",this._metadata=t}publish(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:void 0;return e&&0<e.length?(e.forEach(e=>function(i){Object.keys(i).forEach(function(e){var t=i[e];t&&(t instanceof Object?i[e]=JSON.stringify(t):i[e]="".concat(t))})}(e.tags)),fetch(this.url,{method:"POST",headers:{"Content-Type":"text/plain"},mode:"no-cors",body:JSON.stringify({metadata:d(d({},this._metadata),t),measurements:e})})):Promise.resolve()}}const ne=Object.freeze({});var oe,ae={EMPTY:ne,from:function(e){return e?e instanceof Map?Object.fromEntries(e):e:ne},toString:function(e){return Array.from(Object.entries(e),e=>{var t=l(e,2),e=t[0],t=t[1];return"".concat(e,"=").concat(t)}).sort().toString()}};const ce=Object.freeze({TIMER:"TIMER",SUMMARY:"SUMMARY",COUNTER:"COUNTER"});class le{constructor(e,t,i){h(this,"name",void 0),h(this,"tags",void 0),h(this,"values",void 0),this.name=e,this.tags=ae.from(t),this.type=i,this.values=[]}reset(){this.values=[]}}class he extends le{constructor(e){super(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:void 0,ce.TIMER)}startMeasurement(){try{return new de(this)}catch(e){return}}record(e){try{isNaN(e)||this.values.push({value:e,timestamp:Date.now()})}catch(e){}}recordNow(){try{var e;this.record(0|(null===(e=performance)||void 0===e?void 0:e.now()))}catch(e){}}}class de{constructor(){this.timer=0<arguments.length&&void 0!==arguments[0]?arguments[0]:void 0,this.startTime=performance.now()}record(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:void 0;try{var i=performance.now()-this.startTime|0;let e=t||this.timer;return e&&e.record(i),i}catch(e){return}}}class ue extends le{constructor(e){super(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:void 0,ce.COUNTER)}inc(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1;try{return 0===this.values.length?this.values.push({value:e,timestamp:Date.now()}):(this.values[0].value+=e,this.values[0].timestamp=Date.now()),this.values[0].value}catch(e){}}}class ge extends le{constructor(e){super(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:void 0,ce.SUMMARY)}record(e){try{this.values.push({value:e,timestamp:Date.now()})}catch(e){}}}class pe{has(e){return void 0!==this[e]}set(e,t){return this[e]=t,this}get(e){return this[e]}values(){return Object.entries(this).map(e=>{return l(e,2)[1]})}}function _e(){return new de}function ve(e){return{partner:e}}class fe extends class{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:void 0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:void 0;h(this,"_registry",void 0),h(this,"commonTags",void 0),h(this,"_scheduled",void 0),this._registry=new pe,this.commonTags=ae.from(e),this.commonPrefix=t}getOrCreate(e,t,i){var r=d(d({},t),this.commonTags),t=this.commonPrefix?this.commonPrefix+"."+e:e,e="".concat(t,"[").concat(ae.toString(r),"]");return this._registry.has(e)||this._registry.set(e,i(t,r)),this._registry.get(e)}getAllMeasurements(){return this._registry.values().map(e=>({name:e.name,type:e.type,tags:e.tags,values:e.values})).filter(function(e){return e.values&&0<e.values.length})}reset(){Array.from(this._registry.values()).forEach(e=>e.reset())}addCommonTags(e){this.commonTags=d(d({},this.commonTags),ae.from(e))}timer(e){return this.getOrCreate(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},(e,t)=>new he(e,t))}counter(e){return this.getOrCreate(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},(e,t)=>new ue(e,t))}summary(e){return this.getOrCreate(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},(e,t)=>new ge(e,t))}publish(){let t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:e=>e,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:void 0;return Promise.resolve(this.getAllMeasurements()).then(e=>t(e,i)).then(()=>this.reset())}schedulePublishAfterMsec(t,i){if(!this._scheduled){let e=this;setTimeout(()=>(e._scheduled=!1,e.publish(i,{trigger:"fixed-time",fixed_time_msec:t})),t),this._scheduled=!0}return this}schedulePublishBeforeUnload(e){const t=this,i="undefined"!=typeof AbortController?new AbortController:void 0;return i&&(i.publisher=e,addEventListener("beforeunload",()=>t.publish(e,{trigger:"beforeunload"}),{capture:!1,signal:i.signal}),this._onUnloadPublishAbortController=i),this}unregister(){const e=this._onUnloadPublishAbortController;if(e)return e.abort(),this.publish(e.publisher,{trigger:"unregister"})}}{constructor(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:void 0,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:void 0;super(d(d({source:e,version:t},ve(i)),r),"id5.api")}loadDelayTimer(){return this.timer("instance.load.delay",0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}fetchCallTimer(e){return this.timer("fetch.call.time",d({status:e},1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}))}fetchFailureCallTimer(){return this.fetchCallTimer("fail",0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}fetchSuccessfulCallTimer(){return this.fetchCallTimer("success",0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}extensionsCallTimer(e,t){return this.timer("extensions.call.time",d({extensionType:e,status:t?"success":"fail"},2<arguments.length&&void 0!==arguments[2]?arguments[2]:{}))}consentRequestTimer(e){return this.timer("consent.request.time",d({requestType:e},1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}))}invocationCountSummary(){return this.summary("invocation.count",0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}instanceCounter(e){return this.counter("instance.count",d({instanceId:e},1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}))}instanceUniqueDomainsCounter(e){return this.counter("instance.domains.count",d({instanceId:e},1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}))}instanceUniqWindowsCounter(e){return this.counter("instance.windows.count",d({instanceId:e},1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}))}instanceUniqPartnersCounter(e){return this.counter("instance.partners.count",d({instanceId:e},1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}))}instanceJoinDelayTimer(){return this.timer("instance.join.delay.time",0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}instanceLateJoinCounter(e){return this.counter("instance.lateJoin.count",d({instanceId:e},1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}))}instanceLateJoinDelayTimer(){return this.timer("instance.lateJoin.delay",d({},0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}))}instanceLastJoinDelayTimer(){return this.timer("instance.lastJoin.delay",d({},0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}))}instanceMsgDeliveryTimer(){return this.timer("instance.message.delivery.time",0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}userIdProvisioningDelayTimer(e){return this.timer("userid.provisioning.delay",d({cachedResponseUsed:e},1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}))}userIdNotificationDeliveryDelayTimer(){return this.timer("userid.provisioning.delivery.delay",d({},0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}))}userIdProvisioningDuplicateTimer(){return this.timer("userid.provisioning.duplicate",d({},0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}))}cachedUserIdAge(){return this.summary("userid.cached.age",d({},0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}))}consentChangeCounter(){return this.counter("leader.consent.change.count",0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}consentIgnoreCounter(){return this.counter("leader.consent.ignore.count",0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}storageAllKeysCounter(){return this.summary("storage.keys.all.count",0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}storageExpiredKeysCounter(){return this.summary("storage.keys.expired.count",0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}instanceSurvivalTime(){return this.timer("instance.survival.time",0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}localStorageGrantCounter(){return this.counter("consent.lsg.count",0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}consentDiscrepancyCounter(){return this.counter("consent.discrepancy.count",0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}refreshCallCounter(e){return this.counter("refresh.call.count",d({target:e},1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}))}}class me{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:Date.now();h(this,"timestamp",void 0),h(this,"response",void 0),this.response=e,this.timestamp=t}getGenericResponse(){return this.response.generic}getResponseFor(e){var t,i;if(null!==(t=this.response)&&void 0!==t&&t.responses&&null!==(i=this.response)&&void 0!==i&&i.responses[e])return d(d({},this.response.generic),this.response.responses[e])}}class Ie{constructor(e,t,i){h(this,"_extensionsProvider",void 0),h(this,"_metrics",void 0),h(this,"_log",void 0),this._extensionsProvider=i,this._metrics=e,this._log=t}fetchId(e,l,h){return this._extensionsProvider.gather(e).then(n=>{const s=e.map(e=>{const t=e.cacheData;var i=null===t||void 0===t||null===(s=t.response)||void 0===s?void 0:s.signature,r=null===t||void 0===t?void 0:t.nb,s=null===t||void 0===t?void 0:t.getMaxAge();return this._createRequest(l,e,i,r,s,n,h)}),o=this._log,a=this._metrics,c=this;return new Promise((t,i)=>{const r=_e();var e="".concat("https://id5-sync.com").concat("/gm/v3");o.info("Fetching ID5 ID from:",e,s),function(r,s,n,o,e){o=3<arguments.length&&void 0!==o?o:{};let a=4<arguments.length&&void 0!==e?e:g;try{let i;var c,l=o.method||(n?"POST":"GET");let e=document.createElement("a");e.href=r;let t="object"==typeof s&&null!==s?s:{success:function(){a.info("ajax","xhr success")},error:function(e){a.error("ajax","xhr error",null,e)}};"function"==typeof s&&(t.success=s),i=new window.XMLHttpRequest,i.onreadystatechange=function(){var e;4===i.readyState&&(200<=(e=i.status)&&e<300||304===e?t.success(i.responseText,i):t.error(i.statusText,i))},i.ontimeout=function(){a.error("ajax","xhr timeout after ",i.timeout,"ms")},"GET"===l&&n&&(u((c=F(r,o)).search,n),r=k(c)),i.open(l,r,!0),o.withCredentials&&(i.withCredentials=!0),U(o.customHeaders,(e,t)=>{i.setRequestHeader(t,e)}),o.preflight&&i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.setRequestHeader("Content-Type",o.contentType||"text/plain"),"POST"===l&&n?i.send(n):i.send()}catch(e){a.error("ajax","xhr construction",e)}}(e,{success:function(e){o.info("Success at fetch call:",e),r.record(null===a||void 0===a?void 0:a.fetchSuccessfulCallTimer());try{t(new me(c._validateResponse(e)))}catch(e){i(e)}},error:function(e){r.record(null===a||void 0===a?void 0:a.fetchFailureCallTimer()),i(e)}},JSON.stringify({requests:s}),{method:"POST",withCredentials:!0},o)})})}_validateResponse(e){if(!e||!O(e)||e.length<1)throw new Error('Empty fetch response from ID5 servers: "'.concat(e,'"'));var t=JSON.parse(e);if(!L(t.generic))throw new Error("Server response failed to validate: ".concat(e));return this._log.info("Valid json response from ID5 received",t),t}_createRequest(e,i,t,r,s,n,o){this._log.info("Create request data for",{fetchIdData:i,consentData:e,signature:t,nbValue:r,refreshInSecondUsed:s,extensions:n});var a=i.partnerId;const c={requestId:i.integrationId,requestCount:i.requestCount,role:i.role,cacheId:i.cacheId,refresh:i.refresh,source:i.source,sourceVersion:i.sourceVersion,partner:a,v:i.originVersion,o:i.origin,tml:null===(a=i.refererInfo)||void 0===a?void 0:a.topmostLocation,ref:null===(a=i.refererInfo)||void 0===a?void 0:a.ref,cu:null===(a=i.refererInfo)||void 0===a?void 0:a.canonicalUrl,u:(null===(a=i.refererInfo)||void 0===a?void 0:a.stack[0])||window.location.href,top:null!==(a=i.refererInfo)&&void 0!==a&&a.reachedTop?1:0,localStorage:!0===o?1:0,nbPage:r,id5cdn:i.isUsingCdn,ua:window.navigator.userAgent,att:i.att};r=e.gdprApplies;N(r)&&(c.gdpr=r?1:0);r=e.consentString;N(r)&&(c.gdpr_consent=r),N(i.allowedVendors)?c.allowed_vendors=i.allowedVendors:N(e.allowedVendors)&&(c.allowed_vendors=e.allowedVendors),N(e.gppData)&&(c.gpp_string=e.gppData.gppString,c.gpp_sid=e.gppData.applicableSections.join(",")),N(t)&&(c.s=t);t=i.uaHints;N(t)&&(c.ua_hints=t),N(e.ccpaString)&&""!==e.ccpaString&&(c.us_privacy=e.ccpaString),function(e){var t=Object.keys(e);let i=t.length,r=new Array(i);for(;i--;)r[i]=[t[i],e[t[i]]];return r}({pd:"pd",partnerUserId:"puid",provider:"provider",segments:"segments",trueLink:"true_link"}).forEach(e=>{var t=l(e,2),e=t[0],t=t[1];N(i[e])&&(c[t]=i[e])});e=i.abTesting;e&&!0===e.enabled&&(c.ab_testing={enabled:!0,control_group_pct:e.controlGroupPct});e=i.invalidSegmentsCount;return e&&0<e&&(c._invalid_segments=e),i.trace&&(c._trace=!0),c.provided_options={refresh_in_seconds:i.providedRefreshInSeconds},c.used_refresh_in_seconds=s,c.extensions=n,c}}const we=Object.freeze({CONSENT_UPDATED:"consent_updated",USER_ID_READY:"user_id_ready",CASCADE_NEEDED:"fire_sync_pixel",USER_ID_FETCH_CANCELED:"user_id_fetch_canceled",USER_ID_FETCH_FAILED:"user_id_fetch_failed"}),ye=Object.freeze({ID5_MESSAGE_RECEIVED:"message",ID5_INSTANCE_JOINED:"instance-joined",ID5_LEADER_ELECTED:"leader-elected"}),Ce=Object.freeze([...Object.values(ye),...Object.values(we)]);class Se{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:g;h(this,"_handlers",void 0),h(this,"_log",void 0),this._log=e,this._handlers={}}_dispatch(t){var e=this._handlers[t];if(e){for(var i=arguments.length,r=new Array(1<i?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];var n,o=f(e);try{for(o.s();!(n=o.n()).done;){const a=n.value;try{a(...r)}catch(e){this._log.error("Event ".concat(t," handler execution failed."),e)}}}catch(e){o.e(e)}finally{o.f()}}}emit(e){if(void 0!==e&&Ce.includes(e)){for(var t=arguments.length,i=new Array(1<t?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];this._dispatch(e,...i)}else this._log.warn("Unsupported event",e)}on(e,t){void 0!==e&&Ce.includes(e)?(this._handlers[e]||(this._handlers[e]=[]),this._handlers[e].push(t)):this._log.warn("Unsupported event",e)}}const be=Object.freeze({DIRECT_METHOD:"direct_method",POST_MESSAGE:"post_message"});class De{constructor(e,t,i){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:g;h(this,"_instanceProperties",void 0),h(this,"_log",void 0),h(this,"callType",void 0),h(this,"_instanceWindow",void 0),this._instanceWindow=t,this._instanceProperties=i,this._log=r,this.callType=e}getId(){return this._instanceProperties.id}getFetchIdData(){return this._instanceProperties.fetchIdData}updateFetchIdData(e){u(this._instanceProperties.fetchIdData,e)}getCacheId(){var e=this._instanceProperties.fetchIdData,e={partnerId:e.partnerId,att:e.att,pd:e.pd,provider:e.provider,abTesting:e.abTesting,segments:JSON.stringify(e.segments),providedRefresh:e.providedRefreshInSeconds,trueLink:null===(e=e.trueLink)||void 0===e?void 0:e.id};return M(JSON.stringify(e))}getDeclaredConsentSource(){return this._instanceProperties.fetchIdData.consentSource||j.cmp}getSourceVersion(){return this._instanceProperties.sourceVersion}getSource(){return this._instanceProperties.source}notifyUidReady(){}notifyFetchUidCanceled(){}notifyCascadeNeeded(){}canDoCascade(){return!0===this._instanceProperties.canDoCascade}getStorage(){return ee}getWindow(){return this._instanceWindow}}class Ee extends De{constructor(e,t,i){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:g,s=4<arguments.length?arguments[4]:void 0;super(be.DIRECT_METHOD,e,t,r),h(this,"_dispatcher",void 0),h(this,"_provisionedUids",void 0),h(this,"_metrics",void 0),this._dispatcher=i,this._metrics=s,this._provisionedUids=new Map}notifyUidReady(e,t){var i,r=null==e||null===(i=e.responseObj)||void 0===i?void 0:i.universal_uid;r&&(this._provisionedUids.has(r)?(i=this._provisionedUids.get(r),this._metrics.userIdProvisioningDuplicateTimer({provisioner:t.provisioner,firstProvisioner:i.provisioner}).record(performance.now()-i.time)):(this._provisionedUids.set(r,{provisioner:t.provisioner,time:performance.now()}),this._dispatcher.emit(we.USER_ID_READY,e,t)))}notifyFetchUidCanceled(e){this._dispatcher.emit(we.USER_ID_FETCH_CANCELED,e)}notifyCascadeNeeded(e){this._dispatcher.emit(we.CASCADE_NEEDED,e)}}class Te extends Z{constructor(e,t){super(),h(this,"_messenger",void 0),h(this,"_destinationId",void 0),this._messanger=e,this._destinationId=t}getItem(){}removeItem(e){this._remoteCall("removeItem",[e])}setItem(e,t){this._remoteCall("setItem",[e,t])}_remoteCall(e,t){this._messanger.callProxyMethod(this._destinationId,i.STORAGE,e,t)}}class Ae extends De{constructor(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:g;super(be.POST_MESSAGE,e.getWindow(),e.properties,i),h(this,"_messenger",void 0),this._messenger=t}_callProxy(e,t){this._messenger.callProxyMethod(this.getId(),i.FOLLOWER,e,t)}notifyUidReady(e,t){this._callProxy("notifyUidReady",[e,t])}notifyFetchUidCanceled(e){this._callProxy("notifyFetchUidCanceled",[e])}notifyCascadeNeeded(e){this._callProxy("notifyCascadeNeeded",[e])}getStorage(){return new Te(this._messenger,this.getId())}}class Pe{constructor(e,t,i,r){h(this,"_store",void 0),h(this,"_log",void 0),h(this,"_provisioner",void 0),h(this,"_meter",void 0),this._provisioner=e,this._store=t,this._log=i,this._meter=r}provisionFromCache(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:void 0;try{const o=this._log;var r=t.getCacheId();const a=this._store.getCachedResponse(r);var s,n=!a||!a.isValid()||a.isExpired();let e=!1;return a&&(s=a.getAgeSec(),this._meter.cachedUserIdAge({expired:a.isExpired(),valid:a.isValid(),provisioner:this._provisioner,maxAge:a.getMaxAge()}).record(isNaN(s)?0:s)),a&&a.isValid()?(o.info("Found valid cached response for instance ",JSON.stringify({id:t.getId(),cacheId:t.getCacheId(),provisioner:this._provisioner,responseFromCache:a})),t.notifyUidReady({timestamp:a.timestamp,responseObj:a.response,isFromCache:!0,willBeRefreshed:!!n},{timestamp:Date.now(),provisioner:this._provisioner,tags:d({callType:t.callType},i)}),e=!0):o.info("Couldn't find response for cacheId",t.getCacheId()),{cacheId:r,responseFromCache:a,refreshRequired:n,provisioned:e}}catch(e){return this._log.error("Cached UserId provisioning failure",e),{refreshRequired:!0,provisioned:!1}}}}class Oe{constructor(){var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0],t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];h(this,"lateJoiner",!1),h(this,"uniqueLateJoiner",!1),this.lateJoiner=e,this.uniqueLateJoiner=t}}class Re{updateConsent(){}updateFetchIdData(){}refreshUid(){}addFollower(){}getProperties(){}}class xe extends Re{constructor(e,t,i,r,s,n){var o=6<arguments.length&&void 0!==arguments[6]?arguments[6]:g,a=7<arguments.length?arguments[7]:void 0;super(),h(this,"_followers",void 0),h(this,"_followersRequests",{}),h(this,"_refreshRequired",{}),h(this,"_fetcher",void 0),h(this,"_log",void 0),h(this,"_consentManager",void 0),h(this,"_inProgressFetch",void 0),h(this,"_queuedRefreshArgs",void 0),h(this,"_lastConsentDataSet",void 0),h(this,"_metrics",void 0),h(this,"_leaderStorage",void 0),h(this,"_store",void 0),this._followers=[],this._fetcher=a,this._properties=t,this._consentManager=s,this._metrics=n,this._window=e,this._leaderStorage=i,this._log=o,this._store=r,this._firstFetchTriggered=!1,this._cachedIdProvider=new Pe("leader",this._store,this._log,this._metrics)}_handleRefreshResult(e,t,i,r){const s=this._log,n=this._consentManager,o=this._store;if(void 0!==r){var a;n.setStoredPrivacy(null===(a=r.getGenericResponse())||void 0===a?void 0:a.privacy);const p=n.localStorageGrant("fetcher-after-response");p.isDefinitivelyAllowed()?(s.info("Storing ID and request hashes in cache"),o.updateNbs(t),o.storeResponse(e,r)):(s.info("Cannot use local storage to cache ID",p),o.clearAll(e));var c,l=f(e);try{for(l.s();!(c=l.n()).done;){var h=c.value.integrationId;this._followersRequests[h]=(this._followersRequests[h]||0)+1}}catch(e){l.e(e)}finally{l.f()}const _=[];var d,u=f(this._followers);try{for(u.s();!(d=u.n()).done;){const v=d.value;var g=r.getResponseFor(v.getId());void 0!==g&&(this._log.debug("Notify uid ready.","Follower:",v.getId(),"Uid:",g),this._refreshRequired[v.getId()]=!1,this._notifyUidReady(v,{timestamp:r.timestamp,responseObj:g,isFromCache:!1}),!0===g.cascade_needed&&_.push(v.getId()))}}catch(e){u.e(e)}finally{u.f()}void 0!==i&&0<_.length&&this._consentManager.localStorageGrant("leader-before-cascade").isDefinitivelyAllowed()&&this._handleCascade(_,r,i)}}_notifyUidReady(e,t){var i={timestamp:Date.now(),provisioner:"leader",tags:{callType:e.callType}};e.notifyUidReady(t,i)}_handleCascade(e,t,i){var r,s=this._followers.filter(t=>void 0!==e.find(e=>t.getId()===e)&&t.canDoCascade()).sort((e,t)=>{function i(e){var t;return(null===(e=e.getFetchIdData().refererInfo)||void 0===e||null===(t=e.stack)||void 0===t?void 0:t.length)||Number.MAX_SAFE_INTEGER}return i(e)-i(t)});if(0<s.length){const n=s[0];n.notifyCascadeNeeded({partnerId:n.getFetchIdData().partnerId,userId:t.getResponseFor(n.getId()).universal_uid,gdprApplies:i.gdprApplies,consentString:i.consentString,gppString:null===(t=i.gppData)||void 0===t?void 0:t.gppString,gppSid:null===(i=i.gppData)||void 0===i||null===(r=i.applicableSections)||void 0===r?void 0:r.join(",")})}else this._log.error("Couldn't find cascade eligible follower")}_handleCancel(e){var t,i=f(this._followers);try{for(i.s();!(t=i.n()).done;){const r=t.value;r.notifyFetchUidCanceled({reason:e})}}catch(e){i.e(e)}finally{i.f()}}_getId(){let n=0<arguments.length&&void 0!==arguments[0]&&arguments[0];const o=this._log;this._waitForConsent().then(t=>{const e=this._consentManager.localStorageGrant("fetch-before-request");if(o.info("Local storage grant",e),e.allowed){var i=this._store.hasConsentChanged(t);e.isDefinitivelyAllowed()&&this._store.storeConsent(t);var r=te.checkIfAccessible();const c=new Map;let a=n;const s=this._followers.map(e=>{var t=e.getId(),i=(this._followersRequests[t]||0)+1,r=this._properties.id,s=!0===this._refreshRequired[e.getId()];a=a||s;var n,o=e.getCacheId();return c.has(o)||(n=this._store.getCachedResponse(o))&&c.set(o,n),d(d({},e.getFetchIdData()),{},{integrationId:t,requestCount:i,refresh:s,role:r===e.getId()?"leader":"follower",cacheId:o,cacheData:c.get(o),sourceVersion:e.getSourceVersion(),source:e.getSource()})});i||a?(o.info("Decided to fetch a fresh ID5 ID",{consentHasChanged:i,shouldRefresh:a}),o.info("Fetching ID5 ID (forceFetch:".concat(n,")")),this._inProgressFetch=!0,this._firstFetchTriggered=!0,this._fetcher.fetchId(s,t,r).then(e=>{this._handleRefreshResult(s,c,t,e),this._handleFetchCompleted()}).catch(e=>{this._handleFailed(e),this._handleFetchCompleted()})):(o.info("Not decided to refresh ID5 ID",{consentHasChanged:i,shouldRefresh:a}),this._handleFetchCompleted())}else o.info("No legal basis to use ID5",t),this._store.clearAll(this._followers.map(e=>({cacheId:e.getCacheId()}))),this._handleCancel("No legal basis to use ID5")})}_waitForConsent(){const t=this._log,e=this._consentManager,i=this._metrics;t.info("Waiting for consent");const r=i.timer("fetch.consent.wait.time");return e.getConsentData().then(e=>(t.info("Consent received",e),r&&r.recordNow(),e))}start(){!0!==this._started&&(this._getId(!1),this._started=!0)}refreshUid(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};let t=1<arguments.length?arguments[1]:void 0;var i=!0===e.forceFetch;t&&(i?this._refreshRequired[t]=!0:(i=this._followers.find(e=>e.getId()===t))&&this._provisionFromCache(i)),this._metrics.refreshCallCounter("leader",{overwrites:void 0===this._queuedRefreshArgs}).inc(),this._callRefresh(e,t)}_callRefresh(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=1<arguments.length?arguments[1]:void 0;this._inProgressFetch?this._queuedRefreshArgs=[e,t]:(!0===e.resetConsent&&(this._consentManager.resetConsentData(!0===e.forceAllowLocalStorageGrant),this._awaitedConsentFrom=t),this._getId(!0===e.forceFetch))}updateConsent(e,t){if(this._consentManager.hasConsentSet())this._handleIgnoredConsentUpdate(e);else{const s=new Set(this._followers.map(e=>e.getDeclaredConsentSource()));var i=e.source||j.cmp,r=1===s.size&&s.has(j.partner);this._awaitedConsentFrom?this._awaitedConsentFrom===t?(this._consentManager.setConsentData(e),this._awaitedConsentFrom=void 0):this._handleIgnoredConsent(e,"awaited"):i!==j.partner||r?this._consentManager.setConsentData(e):this._handleIgnoredConsent(e,"partner")}}_handleIgnoredConsentUpdate(e){try{const r=this._consentManager._consentDataHolder.getValue();if(r){const s={},n=q.createFrom(e);Object.values(G).forEach(e=>{var t,i;n.apiTypes.includes(e)&&r.apiTypes.includes(e)?(t=JSON.stringify(r.getApiTypeData(e)),i=JSON.stringify(n.getApiTypeData(e)),s[e]=t===i?"same":"different"):n.apiTypes.includes(e)?s[e]="added":r.apiTypes.includes(e)&&(s[e]="missed")}),this._metrics.consentChangeCounter(s).inc()}}catch(e){this._log.error(e)}}_handleIgnoredConsent(e,t){try{const i={reason:t,source:e.source};e.apiTypes.forEach(e=>i[e]=!0),this._metrics.consentIgnoreCounter(i)}catch(e){this._log.error(e)}}updateFetchIdData(t,e){const i=this._followers.find(e=>e.getId()===t);var r=i.getCacheId();i.updateFetchIdData(e);e=i.getCacheId();e!==r&&(this._log.info("Follower",i.getId(),"cacheId changed from",r," to",e,"required refresh"),this._refreshRequired[i.getId()]=!0)}addFollower(t){const e=this._log;var i=void 0===this._followers.find(e=>e.getCacheId()===t.getCacheId());this._followers.push(t),e.info("Added follower",t.getId(),"cacheId",t.getCacheId()),this._window!==t.getWindow()&&(r=t.getStorage(),e.info("Adding follower's",t.getId(),"storage as replica"),this._leaderStorage.addReplica(r));var r=this._provisionFromCache(t);let s=new Oe;return!0===this._firstFetchTriggered&&(s.lateJoiner=!0,s.uniqueLateJoiner=i,r&&this._callRefresh({forceFetch:!0})),s}_provisionFromCache(e){var t=this._cachedIdProvider.provisionFromCache(e);return this._refreshRequired[e.getId()]=t.refreshRequired,t.provisioned&&this._store.incNb(t.cacheId),t.refreshRequired}getProperties(){return this._properties}_handleFetchCompleted(){this._inProgressFetch=void 0,this._queuedRefreshArgs&&(this._callRefresh(...this._queuedRefreshArgs),this._queuedRefreshArgs=void 0)}_handleFailed(e){this._log.error("Fetch id failed",e);var t,i=f(this._followers);try{for(i.s();!(t=i.n()).done;){const r=t.value;r.notifyFetchUidCanceled({reason:"error"})}}catch(e){i.e(e)}finally{i.f()}}}class Le extends Re{constructor(e,t){super(),h(this,"_messenger",void 0),h(this,"_leaderInstanceProperties",void 0),this._messenger=e,this._leaderInstanceProperties=t}_sendToLeader(e,t){this._messenger.callProxyMethod(this._leaderInstanceProperties.id,i.LEADER,e,t)}updateConsent(e,t){this._sendToLeader("updateConsent",[e,t])}refreshUid(e,t){this._sendToLeader("refreshUid",[e,t])}updateFetchIdData(e,t){this._sendToLeader("updateFetchIdData",[e,t])}getProperties(){return this._leaderInstanceProperties}}class Ne extends Re{constructor(){super(...arguments),h(this,"_callsQueue",[]),h(this,"_assignedLeader",void 0)}updateConsent(e,t){this._callOrBuffer("updateConsent",[e,t])}updateFetchIdData(e,t){this._callOrBuffer("updateFetchIdData",[e,t])}refreshUid(e,t){this._callOrBuffer("refreshUid",[e,t])}addFollower(e){return this._callOrBuffer("addFollower",[e])}getProperties(){if(this._assignedLeader)return this._assignedLeader.getProperties()}assignLeader(e){this._assignedLeader=e;var t,i=f(this._callsQueue);try{for(i.s();!(t=i.n()).done;){var r=t.value;this._callAssignedLeader(r.name,r.args)}}catch(e){i.e(e)}finally{i.f()}this._callsQueue=[]}_callOrBuffer(e,t){if(this._assignedLeader)return this._callAssignedLeader(e,t);this._callsQueue.push({name:e,args:t})}_callAssignedLeader(e,t){return this._assignedLeader[e](...t)}}class Ue{constructor(){h(this,"_valuePromise",void 0),h(this,"_value",void 0),h(this,"_resolve",void 0),h(this,"_hasValue",void 0),this.reset()}reset(){this._value=void 0,this._hasValue=!1,this._valuePromise=new Promise(e=>{this._resolve=e})}set(e){this._hasValue?this._valuePromise=Promise.resolve(e):(this._hasValue=!0,this._resolve(e)),this._value=e}getValuePromise(){return this._valuePromise}hasValue(){return this._hasValue}getValue(){return this._value}}class Fe extends class{getConsentData(){}localStorageGrant(){}setStoredPrivacy(){}}{constructor(e,t,i,r,s){super(),h(this,"_consentDataHolder",void 0),h(this,"storedPrivacyData",void 0),h(this,"localStorage",void 0),h(this,"_forceAllowLocalStorageGrant",void 0),this._log=r,this.localStorage=e,this.storageConfig=t,this._consentDataHolder=new Ue,this._forceAllowLocalStorageGrant=i,this._metrics=s}isForceAllowLocalStorageGrant(){return this._forceAllowLocalStorageGrant}resetConsentData(e){this._consentDataHolder.reset(),this.storedPrivacyData=void 0,this._forceAllowLocalStorageGrant=e}localStorageGrant(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"unknown",i=this._getLocalStorageGrant();return null===(e=this._metrics)||void 0===e||null!==(t=e.localStorageGrantCounter(d({allowed:i.allowed,grantType:i.grantType,lsgContext:t,consentSet:null===(t=this._consentDataHolder)||void 0===t?void 0:t.hasValue()},i.api)))&&void 0!==t&&t.inc(),i}_getLocalStorageGrant(){const e=this._log;if(!0===this._forceAllowLocalStorageGrant)return e.warn("cmpApi: Local storage access granted by configuration override, consent will not be checked"),new B(!0,H.FORCE_ALLOWED_BY_CONFIG);if(this._consentDataHolder.hasValue()&&0!==this._consentDataHolder.getValue().apiTypes.length)return this._consentDataHolder.getValue().localStorageGrant();if(L(this.storedPrivacyData)||(t=this.localStorage.getItemWithExpiration(this.storageConfig.PRIVACY),this.storedPrivacyData=t&&JSON.parse(t),e.info("cmpApi: Loaded stored privacy data from local storage",this.storedPrivacyData)),this.storedPrivacyData&&!0===this.storedPrivacyData.id5_consent)return new B(!0,H.ID5_CONSENT);if(!this.storedPrivacyData||!N(this.storedPrivacyData.jurisdiction))return new B(!0,H.PROVISIONAL);var t=this.storedPrivacyData.jurisdiction,t=t in J.PRIVACY.JURISDICTIONS&&J.PRIVACY.JURISDICTIONS[t];return new B(!1===t,H.JURISDICTION)}setStoredPrivacy(e){const t=this._log;try{L(e)?(this.storedPrivacyData=e,this.localStorage.setItemWithExpiration(this.storageConfig.PRIVACY,JSON.stringify(e))):t.error("cmpApi: Cannot store privacy data if it is not an object",e)}catch(e){t.error("cmpApi: Error while storing privacy data",e)}}setConsentData(e){this._log.debug("Set consent data",e);e=q.createFrom(e);this._consentDataHolder.set(e)}getConsentData(){return this._consentDataHolder.getValuePromise()}hasConsentSet(){return this._consentDataHolder.hasValue()}}class ke{constructor(e,t,i,r){h(this,"localStorageGrantChecker",void 0),h(this,"localStorage",void 0),h(this,"_log",void 0),this.localStorageGrantChecker=e,this.localStorage=t,this.storageConfig=i,this._log=r}get(e){const t=this._log;try{const r=this.localStorageGrant();if(r.isDefinitivelyAllowed()){var i=this.localStorage.getItemWithExpiration(e);return t.info("Local storage get key=".concat(e.name," value=").concat(i)),i}t.warn("clientStore.get() has been called without definitive grant",r)}catch(e){t.error(e)}}_getObject(e){const t=this._log;try{const r=this.localStorageGrant();if(r.isDefinitivelyAllowed()){var i=this.localStorage.getObjectWithExpiration(e);return t.info("Local storage get key=".concat(e.name," value=").concat(i)),i}t.warn("clientStore.get() has been called without definitive grant",r)}catch(e){t.error(e)}}clear(e){const t=this._log;try{this.localStorage.removeItemWithExpiration(e)}catch(e){t.error(e)}}scheduleGC(t){const i=this.localStorageGrant(),r=this.localStorage,s=this.storageConfig.ID5_V2.name;setTimeout(function(){var e;i.isDefinitivelyAllowed()&&(e=r.removeExpiredObjectWithPrefix(s),t.storageAllKeysCounter().record((null==e?void 0:e.all)||0),t.storageExpiredKeysCounter().record((null==e?void 0:e.expired)||0))},0)}_clearObject(e){const t=this._log;try{this.localStorage.removeItem(e.name)}catch(e){t.error(e)}}_put(e,t){const i=this._log;try{const r=this.localStorageGrant();r.isDefinitivelyAllowed()?(i.info("Local storage put key=".concat(e.name," value=").concat(t)),this.localStorage.setItemWithExpiration(e,t)):i.warn("clientStore._put() has been called without definitive grant",r)}catch(e){i.error(e)}}_updateObject(e,t){const i=this._log;try{const r=this.localStorageGrant();if(r.isDefinitivelyAllowed())return this.localStorage.updateObjectWithExpiration(e,t);i.warn("clientStore._updateObject() has been called without definitive grant",r)}catch(e){i.error(e)}}localStorageGrant(){return this.localStorageGrantChecker()}getResponse(){var e=this.get(this.storageConfig.ID5);return e&&JSON.parse(decodeURIComponent(e))}clearResponse(){this.clear(this.storageConfig.ID5)}clearResponseV2(e){this._clearObject(this.storageConfig.ID5_V2.withNameSuffixed(e))}putResponseV1(e){this._put(this.storageConfig.ID5,encodeURIComponent(O(e)?e:JSON.stringify(e)))}getHashedConsentData(){return this.get(this.storageConfig.CONSENT_DATA)}clearHashedConsentData(){this.clear(this.storageConfig.CONSENT_DATA)}putHashedConsentData(e){e!==new q&&this._put(this.storageConfig.CONSENT_DATA,e.hashCode())}clearDateTime(){this.clear(this.storageConfig.LAST)}setResponseDateTimeV1(e){this._put(this.storageConfig.LAST,e)}storeResponseV2(e,t){let i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:Date.now();return this._updateObject(this.storageConfig.ID5_V2.withNameSuffixed(e),e=>d(d({},e),{},{response:t,responseTimestamp:i}))}getStoredResponseV2(e){return this._getObject(this.storageConfig.ID5_V2.withNameSuffixed(e))}incNbV2(e){let i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return this._updateObject(this.storageConfig.ID5_V2.withNameSuffixed(e),e=>{var t=Math.max(0,x(null==e?void 0:e.nb)?Math.round(e.nb)+i:i);return d(d({},e),{},{nb:t})})}static storedDataMatchesCurrentData(e,t){return null==e||e===t}storedConsentDataMatchesConsentData(e){return ke.storedDataMatchesCurrentData(this.getHashedConsentData(),e.hashCode())}getExtensions(){return this._getObject(this.storageConfig.EXTENSIONS)}storeExtensions(e,t){return this._updateObject(t,()=>e)}clearExtensions(){return this.clear(this.storageConfig.EXTENSIONS)}}class Me{constructor(e,t,i){h(this,"_metrics",void 0),h(this,"_log",void 0),h(this,"_store",void 0),this._metrics=e,this._log=t,this._store=i}static getChunkUrl(e,t){return"https://d".concat(e,".eu-").concat(t,"-id5-sync.com")}submitExtensionCall(t,i){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:void 0;let r=_e();return fetch(t,e).then(e=>{if(e.ok)return r.record(this._metrics.extensionsCallTimer(i,!0)),e.json();r.record(this._metrics.extensionsCallTimer(i,!1));e="The call to get extensions at ".concat(t," was not ok, status: ").concat(e.status,", statusText: ").concat(e.statusText);return this._log.warn(e),Promise.reject(new Error(e))}).catch(e=>(r.record(this._metrics.extensionsCallTimer(i,!1)),this._log.warn("Got error from ".concat(t," endpoint"),e),{}))}gatherChunks(e,i){if(e){let t=_e();return Promise.all(Array.from({length:i.length},(e,t)=>{t=Me.getChunkUrl(t,i.urlVersion);return fetch(t).then(e=>{if(e.ok)return e.text();throw new Error("The call to get ".concat(i.name," was not ok, status: ").concat(e.status,", statusText: ").concat(e.statusText))})})).then(e=>(t.record(this._metrics.extensionsCallTimer(i.name,!0)),{[i.name]:e,[i.name+"Version"]:"".concat(i.version)})).catch(e=>(t.record(this._metrics.extensionsCallTimer(i.name,!1)),this._log.warn("Got error when getting ".concat(i.name),e),{}))}return Promise.resolve({})}gather(e){var t=this._store.getCachedExtensions();if(void 0!==t)return Promise.resolve(t);let i=_e(),r=this._submitBounce(e);return this.submitExtensionCall("https://lb.eu-1-id5-sync.com/lb/v1","lb").then(e=>{var t=this.getChunksEnabled(e);return Promise.allSettled([Promise.resolve(e),this.gatherChunks(t,Me.CHUNKS_CONFIGS.devChunks),this.gatherChunks(t,Me.CHUNKS_CONFIGS.groupChunks),r])}).then(e=>{i.record(this._metrics.extensionsCallTimer("all",!0));let t=Me.DEFAULT_RESPONSE;return e.forEach(e=>{e.value&&(t=d(d({},t),e.value))}),this._store.storeExtensions(t),t}).catch(e=>(i.record(this._metrics.extensionsCallTimer("all",!1)),this._log.error("Got error ".concat(e," when gathering extensions data")),Me.DEFAULT_RESPONSE))}_submitBounce(e){return e.some(e=>{return N(null===(e=e.cacheData)||void 0===e?void 0:e.signature)})?Promise.resolve({}):this.submitExtensionCall("https://id5-sync.com/bounce","bounce",{credentials:"include"})}getChunksEnabled(e){e=null==e?void 0:e.chunks;return 0!==e&&e}}h(Me,"CHUNKS_CONFIGS",Object.freeze({devChunks:{name:"devChunks",urlVersion:3,length:8,version:4},groupChunks:{name:"groupChunks",urlVersion:4,length:8,version:4}})),h(Me,"DEFAULT_RESPONSE",{lbCDN:"%%LB_CDN%%"});const je={createExtensions:function(e,t,i){return new Me(e,t,i)}},Ve=Object.freeze({UNKNOWN:"unknown",LEADER:"leader",FOLLOWER:"follower"}),Ge=Object.freeze({MULTIPLEXING:"multiplexing",SINGLETON:"singleton"}),We=Object.freeze({AWAITING_SCHEDULE:"awaiting_schedule",SKIPPED:"skipped",SCHEDULED:"scheduled",COMPLETED:"completed",CANCELED:"canceled"});class qe{constructor(e,t,i){h(this,"properties",void 0),h(this,"knownState",void 0),h(this,"_joinTime",void 0),h(this,"_window",void 0),this.properties=e,this.knownState=t,this._window=i,this._joinTime=performance.now()}getId(){return this.properties.id}isMultiplexingPartyAllowed(){var e;return(null===(e=this.knownState)||void 0===e?void 0:e.operatingMode)===Ge.MULTIPLEXING}getInstanceMultiplexingLeader(){var e,t;if((null===(e=this.knownState)||void 0===e?void 0:e.operatingMode)===Ge.MULTIPLEXING)return null===(e=this.knownState)||void 0===e||null===(t=e.multiplexing)||void 0===t?void 0:t.leader}getWindow(){return this._window}}class He{constructor(e){h(this,"_knownValues",[]),h(this,"_counter",void 0),this._counter=e}add(e){e&&-1===this._knownValues.indexOf(e)&&(this._counter.inc(),this._knownValues.push(e))}}class Be{constructor(e,t){h(this,"_instancesCounter",void 0),h(this,"_domainsCounter",void 0),h(this,"_windowsCounter",void 0),h(this,"_partnersCounter",void 0);var i=t.id;this._instancesCounter=e.instanceCounter(t.id),this._windowsCounter=new He(e.instanceUniqWindowsCounter(i)),this._partnersCounter=new He(e.instanceUniqPartnersCounter(i)),this._domainsCounter=new He(e.instanceUniqueDomainsCounter(i))}addInstance(e){var t,i,r;this._instancesCounter.inc(),this._partnersCounter.add((null==e||null===(t=e.fetchIdData)||void 0===t?void 0:t.partnerId)|(null==e||null===(i=e.sourceConfiguration)||void 0===i||null===(r=i.options)||void 0===r?void 0:r.partnerId)),this._domainsCounter.add(null==e?void 0:e.domain),this._windowsCounter.add(null==e?void 0:e.href)}}class Je{constructor(e){h(this,"_scheduleTime",void 0),h(this,"_closeTime",void 0),h(this,"_timeoutId",void 0),h(this,"_state",We.AWAITING_SCHEDULE),h(this,"_delayMs",void 0),h(this,"_instance",void 0),this._instance=e}schedule(e){const t=this;t._delayMs=e,this._timeoutId=setTimeout(()=>{t._timeoutId&&(t._timeoutId=void 0,t._instance._doElection(),t._closeWithState(We.COMPLETED))},t._delayMs),t._state=We.SCHEDULED,t._scheduleTime=performance.now()}skip(){this._closeWithState(We.SKIPPED)}cancel(){this._timeoutId&&(clearTimeout(this._timeoutId),this._timeoutId=void 0),this._closeWithState(We.CANCELED)}_closeWithState(e){this._state=e,this._closeTime=performance.now()}}class ze{constructor(e,t,i,r,s,n,o){h(this,"properties",void 0),h(this,"_messenger",void 0),h(this,"_knownInstances",new Map),h(this,"_lastJoinedInstance",void 0),h(this,"role",void 0),h(this,"_leader",void 0),h(this,"_mode",void 0),h(this,"_metrics",void 0),h(this,"_logger",void 0),h(this,"_instanceCounters",void 0),h(this,"_election",void 0),h(this,"_window",void 0),h(this,"_storage",void 0),h(this,"_trueLinkAdapter",void 0),h(this,"_cachedIdProvider",void 0);var a=N(globalThis)&&N(globalThis.crypto)&&P(globalThis.crypto.randomUUID)?globalThis.crypto.randomUUID():"".concat(1e6*Math.random()|0);this.properties=u({id:a,version:"1.0.31",href:null===(a=e.location)||void 0===a?void 0:a.href,domain:null===(a=e.location)||void 0===a?void 0:a.hostname},t),this.role=Ve.UNKNOWN,this._metrics=r,this._instanceCounters=new Be(r,this.properties),this._loadTime=performance.now(),this._logger=new Ke(s,this),this._window=e,this._dispatcher=new Se(this._logger),this._leader=new Ne,this._followerRole=new Ee(this._window,this.properties,this._dispatcher,this._logger,this._metrics),this._election=new Je(this),this._storage=i,this._trueLinkAdapter=n,this._cachedIdProvider=new Pe("self",new Y(o,n),this._logger,this._metrics)}updateConfig(e){u(this.properties,e)}init(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:500;let r=this,s=r._window;r._mode=!0===r.properties.singletonMode?Ge.SINGLETON:Ge.MULTIPLEXING,r._instanceCounters.addInstance(r.properties),function(i){const r=i._metrics;[100,200,500,1e3,2e3,3e3,5e3].forEach(t=>{setTimeout(()=>{var e=((null===(e=i._knownInstances)||void 0===e?void 0:e.size)||0)+1;r.summary("instance.partySize",{after:t,electionState:i._election._state}).record(e)},t)})}(r),r._messenger=new C(r.properties.id,s,r._logger),r._messenger.onAnyMessage((e,t)=>{var i=Date.now()-e.timestamp|0;r._metrics.instanceMsgDeliveryTimer({messageType:e.type,sameWindow:s===t}).record(i),r._logger.debug("Message received",e),r._doFireEvent(ye.ID5_MESSAGE_RECEIVED,e)}).onMessage(I.TYPE,(e,t)=>{let i=u(new I,e.payload);void 0===i.isResponse&&(i.isResponse=e.dst!==_),r._handleHelloMessage(i,e,t)}).onProxyMethodCall(new y(this._logger).registerTarget(i.LEADER,r._leader).registerTarget(i.FOLLOWER,r._followerRole).registerTarget(i.STORAGE,r._storage)),r._mode===Ge.SINGLETON?(r._election.skip(),r._onLeaderElected(r.properties)):r._mode===Ge.MULTIPLEXING&&r._election.schedule(e),r._messenger.broadcastMessage(r._createHelloMessage(!1),I.TYPE)}register(e){try{this.updateConfig(e),this.init()}catch(e){this._logger.error("Failed to register integration instance",e)}return this}_handleHelloMessage(e,t,i){this._joinInstance(e,t,i)}unregister(){this._logger.info("Unregistering"),this._messenger&&this._messenger.unregister()}on(e,t){return this._dispatcher.on(e,t),this}_joinInstance(e,t,i){var r=e.isResponse;const s=new qe(e.instance,e.instanceState,i);this._knownInstances.get(s.getId())?this._logger.debug("Instance already known",s.getId()):(this._knownInstances.set(s.getId(),s),this._lastJoinedInstance=s,this._instanceCounters.addInstance(s.properties),this._metrics.instanceJoinDelayTimer({election:this._election._state}).record(performance.now()-this._loadTime|0),r?(r=s.getInstanceMultiplexingLeader(),this._mode===Ge.MULTIPLEXING&&this.role===Ve.UNKNOWN&&void 0!==r&&(this._logger.info("Joined late, elected leader is",r),this._election.cancel(),this._onLeaderElected(r))):(this._messenger.sendResponseMessage(t,this._createHelloMessage(!0),I.TYPE),this._mode===Ge.MULTIPLEXING&&this.role!==Ve.UNKNOWN&&this._handleLateJoiner(s)),this._logger.debug("Instance joined",s.getId()),this._doFireEvent(ye.ID5_INSTANCE_JOINED,s.properties))}_createHelloMessage(){var e,t=0<arguments.length&&void 0!==arguments[0]&&arguments[0];let i={operatingMode:this._mode,knownInstances:Array.from(this._knownInstances.values()).map(e=>e.properties)};return this._mode===Ge.MULTIPLEXING&&(i.multiplexing={role:this.role,electionState:null===(e=this._election)||void 0===e?void 0:e._state,leader:this._leader.getProperties()}),new I(this.properties,t,i)}_handleLateJoiner(e){this._logger.info("Late joiner detected",e.properties);var t=this._metrics.instanceLateJoinCounter(this.properties.id,{scope:"party"}).inc();this._metrics.instanceLateJoinDelayTimer({election:this._election._state,isFirst:1===t}).record(performance.now()-this._election._closeTime),!e.isMultiplexingPartyAllowed()||this.role!==Ve.LEADER||!0===(null==(e=this._leader.addFollower(new Ae(e,this._messenger,this._logger)))?void 0:e.lateJoiner)&&this._metrics.instanceLateJoinCounter(this.properties.id,{scope:"leader",unique:!0===(null==e?void 0:e.uniqueLateJoiner)}).inc()}_doFireEvent(e){for(var t=arguments.length,i=new Array(1<t?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];this._dispatcher.emit(e,...i)}_actAsLeader(){var e=this.properties;const t=this._logger;var i=this._metrics,r=new ie(this._storage),s=new $(r),n=new K(e.storageExpirationDays);const o=new Fe(s,n,e.forceAllowLocalStorageGrant,t,i);s=new Y(new ke(()=>o.localStorageGrant("client-store"),s,n,t),this._trueLinkAdapter),n=new Ie(i,t,je.createExtensions(i,t,s));const a=new xe(this._window,e,r,s,o,i,t,n);a.addFollower(this._followerRole),this._leader.assignLeader(a),this._mode===Ge.MULTIPLEXING&&Array.from(this._knownInstances.values()).filter(e=>e.isMultiplexingPartyAllowed()).map(e=>a.addFollower(new Ae(e,this._messenger,t))),a.start()}_followRemoteLeader(e){this._leader.assignLeader(new Le(this._messenger,e)),this._logger.info("Following remote leader ",e)}updateConsent(e){this._leader.updateConsent(e,this.properties.id)}updateFetchIdData(e){this._leader.updateFetchIdData(this.properties.id,e),u(this.properties.fetchIdData,e)}refreshUid(e){this._leader.refreshUid(e,this.properties.id)}_doElection(){var e=this._election;const t=this._knownInstances;let i=Array.from(t.values()).filter(e=>e.isMultiplexingPartyAllowed()).map(e=>e.properties);i.push(this.properties),this._onLeaderElected(function(e){if(!e||0===e.length)return;e=e.sort((e,t)=>{let i=-(0|S(e.version,t.version));var r,s,n;return 0===i&&(i=e.source.localeCompare(t.source),0===i&&(i=-(0|S(e.sourceVersion,t.sourceVersion))),0===i&&(s=(null===(s=e.fetchIdData)||void 0===s||null===(r=s.refererInfo)||void 0===r?void 0:r.numIframes)||Number.MAX_SAFE_INTEGER,n=(null===(r=t.fetchIdData)||void 0===r||null===(n=r.refererInfo)||void 0===n?void 0:n.numIframes)||Number.MAX_SAFE_INTEGER,i=s-n),0===i&&(i=e.id.localeCompare(t.id))),i});return e[0]}(i));var r=this._lastJoinedInstance;r&&this._metrics.instanceLastJoinDelayTimer().record(Math.max(r._joinTime-e._scheduleTime,0))}_onLeaderElected(e){var t=this;t.role=e.id===t.properties.id?Ve.LEADER:Ve.FOLLOWER,t.role===Ve.LEADER?t._actAsLeader():t.role===Ve.FOLLOWER&&t._followRemoteLeader(e),t._logger.debug("Leader elected",e.id,"my role",t.role),t._doFireEvent(ye.ID5_LEADER_ELECTED,t.role,t._leader.getProperties())}getId(){return this.properties.id}lookupForCachedId(){return this._logger.info("Self lookup for cachedId triggered"),this._cachedIdProvider.provisionFromCache(this._followerRole)}}class Ke extends e{constructor(e,t){super(),h(this,"_instance",void 0),this._delegate=e||g,this._instance=t}_prefix(){return"Instance(id=".concat(this._instance.getId(),", role=").concat(this._instance.role,")")}debug(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this._delegate.debug((new Date).toISOString(),this._prefix(),...t)}info(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this._delegate.info((new Date).toISOString(),this._prefix(),...t)}warn(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this._delegate.warn((new Date).toISOString(),this._prefix(),...t)}error(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this._delegate.error((new Date).toISOString(),this._prefix(),...t)}}const Ye=new class{createInstance(e,t,i,r,s,n){return new ze(e,{},r,i,t,s,n)}},Xe="TRUE"===rt("id5_debug").toUpperCase(),Qe="TRACE"===rt("id5_debug").toUpperCase(),$e=Boolean(window.console);let Ze=!1;function et(e,t,i,r,s){tt()&&$e&&e&&e.apply(console,["%cID5 - ".concat(t,"#").concat(i),"color: #fff; background: #1c307e; padding: 1px 4px; border-radius: 3px;",r].concat(s))}function tt(){return Xe||Qe||Ze}class it extends e{constructor(e,t){super(),h(this,"_invocationId",void 0),h(this,"_origin",void 0),this._invocationId=t,this._origin=e}debug(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];!function(e,t){for(var i=arguments.length,r=new Array(2<i?i-2:0),s=2;s<i;s++)r[s-2]=arguments[s];et(console.info,e,t,"DEBUG",r)}(this._origin,this._invocationId,...t)}info(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];!function(e,t){for(var i=arguments.length,r=new Array(2<i?i-2:0),s=2;s<i;s++)r[s-2]=arguments[s];et(console.info,e,t,"INFO",r)}(this._origin,this._invocationId,...t)}warn(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];!function(e,t){for(var i=arguments.length,r=new Array(2<i?i-2:0),s=2;s<i;s++)r[s-2]=arguments[s];et(console.warn,e,t,"WARNING",r)}(this._origin,this._invocationId,...t)}error(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];!function(e,t){for(var i=arguments.length,r=new Array(2<i?i-2:0),s=2;s<i;s++)r[s-2]=arguments[s];et(console.error,e,t,"ERROR",r)}(this._origin,this._invocationId,...t)}}function rt(e){const t=new RegExp("[\\?&]"+e+"=([^&#]*)"),i=t.exec(window.location.search);return null===i?"":decodeURIComponent(i[1].replace(/\+/g," "))}const st=A,nt=P,ot=O,at=R,ct=x,lt=L,ht=function(e){return A(e,"Boolean")},dt=N;function ut(e){let t=new Image;t.src=e}function gt(e,t,i,r,s){for(t=t.split?t.split("."):t,r=0;r<t.length;r++)e=e?e[t[r]]:s;return e===s?i:e}new it("ajax");const pt=e=>null!=e&&"object"==typeof e;const _t=(oe=window,function(){try{var i=vt(),r=i.length-1,s=null!==i[r].location||0<r&&null!==i[r-1].referrer,n=function(e){let t=[];var i,r=null;let s=null,n=null,o=null,a=null,c;for(c=e.length-1;0<=c;c--){try{s=e[c].location}catch(e){}if(s)t.push(s),a=a||s;else if(0!==c){i=e[c-1];try{n=i.referrer,o=i.ancestor}catch(e){}n?(t.push(n),a=a||n):o?(t.push(o),a=a||o):t.push(r)}else t.push(r)}return{stack:t,detectedRefererUrl:a}}(i);let e,t;i[i.length-1].canonicalUrl&&(e=i[i.length-1].canonicalUrl);try{t=oe.top.document.referrer}catch(e){}return{topmostLocation:n.detectedRefererUrl,ref:t||null,reachedTop:s,numIframes:r,stack:n.stack,canonicalUrl:e}}catch(e){}});function vt(){let i=function(){let t=[],i;do{try{i=i?i.parent:oe;try{var r=i===oe.top;let e={referrer:i.document.referrer||null,location:i.location.href||null,isTop:r};r&&(e=u(e,{canonicalUrl:function(e){try{var t=e.querySelector("link[rel='canonical']");if(null!==t)return t.href}catch(e){}return null}(i.document)})),t.push(e)}catch(e){t.push({referrer:null,location:null,isTop:i===oe.top})}}catch(e){return t.push({referrer:null,location:null,isTop:!1}),t}}while(i!==oe.top);return t}();var r=function(){try{return oe.location.ancestorOrigins?oe.location.ancestorOrigins:void 0}catch(e){}}();if(r)for(let e=0,t=r.length;e<t;e++)i[e].ancestor=r[e];return i}const ft={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,a:26,b:27,c:28,d:29,e:30,f:31,g:32,h:33,i:34,j:35,k:36,l:37,m:38,n:39,o:40,p:41,q:42,r:43,s:44,t:45,u:46,v:47,w:48,x:49,y:50,z:51,0:52,1:53,2:54,3:55,4:56,5:57,6:58,7:59,8:60,9:61,"-":62,_:63,"+":62,"/":63};const mt=Object.freeze({tcfv2:{objName:"__tcfapiCall",objKeys:["command","version"],returnObjName:"__tcfapiReturn"},uspv1:{objName:"__uspapiCall",objKeys:["command","version"],returnObjName:"__uspapiReturn"},gppv1:{objName:"__gppCall",objKeys:["command","parameter"],returnObjName:"__gppReturn"}}),It=Object.freeze({TCF:0,USP:1,GPP:2});class wt{constructor(e,t){h(this,"direct",void 0),h(this,"version",void 0),this.direct=e,this.version=t}getConsentData(){var e=this;return s(function*(){return e.getClientConsentData()})()}static create(a){return s(function*(){var e=bt._findCmpApi("__gpp"),t=e.cmpApiFrame,e=e.cmpApiFunction;let i,r=!1;if(!t)return a.warn("cmpApi: GPP not found! Using defaults."),Promise.resolve();if(nt(e))r=!0,a.info("cmpApi: Detected GPP is directly accessible, calling it now."),i=e;else{a.info("cmpApi: Detected GPP is outside the current iframe. Using message passing.");const o=bt._buildCmpSurrogate(mt.gppv1,t);i=function(e,t,i){o(e,i,t)}}var s=yield new Promise(t=>{var e=i("ping",function(e){t(e)});e&&t(e)});switch(s.gppVersion){case yt.version:return new yt(s,i,r);case St.version:return new St(s,i,r);default:var n="Unsupported version of gpp: ".concat(s.gppVersion);return a.warn(n),Promise.reject(n)}})()}static tcfDataHasLocalStorageGrant(e){return at(e.PurposeConsent)&&!0===e.PurposeConsent[0]&&0<=(null===(e=e.VendorConsent)||void 0===e?void 0:e.indexOf("131"))}static getTcfData(e){e=null==e?void 0:e.tcfeuv2;let t=void 0;return at(e)&<(e[0])?t=e[0]:lt(e)&&(t=e),t}}class yt extends wt{constructor(e,t,i){super(i,yt.version),h(this,"gppFn",void 0),h(this,"ready",void 0),this.gppFn=t,this.ready=this.isReady(e)}isReady(e){return"loaded"===e.cmpStatus&&"visible"!==e.cmpDisplayStatus}getClientConsentData(){var r=this;return s(function*(){r.ready||(r.ready=yield new Promise(t=>{r.gppFn("addEventListener",e=>!!r.isReady(e.pingData)&&void t(!0))}));var e=new Promise(t=>{r.gppFn("getGPPData",e=>{t(e)})}),t=new Promise(t=>{r.gppFn("getSection",e=>{t(e)},"tcfeuv2")}),e=l(yield Promise.all([e,t]),2),t=e[0],e=e[1];const i=new W;return i.version=G.GPP_V1_0,i.gppString=t.gppString,i.applicableSections=t.applicableSections,e&&(i.localStoragePurposeConsent=wt.tcfDataHasLocalStorageGrant(e)),i})()}}function Ct(e,t,i){i&&(e.apiTypes.push(t),u(e,i))}h(yt,"version","1.0");class St extends wt{constructor(e,t,i){super(i,St.version),h(this,"gppFn",void 0),h(this,"readyPingData",void 0),this.gppFn=t,"ready"===e.signalStatus&&(this.readyPingData=e)}getClientConsentData(){var i=this;return s(function*(){return new Promise(t=>{i.readyPingData?t(i.parsePingData(i.readyPingData)):i.gppFn("addEventListener",e=>"ready"===e.pingData.signalStatus&&void t(i.parsePingData(e.pingData)))})})()}parsePingData(e){const t=new W;t.gppString=e.gppString,t.version=G.GPP_V1_1,t.applicableSections=e.applicableSections;e=wt.getTcfData(e.parsedSections);return e&&(t.localStoragePurposeConsent=wt.tcfDataHasLocalStorageGrant(e)),t}}h(St,"version","1.1");class bt{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:g;h(this,"_lookupInProgress",void 0),h(this,"_log",void 0),h(this,"_metrics",void 0),h(this,"_consentDataPromise",void 0),this._metrics=e,this._log=t}refreshConsentData(e,t,i){const r=this;return r._lookupInProgress||(r._lookupInProgress=!0,r._consentDataPromise=this._lookupConsentData(e,t,i).finally(()=>{r._lookupInProgress=!1})),this._consentDataPromise}_lookupConsentData(e,t,i){if(e){this._log.warn("cmpApi: ID5 is operating in forced consent mode and will not retrieve any consent signals from the CMP");let e=new q;return e.forcedGrantByConfig=!0,e.source=j.partner,Promise.resolve(e)}switch(t){case"static":return new Promise(e=>{this._parseStaticConsentData(i,e)});case"iab":return new Promise(e=>{this._lookupIabConsent(e)});default:return this._log.error("cmpApi: Unknown consent API: ".concat(t)),Promise.reject(new Error("Unknown consent API: ".concat(t)))}}_parseStaticConsentData(e,t){e=e||{};let i=new q;if(i.source=j.partner,lt(e.getTCData)){const r=this._parseTcfData(e.getTCData);Ct(i,G.TCF_V2,r);try{const s=this._metrics;this._lookupTcf(e=>{s.consentDiscrepancyCounter({apiType:G.TCF_V2,sameString:(null==e?void 0:e.consentString)===(null===r||void 0===r?void 0:r.consentString),sameLSPC:(null==e?void 0:e.localStoragePurposeConsent)===(null===r||void 0===r?void 0:r.localStoragePurposeConsent),sameGdpr:(null==e?void 0:e.gdprApplies)===(null===r||void 0===r?void 0:r.gdprApplies)}).inc()})}catch(e){}}if(at(e.allowedVendors)&&Ct(i,G.ID5_ALLOWED_VENDORS,{allowedVendors:e.allowedVendors.map(e=>e.toString()),gdprApplies:!0}),lt(e.getUSPData)){const n=this._parseUspData(e.getUSPData);Ct(i,G.USP_V1,n);try{const o=this._metrics;this._lookupUsp(e=>{o.consentDiscrepancyCounter({apiType:G.USP_V1,sameString:(null==e?void 0:e.ccpaString)===(null===n||void 0===n?void 0:n.ccpaString)}).inc()})}catch(e){}}0===i.apiTypes.length&&this._log.warn("cmpApi: No static consent data detected! Using defaults."),this._log.info("cmpApi: Detected APIs '".concat(i.apiTypes,"' from static consent data"),e),t(i)}_lookupIabConsent(r){const s=[];let n=new q;n.source=j.cmp;var e=i=>(s[i]=0,(e,t)=>{s[i]||(s[i]=Date.now(),e&&Ct(n,t,e),s.every(e=>0<e)&&r(n))}),t=e(It.TCF),i=e(It.USP),e=e(It.GPP);this._lookupGpp(e),this._lookupTcf(t),this._lookupUsp(i)}_lookupUsp(i){var e=bt._findCmpApi("__uspapi"),t=e.cmpApiFrame,e=e.cmpApiFunction;let r;if(!t)return this._log.warn("cmpApi: USP not found! Using defaults for CCPA."),void i();r=nt(e)?(this._log.info("cmpApi: Detected USP is directly accessible, calling it now."),e):(this._log.info("cmpApi: Detected USP is outside the current iframe. Using message passing."),bt._buildCmpSurrogate(mt.uspv1,t));r("getUSPData",1,(e,t)=>{t?i(this._parseUspData(e),G.USP_V1):(this._log.error("cmpApi: USP callback not successful. Using defaults for CCPA."),i())})}_lookupGpp(n){var o=this;return s(function*(){var t=Date.now();try{let e=yield wt.create(o._log);if(e){var i={gppVersion:e.version,directCmp:e.direct};try{var r=yield e.getConsentData();n({gppData:r},r.version);var s=Date.now();o._metrics.timer("gpp.delay",i).record(s-t)}catch(e){o._metrics.counter("gpp.failure",u({type:"CONSENT"},i)).inc(),o._log.error("cmpApi: getting GPP consent not successful. Using defaults for Gpp."),n()}}else n()}catch(e){o._metrics.counter("gpp.failure",{type:"CLIENT"}).inc(),o._log.error("cmpApi: creating GPP client not successful. Using defaults for Gpp."),n()}})()}static _buildCmpSurrogate(a,c){return(e,t,i)=>{const r=Math.random()+"",s={},n={};n[a.objKeys[0]]=e,n[a.objKeys[1]]=t,n.callId=r,s[a.objName]=n;const o=e=>{e=gt(e,"data.".concat(a.returnObjName));e&&e.callId===r&&(void 0!==(e=i(e.returnValue,e.success))&&!0!==e||window.removeEventListener("message",o))};window.addEventListener("message",o,!1),c.postMessage(s,"*")}}_lookupTcf(e){var t=bt._findTCF(),i=t.cmpFrame,t=t.cmpFunction;if(!i)return this._log.warn("cmpApi: TCF not found! Using defaults for GDPR."),void e();nt(t)?this._lookupDirectTcf(t,e):(this._log.info("cmpApi: Detected TCF is outside the current iframe. Using message passing."),this._lookupMessageTcf(i,e))}_lookupMessageTcf(e,t){e=bt._buildCmpSurrogate(mt.tcfv2,e);this._lookupDirectTcf(e,t)}_lookupDirectTcf(e,s){const n=this._log;e("addEventListener",2,(e,t)=>{var i,r;return i="event",r=e,n.info("cmpApi: TCFv2 - Received a call back: ".concat(i),r),t?!(!e||!1!==e.gdprApplies&&"tcloaded"!==e.eventStatus&&"useractioncomplete"!==e.eventStatus)&&void s(this._parseTcfData(e),G.TCF_V2):(n.error("cmpApi: TCFv2 - Received insuccess: ".concat("addEventListener",". Please check your CMP setup. Using defaults for GDPR.")),void s())})}_parseUspData(e){if(lt(e)&&ot(e.uspString))return{ccpaString:e.uspString};this._log.error("cmpApi: No or malformed USP data. Using defaults for CCPA.")}_parseTcfData(e){let t=this._log,i,r;if(i=bt._isValidV2ConsentObject,r=bt._normalizeV2Data,i(e))return r(e);t.error("cmpApi: Invalid CMP data. Using defaults for GDPR.",e)}static _isValidV2ConsentObject(e){var t=e&&e.gdprApplies,e=e&&e.tcString;return!1===t||ot(e)}static _normalizeV2Data(e){let t=gt(e,"purpose.consents.1");return ht(t)||(t=function(e,t){var i=152+t-1,t=~~(i/6);if(e&&"C"===e.charAt(0)&&!(e.length<=t)){t=e.charAt(t),t=ft[t];if(void 0!==t)return 0!=(t&1<<6-i%6-1)}}(e.tcString,1)),{consentString:e.tcString,localStoragePurposeConsent:t,gdprApplies:e.gdprApplies}}static _findTCF(){let e=window,t,i;for(;!t;){try{if("function"==typeof e.__tcfapi){i=e.__tcfapi,t=e;break}}catch(e){}try{if(e.frames.__tcfapiLocator){t=e;break}}catch(e){}if(e===window.top)break;e=e.parent}return{cmpFrame:t,cmpFunction:i}}static _findCmpApi(e){let t=window,i,r;for(;!i;){try{if("function"==typeof t[e]){r=t[e],i=t;break}}catch(e){}try{if(t.frames["".concat(e,"Locator")]){i=t;break}}catch(e){}if(t===window.top)break;t=t.parent}return{cmpApiFrame:i,cmpApiFunction:r}}}const Dt="1.0.72";class Et{static gatherUaHints(e,t){return s(function*(){if(N(window.navigator.userAgentData)&&!e){let e;try{e=yield window.navigator.userAgentData.getHighEntropyValues(["architecture","fullVersionList","model","platformVersion"])}catch(e){return void t.error("Error while calling navigator.userAgentData.getHighEntropyValues()",e)}return Et.filterUaHints(e)}})()}static filterUaHints(e){if(N(e)){const t=/[()-.:;=?_/]/g;return R(e.brands)&&(e.brands=e.brands.filter(e=>O(e.brand)&&e.brand.search(t)<0)),R(e.fullVersionList)&&(e.fullVersionList=e.fullVersionList.filter(e=>O(e.brand)&&e.brand.search(t)<0)),e}}}const Tt=Object.freeze({NEVER:"never",AFTER_UID_SET:"after-uid-set",ASAP:"asap"}),At=Object.freeze({allowGCReclaim:Object.values(Tt)});class Pt{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:g;if(h(this,"invocationId",void 0),h(this,"options",void 0),h(this,"providedOptions",void 0),h(this,"invalidSegments",void 0),this._log=t,this.options={debugBypassConsent:!1,allowLocalStorageWithoutConsentApi:!1,cmpApi:"iab",consentData:{},refreshInSeconds:7200,partnerId:void 0,partnerUserId:void 0,callbackOnAvailable:void 0,callbackOnUpdates:void 0,callbackTimeoutInMs:void 0,pd:void 0,abTesting:{enabled:!1,controlGroupPct:0},provider:void 0,maxCascades:8,applyCreativeRestrictions:!1,acr:!1,segments:void 0,disableUaHints:!1,storageExpirationDays:void 0,att:void 0,diagnostics:{publishingDisabled:!1,publishAfterLoadInMsec:3e4,publishBeforeWindowUnload:!0,publishingSampleRatio:.01},multiplexing:{_disabled:!1},allowGCReclaim:Tt.AFTER_UID_SET},this.providedOptions={},!ct(e.partnerId)&&!ot(e.partnerId))throw new Error("partnerId is required and must be a number or a string");this.invalidSegments=0,this.updOptions(e),this.storageConfig=new K(e.storageExpirationDays)}getOptions(){return this.options}getProvidedOptions(){return this.providedOptions}getInvalidSegments(){return this.invalidSegments}hasCreativeRestrictions(){return this.options.applyCreativeRestrictions||this.options.acr}updOptions(a){const c=this,l=c._log;if(lt(a)){this.setPartnerId(a.partnerId);const h=(e,t)=>{this.options[e]=t,this.providedOptions[e]=t};Object.keys(a).forEach(e=>{if("segments"===e){const r=a[e],s=[];N(r)&&(at(r)?(r.forEach((e,t)=>{t="segments[".concat(t,"]");return at(e.ids)&&function(e,t){let i=!0;return U(e,e=>i=i&&t(e)),i}(e.ids,ot)?e.ids.length<1?(l.error("Config option ".concat(t,".ids should contain at least one segment ID")),void(c.invalidSegments+=1)):ot(e.destination)?void s.push(e):(Ot(l,"".concat(t,".destination"),"String",e.destination),void(c.invalidSegments+=1)):(Ot(l,"".concat(t,".ids"),"Array of String",e.ids),void(c.invalidSegments+=1))}),h(e,s)):Ot(l,e,"Array",r))}else if("diagnostics"===e){const n=this.options.diagnostics,o=a.diagnostics;if(st(o,Pt.configTypes.diagnostics)){let t=d({},n);Object.keys(o).forEach(e=>{void 0!==n[e]&&typeof n[e]==typeof o[e]&&(t[e]=o[e])}),this.options[e]=t}this.providedOptions[e]=a[e]}else{var t,i;void 0!==At[e]?(i=a[e])&&At[e].includes(i)&&h(e,i):"partnerId"!==e&&(t=Pt.configTypes[e],N(i=a[e])&&(st(i,t)?h(e,i):Ot(l,e,t,i)))}})}else l.error("Config options must be an object")}setPartnerId(e){let t;if(ot(e)){if(t=parseInt(e),isNaN(t)||t<0)throw new Error("partnerId is required and must parse to a positive integer")}else ct(e)&&(t=e);if(ct(t)){if(ct(this.options.partnerId)&&t!==this.options.partnerId)throw new Error("Cannot update config with a different partnerId");this.options.partnerId=t,this.providedOptions.partnerId=e}}}function Ot(e,t,i,r){e.error("Config option ".concat(t," must be of type ").concat(i," but was ").concat(toString.call(r),". Ignoring..."))}h(Pt,"configTypes",{debugBypassConsent:"Boolean",allowLocalStorageWithoutConsentApi:"Boolean",cmpApi:"String",consentData:"Object",refreshInSeconds:"Number",partnerUserId:"String",callbackOnAvailable:"Function",callbackOnUpdates:"Function",callbackTimeoutInMs:"Number",pd:"String",abTesting:"Object",provider:"String",maxCascades:"Number",applyCreativeRestrictions:"Boolean",acr:"Boolean",disableUaHints:"Boolean",storageExpirationDays:"Number",att:"Number",diagnostics:"Object",multiplexing:"Object",dynamicConfig:"Object",allowGCReclaim:"String"});class Rt{constructor(e,t,i,r,s,n,o){h(this,"_called",void 0),h(this,"_callbackFn",void 0),h(this,"_callbackArgs",void 0),h(this,"_beforeTrigger",void 0),h(this,"_watchdog",void 0),h(this,"_log",void 0),h(this,"_metrics",void 0),h(this,"_callbackName",void 0),this._callbackName=e,this._log=t,this._metrics=i,this._callbackFn=r;for(var a=arguments.length,c=new Array(7<a?a-7:0),l=7;l<a;l++)c[l-7]=arguments[l];this._callbackArgs=c,this._beforeTrigger=o,this._called=!1,this._callbackTriggerTimer=_e(),this._timeout=s,n?this._watchdog=setTimeout(()=>this._trigger("immediate"),0):0<s&&(this._watchdog=setTimeout(()=>this._trigger("timeout"),s))}_trigger(){let e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"unknown";this._watchdog=void 0;let t=this._callbackTriggerTimer.record(this._metrics.timer("callback.trigger.time",{trigger:e,callbackName:this._callbackName,timeout:this._timeout}));this._called||(this._called=!0,setTimeout(()=>{this._log.debug("Firing ".concat(this._callbackName," callback after ").concat(t,"ms. Triggered by ").concat(e,", configured timeoutMs=").concat(this._timeout)),this._beforeTrigger(),this._callbackFn.call(globalThis,...this._callbackArgs)},0))}triggerNow(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"eventOccurred";this.disableWatchdog(),this._trigger(e)}disableWatchdog(){this._watchdog&&(clearTimeout(this._watchdog),this._watchdog=void 0)}}class xt{constructor(e,t,i){h(this,"refererInfo",void 0),h(this,"apiVersion",void 0),h(this,"isUsingCdn",void 0),this.refererInfo=e,this.apiVersion=t,this.isUsingCdn=i}}class Lt{constructor(e,t){h(this,"_targets",void 0),h(this,"_metrics",void 0),h(this,"_survivalTimer",void 0),this._targets=[e,t],this._metrics=t,this._survivalTimer=_e()}unregister(e){this._survivalTimer&&this._metrics&&this._survivalTimer.record(this._metrics.instanceSurvivalTime({unregisterTrigger:e})),this._targets.forEach(e=>{try{dt(e)&&nt(e.unregister)&&e.unregister()}catch(e){}})}}globalThis.__id5_finalization_registry||(globalThis.__id5_finalization_registry=new class{constructor(){h(this,"_finalizationRegistry",void 0),h(this,"_instancesHolder",void 0),this._instancesHolder=new Set;try{this._finalizationRegistry=new FinalizationRegistry(e=>{try{dt(e)&&nt(e.unregister)&&e.unregister("gc-reclaim")}catch(e){}})}catch(e){}}register(e){try{e.getOptions().allowGCReclaim!==Tt.ASAP&&this._instancesHolder.add(e),this._finalizationRegistry.register(e,e._unregisterTargets,e)}catch(e){}}unregister(e){try{this.releaseInstance(e,!0),this._finalizationRegistry.unregister(e)}catch(e){}}releaseInstance(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];!e.getOptions().allowGCReclaim===Tt.NEVER&&!t||this._instancesHolder.delete(e)}});const Nt=globalThis.__id5_finalization_registry;class Ut{constructor(e){h(this,"_ref",void 0),this._ref=e}deref(){return this._ref}}class Ft{getOptions(){return this.config.getOptions()}getProvidedOptions(){return this.config.getProvidedOptions()}getInvalidSegments(){return this.config.getInvalidSegments()}getUserId(){return!1===this._isExposed?"0":this._userId}getLinkType(){return!1===this._isExposed?0:this.getExt().linkType}getExt(){var e=!1===this._isExposed?{}:this._ext;return u({abTestingControlGroup:!this.exposeUserId()},e)}getPublisherTrueLinkId(){return!1===this._isExposed?void 0:this._publisherTrueLinkId}isFromCache(){return this._fromCache}exposeUserId(){return this._isExposed}getUserIdAsEid(){return{source:J.ID5_EIDS_SOURCE,uids:[{atype:1,id:this.getUserId(),ext:this.getExt()}]}}onAvailable(e,t){if(!nt(e))throw new Error("onAvailable expects a function");return this._availableCallback?this._log.warn("onAvailable was already called, ignoring"):this._availableCallback=new Rt("onAvailable",this._log,this._metrics,e,t,this._userIdAvailable,()=>{},this),this}onUpdate(e){if(!nt(e))throw new Error("onUpdate expects a function");return this._updateCallback=e,this._userIdAvailable&&this._fireOnUpdate(),this}onRefresh(e,t){if(!nt(e))throw new Error("onRefresh expects a function");this._refreshCallback&&this._refreshCallback.disableWatchdog();var i=!0===this._isRefreshing&&!1===this._isRefreshingWithFetch&&this._userIdAvailable;return this._refreshCallback=new Rt("onRefresh",this._log,this._metrics,e,t,i,()=>{this._isRefreshing=!1,this._isRefreshingWithFetch=!1},this),this}unregister(){try{this._unregisterTargets.unregister("api-call"),Nt.unregister(this)}catch(e){}}collectEvent(t,i){const r=e=>{e=new Request("https://id5-sync.com/event",{method:"POST",mode:"no-cors",body:JSON.stringify({partnerId:this.config.getOptions().partnerId,id5id:e,eventType:t,metadata:i})});return this._log.info("Sending event",e),fetch(e).catch(e=>this._log.error("Error while sending event to ID5 of type "+t,e))};return this._userIdAvailable?r(this._userId):this._userIdAvailablePromise.then(e=>r(e))}constructor(e,t,i,r,s,n,o,a,c,l){h(this,"_availableCallback",void 0),h(this,"_updateCallback",void 0),h(this,"_refreshCallback",void 0),h(this,"_isExposed",void 0),h(this,"_fromCache",void 0),h(this,"_isRefreshing",!1),h(this,"_isRefreshingWithFetch",!1),h(this,"_userId",void 0),h(this,"_ext",void 0),h(this,"_userIdAvailable",!1),h(this,"_userIdAvailablePromise",void 0),h(this,"_userIdAvailablePromiseResolver",void 0),h(this,"invocationId",void 0),h(this,"config",void 0),h(this,"clientStore",void 0),h(this,"consentManagement",void 0),h(this,"_consentDataProvider",void 0),h(this,"_metrics",void 0),h(this,"_log",void 0),h(this,"_multiplexingInstance",void 0),h(this,"_pageLevelInfo",void 0),h(this,"_trueLinkAdapter",void 0),h(this,"_publisherTrueLinkId",void 0),h(this,"_origin",void 0),this.config=e,this.clientStore=t,this.consentManagement=i,this._metrics=r,this._consentDataProvider=s,this._log=new p("Id5Instance:",n),this._multiplexingInstance=o,this._userIdAvailablePromise=new Promise(e=>{this._userIdAvailablePromiseResolver=e}),this._pageLevelInfo=a,this._unregisterTargets=new Lt(this._multiplexingInstance,this._metrics),this._trueLinkAdapter=c,this._origin=l||"api",Nt.register(this)}bootstrap(){const n=_e();var e=this.config.getOptions();const o=this._ref();this._multiplexingInstance.on(we.CASCADE_NEEDED,e=>{const t=o.deref();t&&t._doCascade(e)}).on(we.USER_ID_READY,(e,t)=>{const i=o.deref();if(i){try{var r=null!=t&&t.tags?d({},t.tags):{};const s=i._metrics;null!=t&&t.timestamp&&s.userIdNotificationDeliveryDelayTimer(r).record(Date.now()-t.timestamp),n.record(s.userIdProvisioningDelayTimer(e.isFromCache,d(d({},r),{},{isUpdate:i._userIdAvailable,hasOnAvailable:void 0!==i._availableCallback,hasOnRefresh:void 0!==i._refreshCallback,hasOnUpdate:void 0!==i._updateCallback,provisioner:(null==t?void 0:t.provisioner)||"leader",hasChanged:i._userId!==e.responseObj.universal_uid})))}catch(e){i._log.error("Failed to measure provisioning metrics",e)}i._setUserId(e.responseObj,e.isFromCache,e.willBeRefreshed)}}).on(we.USER_ID_FETCH_CANCELED,e=>{const t=o.deref();t&&t._log.info("ID5 User ID fetch canceled:",e.reason)}),this._log.info("bootstrapped for partner ".concat(e.partnerId," with referer ").concat(this._refererInfo," and options"),this.getProvidedOptions())}firstFetch(){const i=this.config.getOptions(),e=this._gatherFetchIdData().then(e=>{var t;this._multiplexingInstance.register({source:this._origin,sourceVersion:Dt,sourceConfiguration:{options:i},fetchIdData:e,singletonMode:!0===(null===i||void 0===i||null===(t=i.multiplexing)||void 0===t?void 0:t._disabled),canDoCascade:!this.config.hasCreativeRestrictions(),forceAllowLocalStorageGrant:this.consentManagement.isForceAllowLocalStorageGrant(),storageExpirationDays:i.storageExpirationDays})}),t=this._submitRefreshConsent().then(e=>{e&&this.consentManagement.setConsentData(e)});return e.then(()=>{this._multiplexingInstance.lookupForCachedId().provisioned||(this._log.info("Couldn't find cached userId. Will try again when consent is resolved"),t.then(()=>{this._log.info("Consent resolved. Looking for cached id again"),this._multiplexingInstance.lookupForCachedId()}))}),Promise.allSettled([e,t])}refreshId(t,e){let i,r;this._log.info("ID refresh requested (force=".concat(t,") with additional options "),e);try{this._isRefreshing=!0,this._isRefreshingWithFetch=t,this.config.updOptions(e);var s=this.config.getOptions();const n=s.allowLocalStorageWithoutConsentApi||s.debugBypassConsent;i=this._gatherFetchIdData().then(e=>{this._multiplexingInstance.updateFetchIdData(e),this._multiplexingInstance.refreshUid({resetConsent:!0,forceAllowLocalStorageGrant:n,forceFetch:t}),r=this._submitRefreshConsent()}),this._metrics.refreshCallCounter("public-api").inc()}catch(e){return this._log.error("Exception caught from refreshId()",e),Promise.reject(e)}return Promise.allSettled([i,r])}_doCascade(e){var t,i=this.config.getOptions();if(e.partnerId===i.partnerId&&0<=i.maxCascades&&!this.config.hasCreativeRestrictions()){var r=i.partnerUserId&&0<i.partnerUserId.length,s=new URL("/".concat(r?"s":"i","/").concat(i.partnerId,"/").concat(i.maxCascades,".gif"),"https://id5-sync.com");const n=s.searchParams;n.set("o","api"),n.set("id5id",e.userId),n.set("gdpr_consent",e.consentString),n.set("gdpr",e.gdprApplies),e.gppString&&(n.set("gpp",e.gppString),n.set("gpp_sid",e.gppSid)),r&&n.set("puid",i.partnerUserId),this._log.info("Opportunities to cascade available",s.href),t=s.href,"loading"!==document.readyState?ut(t):document.addEventListener("DOMContentLoaded",function(){ut(t)})}}_gatherFetchIdData(){var i=this;return s(function*(){var e=i.config.getOptions(),t=yield Et.gatherUaHints(e.disableUaHints,i._log);return{partnerId:e.partnerId,refererInfo:i._pageLevelInfo.refererInfo,origin:i._origin,originVersion:i._pageLevelInfo.apiVersion,isUsingCdn:i._pageLevelInfo.isUsingCdn,att:e.att,uaHints:t,abTesting:e.abTesting,segments:e.segments,invalidSegmentsCount:i.getInvalidSegments(),provider:e.provider,pd:e.pd,partnerUserId:e.partnerUserId,refreshInSeconds:e.refreshInSeconds,providedRefreshInSeconds:i.getProvidedOptions().refreshInSeconds,trace:Qe,allowedVendors:null===(t=e.consentData)||void 0===t?void 0:t.allowedVendors,consentSource:"iab"===e.cmpApi&&!0!==e.debugBypassConsent?j.cmp:j.partner,trueLink:i._trueLinkAdapter.getTrueLink()}})()}_ref(){return new("undefined"!=typeof WeakRef?WeakRef:Ut)(this)}_submitRefreshConsent(){var n=this;return s(function*(){var e=n.config.getOptions();let t=_e();var i=e.debugBypassConsent?"bypass":e.cmpApi;let r;try{r=yield n._consentDataProvider.refreshConsentData(e.debugBypassConsent,e.cmpApi,e.consentData);const s={};r.apiTypes.forEach(e=>s[e]=!0),t.record(n._metrics.consentRequestTimer(i,d({success:!0},s))),n._multiplexingInstance.updateConsent(r)}catch(e){n._log.error("Couldn't get consent data",e),t.record(n._metrics.consentRequestTimer(i,{success:!1,error:e.message}))}return r})()}_setUserId(e,t){var i=2<arguments.length&&void 0!==arguments[2]&&arguments[2],r=e.universal_uid;if(this._isExposed=!0,lt(e.ab_testing))switch(e.ab_testing.result){case"normal":break;default:case"error":this._log.error("There was an error with A/B Testing. Make sure controlGroupRatio is a number >= 0 and <= 1");break;case"control":this._isExposed=!1,this._log.info("User is in control group!")}var s=this._userId!==r||!1===function e(t,i){if(!pt(t)||!pt(i))return t===i;var r=Object.keys(t),s=Object.keys(i);if(r.length!==s.length)return!1;for(var n=0,o=r;n<o.length;n++){var a=o[n];if(!e(t[a],i[a]))return!1}return!0}(this._ext,e.ext);this._userIdAvailable=!0,this._userId=r,this._userIdAvailablePromiseResolver(r),this._ext=e.ext,this._publisherTrueLinkId=e.publisherTrueLinkId,this._fromCache=t,this._log.info("User id updated",{hasChanged:s,fromCache:t}),this._availableCallback&&this._availableCallback.triggerNow(),this._isRefreshing&&this._refreshCallback&&(!1===t||!1===this._isRefreshingWithFetch)&&this._refreshCallback.triggerNow(),s&&this._fireOnUpdate(),this.getOptions().allowGCReclaim!==Tt.AFTER_UID_SET||t&&i||Nt.releaseInstance(this)}_fireOnUpdate(){setTimeout(()=>{nt(this._updateCallback)&&(this._log.debug("Firing onUpdate"),this._updateCallback(this))},0)}localStorageGrant(){return this.clientStore.localStorageGrant()}}class kt{isBooted(){return L(window.id5Bootstrap)}getTrueLink(){return this.isBooted()?window.id5Bootstrap.getTrueLinkInfo():{booted:!1}}setPrivacy(e){this.isBooted()&&window.id5Bootstrap.setPrivacy&&window.id5Bootstrap.setPrivacy(e)}clearPrivacy(){this.setPrivacy(void 0)}}class Mt{set debug(e){e=e,Ze=!!e}get debug(){return tt()}constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"api";h(this,"origin",void 0),h(this,"loaded",!1),h(this,"_isUsingCdn",!1),h(this,"_referer",!1),h(this,"_version",Dt),h(this,"versions",{}),h(this,"invocationId",0),this.loaded=!0,this._isUsingCdn=!!(document&&document.currentScript&&document.currentScript.src&&0===document.currentScript.src.indexOf("https://cdn.id5-sync.com")),this._referer=_t(),this.versions[Dt]=!0,this.origin=e}init(e){this.invocationId+=1;const t=new it(this.origin,this.invocationId);try{t.info("ID5 API version ".concat(this._version,". Invoking init()"),e);const h=new Pt(e,t);var i=h.getOptions();const d=this._configureDiagnostics(i,t);d&&(d.loadDelayTimer().recordNow(),d.invocationCountSummary().record(this.invocationId,{fenced:"function"==typeof window.Fence&&window.fence instanceof window.Fence}));var r=new te(window,!h.hasCreativeRestrictions()),s=new $(r,t),n=i.allowLocalStorageWithoutConsentApi||i.debugBypassConsent;const u=new Fe(s,h.storageConfig,n,t,d);const g=new ke(()=>u.localStorageGrant(),s,h.storageConfig,t);var o=new kt,a=Ye.createInstance(window,t,d,r,o,g),c=new bt(d,t),l=new xt(this._referer,this._version,this._isUsingCdn);const p=new Ft(h,g,u,d,c,t,a,l,o,this.origin);return p.bootstrap(),p.firstFetch(),g.scheduleGC(d),p}catch(e){t.error("Exception caught during init()",e)}}refreshId(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(!ht(t))throw new Error("Invalid usage of refreshId(): second parameter must be a boolean");return e.refreshId(t,i),e}_configureDiagnostics(e,t){try{var i=e.partnerId;const a=new fe(this.origin,Dt);var r,s=e.diagnostics;return a.addCommonTags(d(d({},ve(i)),{},{tml:this._referer.topmostLocation,provider:e.provider||"default"})),null!=s&&s.publishingDisabled||(n=s.publishingSampleRatio,r=Math.random()<n&&re?(e,t)=>new se(o,{sampling:n}).publish(e,t):e=>e,null!=s&&s.publishAfterLoadInMsec&&0<s.publishAfterLoadInMsec&&a.schedulePublishAfterMsec(s.publishAfterLoadInMsec,r),null!=s&&s.publishBeforeWindowUnload&&a.schedulePublishBeforeUnload(r)),a}catch(e){return void t.error("Failed to configure diagnostics",e)}var n,o}}new Mt;window.ID5&&"api"===window.ID5.origin||(window.ID5=new Mt("api"))}();