@optable/web-sdk 0.40.0 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/dist/sdk.js +1 -1
- package/lib/dist/build.json +1 -1
- package/lib/dist/config.d.ts +5 -0
- package/lib/dist/config.js +1 -0
- package/lib/dist/core/resolvers/resolveMultiTargeting.js +44 -27
- package/lib/dist/core/utils.d.ts +2 -0
- package/lib/dist/core/utils.js +4 -0
- package/lib/dist/edge/site.d.ts +1 -6
- package/lib/dist/edge/targeting.d.ts +1 -0
- package/lib/dist/edge/targeting.js +4 -0
- package/lib/dist/sdk.js +1 -3
- package/package.json +3 -2
- package/lib/dist/addons/paapi.d.ts +0 -19
- package/lib/dist/addons/paapi.js +0 -162
- package/lib/dist/addons/topics-api.d.ts +0 -14
- package/lib/dist/addons/topics-api.js +0 -75
package/browser/dist/sdk.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see sdk.js.LICENSE.txt */
|
|
2
|
-
(()=>{var t={312:(t,e,r)=>{var i;!function(){"use strict";var e="input is invalid type",n="object"==typeof window,s=n?window:{};s.JS_SHA256_NO_WINDOW&&(n=!1);var o=!n&&"object"==typeof self,a=!s.JS_SHA256_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;a?s=r.g:o&&(s=self);var c=!s.JS_SHA256_NO_COMMON_JS&&t.exports,d=r.amdO,u=!s.JS_SHA256_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,h="0123456789abcdef".split(""),p=[-2147483648,8388608,32768,128],l=[24,16,8,0],g=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],f=["hex","array","digest","arrayBuffer"],m=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!u||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var y=function(t,e){return function(r){return new b(e,!0).update(r)[t]()}},w=function(t){var e=y("hex",t);a&&(e=v(e,t)),e.create=function(){return new b(t)},e.update=function(t){return e.create().update(t)};for(var r=0;r<f.length;++r){var i=f[r];e[i]=y(i,t)}return e},v=function(t,i){var n,o=r(394),a=r(903).Buffer,c=i?"sha224":"sha256";return n=a.from&&!s.JS_SHA256_NO_BUFFER_FROM?a.from:function(t){return new a(t)},function(r){if("string"==typeof r)return o.createHash(c).update(r,"utf8").digest("hex");if(null==r)throw new Error(e);return r.constructor===ArrayBuffer&&(r=new Uint8Array(r)),Array.isArray(r)||ArrayBuffer.isView(r)||r.constructor===a?o.createHash(c).update(n(r)).digest("hex"):t(r)}},A=function(t,e){return function(r,i){return new P(r,e,!0).update(i)[t]()}},S=function(t){var e=A("hex",t);e.create=function(e){return new P(e,t)},e.update=function(t,r){return e.create(t).update(r)};for(var r=0;r<f.length;++r){var i=f[r];e[i]=A(i,t)}return e};function b(t,e){e?(m[0]=m[16]=m[1]=m[2]=m[3]=m[4]=m[5]=m[6]=m[7]=m[8]=m[9]=m[10]=m[11]=m[12]=m[13]=m[14]=m[15]=0,this.blocks=m):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=t}function P(t,r,i){var n,s=typeof t;if("string"===s){var o,a=[],c=t.length,d=0;for(n=0;n<c;++n)(o=t.charCodeAt(n))<128?a[d++]=o:o<2048?(a[d++]=192|o>>>6,a[d++]=128|63&o):o<55296||o>=57344?(a[d++]=224|o>>>12,a[d++]=128|o>>>6&63,a[d++]=128|63&o):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++n)),a[d++]=240|o>>>18,a[d++]=128|o>>>12&63,a[d++]=128|o>>>6&63,a[d++]=128|63&o);t=a}else{if("object"!==s)throw new Error(e);if(null===t)throw new Error(e);if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw new Error(e)}t.length>64&&(t=new b(r,!0).update(t).array());var h=[],p=[];for(n=0;n<64;++n){var l=t[n]||0;h[n]=92^l,p[n]=54^l}b.call(this,r,i),this.update(p),this.oKeyPad=h,this.inner=!0,this.sharedMemory=i}b.prototype.update=function(t){if(!this.finalized){var r,i=typeof t;if("string"!==i){if("object"!==i)throw new Error(e);if(null===t)throw new Error(e);if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}for(var n,s,o=0,a=t.length,c=this.blocks;o<a;){if(this.hashed&&(this.hashed=!1,c[0]=this.block,this.block=c[16]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=c[11]=c[12]=c[13]=c[14]=c[15]=0),r)for(s=this.start;o<a&&s<64;++o)c[s>>>2]|=t[o]<<l[3&s++];else for(s=this.start;o<a&&s<64;++o)(n=t.charCodeAt(o))<128?c[s>>>2]|=n<<l[3&s++]:n<2048?(c[s>>>2]|=(192|n>>>6)<<l[3&s++],c[s>>>2]|=(128|63&n)<<l[3&s++]):n<55296||n>=57344?(c[s>>>2]|=(224|n>>>12)<<l[3&s++],c[s>>>2]|=(128|n>>>6&63)<<l[3&s++],c[s>>>2]|=(128|63&n)<<l[3&s++]):(n=65536+((1023&n)<<10|1023&t.charCodeAt(++o)),c[s>>>2]|=(240|n>>>18)<<l[3&s++],c[s>>>2]|=(128|n>>>12&63)<<l[3&s++],c[s>>>2]|=(128|n>>>6&63)<<l[3&s++],c[s>>>2]|=(128|63&n)<<l[3&s++]);this.lastByteIndex=s,this.bytes+=s-this.start,s>=64?(this.block=c[16],this.start=s-64,this.hash(),this.hashed=!0):this.start=s}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},b.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>>2]|=p[3&e],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}},b.prototype.hash=function(){var t,e,r,i,n,s,o,a,c,d=this.h0,u=this.h1,h=this.h2,p=this.h3,l=this.h4,f=this.h5,m=this.h6,y=this.h7,w=this.blocks;for(t=16;t<64;++t)e=((n=w[t-15])>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,r=((n=w[t-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,w[t]=w[t-16]+e+w[t-7]+r|0;for(c=u&h,t=0;t<64;t+=4)this.first?(this.is224?(s=300032,y=(n=w[0]-1413257819)-150054599|0,p=n+24177077|0):(s=704751109,y=(n=w[0]-210244248)-1521486534|0,p=n+143694565|0),this.first=!1):(e=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),i=(s=d&u)^d&h^c,y=p+(n=y+(r=(l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&f^~l&m)+g[t]+w[t])|0,p=n+(e+i)|0),e=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),i=(o=p&d)^p&u^s,m=h+(n=m+(r=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7))+(y&l^~y&f)+g[t+1]+w[t+1])|0,e=((h=n+(e+i)|0)>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),i=(a=h&p)^h&d^o,f=u+(n=f+(r=(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7))+(m&y^~m&l)+g[t+2]+w[t+2])|0,e=((u=n+(e+i)|0)>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),i=(c=u&h)^u&p^a,l=d+(n=l+(r=(f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(f&m^~f&y)+g[t+3]+w[t+3])|0,d=n+(e+i)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+d|0,this.h1=this.h1+u|0,this.h2=this.h2+h|0,this.h3=this.h3+p|0,this.h4=this.h4+l|0,this.h5=this.h5+f|0,this.h6=this.h6+m|0,this.h7=this.h7+y|0},b.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,i=this.h3,n=this.h4,s=this.h5,o=this.h6,a=this.h7,c=h[t>>>28&15]+h[t>>>24&15]+h[t>>>20&15]+h[t>>>16&15]+h[t>>>12&15]+h[t>>>8&15]+h[t>>>4&15]+h[15&t]+h[e>>>28&15]+h[e>>>24&15]+h[e>>>20&15]+h[e>>>16&15]+h[e>>>12&15]+h[e>>>8&15]+h[e>>>4&15]+h[15&e]+h[r>>>28&15]+h[r>>>24&15]+h[r>>>20&15]+h[r>>>16&15]+h[r>>>12&15]+h[r>>>8&15]+h[r>>>4&15]+h[15&r]+h[i>>>28&15]+h[i>>>24&15]+h[i>>>20&15]+h[i>>>16&15]+h[i>>>12&15]+h[i>>>8&15]+h[i>>>4&15]+h[15&i]+h[n>>>28&15]+h[n>>>24&15]+h[n>>>20&15]+h[n>>>16&15]+h[n>>>12&15]+h[n>>>8&15]+h[n>>>4&15]+h[15&n]+h[s>>>28&15]+h[s>>>24&15]+h[s>>>20&15]+h[s>>>16&15]+h[s>>>12&15]+h[s>>>8&15]+h[s>>>4&15]+h[15&s]+h[o>>>28&15]+h[o>>>24&15]+h[o>>>20&15]+h[o>>>16&15]+h[o>>>12&15]+h[o>>>8&15]+h[o>>>4&15]+h[15&o];return this.is224||(c+=h[a>>>28&15]+h[a>>>24&15]+h[a>>>20&15]+h[a>>>16&15]+h[a>>>12&15]+h[a>>>8&15]+h[a>>>4&15]+h[15&a]),c},b.prototype.toString=b.prototype.hex,b.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,i=this.h3,n=this.h4,s=this.h5,o=this.h6,a=this.h7,c=[t>>>24&255,t>>>16&255,t>>>8&255,255&t,e>>>24&255,e>>>16&255,e>>>8&255,255&e,r>>>24&255,r>>>16&255,r>>>8&255,255&r,i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o];return this.is224||c.push(a>>>24&255,a>>>16&255,a>>>8&255,255&a),c},b.prototype.array=b.prototype.digest,b.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t},P.prototype=new b,P.prototype.finalize=function(){if(b.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();b.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(t),b.prototype.finalize.call(this)}};var E=w();E.sha256=E,E.sha224=w(!0),E.sha256.hmac=S(),E.sha224.hmac=S(!0),c?t.exports=E:(s.sha256=E.sha256,s.sha224=E.sha224,d&&(void 0===(i=function(){return E}.call(E,r,E,t))||(t.exports=i)))}()},903:()=>{},394:()=>{}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var s=e[i]={exports:{}};return t[i](s,s.exports,r),s.exports}r.amdO={},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),(()=>{"use strict";const t={r:"v0.40.0"};function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function i(t,r,i){return(r=function(t){var r=function(t){if("object"!=e(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,"string");if("object"!=e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,t}async function n(t){const e=await S("/config",t,{method:"GET",headers:{Accept:"application/json"}});return new A(t).setSite(e),e}const s={"Europe/Vienna":"gdpr","Europe/Brussels":"gdpr","Europe/Sofia":"gdpr","Europe/Zagreb":"gdpr","Asia/Nicosia":"gdpr","Europe/Nicosia":"gdpr","Europe/Prague":"gdpr","Europe/Copenhagen":"gdpr","Europe/Tallinn":"gdpr","Europe/Helsinki":"gdpr","Europe/Paris":"gdpr","Europe/Berlin":"gdpr","Europe/Athens":"gdpr","Europe/Budapest":"gdpr","Atlantic/Reykjavik":"gdpr","Europe/Dublin":"gdpr","Europe/Rome":"gdpr","Europe/Riga":"gdpr","Europe/Vaduz":"gdpr","Europe/Vilnius":"gdpr","Europe/Luxembourg":"gdpr","Europe/Malta":"gdpr","Europe/Oslo":"gdpr","Europe/Warsaw":"gdpr","Europe/Lisbon":"gdpr","Europe/Bucharest":"gdpr","Europe/Bratislava":"gdpr","Europe/Ljubljana":"gdpr","Europe/Madrid":"gdpr","Europe/Stockholm":"gdpr","Europe/Amsterdam":"gdpr","Atlantic/Azores":"gdpr","Atlantic/Canary":"gdpr","America/Cayenne":"gdpr","America/Guadeloupe":"gdpr","Atlantic/Madeira":"gdpr","America/Martinique":"gdpr","Indian/Mayotte":"gdpr","Indian/Reunion":"gdpr","America/Marigot":"gdpr","Europe/Zurich":"gdpr","Europe/London":"gdpr","America/Toronto":"can","America/Adak":"us","America/Anchorage":"us","America/Atka":"us","America/Boise":"us","America/Chicago":"us","America/Denver":"us","America/Detroit":"us","America/Indiana/Indianapolis":"us","America/Indiana/Knox":"us","America/Indiana/Marengo":"us","America/Indiana/Petersburg":"us","America/Indiana/Tell_City":"us","America/Indiana/Vevay":"us","America/Indiana/Vincennes":"us","America/Indiana/Winamac":"us","America/Indianapolis":"us","America/Juneau":"us","America/Kentucky/Louisville":"us","America/Kentucky/Monticello":"us","America/Knox_IN":"us","America/Los_Angeles":"us","America/Louisville":"us","America/Menominee":"us","America/Metlakatla":"us","America/New_York":"us","America/Nome":"us","America/North_Dakota/Beulah":"us","America/North_Dakota/Center":"us","America/North_Dakota/New_Salem":"us","America/Phoenix":"us","America/Shiprock":"us","America/Sitka":"us","America/Yakutat":"us","Pacific/Honolulu":"us"},o="tcfcav1",a="tcfeuv2",c=[2],d=[5],u=[7,8,10,12,17,13,18,14,19,20,21,15,22,16,11,9];function h(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=function(t,e){const{gdprApplies:r,gppSectionIDs:i,gdprData:n}=e;if(void 0!==r)return r?"gdpr":"gdpr"===t?null:t;if(void 0!==n&&"gdpr"===t)return"gdpr";if(void 0===i||1===i.length&&0===i[0])return t;if(1===i.length&&-1===i[0])return null;if(i.some((t=>c.includes(t))))return"gdpr";if(i.some((t=>d.includes(t))))return"can";if(i.some((t=>u.includes(t))))return"us";switch(t){case"gdpr":if(!i.some((t=>c.includes(t))))return null;break;case"can":if(!i.some((t=>d.includes(t))))return null;break;case"us":if(!i.some((t=>u.includes(t))))return null}return t}(t,e),n={reg:i,gpp:e.gppString,gppSectionIDs:e.gppSectionIDs,gdpr:e.gdprString,gdprApplies:e.gdprApplies,deviceAccess:!1,createProfilesForAdvertising:!1,useProfilesForAdvertising:!1,measureAdvertisingPerformance:!1};switch(i){case"gdpr":e.gdprData?(n.deviceAccess=l(e.gdprData,1,r.tcfeuVendorID),n.createProfilesForAdvertising=l(e.gdprData,3,r.tcfeuVendorID),n.useProfilesForAdvertising=l(e.gdprData,4,r.tcfeuVendorID),n.measureAdvertisingPerformance=l(e.gdprData,7,r.tcfeuVendorID)):e.gppData&&(n.deviceAccess=f(e.gppData,1,r.tcfeuVendorID),n.createProfilesForAdvertising=f(e.gppData,3,r.tcfeuVendorID),n.useProfilesForAdvertising=f(e.gppData,4,r.tcfeuVendorID),n.measureAdvertisingPerformance=f(e.gppData,7,r.tcfeuVendorID));break;case"can":n.deviceAccess=!0,e.gppData&&(n.createProfilesForAdvertising=g(e.gppData,3,r.tcfcaVendorID),n.useProfilesForAdvertising=g(e.gppData,4,r.tcfcaVendorID),n.measureAdvertisingPerformance=g(e.gppData,7,r.tcfcaVendorID));break;default:n.deviceAccess=!0,n.createProfilesForAdvertising=!0,n.useProfilesForAdvertising=!0,n.measureAdvertisingPerformance=!0}return n}function p(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r={};!function(){if("function"==typeof window.__tcfapi)return;let t;const e={};let r=window;for(;r;){try{if(r.frames.__tcfapiLocator){t=r;break}}catch{}if(r===window.top)break;r=r.parent}t&&(window.__tcfapi=function(r,i,n){const s=Math.random()+"";e[s]=n,t.postMessage({__tcfapiCall:{command:r,version:i,callId:s}},"*")},window.addEventListener("message",(t=>{let r={};try{r="string"==typeof t.data?JSON.parse(t.data):t.data}catch{}const i=r.__tcfapiReturn;i&&"function"==typeof e[i.callId]&&(e[i.callId](i.returnValue,i.success),delete e[i.callId])}),!1))}(),function(){if("function"==typeof window.__gpp)return;let t;const e={};let r=window;for(;r;){try{if(r.frames.__gppLocator){t=r;break}}catch{}if(r===window.top)break;r=r.parent}t&&(window.__gpp=function(r,i){const n=Math.random()+"";e[n]=i,t.postMessage({__gppCall:{command:r,version:"1.1",callId:n}},"*")},window.addEventListener("message",(t=>{let r={};try{r="string"==typeof t.data?JSON.parse(t.data):t.data}catch{}const i=r.__gppReturn;i&&"function"==typeof e[i.callId]&&(e[i.callId](i.returnValue,i.success),delete e[i.callId])}),!1))}();const i=h(t,r,e);return"function"==typeof window.__tcfapi&&window.__tcfapi?.("addEventListener",2,((n,s)=>{s&&("tcloaded"===n.eventStatus||"useractioncomplete"===n.eventStatus)&&(n=>{r.gdprString=n.tcString,r.gdprApplies=n.gdprApplies,r.gdprData=n,Object.assign(i,h(t,r,e))})(n)})),"function"==typeof window.__gpp&&window.__gpp?.("addEventListener",((n,s)=>{s&&"signalStatus"===n.eventName&&"ready"===n.data&&(n=>{r.gppString=n.gppString,r.gppSectionIDs=n.applicableSections,r.gppData=n,Object.assign(i,h(t,r,e))})(n.pingData)})),i}function l(t,e,r){return r?!!t.purpose?.consents?.[e]&&!!t.vendor?.consents?.[r]:!!t.publisher?.consents?.[e]}function g(t,e,r){const i=e>1,n=t.parsedSections?.[o]||[];if("number"==typeof r){const t=n.find((t=>"Version"in t));if(!t)return!1;let s=t.PurposesExpressConsent.includes(e)&&t.VendorExpressConsent.includes(r);return i&&(s||=t.PurposesImpliedConsent.includes(e)&&t.VendorImpliedConsent.includes(r)),s}const s=n.find((t=>"SubsectionType"in t&&3===t.SubsectionType));if(!s)return!1;let a=s.PubPurposesExpressConsent.includes(e);return i&&(a||=s.PubPurposesImpliedConsent.includes(e)),a}function f(t,e,r){const i=e>1,n=t.parsedSections?.[a]||[];if("number"==typeof r){const t=n.find((t=>"Version"in t));if(!t)return!1;let s=t.PurposeConsent.includes(e)&&t.VendorConsent.includes(r);return i&&(s||=t.PurposesLITransparency.includes(e)&&t.VendorLegitimateInterest.includes(r)),s}const s=n.find((t=>"SegmentType"in t&&3===t.SegmentType));if(!s)return!1;let o=s.PubPurposesConsent.includes(e);return i&&(o||=s.PubPurposesLITransparency.includes(e)),o}class m{constructor(t){i(this,"consent",void 0),this.consent=t}getItem(t){return this.consent.deviceAccess?window.localStorage.getItem(t):null}setItem(t,e){this.consent.deviceAccess&&window.localStorage.setItem(t,e)}removeItem(t){this.consent.deviceAccess&&window.localStorage.removeItem(t)}}const y="_optable_pairId";function w(t){const e=new Uint16Array(t.length);for(let r=0;r<e.length;r++)e[r]=t.charCodeAt(r);return btoa(String.fromCharCode(...new Uint8Array(e.buffer)))}function v(t){return t.node?w(`${t.host}/${t.node}`):w(`${t.host}`)}class A{constructor(t){this.config=t,i(this,"passportKeys",void 0),i(this,"targetingKeys",void 0),i(this,"siteKeys",void 0),i(this,"pairKeys",void 0),i(this,"storage",void 0),this.passportKeys=function(t){const e=[],r=[],i=`OPTABLE_PASSPORT_${v(t)}`;return e.push(i),r.push(i),t.legacyHostCache?(r.push(`OPTABLE_PASSPORT_${w(`${t.legacyHostCache}`)}`),r.push(`OPTABLE_PASS_${w(`${t.legacyHostCache}/${t.site}`)}`)):r.push(`OPTABLE_PASS_${w(`${t.host}/${t.site}`)}`),{write:e,read:r}}(t),this.targetingKeys=function(t){const e=`OPTABLE_TARGETING_${v(t)}`;return{write:[e,t.optableCacheTargeting],read:[e]}}(t),this.siteKeys=function(t){const e=`OPTABLE_SITE_${v(t)}`;return{write:[e],read:[e]}}(t),this.pairKeys={write:[y],read:[y]},this.storage=new m(this.config.consent)}getPassport(){return this.readStorageKeys(this.passportKeys)}setPassport(t){this.writeToStorageKeys(this.passportKeys,t)}getTargeting(){const t=this.readStorageKeys(this.targetingKeys);return t?JSON.parse(t):null}setTargeting(t){t&&(this.writeToStorageKeys(this.targetingKeys,JSON.stringify(t)),this.setPairIDs(t))}getSite(){const t=this.readStorageKeys(this.siteKeys);return t?JSON.parse(t):null}setSite(t){t&&this.writeToStorageKeys(this.siteKeys,JSON.stringify(t))}setPairIDs(t){const e=t.ortb2?.user?.eids?.filter((t=>"pair-protocol.com"===t.source)),r=e?.flatMap((t=>t.uids));if(!r)return;const i=new Set(r.map((t=>t.id)));this.writeToStorageKeys(this.pairKeys,btoa(JSON.stringify({envelope:[...i]})))}getPairIDs(){const t=this.readStorageKeys(this.pairKeys);return t?JSON.parse(atob(t))?.envelope:null}readStorageKeys(t){for(const e of t.read){const t=this.storage.getItem(e);if(t)return t}return null}writeToStorageKeys(t,e){if(e)for(const r of t.write)this.storage.setItem(r,e)}clearStorageKeys(t){for(const e of[...t.read,...t.write])this.storage.removeItem(e)}clearPassport(){this.clearStorageKeys(this.passportKeys)}clearTargeting(){this.clearStorageKeys(this.targetingKeys)}clearSite(){this.clearStorageKeys(this.siteKeys)}}async function S(e,r,i){const n=await globalThis.fetch(function(e,r,i){const{host:n,cookies:s}=r,o=new URL(e,`https://${n}`);if(o.searchParams.set("osdk",`web-${t.r}`),o.searchParams.set("sid",r.sessionID),r.skipEnrichment&&o.searchParams.set("skip_enrichment",`${r.skipEnrichment}`),r.node&&o.searchParams.set("t",r.node),r.site&&o.searchParams.set("o",r.site),void 0!==r.consent.gpp&&o.searchParams.set("gpp",r.consent.gpp),void 0!==r.consent.gppSectionIDs&&o.searchParams.set("gpp_sid",r.consent.gppSectionIDs.join(",")),void 0!==r.consent.gdpr&&o.searchParams.set("gdpr_consent",r.consent.gdpr),void 0!==r.consent.gdprApplies&&o.searchParams.set("gdpr",Number(r.consent.gdprApplies).toString()),r.readOnly&&o.searchParams.set("ro","true"),s)o.searchParams.set("cookies","yes");else{const t=new A(r).getPassport();o.searchParams.set("cookies","no"),o.searchParams.set("passport",t||"")}const a={...i};return a.credentials=r.consent.deviceAccess?"include":"omit",r.mockedIP&&(a.headers=new Headers(a.headers),a.headers.set("X-Forwarded-For",r.mockedIP)),new Request(o.toString(),a)}(e,r,i)),s=n.headers.get("Content-Type"),o=s?.startsWith("application/json")?await n.json():await n.text();if(!n.ok)throw new Error(o.error);return o.passport&&(new A(r).setPassport(o.passport),delete o.passport),o}var b,P,E,I=((P=I||{})[P.Banner=1]="Banner",P[P.Video=2]="Video",P[P.Audio=3]="Audio",P[P.Native=4]="Native",P),_={},T={},C={};(E=b||(b={})).Placement=T,E.Media=C,E.Context=_;const k={cookies:!0,initPassport:!0,readOnly:!1,experiments:[],consent:{reg:null,deviceAccess:!0,createProfilesForAdvertising:!0,useProfilesForAdvertising:!0,measureAdvertisingPerformance:!0}};function D(){const t=new Uint8Array(16);return crypto.getRandomValues(t),btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function O(t){return{user:{data:(t?.audience??[]).map((t=>({name:t.provider,segment:t.ids,ext:{segtax:t.rtb_segtax}}))),ext:{eids:(t?.user??[]).map((t=>({source:t.provider,uids:t.ids.map((t=>{let{id:e}=t;return{id:e,atype:3}}))})))}}}}function x(t){const e={};if(!t)return e;for(const r of t.audience??[])r.keyspace&&(r.keyspace in e||(e[r.keyspace]=[]),e[r.keyspace].push(...r.ids.map((t=>t.id))));return e}var K=r(312);class N{constructor(t){i(this,"dcn",void 0),i(this,"init",void 0),this.dcn=function(t){const e={host:t.host,site:t.site,optableCacheTargeting:t.optableCacheTargeting??"optable-cache:targeting",cookies:t.cookies??k.cookies,initPassport:t.initPassport??k.initPassport,consent:k.consent,readOnly:t.readOnly??k.readOnly,node:t.node,legacyHostCache:t.legacyHostCache,experiments:t.experiments??k.experiments,mockedIP:t.mockedIP,sessionID:t.sessionID??D(),skipEnrichment:t.skipEnrichment,initTargeting:t.initTargeting,abTests:t.abTests};return t.consent?.static?e.consent=t.consent.static:t.consent?.cmpapi&&(e.consent=p(function(){const t=Intl.DateTimeFormat().resolvedOptions().timeZone,e=s[t];return"can"===e?["fr","fr-CA"].some((t=>navigator.languages.includes(t)))?"can":null:e??null}(),t.consent.cmpapi)),e}(t),this.init=this.initialize()}async initialize(){this.dcn.initPassport&&await n(this.dcn).catch((()=>{})),this.dcn.initTargeting&&this.targeting().catch((()=>{}))}async identify(){await this.init;for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(t,e){return S("/identify",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}(this.dcn,e.filter((t=>t)))}async uid2Token(t){return await this.init,function(t,e){return S("/uid2/token",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}(this.dcn,t)}async targeting(){const t=function(t){if("string"==typeof t)return{ids:[t],hids:[]};if(null!==(e=t)&&"object"==typeof e&&!Array.isArray(e))return{ids:t?.ids??[],hids:t?.hids??[]};var e;throw"Invalid request type for targeting. Expected string or object."}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"__passport__");if(t.ids.length>1&&!this.dcn.experiments.includes("targeting-cascade"))throw"Targeting multiple IDs is only available with the 'targeting-cascade' experiment enabled.";return await this.init,async function(t,e){const r=new URLSearchParams;e.ids.forEach((t=>r.append("id",t))),e.hids.forEach((t=>r.append("hid",t)));const i=function(t){if(!t||0===t.length)return null;if(t.reduce(((t,e)=>t+e.trafficPercentage),0)>100)return console.error("AB Test Config Error: Traffic Percentage Sum Exceeds 100%"),null;const e=Math.floor(100*Math.random());let r=0;for(const i of t)if(r+=i.trafficPercentage,e<r)return i;return null}(t.abTests);i&&(r.append("ab_test_id",i.id),i.matcher_override)&&[...i.matcher_override].sort(((t,e)=>t.rank-e.rank)).forEach((t=>{r.append("matcher_override",t.id)}));const n="/v2/targeting?"+r.toString(),s=await S(n,t,{method:"GET",headers:{Accept:"application/json"}});return s&&(new A(t).setTargeting(s),function(t,e){const r=e.ortb2?.user?.eids?.map((t=>t.matcher));window.dispatchEvent(new CustomEvent("optable-targeting:change",{detail:{instance:t.node||t.host,resolved:!!e.ortb2?.user?.eids?.length,resolvedIDs:e.resolved_ids??[],ortb2:e.ortb2,provenance:new Set(r)}}))}(t,s)),s}(this.dcn,t)}targetingFromCache(){return t=this.dcn,new A(t).getTargeting();var t}async site(){return n(this.dcn)}siteFromCache(){return t=this.dcn,new A(t).getSite();var t}targetingClearCache(){var t;t=this.dcn,new A(t).clearTargeting()}async prebidORTB2(){return O(await this.targeting())}prebidORTB2FromCache(){return O(this.targetingFromCache())}async targetingKeyValues(){return x(await this.targeting())}targetingKeyValuesFromCache(){return x(this.targetingFromCache())}async witness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return await this.init,function(t,e,r){const i={event:e,properties:r};return S("/witness",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})}(this.dcn,t,e)}async profile(t){return await this.init,function(t,e){const r={traits:e};return S("/profile",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}(this.dcn,t)}async tokenize(t){return await this.init,function(t,e){let r="/v1/tokenize";t.experiments.includes("tokenize-v2")&&(r="/v2/tokenize");let i={id:e};return S(r,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})}(this.dcn,t)}async resolve(t){return await this.init,async function(t,e){const r=new URLSearchParams;"string"==typeof e&&r.append("id",e);const i="/v1/resolve?"+r.toString();return function(t){const e={clusters:[],lmpid:""};if("object"!=typeof t||null===t)return e;if("lmpid"in t&&"string"==typeof t?.lmpid&&(e.lmpid=t.lmpid),!("clusters"in t)||!Array.isArray(t?.clusters))return e;for(const r of t.clusters){const t={ids:[],traits:[]};if(Array.isArray(r?.ids))for(const e of r.ids)"string"==typeof e&&t.ids.push(e);if(Array.isArray(r?.traits))for(const e of r.traits)"string"==typeof e?.key&&"string"==typeof e?.value&&t.traits.push({key:e.key,value:e.value});(t.ids.length>0||t.traits.length>0)&&e.clusters.push(t)}return e}(await S(i,t,{method:"GET",headers:{Accept:"application/json"}}))}(this.dcn,t)}static eid(t){return t?"e:"+K.sha256.hex(t.toLowerCase().trim()):""}static sha256(t){return t?K.sha256.hex(t):""}static cid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r="c:";if("string"!=typeof t)throw new Error("Invalid ppid");if("number"!=typeof e||isNaN(e)||e<0||e>19)throw new Error("Invalid variant");return e>0&&(r=`c${e}:`),t?r+t.trim():""}static TargetingKeyValues(t){return x(t)}static PrebidORTB2(t){return O(t)}}i(N,"version",t.r);const B=N;function V(t){return{advertiserId:t.advertiserId?.toString(),campaignId:t.campaignId?.toString(),creativeId:t.creativeId?.toString(),isEmpty:t.isEmpty?.toString(),lineItemId:t.lineItemId?.toString(),serviceName:t.serviceName?.toString(),size:t.size?.toString(),slotElementId:t.slot?.getSlotElementId(),sourceAgnosticCreativeId:t.sourceAgnosticCreativeId?.toString(),sourceAgnosticLineItemId:t.sourceAgnosticLineItemId?.toString()}}B.prototype.installGPTEventListeners=function(){const t=this;t.installGPTEventListeners=function(){},window.googletag=window.googletag||{cmd:[]};const e=window.googletag;e.cmd.push((function(){e.pubads().addEventListener("slotRenderEnded",(function(e){t.witness("googletag.events.slotRenderEnded",V(e))})),e.pubads().addEventListener("impressionViewable",(function(e){t.witness("googletag.events.impressionViewable",V(e))}))}))},B.prototype.installGPTSecureSignals=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];window.googletag=window.googletag||{cmd:[]};const i=window.googletag;e&&e.length>0&&i.cmd.push((()=>{e.forEach((t=>{let{provider:e,id:r}=t;i.secureSignalProviders.push({id:e,collectorFunction:()=>Promise.resolve(r)})}))}))};const L=/^[a-f0-9]{64}$/i;B.prototype.tryIdentifyFromParams=function(t,e){const r=new RegExp(`^${t||"oeid"}$`,"i"),i=new URLSearchParams(window.location.search);let n="";for(const[t,e]of i)if(r.test(t)){n=e;break}""!=n&&(e||function(t){return L.test(t)}(n))&&this.identify((e||"e")+":"+n.toLowerCase())},B.prototype.auctionConfig=async function(){await this.init;let t=this.siteFromCache();return t||(t=await this.site()),t.auctionConfig??null},B.prototype.installGPTAuctionConfigs=async function(t){this.installGPTAuctionConfigs=function(){return Promise.resolve()};const e=await this.auctionConfig();if(!e)return;window.googletag=window.googletag||{cmd:[]};const r=window.googletag;r.cmd.push((function(){let i=r.pubads().getSlots();t&&(i=i.filter(t));for(const t of i){const r=t.getSizes(),i=[];for(const t of r)"fluid"!==t&&i.push({configKey:e.seller+"-"+t.getWidth()+"x"+t.getHeight(),auctionConfig:{...e,requestedSize:{width:t.getWidth()+"px",height:t.getHeight()+"px"}}});t.setConfig({componentAuction:i})}}))},B.prototype.runAdAuction=async function(t,e){if(!("runAdAuction"in navigator))throw"run-ad-auction not supported";const r=document.getElementById(t);if(!r)throw"spot not found";const i=function(t){const e=window.getComputedStyle(t,null);return{width:e.getPropertyValue("width"),height:e.getPropertyValue("height")}}(r),n=await this.auctionConfig();if(!n)return!1;const s={...n,requestedSize:i,resolveToConfig:!0},o=e?.iframe??!1;o&&(s.resolveToConfig=!1);const a=await navigator.runAdAuction(s);if(!a)return r.replaceChildren(),!1;if(o){const t=document.createElement("iframe");t.src=a,t.style.border="none",t.style.width=i.width,t.style.height=i.height,r.replaceChildren(t)}else{const t=document.createElement("fencedframe");t.config=a,t.style.border="none",r.replaceChildren(t)}return!0},B.prototype.joinAdInterestGroups=async function(){if(!("joinAdInterestGroup"in navigator))throw"join-ad-interest-group not supported";if(!(this.dcn.consent.deviceAccess&&this.dcn.consent.createProfilesForAdvertising&&this.dcn.consent.measureAdvertisingPerformance))throw"consent not granted for joining interest groups";await this.init;let t=this.siteFromCache();if(t||(t=await this.site()),!t.interestGroupPixel)throw"origin not enabled for protected audience apis";const e=new URL(t.interestGroupPixel),r=document.createElement("iframe");r.src=e.toString(),r.allow="join-ad-interest-group "+e.origin,r.style.display="none";const i=new Promise(((t,e)=>{window.addEventListener("message",(i=>{i.source===r.contentWindow&&("success"!==i.data.result?e():t())}))}));return document.body.appendChild(r),i},B.prototype.getTopics=async function(){if(!("browsingTopics"in document))throw"browsing-topics not supported";if(!this.dcn.consent.deviceAccess)throw"consent not granted for reading browsing topics";await this.init;let t=this.siteFromCache();if(t||(t=await this.site()),!t.getTopicsURL)throw"origin not enabled for topics api";const e=new URL(t.getTopicsURL),r=document.createElement("iframe");r.src=e.toString(),r.allow="browsing-topics "+e.origin,r.style.display="none";const i=new Promise(((t,e)=>{window.addEventListener("message",(i=>{i.source===r.contentWindow&&(i.data.error?e(new Error(i.data.error.toString())):t(i.data.result))}))}));return document.body.appendChild(r),i},B.prototype.ingestTopics=function(){this.getTopics().then((t=>{if(!t.length)return;const e=t.reduce(((t,e)=>{const r=`topics_v${e.taxonomyVersion}`;return t[r]?t[r]+=",":t[r]="",t[r]+=String(e.topic),t}),{});this.profile(e)})).catch((()=>{}))},window.optable=window.optable||{},window.optable.SDK=B,window.optable.cmd=new class{constructor(t){if(this.cmds=t,Array.isArray(this.cmds))for(const t of this.cmds)"function"==typeof t&&t()}push(t){t()}}(window.optable.cmd||[]),window.optable.utils={resolveMultiNodeTargeting:async function(t){return t?t.some((t=>t.priority))?async function(t){const e=new Set,r={user:{data:[],eids:[]}},i=new Map,n=new Map;const s=t.map((t=>{let{targetingFn:e,matcher:s,mm:o,priority:a}=t;return e().then((t=>function(t,e,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const a=Math.max(0,o),{data:c=[],eids:d=[]}=t.ortb2?.user??{};r.user.data.push(...c),d.filter((t=>t.uids.length)).forEach((t=>{let{ext:r,...o}=t;const c=o.matcher??e,d=i.get(a)??[];c&&i.set(a,[...d,c]);const u=n.get(a)??[];n.set(a,[...u,{...o,matcher:o.matcher??e,mm:o.mm??s}])}))}(t,s,o,a)))}));await Promise.allSettled(s);const o=Array.from(n.keys()).sort(((t,e)=>t-e)).filter((t=>n.get(t)?.length)).shift();if(o){const t=i.get(o)||[];r.user.eids.push(...n.get(o)||[]),t.forEach((t=>e.add(t)))}return{ortb2:r,eidSources:e}}(t):async function(t){const e=new Set,r={user:{data:[],eids:[]}};const i=t.map((t=>{let{targetingFn:i,matcher:n,mm:s}=t;return i().then((t=>function(t,i,n){const{data:s=[],eids:o=[]}=t.ortb2?.user??{};r.user.data.push(...s),o.filter((t=>t.uids.length)).forEach((t=>{let{ext:s,...o}=t;const a=o.matcher??i;a&&e.add(a),r.user.eids.push({...o,mm:o.mm??n,matcher:o.matcher??i})}))}(t,n,s)))}));return await Promise.allSettled(i),{ortb2:r,eidSources:e}}(t):Promise.reject("No targeting rules provided")}},window.optable.instance_config&&(window.optable.instance=new B(window.optable.instance_config))})()})();
|
|
2
|
+
(()=>{var e={312:(e,t,r)=>{var i;!function(){"use strict";var t="input is invalid type",s="object"==typeof window,n=s?window:{};n.JS_SHA256_NO_WINDOW&&(s=!1);var o=!s&&"object"==typeof self,a=!n.JS_SHA256_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;a?n=r.g:o&&(n=self);var c=!n.JS_SHA256_NO_COMMON_JS&&e.exports,d=r.amdO,u=!n.JS_SHA256_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,h="0123456789abcdef".split(""),p=[-2147483648,8388608,32768,128],l=[24,16,8,0],g=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],f=["hex","array","digest","arrayBuffer"],m=[];!n.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!u||!n.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});var y=function(e,t){return function(r){return new b(t,!0).update(r)[e]()}},w=function(e){var t=y("hex",e);a&&(t=v(t,e)),t.create=function(){return new b(e)},t.update=function(e){return t.create().update(e)};for(var r=0;r<f.length;++r){var i=f[r];t[i]=y(i,e)}return t},v=function(e,i){var s,o=r(394),a=r(903).Buffer,c=i?"sha224":"sha256";return s=a.from&&!n.JS_SHA256_NO_BUFFER_FROM?a.from:function(e){return new a(e)},function(r){if("string"==typeof r)return o.createHash(c).update(r,"utf8").digest("hex");if(null==r)throw new Error(t);return r.constructor===ArrayBuffer&&(r=new Uint8Array(r)),Array.isArray(r)||ArrayBuffer.isView(r)||r.constructor===a?o.createHash(c).update(s(r)).digest("hex"):e(r)}},A=function(e,t){return function(r,i){return new P(r,t,!0).update(i)[e]()}},S=function(e){var t=A("hex",e);t.create=function(t){return new P(t,e)},t.update=function(e,r){return t.create(e).update(r)};for(var r=0;r<f.length;++r){var i=f[r];t[i]=A(i,e)}return t};function b(e,t){t?(m[0]=m[16]=m[1]=m[2]=m[3]=m[4]=m[5]=m[6]=m[7]=m[8]=m[9]=m[10]=m[11]=m[12]=m[13]=m[14]=m[15]=0,this.blocks=m):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=e}function P(e,r,i){var s,n=typeof e;if("string"===n){var o,a=[],c=e.length,d=0;for(s=0;s<c;++s)(o=e.charCodeAt(s))<128?a[d++]=o:o<2048?(a[d++]=192|o>>>6,a[d++]=128|63&o):o<55296||o>=57344?(a[d++]=224|o>>>12,a[d++]=128|o>>>6&63,a[d++]=128|63&o):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++s)),a[d++]=240|o>>>18,a[d++]=128|o>>>12&63,a[d++]=128|o>>>6&63,a[d++]=128|63&o);e=a}else{if("object"!==n)throw new Error(t);if(null===e)throw new Error(t);if(u&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||u&&ArrayBuffer.isView(e)))throw new Error(t)}e.length>64&&(e=new b(r,!0).update(e).array());var h=[],p=[];for(s=0;s<64;++s){var l=e[s]||0;h[s]=92^l,p[s]=54^l}b.call(this,r,i),this.update(p),this.oKeyPad=h,this.inner=!0,this.sharedMemory=i}b.prototype.update=function(e){if(!this.finalized){var r,i=typeof e;if("string"!==i){if("object"!==i)throw new Error(t);if(null===e)throw new Error(t);if(u&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||u&&ArrayBuffer.isView(e)))throw new Error(t);r=!0}for(var s,n,o=0,a=e.length,c=this.blocks;o<a;){if(this.hashed&&(this.hashed=!1,c[0]=this.block,this.block=c[16]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=c[11]=c[12]=c[13]=c[14]=c[15]=0),r)for(n=this.start;o<a&&n<64;++o)c[n>>>2]|=e[o]<<l[3&n++];else for(n=this.start;o<a&&n<64;++o)(s=e.charCodeAt(o))<128?c[n>>>2]|=s<<l[3&n++]:s<2048?(c[n>>>2]|=(192|s>>>6)<<l[3&n++],c[n>>>2]|=(128|63&s)<<l[3&n++]):s<55296||s>=57344?(c[n>>>2]|=(224|s>>>12)<<l[3&n++],c[n>>>2]|=(128|s>>>6&63)<<l[3&n++],c[n>>>2]|=(128|63&s)<<l[3&n++]):(s=65536+((1023&s)<<10|1023&e.charCodeAt(++o)),c[n>>>2]|=(240|s>>>18)<<l[3&n++],c[n>>>2]|=(128|s>>>12&63)<<l[3&n++],c[n>>>2]|=(128|s>>>6&63)<<l[3&n++],c[n>>>2]|=(128|63&s)<<l[3&n++]);this.lastByteIndex=n,this.bytes+=n-this.start,n>=64?(this.block=c[16],this.start=n-64,this.hash(),this.hashed=!0):this.start=n}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},b.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>>2]|=p[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}},b.prototype.hash=function(){var e,t,r,i,s,n,o,a,c,d=this.h0,u=this.h1,h=this.h2,p=this.h3,l=this.h4,f=this.h5,m=this.h6,y=this.h7,w=this.blocks;for(e=16;e<64;++e)t=((s=w[e-15])>>>7|s<<25)^(s>>>18|s<<14)^s>>>3,r=((s=w[e-2])>>>17|s<<15)^(s>>>19|s<<13)^s>>>10,w[e]=w[e-16]+t+w[e-7]+r|0;for(c=u&h,e=0;e<64;e+=4)this.first?(this.is224?(n=300032,y=(s=w[0]-1413257819)-150054599|0,p=s+24177077|0):(n=704751109,y=(s=w[0]-210244248)-1521486534|0,p=s+143694565|0),this.first=!1):(t=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),i=(n=d&u)^d&h^c,y=p+(s=y+(r=(l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&f^~l&m)+g[e]+w[e])|0,p=s+(t+i)|0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),i=(o=p&d)^p&u^n,m=h+(s=m+(r=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7))+(y&l^~y&f)+g[e+1]+w[e+1])|0,t=((h=s+(t+i)|0)>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),i=(a=h&p)^h&d^o,f=u+(s=f+(r=(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7))+(m&y^~m&l)+g[e+2]+w[e+2])|0,t=((u=s+(t+i)|0)>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),i=(c=u&h)^u&p^a,l=d+(s=l+(r=(f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(f&m^~f&y)+g[e+3]+w[e+3])|0,d=s+(t+i)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+d|0,this.h1=this.h1+u|0,this.h2=this.h2+h|0,this.h3=this.h3+p|0,this.h4=this.h4+l|0,this.h5=this.h5+f|0,this.h6=this.h6+m|0,this.h7=this.h7+y|0},b.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,i=this.h3,s=this.h4,n=this.h5,o=this.h6,a=this.h7,c=h[e>>>28&15]+h[e>>>24&15]+h[e>>>20&15]+h[e>>>16&15]+h[e>>>12&15]+h[e>>>8&15]+h[e>>>4&15]+h[15&e]+h[t>>>28&15]+h[t>>>24&15]+h[t>>>20&15]+h[t>>>16&15]+h[t>>>12&15]+h[t>>>8&15]+h[t>>>4&15]+h[15&t]+h[r>>>28&15]+h[r>>>24&15]+h[r>>>20&15]+h[r>>>16&15]+h[r>>>12&15]+h[r>>>8&15]+h[r>>>4&15]+h[15&r]+h[i>>>28&15]+h[i>>>24&15]+h[i>>>20&15]+h[i>>>16&15]+h[i>>>12&15]+h[i>>>8&15]+h[i>>>4&15]+h[15&i]+h[s>>>28&15]+h[s>>>24&15]+h[s>>>20&15]+h[s>>>16&15]+h[s>>>12&15]+h[s>>>8&15]+h[s>>>4&15]+h[15&s]+h[n>>>28&15]+h[n>>>24&15]+h[n>>>20&15]+h[n>>>16&15]+h[n>>>12&15]+h[n>>>8&15]+h[n>>>4&15]+h[15&n]+h[o>>>28&15]+h[o>>>24&15]+h[o>>>20&15]+h[o>>>16&15]+h[o>>>12&15]+h[o>>>8&15]+h[o>>>4&15]+h[15&o];return this.is224||(c+=h[a>>>28&15]+h[a>>>24&15]+h[a>>>20&15]+h[a>>>16&15]+h[a>>>12&15]+h[a>>>8&15]+h[a>>>4&15]+h[15&a]),c},b.prototype.toString=b.prototype.hex,b.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,i=this.h3,s=this.h4,n=this.h5,o=this.h6,a=this.h7,c=[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,r>>>24&255,r>>>16&255,r>>>8&255,255&r,i>>>24&255,i>>>16&255,i>>>8&255,255&i,s>>>24&255,s>>>16&255,s>>>8&255,255&s,n>>>24&255,n>>>16&255,n>>>8&255,255&n,o>>>24&255,o>>>16&255,o>>>8&255,255&o];return this.is224||c.push(a>>>24&255,a>>>16&255,a>>>8&255,255&a),c},b.prototype.array=b.prototype.digest,b.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(this.is224?28:32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),e},P.prototype=new b,P.prototype.finalize=function(){if(b.prototype.finalize.call(this),this.inner){this.inner=!1;var e=this.array();b.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(e),b.prototype.finalize.call(this)}};var I=w();I.sha256=I,I.sha224=w(!0),I.sha256.hmac=S(),I.sha224.hmac=S(!0),c?e.exports=I:(n.sha256=I.sha256,n.sha224=I.sha224,d&&(void 0===(i=function(){return I}.call(I,r,I,e))||(e.exports=i)))}()},903:()=>{},394:()=>{}},t={};function r(i){var s=t[i];if(void 0!==s)return s.exports;var n=t[i]={exports:{}};return e[i](n,n.exports,r),n.exports}r.amdO={},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),(()=>{"use strict";const e={r:"v0.41.0"};function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function i(e,r,i){return(r=function(e){var r=function(e){if("object"!=t(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,"string");if("object"!=t(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==t(r)?r:r+""}(r))in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,e}async function s(e){const t=await S("/config",e,{method:"GET",headers:{Accept:"application/json"}});return new A(e).setSite(t),t}const n={"Europe/Vienna":"gdpr","Europe/Brussels":"gdpr","Europe/Sofia":"gdpr","Europe/Zagreb":"gdpr","Asia/Nicosia":"gdpr","Europe/Nicosia":"gdpr","Europe/Prague":"gdpr","Europe/Copenhagen":"gdpr","Europe/Tallinn":"gdpr","Europe/Helsinki":"gdpr","Europe/Paris":"gdpr","Europe/Berlin":"gdpr","Europe/Athens":"gdpr","Europe/Budapest":"gdpr","Atlantic/Reykjavik":"gdpr","Europe/Dublin":"gdpr","Europe/Rome":"gdpr","Europe/Riga":"gdpr","Europe/Vaduz":"gdpr","Europe/Vilnius":"gdpr","Europe/Luxembourg":"gdpr","Europe/Malta":"gdpr","Europe/Oslo":"gdpr","Europe/Warsaw":"gdpr","Europe/Lisbon":"gdpr","Europe/Bucharest":"gdpr","Europe/Bratislava":"gdpr","Europe/Ljubljana":"gdpr","Europe/Madrid":"gdpr","Europe/Stockholm":"gdpr","Europe/Amsterdam":"gdpr","Atlantic/Azores":"gdpr","Atlantic/Canary":"gdpr","America/Cayenne":"gdpr","America/Guadeloupe":"gdpr","Atlantic/Madeira":"gdpr","America/Martinique":"gdpr","Indian/Mayotte":"gdpr","Indian/Reunion":"gdpr","America/Marigot":"gdpr","Europe/Zurich":"gdpr","Europe/London":"gdpr","America/Toronto":"can","America/Adak":"us","America/Anchorage":"us","America/Atka":"us","America/Boise":"us","America/Chicago":"us","America/Denver":"us","America/Detroit":"us","America/Indiana/Indianapolis":"us","America/Indiana/Knox":"us","America/Indiana/Marengo":"us","America/Indiana/Petersburg":"us","America/Indiana/Tell_City":"us","America/Indiana/Vevay":"us","America/Indiana/Vincennes":"us","America/Indiana/Winamac":"us","America/Indianapolis":"us","America/Juneau":"us","America/Kentucky/Louisville":"us","America/Kentucky/Monticello":"us","America/Knox_IN":"us","America/Los_Angeles":"us","America/Louisville":"us","America/Menominee":"us","America/Metlakatla":"us","America/New_York":"us","America/Nome":"us","America/North_Dakota/Beulah":"us","America/North_Dakota/Center":"us","America/North_Dakota/New_Salem":"us","America/Phoenix":"us","America/Shiprock":"us","America/Sitka":"us","America/Yakutat":"us","Pacific/Honolulu":"us"},o="tcfcav1",a="tcfeuv2",c=[2],d=[5],u=[7,8,10,12,17,13,18,14,19,20,21,15,22,16,11,9];function h(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=function(e,t){const{gdprApplies:r,gppSectionIDs:i,gdprData:s}=t;if(void 0!==r)return r?"gdpr":"gdpr"===e?null:e;if(void 0!==s&&"gdpr"===e)return"gdpr";if(void 0===i||1===i.length&&0===i[0])return e;if(1===i.length&&-1===i[0])return null;if(i.some((e=>c.includes(e))))return"gdpr";if(i.some((e=>d.includes(e))))return"can";if(i.some((e=>u.includes(e))))return"us";switch(e){case"gdpr":if(!i.some((e=>c.includes(e))))return null;break;case"can":if(!i.some((e=>d.includes(e))))return null;break;case"us":if(!i.some((e=>u.includes(e))))return null}return e}(e,t),s={reg:i,gpp:t.gppString,gppSectionIDs:t.gppSectionIDs,gdpr:t.gdprString,gdprApplies:t.gdprApplies,deviceAccess:!1,createProfilesForAdvertising:!1,useProfilesForAdvertising:!1,measureAdvertisingPerformance:!1};switch(i){case"gdpr":t.gdprData?(s.deviceAccess=l(t.gdprData,1,r.tcfeuVendorID),s.createProfilesForAdvertising=l(t.gdprData,3,r.tcfeuVendorID),s.useProfilesForAdvertising=l(t.gdprData,4,r.tcfeuVendorID),s.measureAdvertisingPerformance=l(t.gdprData,7,r.tcfeuVendorID)):t.gppData&&(s.deviceAccess=f(t.gppData,1,r.tcfeuVendorID),s.createProfilesForAdvertising=f(t.gppData,3,r.tcfeuVendorID),s.useProfilesForAdvertising=f(t.gppData,4,r.tcfeuVendorID),s.measureAdvertisingPerformance=f(t.gppData,7,r.tcfeuVendorID));break;case"can":s.deviceAccess=!0,t.gppData&&(s.createProfilesForAdvertising=g(t.gppData,3,r.tcfcaVendorID),s.useProfilesForAdvertising=g(t.gppData,4,r.tcfcaVendorID),s.measureAdvertisingPerformance=g(t.gppData,7,r.tcfcaVendorID));break;default:s.deviceAccess=!0,s.createProfilesForAdvertising=!0,s.useProfilesForAdvertising=!0,s.measureAdvertisingPerformance=!0}return s}function p(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r={};!function(){if("function"==typeof window.__tcfapi)return;let e;const t={};let r=window;for(;r;){try{if(r.frames.__tcfapiLocator){e=r;break}}catch{}if(r===window.top)break;r=r.parent}e&&(window.__tcfapi=function(r,i,s){const n=Math.random()+"";t[n]=s,e.postMessage({__tcfapiCall:{command:r,version:i,callId:n}},"*")},window.addEventListener("message",(e=>{let r={};try{r="string"==typeof e.data?JSON.parse(e.data):e.data}catch{}const i=r.__tcfapiReturn;i&&"function"==typeof t[i.callId]&&(t[i.callId](i.returnValue,i.success),delete t[i.callId])}),!1))}(),function(){if("function"==typeof window.__gpp)return;let e;const t={};let r=window;for(;r;){try{if(r.frames.__gppLocator){e=r;break}}catch{}if(r===window.top)break;r=r.parent}e&&(window.__gpp=function(r,i){const s=Math.random()+"";t[s]=i,e.postMessage({__gppCall:{command:r,version:"1.1",callId:s}},"*")},window.addEventListener("message",(e=>{let r={};try{r="string"==typeof e.data?JSON.parse(e.data):e.data}catch{}const i=r.__gppReturn;i&&"function"==typeof t[i.callId]&&(t[i.callId](i.returnValue,i.success),delete t[i.callId])}),!1))}();const i=h(e,r,t);return"function"==typeof window.__tcfapi&&window.__tcfapi?.("addEventListener",2,((s,n)=>{n&&("tcloaded"===s.eventStatus||"useractioncomplete"===s.eventStatus)&&(s=>{r.gdprString=s.tcString,r.gdprApplies=s.gdprApplies,r.gdprData=s,Object.assign(i,h(e,r,t))})(s)})),"function"==typeof window.__gpp&&window.__gpp?.("addEventListener",((s,n)=>{n&&"signalStatus"===s.eventName&&"ready"===s.data&&(s=>{r.gppString=s.gppString,r.gppSectionIDs=s.applicableSections,r.gppData=s,Object.assign(i,h(e,r,t))})(s.pingData)})),i}function l(e,t,r){return r?!!e.purpose?.consents?.[t]&&!!e.vendor?.consents?.[r]:!!e.publisher?.consents?.[t]}function g(e,t,r){const i=t>1,s=e.parsedSections?.[o]||[];if("number"==typeof r){const e=s.find((e=>"Version"in e));if(!e)return!1;let n=e.PurposesExpressConsent.includes(t)&&e.VendorExpressConsent.includes(r);return i&&(n||=e.PurposesImpliedConsent.includes(t)&&e.VendorImpliedConsent.includes(r)),n}const n=s.find((e=>"SubsectionType"in e&&3===e.SubsectionType));if(!n)return!1;let a=n.PubPurposesExpressConsent.includes(t);return i&&(a||=n.PubPurposesImpliedConsent.includes(t)),a}function f(e,t,r){const i=t>1,s=e.parsedSections?.[a]||[];if("number"==typeof r){const e=s.find((e=>"Version"in e));if(!e)return!1;let n=e.PurposeConsent.includes(t)&&e.VendorConsent.includes(r);return i&&(n||=e.PurposesLITransparency.includes(t)&&e.VendorLegitimateInterest.includes(r)),n}const n=s.find((e=>"SegmentType"in e&&3===e.SegmentType));if(!n)return!1;let o=n.PubPurposesConsent.includes(t);return i&&(o||=n.PubPurposesLITransparency.includes(t)),o}class m{constructor(e){i(this,"consent",void 0),this.consent=e}getItem(e){return this.consent.deviceAccess?window.localStorage.getItem(e):null}setItem(e,t){this.consent.deviceAccess&&window.localStorage.setItem(e,t)}removeItem(e){this.consent.deviceAccess&&window.localStorage.removeItem(e)}}const y="_optable_pairId";function w(e){const t=new Uint16Array(e.length);for(let r=0;r<t.length;r++)t[r]=e.charCodeAt(r);return btoa(String.fromCharCode(...new Uint8Array(t.buffer)))}function v(e){return e.node?w(`${e.host}/${e.node}`):w(`${e.host}`)}class A{constructor(e){this.config=e,i(this,"passportKeys",void 0),i(this,"targetingKeys",void 0),i(this,"siteKeys",void 0),i(this,"pairKeys",void 0),i(this,"storage",void 0),this.passportKeys=function(e){const t=[],r=[],i=`OPTABLE_PASSPORT_${v(e)}`;return t.push(i),r.push(i),e.legacyHostCache?(r.push(`OPTABLE_PASSPORT_${w(`${e.legacyHostCache}`)}`),r.push(`OPTABLE_PASS_${w(`${e.legacyHostCache}/${e.site}`)}`)):r.push(`OPTABLE_PASS_${w(`${e.host}/${e.site}`)}`),{write:t,read:r}}(e),this.targetingKeys=function(e){const t=`OPTABLE_TARGETING_${v(e)}`;return{write:[t,e.optableCacheTargeting],read:[t]}}(e),this.siteKeys=function(e){const t=`OPTABLE_SITE_${v(e)}`;return{write:[t],read:[t]}}(e),this.pairKeys={write:[y],read:[y]},this.storage=new m(this.config.consent)}getPassport(){return this.readStorageKeys(this.passportKeys)}setPassport(e){this.writeToStorageKeys(this.passportKeys,e)}getTargeting(){const e=this.readStorageKeys(this.targetingKeys);return e?JSON.parse(e):null}setTargeting(e){e&&(this.writeToStorageKeys(this.targetingKeys,JSON.stringify(e)),this.setPairIDs(e))}getSite(){const e=this.readStorageKeys(this.siteKeys);return e?JSON.parse(e):null}setSite(e){e&&this.writeToStorageKeys(this.siteKeys,JSON.stringify(e))}setPairIDs(e){const t=e.ortb2?.user?.eids?.filter((e=>"pair-protocol.com"===e.source)),r=t?.flatMap((e=>e.uids));if(!r)return;const i=new Set(r.map((e=>e.id)));this.writeToStorageKeys(this.pairKeys,btoa(JSON.stringify({envelope:[...i]})))}getPairIDs(){const e=this.readStorageKeys(this.pairKeys);return e?JSON.parse(atob(e))?.envelope:null}readStorageKeys(e){for(const t of e.read){const e=this.storage.getItem(t);if(e)return e}return null}writeToStorageKeys(e,t){if(t)for(const r of e.write)this.storage.setItem(r,t)}clearStorageKeys(e){for(const t of[...e.read,...e.write])this.storage.removeItem(t)}clearPassport(){this.clearStorageKeys(this.passportKeys)}clearTargeting(){this.clearStorageKeys(this.targetingKeys)}clearSite(){this.clearStorageKeys(this.siteKeys)}}async function S(t,r,i){const s=await globalThis.fetch(function(t,r,i){const{host:s,cookies:n}=r,o=new URL(t,`https://${s}`);if(o.searchParams.set("osdk",`web-${e.r}`),o.searchParams.set("sid",r.sessionID),r.skipEnrichment&&o.searchParams.set("skip_enrichment",`${r.skipEnrichment}`),r.node&&o.searchParams.set("t",r.node),r.site&&o.searchParams.set("o",r.site),void 0!==r.consent.gpp&&o.searchParams.set("gpp",r.consent.gpp),void 0!==r.consent.gppSectionIDs&&o.searchParams.set("gpp_sid",r.consent.gppSectionIDs.join(",")),void 0!==r.consent.gdpr&&o.searchParams.set("gdpr_consent",r.consent.gdpr),void 0!==r.consent.gdprApplies&&o.searchParams.set("gdpr",Number(r.consent.gdprApplies).toString()),r.readOnly&&o.searchParams.set("ro","true"),n)o.searchParams.set("cookies","yes");else{const e=new A(r).getPassport();o.searchParams.set("cookies","no"),o.searchParams.set("passport",e||"")}const a={...i};return a.credentials=r.consent.deviceAccess?"include":"omit",r.mockedIP&&(a.headers=new Headers(a.headers),a.headers.set("X-Forwarded-For",r.mockedIP)),new Request(o.toString(),a)}(t,r,i)),n=s.headers.get("Content-Type"),o=n?.startsWith("application/json")?await s.json():await s.text();if(!s.ok)throw new Error(o.error);return o.passport&&(new A(r).setPassport(o.passport),delete o.passport),o}var b,P,I,_=((P=_||{})[P.Banner=1]="Banner",P[P.Video=2]="Video",P[P.Audio=3]="Audio",P[P.Native=4]="Native",P),E={},T={},k={};(I=b||(b={})).Placement=T,I.Media=k,I.Context=E;const C={cookies:!0,initPassport:!0,readOnly:!1,experiments:[],consent:{reg:null,deviceAccess:!0,createProfilesForAdvertising:!0,useProfilesForAdvertising:!0,measureAdvertisingPerformance:!0}};function D(){const e=new Uint8Array(16);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function O(e){return{user:{data:(e?.audience??[]).map((e=>({name:e.provider,segment:e.ids,ext:{segtax:e.rtb_segtax}}))),ext:{eids:(e?.user??[]).map((e=>({source:e.provider,uids:e.ids.map((e=>{let{id:t}=e;return{id:t,atype:3}}))})))}}}}function x(e){const t={};if(!e)return t;for(const r of e.audience??[])r.keyspace&&(r.keyspace in t||(t[r.keyspace]=[]),t[r.keyspace].push(...r.ids.map((e=>e.id))));return t}function N(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function K(){const e={};let t=0;return{refs:e,process:(r,i)=>{if(!r.refs)return i;for(const s of i.uids)if(N(s.ext?.optable)&&"ref"in s.ext.optable&&"string"==typeof s.ext.optable.ref){const i=r.refs[s.ext.optable.ref];t+=1;const n=t.toString(10);e[n]=i,s.ext.optable.ref=n}return i}}}var B=r(312);class V{constructor(e){i(this,"dcn",void 0),i(this,"init",void 0),this.dcn=function(e){const t={host:e.host,site:e.site,optableCacheTargeting:e.optableCacheTargeting??"optable-cache:targeting",cookies:e.cookies??C.cookies,initPassport:e.initPassport??C.initPassport,consent:C.consent,readOnly:e.readOnly??C.readOnly,node:e.node,legacyHostCache:e.legacyHostCache,experiments:e.experiments??C.experiments,mockedIP:e.mockedIP,sessionID:e.sessionID??D(),skipEnrichment:e.skipEnrichment,initTargeting:e.initTargeting,abTests:e.abTests,additionalTargetingSignals:e.additionalTargetingSignals};return e.consent?.static?t.consent=e.consent.static:e.consent?.cmpapi&&(t.consent=p(function(){const e=Intl.DateTimeFormat().resolvedOptions().timeZone,t=n[e];return"can"===t?["fr","fr-CA"].some((e=>navigator.languages.includes(e)))?"can":null:t??null}(),e.consent.cmpapi)),t}(e),this.init=this.initialize()}async initialize(){this.dcn.initPassport&&await s(this.dcn).catch((()=>{})),this.dcn.initTargeting&&this.targeting().catch((()=>{}))}async identify(){await this.init;for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e,t){return S("/identify",e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}(this.dcn,t.filter((e=>e)))}async uid2Token(e){return await this.init,function(e,t){return S("/uid2/token",e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}(this.dcn,e)}async targeting(){const e=function(e){if("string"==typeof e)return{ids:[e],hids:[]};if(N(e))return{ids:e?.ids??[],hids:e?.hids??[]};throw"Invalid request type for targeting. Expected string or object."}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"__passport__");if(e.ids.length>1&&!this.dcn.experiments.includes("targeting-cascade"))throw"Targeting multiple IDs is only available with the 'targeting-cascade' experiment enabled.";return await this.init,async function(e,t){const r=new URLSearchParams;t.ids.forEach((e=>r.append("id",e))),t.hids.forEach((e=>r.append("hid",e)));const i=function(e){if(!e||0===e.length)return null;if(e.reduce(((e,t)=>e+t.trafficPercentage),0)>100)return console.error("AB Test Config Error: Traffic Percentage Sum Exceeds 100%"),null;const t=Math.floor(100*Math.random());let r=0;for(const i of e)if(r+=i.trafficPercentage,t<r)return i;return null}(e.abTests);i&&(r.append("ab_test_id",i.id),i.matcher_override)&&[...i.matcher_override].sort(((e,t)=>e.rank-t.rank)).forEach((e=>{r.append("matcher_override",e.id)}));e.additionalTargetingSignals?.ref&&r.append("ref",`${window.location.protocol}//${window.location.host}${window.location.pathname}`);const s="/v2/targeting?"+r.toString(),n=await S(s,e,{method:"GET",headers:{Accept:"application/json"}});return n&&(new A(e).setTargeting(n),function(e,t){const r=t.ortb2?.user?.eids?.map((e=>e.matcher));window.dispatchEvent(new CustomEvent("optable-targeting:change",{detail:{instance:e.node||e.host,resolved:!!t.ortb2?.user?.eids?.length,resolvedIDs:t.resolved_ids??[],ortb2:t.ortb2,provenance:new Set(r)}}))}(e,n)),n}(this.dcn,e)}targetingFromCache(){return e=this.dcn,new A(e).getTargeting();var e}async site(){return s(this.dcn)}siteFromCache(){return e=this.dcn,new A(e).getSite();var e}targetingClearCache(){var e;e=this.dcn,new A(e).clearTargeting()}async prebidORTB2(){return O(await this.targeting())}prebidORTB2FromCache(){return O(this.targetingFromCache())}async targetingKeyValues(){return x(await this.targeting())}targetingKeyValuesFromCache(){return x(this.targetingFromCache())}async witness(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return await this.init,function(e,t,r){const i={event:t,properties:r};return S("/witness",e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})}(this.dcn,e,t)}async profile(e){return await this.init,function(e,t){const r={traits:t};return S("/profile",e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}(this.dcn,e)}async tokenize(e){return await this.init,function(e,t){let r="/v1/tokenize";e.experiments.includes("tokenize-v2")&&(r="/v2/tokenize");let i={id:t};return S(r,e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})}(this.dcn,e)}async resolve(e){return await this.init,async function(e,t){const r=new URLSearchParams;"string"==typeof t&&r.append("id",t);const i="/v1/resolve?"+r.toString();return function(e){const t={clusters:[],lmpid:""};if("object"!=typeof e||null===e)return t;if("lmpid"in e&&"string"==typeof e?.lmpid&&(t.lmpid=e.lmpid),!("clusters"in e)||!Array.isArray(e?.clusters))return t;for(const r of e.clusters){const e={ids:[],traits:[]};if(Array.isArray(r?.ids))for(const t of r.ids)"string"==typeof t&&e.ids.push(t);if(Array.isArray(r?.traits))for(const t of r.traits)"string"==typeof t?.key&&"string"==typeof t?.value&&e.traits.push({key:t.key,value:t.value});(e.ids.length>0||e.traits.length>0)&&t.clusters.push(e)}return t}(await S(i,e,{method:"GET",headers:{Accept:"application/json"}}))}(this.dcn,e)}static eid(e){return e?"e:"+B.sha256.hex(e.toLowerCase().trim()):""}static sha256(e){return e?B.sha256.hex(e):""}static cid(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r="c:";if("string"!=typeof e)throw new Error("Invalid ppid");if("number"!=typeof t||isNaN(t)||t<0||t>19)throw new Error("Invalid variant");return t>0&&(r=`c${t}:`),e?r+e.trim():""}static TargetingKeyValues(e){return x(e)}static PrebidORTB2(e){return O(e)}}i(V,"version",e.r);const L=V;function j(e){return{advertiserId:e.advertiserId?.toString(),campaignId:e.campaignId?.toString(),creativeId:e.creativeId?.toString(),isEmpty:e.isEmpty?.toString(),lineItemId:e.lineItemId?.toString(),serviceName:e.serviceName?.toString(),size:e.size?.toString(),slotElementId:e.slot?.getSlotElementId(),sourceAgnosticCreativeId:e.sourceAgnosticCreativeId?.toString(),sourceAgnosticLineItemId:e.sourceAgnosticLineItemId?.toString()}}L.prototype.installGPTEventListeners=function(){const e=this;e.installGPTEventListeners=function(){},window.googletag=window.googletag||{cmd:[]};const t=window.googletag;t.cmd.push((function(){t.pubads().addEventListener("slotRenderEnded",(function(t){e.witness("googletag.events.slotRenderEnded",j(t))})),t.pubads().addEventListener("impressionViewable",(function(t){e.witness("googletag.events.impressionViewable",j(t))}))}))},L.prototype.installGPTSecureSignals=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];window.googletag=window.googletag||{cmd:[]};const i=window.googletag;t&&t.length>0&&i.cmd.push((()=>{t.forEach((e=>{let{provider:t,id:r}=e;i.secureSignalProviders.push({id:t,collectorFunction:()=>Promise.resolve(r)})}))}))};const F=/^[a-f0-9]{64}$/i;L.prototype.tryIdentifyFromParams=function(e,t){const r=new RegExp(`^${e||"oeid"}$`,"i"),i=new URLSearchParams(window.location.search);let s="";for(const[e,t]of i)if(r.test(e)){s=t;break}""!=s&&(t||function(e){return F.test(e)}(s))&&this.identify((t||"e")+":"+s.toLowerCase())},window.optable=window.optable||{},window.optable.SDK=L,window.optable.cmd=new class{constructor(e){if(this.cmds=e,Array.isArray(this.cmds))for(const e of this.cmds)"function"==typeof e&&e()}push(e){e()}}(window.optable.cmd||[]),window.optable.utils={resolveMultiNodeTargeting:async function(e){return e?e.some((e=>e.priority))?async function(e){const t=new Set,{refs:r,process:i}=K(),s={user:{data:[],eids:[]}},n=new Map,o=new Map;const a=e.map((e=>{let{targetingFn:t,matcher:r,mm:a,priority:c}=e;return t().then((e=>function(e,t,r){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const c=Math.max(0,a),{data:d=[],eids:u=[]}=e.ortb2?.user??{};s.user.data.push(...d),u.filter((e=>e.uids.length)).forEach((s=>{const a=s.matcher??t,d=n.get(c)??[];a&&n.set(c,[...d,a]);const u={...i(e,s),matcher:s.matcher??t,mm:s.mm??r},h=o.get(c)??[];o.set(c,[...h,u])}))}(e,r,a,c)))}));await Promise.allSettled(a);const c=Array.from(o.keys()).sort(((e,t)=>e-t)).filter((e=>o.get(e)?.length)).shift();if(c){const e=n.get(c)||[];s.user.eids.push(...o.get(c)||[]),e.forEach((e=>t.add(e)))}return{ortb2:s,eidSources:t,refs:r}}(e):async function(e){const t=new Set,{refs:r,process:i}=K(),s={user:{data:[],eids:[]}};const n=e.map((e=>{let{targetingFn:r,matcher:n,mm:o}=e;return r().then((e=>function(e,r,n){const{data:o=[],eids:a=[]}=e.ortb2?.user??{};s.user.data.push(...o),a.filter((e=>e.uids.length)).forEach((o=>{const a=o.matcher??r;a&&t.add(a),s.user.eids.push({...i(e,o),mm:o.mm??n,matcher:o.matcher??r})}))}(e,n,o)))}));return await Promise.allSettled(n),{ortb2:s,eidSources:t,refs:r}}(e):Promise.reject("No targeting rules provided")}},window.optable.instance_config&&(window.optable.instance=new L(window.optable.instance_config))})()})();
|
package/lib/dist/build.json
CHANGED
package/lib/dist/config.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ type ABTestConfig = {
|
|
|
9
9
|
trafficPercentage: number;
|
|
10
10
|
matcher_override?: MatcherOverride[];
|
|
11
11
|
};
|
|
12
|
+
type TargetingSignals = {
|
|
13
|
+
ref?: boolean;
|
|
14
|
+
};
|
|
12
15
|
type InitConsent = {
|
|
13
16
|
cmpapi?: CMPApiConfig;
|
|
14
17
|
static?: Consent;
|
|
@@ -29,6 +32,7 @@ type InitConfig = {
|
|
|
29
32
|
initTargeting?: boolean;
|
|
30
33
|
optableCacheTargeting?: string;
|
|
31
34
|
abTests?: ABTestConfig[];
|
|
35
|
+
additionalTargetingSignals?: TargetingSignals;
|
|
32
36
|
};
|
|
33
37
|
type ResolvedConfig = {
|
|
34
38
|
site: string;
|
|
@@ -46,6 +50,7 @@ type ResolvedConfig = {
|
|
|
46
50
|
skipEnrichment?: boolean;
|
|
47
51
|
initTargeting?: boolean;
|
|
48
52
|
abTests?: ABTestConfig[];
|
|
53
|
+
additionalTargetingSignals?: TargetingSignals;
|
|
49
54
|
};
|
|
50
55
|
declare const DCN_DEFAULTS: {
|
|
51
56
|
cookies: boolean;
|
package/lib/dist/config.js
CHANGED
|
@@ -30,6 +30,7 @@ function getConfig(init) {
|
|
|
30
30
|
skipEnrichment: init.skipEnrichment,
|
|
31
31
|
initTargeting: init.initTargeting,
|
|
32
32
|
abTests: init.abTests,
|
|
33
|
+
additionalTargetingSignals: init.additionalTargetingSignals,
|
|
33
34
|
};
|
|
34
35
|
if ((_g = init.consent) === null || _g === void 0 ? void 0 : _g.static) {
|
|
35
36
|
config.consent = init.consent.static;
|
|
@@ -7,17 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
var t = {};
|
|
12
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
-
t[p] = s[p];
|
|
14
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
-
t[p[i]] = s[p[i]];
|
|
18
|
-
}
|
|
19
|
-
return t;
|
|
20
|
-
};
|
|
10
|
+
import { isObject } from "../utils";
|
|
21
11
|
// Resolve multiple targeting nodes
|
|
22
12
|
// If any of the targeting nodes have the 'priority' attribute, we will resolve the most prioritize node
|
|
23
13
|
// Otherwise, we will aggregate all resolved targeting data
|
|
@@ -35,6 +25,7 @@ function resolveMultiNodeTargeting(rules) {
|
|
|
35
25
|
function resolveAggregateTargeting(rules) {
|
|
36
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
27
|
const eidSources = new Set();
|
|
28
|
+
const { refs, process: refsProcessor } = buildRefsProcessor();
|
|
38
29
|
const ortb2 = {
|
|
39
30
|
user: {
|
|
40
31
|
data: [],
|
|
@@ -47,17 +38,16 @@ function resolveAggregateTargeting(rules) {
|
|
|
47
38
|
ortb2.user.data.push(...data);
|
|
48
39
|
eids
|
|
49
40
|
.filter((x) => x.uids.length)
|
|
50
|
-
.forEach((
|
|
51
|
-
var _b, _c
|
|
52
|
-
|
|
53
|
-
const match = (_b = eid.matcher) !== null && _b !== void 0 ? _b : matcher;
|
|
41
|
+
.forEach((eid) => {
|
|
42
|
+
var _a, _b, _c;
|
|
43
|
+
const match = (_a = eid.matcher) !== null && _a !== void 0 ? _a : matcher;
|
|
54
44
|
match && eidSources.add(match);
|
|
55
|
-
ortb2.user.eids.push(Object.assign(Object.assign({}, eid), { mm: (
|
|
45
|
+
ortb2.user.eids.push(Object.assign(Object.assign({}, refsProcessor(response, eid)), { mm: (_b = eid.mm) !== null && _b !== void 0 ? _b : mm, matcher: (_c = eid.matcher) !== null && _c !== void 0 ? _c : matcher }));
|
|
56
46
|
});
|
|
57
47
|
}
|
|
58
48
|
const targetingFnPromises = rules.map(({ targetingFn, matcher, mm }) => targetingFn().then((res) => processTokens(res, matcher, mm)));
|
|
59
49
|
yield Promise.allSettled(targetingFnPromises);
|
|
60
|
-
return { ortb2, eidSources };
|
|
50
|
+
return { ortb2, eidSources, refs };
|
|
61
51
|
});
|
|
62
52
|
}
|
|
63
53
|
// Resolve the most prioritize targeting node
|
|
@@ -65,6 +55,7 @@ function resolveAggregateTargeting(rules) {
|
|
|
65
55
|
function resolvePriorityTargeting(rules) {
|
|
66
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
67
57
|
const eidSources = new Set();
|
|
58
|
+
const { refs, process: refsProcessor } = buildRefsProcessor();
|
|
68
59
|
const ortb2 = {
|
|
69
60
|
user: {
|
|
70
61
|
data: [],
|
|
@@ -80,17 +71,14 @@ function resolvePriorityTargeting(rules) {
|
|
|
80
71
|
ortb2.user.data.push(...data);
|
|
81
72
|
eids
|
|
82
73
|
.filter((x) => x.uids.length)
|
|
83
|
-
.forEach((
|
|
84
|
-
var _b, _c, _d, _e
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
const currentSources = (_c = sourcesByPriority.get(adjustedPriority)) !== null && _c !== void 0 ? _c : [];
|
|
74
|
+
.forEach((eid) => {
|
|
75
|
+
var _a, _b, _c, _d, _e;
|
|
76
|
+
const match = (_a = eid.matcher) !== null && _a !== void 0 ? _a : matcher;
|
|
77
|
+
const currentSources = (_b = sourcesByPriority.get(adjustedPriority)) !== null && _b !== void 0 ? _b : [];
|
|
88
78
|
match && sourcesByPriority.set(adjustedPriority, [...currentSources, match]);
|
|
89
|
-
const
|
|
90
|
-
eidsByPriority.
|
|
91
|
-
|
|
92
|
-
Object.assign(Object.assign({}, eid), { matcher: (_e = eid.matcher) !== null && _e !== void 0 ? _e : matcher, mm: (_f = eid.mm) !== null && _f !== void 0 ? _f : mm }),
|
|
93
|
-
]);
|
|
79
|
+
const newEid = Object.assign(Object.assign({}, refsProcessor(response, eid)), { matcher: (_c = eid.matcher) !== null && _c !== void 0 ? _c : matcher, mm: (_d = eid.mm) !== null && _d !== void 0 ? _d : mm });
|
|
80
|
+
const currentEids = (_e = eidsByPriority.get(adjustedPriority)) !== null && _e !== void 0 ? _e : [];
|
|
81
|
+
eidsByPriority.set(adjustedPriority, [...currentEids, newEid]);
|
|
94
82
|
});
|
|
95
83
|
}
|
|
96
84
|
const targetingFnPromises = rules.map(({ targetingFn, matcher, mm, priority }) => targetingFn().then((res) => processTokens(res, matcher, mm, priority)));
|
|
@@ -107,7 +95,36 @@ function resolvePriorityTargeting(rules) {
|
|
|
107
95
|
return {
|
|
108
96
|
ortb2,
|
|
109
97
|
eidSources,
|
|
98
|
+
refs,
|
|
110
99
|
};
|
|
111
100
|
});
|
|
112
101
|
}
|
|
102
|
+
function buildRefsProcessor() {
|
|
103
|
+
const refs = {};
|
|
104
|
+
let globalRef = 0;
|
|
105
|
+
return {
|
|
106
|
+
refs,
|
|
107
|
+
process: (response, eid) => {
|
|
108
|
+
var _a;
|
|
109
|
+
if (!response.refs) {
|
|
110
|
+
return eid;
|
|
111
|
+
}
|
|
112
|
+
for (const uid of eid.uids) {
|
|
113
|
+
if (!isObject((_a = uid.ext) === null || _a === void 0 ? void 0 : _a.optable)) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if ("ref" in uid.ext.optable && typeof uid.ext.optable.ref === "string") {
|
|
117
|
+
const refBody = response.refs[uid.ext.optable.ref];
|
|
118
|
+
// Assign new global ref key
|
|
119
|
+
globalRef += 1;
|
|
120
|
+
const newRefKey = globalRef.toString(10);
|
|
121
|
+
// Mutate global refs
|
|
122
|
+
refs[newRefKey] = refBody;
|
|
123
|
+
uid.ext.optable.ref = newRefKey;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return eid;
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
}
|
|
113
130
|
export { resolveMultiNodeTargeting };
|
package/lib/dist/edge/site.d.ts
CHANGED
|
@@ -11,12 +11,7 @@ type AuctionConfig = {
|
|
|
11
11
|
resolveToConfig?: boolean;
|
|
12
12
|
auctionSignals?: any;
|
|
13
13
|
};
|
|
14
|
-
type SiteResponse = {
|
|
15
|
-
interestGroupPixel: string;
|
|
16
|
-
auctionConfig?: AuctionConfig | null;
|
|
17
|
-
auctionConfigURL?: string;
|
|
18
|
-
getTopicsURL: string;
|
|
19
|
-
};
|
|
14
|
+
type SiteResponse = {};
|
|
20
15
|
declare function Site(config: ResolvedConfig): Promise<SiteResponse>;
|
|
21
16
|
declare function SiteFromCache(config: ResolvedConfig): SiteResponse | null;
|
|
22
17
|
export { Site, SiteFromCache };
|
|
@@ -35,6 +35,7 @@ function determineABTest(abTests) {
|
|
|
35
35
|
}
|
|
36
36
|
function Targeting(config, req) {
|
|
37
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
var _a;
|
|
38
39
|
const searchParams = new URLSearchParams();
|
|
39
40
|
req.ids.forEach((id) => searchParams.append("id", id));
|
|
40
41
|
req.hids.forEach((id) => searchParams.append("hid", id));
|
|
@@ -49,6 +50,9 @@ function Targeting(config, req) {
|
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
}
|
|
53
|
+
if ((_a = config.additionalTargetingSignals) === null || _a === void 0 ? void 0 : _a.ref) {
|
|
54
|
+
searchParams.append("ref", `${window.location.protocol}//${window.location.host}${window.location.pathname}`);
|
|
55
|
+
}
|
|
52
56
|
const path = "/v2/targeting?" + searchParams.toString();
|
|
53
57
|
const response = yield fetch(path, config, {
|
|
54
58
|
method: "GET",
|
package/lib/dist/sdk.js
CHANGED
|
@@ -13,6 +13,7 @@ import { Identify } from "./edge/identify";
|
|
|
13
13
|
import { Uid2Token } from "./edge/uid2_token";
|
|
14
14
|
import { Resolve } from "./edge/resolve";
|
|
15
15
|
import { Site, SiteFromCache } from "./edge/site";
|
|
16
|
+
import { isObject } from "./core/utils";
|
|
16
17
|
import { TargetingKeyValues, Targeting, TargetingFromCache, TargetingClearCache, PrebidORTB2, } from "./edge/targeting";
|
|
17
18
|
import { Witness } from "./edge/witness";
|
|
18
19
|
import { Profile } from "./edge/profile";
|
|
@@ -148,8 +149,5 @@ function normalizeTargetingRequest(input) {
|
|
|
148
149
|
}
|
|
149
150
|
throw "Invalid request type for targeting. Expected string or object.";
|
|
150
151
|
}
|
|
151
|
-
function isObject(val) {
|
|
152
|
-
return val !== null && typeof val === "object" && !Array.isArray(val);
|
|
153
|
-
}
|
|
154
152
|
export { OptableSDK, normalizeTargetingRequest };
|
|
155
153
|
export default OptableSDK;
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"homepage": "https://optable.co",
|
|
11
11
|
"license": "SEE LICENSE IN LICENSE",
|
|
12
|
-
"version": "v0.
|
|
12
|
+
"version": "v0.41.0",
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@babel/core": "^7.12.3",
|
|
15
15
|
"@babel/plugin-proposal-class-properties": "^7.12.1",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"jest-environment-jsdom": "^29.7.0",
|
|
26
26
|
"jest-localstorage-mock": "^2.4.26",
|
|
27
27
|
"msw": "^2.6.9",
|
|
28
|
-
"prettier": "^3.
|
|
28
|
+
"prettier": "^3.6.2",
|
|
29
29
|
"shellcheck": "^3.0.0",
|
|
30
30
|
"typescript": "^5.2.2",
|
|
31
31
|
"webpack": "^5.97.1",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/runtime": "^7.27.0",
|
|
37
|
+
"@optable/web-sdk": "^0.40.0",
|
|
37
38
|
"iab-openrtb": "^1.0.1",
|
|
38
39
|
"js-sha256": "^0.11.0",
|
|
39
40
|
"regenerator-runtime": "^0.13.7"
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { AuctionConfig } from "../edge/site";
|
|
2
|
-
declare global {
|
|
3
|
-
interface Navigator {
|
|
4
|
-
runAdAuction: (config: AuctionConfig) => Promise<any>;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
type GPTSlotFilter = (slot: googletag.Slot) => boolean;
|
|
8
|
-
type RunAdAuctionOptions = {
|
|
9
|
-
iframe?: boolean;
|
|
10
|
-
};
|
|
11
|
-
declare module "../sdk" {
|
|
12
|
-
interface OptableSDK {
|
|
13
|
-
joinAdInterestGroups: () => Promise<void>;
|
|
14
|
-
auctionConfig: () => Promise<AuctionConfig | null>;
|
|
15
|
-
runAdAuction: (domID: string, options?: RunAdAuctionOptions) => Promise<boolean>;
|
|
16
|
-
installGPTAuctionConfigs: (filter?: GPTSlotFilter) => Promise<void>;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
export {};
|
package/lib/dist/addons/paapi.js
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import OptableSDK from "../sdk";
|
|
11
|
-
/*
|
|
12
|
-
* auctionConfig obtains the auction configuration for the current origin
|
|
13
|
-
*/
|
|
14
|
-
OptableSDK.prototype.auctionConfig = function () {
|
|
15
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
var _a;
|
|
17
|
-
yield this.init;
|
|
18
|
-
let siteConfig = this.siteFromCache();
|
|
19
|
-
if (!siteConfig) {
|
|
20
|
-
siteConfig = yield this.site();
|
|
21
|
-
}
|
|
22
|
-
return (_a = siteConfig.auctionConfig) !== null && _a !== void 0 ? _a : null;
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
function elementInnerSize(element) {
|
|
26
|
-
const style = window.getComputedStyle(element, null);
|
|
27
|
-
return {
|
|
28
|
-
width: style.getPropertyValue("width"),
|
|
29
|
-
height: style.getPropertyValue("height"),
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
/*
|
|
33
|
-
* installGPTAuctionConfigs obtains the auction configuration for the current origin
|
|
34
|
-
* and installs it into the page GPT slots, optionally filtered.
|
|
35
|
-
*/
|
|
36
|
-
OptableSDK.prototype.installGPTAuctionConfigs = function (filter) {
|
|
37
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
const sdk = this;
|
|
39
|
-
sdk.installGPTAuctionConfigs = function () {
|
|
40
|
-
return Promise.resolve();
|
|
41
|
-
};
|
|
42
|
-
const siteAuctionConfig = yield sdk.auctionConfig();
|
|
43
|
-
if (!siteAuctionConfig) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
window.googletag = window.googletag || { cmd: [] };
|
|
47
|
-
const gpt = window.googletag;
|
|
48
|
-
gpt.cmd.push(function () {
|
|
49
|
-
let slots = gpt.pubads().getSlots();
|
|
50
|
-
if (filter) {
|
|
51
|
-
slots = slots.filter(filter);
|
|
52
|
-
}
|
|
53
|
-
for (const slot of slots) {
|
|
54
|
-
const sizes = slot.getSizes();
|
|
55
|
-
const componentAuction = [];
|
|
56
|
-
for (const size of sizes) {
|
|
57
|
-
if (size === "fluid") {
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
componentAuction.push({
|
|
61
|
-
configKey: siteAuctionConfig.seller + "-" + size.getWidth() + "x" + size.getHeight(),
|
|
62
|
-
auctionConfig: Object.assign(Object.assign({}, siteAuctionConfig), { requestedSize: { width: size.getWidth() + "px", height: size.getHeight() + "px" } }),
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
// @ts-ignore // outdated typings for componentAuction expects some legacy field names
|
|
66
|
-
slot.setConfig({ componentAuction });
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
/*
|
|
72
|
-
* runAdAuction runs an ad auction locally for a given spot dom ID.
|
|
73
|
-
*/
|
|
74
|
-
OptableSDK.prototype.runAdAuction = function (domID, options) {
|
|
75
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
var _a;
|
|
77
|
-
const supported = "runAdAuction" in navigator;
|
|
78
|
-
if (!supported) {
|
|
79
|
-
throw "run-ad-auction not supported";
|
|
80
|
-
}
|
|
81
|
-
const spot = document.getElementById(domID);
|
|
82
|
-
if (!spot) {
|
|
83
|
-
throw "spot not found";
|
|
84
|
-
}
|
|
85
|
-
const requestedSize = elementInnerSize(spot);
|
|
86
|
-
const siteAuctionConfig = yield this.auctionConfig();
|
|
87
|
-
if (!siteAuctionConfig) {
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
const auctionConfig = Object.assign(Object.assign({}, siteAuctionConfig), { requestedSize, resolveToConfig: true });
|
|
91
|
-
const useIframe = (_a = options === null || options === void 0 ? void 0 : options.iframe) !== null && _a !== void 0 ? _a : false;
|
|
92
|
-
if (useIframe) {
|
|
93
|
-
auctionConfig.resolveToConfig = false;
|
|
94
|
-
}
|
|
95
|
-
const result = yield navigator.runAdAuction(auctionConfig);
|
|
96
|
-
if (!result) {
|
|
97
|
-
spot.replaceChildren();
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
if (useIframe) {
|
|
101
|
-
const iframe = document.createElement("iframe");
|
|
102
|
-
iframe.src = result;
|
|
103
|
-
iframe.style.border = "none";
|
|
104
|
-
iframe.style.width = requestedSize.width;
|
|
105
|
-
iframe.style.height = requestedSize.height;
|
|
106
|
-
spot.replaceChildren(iframe);
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
const fencedFrame = document.createElement("fencedframe");
|
|
110
|
-
fencedFrame.config = result;
|
|
111
|
-
fencedFrame.style.border = "none";
|
|
112
|
-
spot.replaceChildren(fencedFrame);
|
|
113
|
-
}
|
|
114
|
-
return true;
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
/*
|
|
118
|
-
* joinAdInterestGroups injects an iframe into the page that tags the device into the matching audiences interest group.
|
|
119
|
-
*/
|
|
120
|
-
OptableSDK.prototype.joinAdInterestGroups = function () {
|
|
121
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
-
const supported = "joinAdInterestGroup" in navigator;
|
|
123
|
-
if (!supported) {
|
|
124
|
-
throw "join-ad-interest-group not supported";
|
|
125
|
-
}
|
|
126
|
-
// For now gate for everything happenning inside the join-ig frame.
|
|
127
|
-
// Eventually each behavior will be individually gated in the frame itself.
|
|
128
|
-
const accessGranted = this.dcn.consent.deviceAccess &&
|
|
129
|
-
this.dcn.consent.createProfilesForAdvertising &&
|
|
130
|
-
this.dcn.consent.measureAdvertisingPerformance;
|
|
131
|
-
if (!accessGranted) {
|
|
132
|
-
throw "consent not granted for joining interest groups";
|
|
133
|
-
}
|
|
134
|
-
yield this.init;
|
|
135
|
-
let siteConfig = this.siteFromCache();
|
|
136
|
-
if (!siteConfig) {
|
|
137
|
-
siteConfig = yield this.site();
|
|
138
|
-
}
|
|
139
|
-
if (!siteConfig.interestGroupPixel) {
|
|
140
|
-
throw "origin not enabled for protected audience apis";
|
|
141
|
-
}
|
|
142
|
-
const pixelURL = new URL(siteConfig.interestGroupPixel);
|
|
143
|
-
const pixel = document.createElement("iframe");
|
|
144
|
-
pixel.src = pixelURL.toString();
|
|
145
|
-
pixel.allow = "join-ad-interest-group " + pixelURL.origin;
|
|
146
|
-
pixel.style.display = "none";
|
|
147
|
-
const joinPromise = new Promise((resolve, reject) => {
|
|
148
|
-
window.addEventListener("message", (event) => {
|
|
149
|
-
if (event.source !== pixel.contentWindow) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
if (event.data.result === "success") {
|
|
153
|
-
resolve();
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
reject();
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
document.body.appendChild(pixel);
|
|
160
|
-
return joinPromise;
|
|
161
|
-
});
|
|
162
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
interface BrowsingTopic {
|
|
2
|
-
configVersion: string;
|
|
3
|
-
modelVersion: string;
|
|
4
|
-
taxonomyVersion: string;
|
|
5
|
-
topic: number;
|
|
6
|
-
version: string;
|
|
7
|
-
}
|
|
8
|
-
declare module "../sdk" {
|
|
9
|
-
interface OptableSDK {
|
|
10
|
-
getTopics: () => Promise<BrowsingTopic[]>;
|
|
11
|
-
ingestTopics: () => void;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export {};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import OptableSDK from "../sdk";
|
|
11
|
-
/*
|
|
12
|
-
* getTopics injects an iframe into the page that obtains the browsingTopics observed by optable.
|
|
13
|
-
*/
|
|
14
|
-
OptableSDK.prototype.getTopics = function () {
|
|
15
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
const supported = "browsingTopics" in document;
|
|
17
|
-
if (!supported) {
|
|
18
|
-
throw "browsing-topics not supported";
|
|
19
|
-
}
|
|
20
|
-
if (!this.dcn.consent.deviceAccess) {
|
|
21
|
-
throw "consent not granted for reading browsing topics";
|
|
22
|
-
}
|
|
23
|
-
yield this.init;
|
|
24
|
-
let siteConfig = this.siteFromCache();
|
|
25
|
-
if (!siteConfig) {
|
|
26
|
-
siteConfig = yield this.site();
|
|
27
|
-
}
|
|
28
|
-
if (!siteConfig.getTopicsURL) {
|
|
29
|
-
throw "origin not enabled for topics api";
|
|
30
|
-
}
|
|
31
|
-
const getTopicsURL = new URL(siteConfig.getTopicsURL);
|
|
32
|
-
const topicsFrame = document.createElement("iframe");
|
|
33
|
-
topicsFrame.src = getTopicsURL.toString();
|
|
34
|
-
topicsFrame.allow = "browsing-topics " + getTopicsURL.origin;
|
|
35
|
-
topicsFrame.style.display = "none";
|
|
36
|
-
const topicsPromise = new Promise((resolve, reject) => {
|
|
37
|
-
window.addEventListener("message", (event) => {
|
|
38
|
-
if (event.source !== topicsFrame.contentWindow) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (event.data.error) {
|
|
42
|
-
reject(new Error(event.data.error.toString()));
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
resolve(event.data.result);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
document.body.appendChild(topicsFrame);
|
|
49
|
-
return topicsPromise;
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
/*
|
|
53
|
-
* ingestTopics invokes getTopics then makes a profile() call with the resulting topics, if any.
|
|
54
|
-
*/
|
|
55
|
-
OptableSDK.prototype.ingestTopics = function () {
|
|
56
|
-
this.getTopics()
|
|
57
|
-
.then((topics) => {
|
|
58
|
-
if (!topics.length) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
const traits = topics.reduce((acc, topic) => {
|
|
62
|
-
const traitKey = `topics_v${topic.taxonomyVersion}`;
|
|
63
|
-
if (acc[traitKey]) {
|
|
64
|
-
acc[traitKey] += ",";
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
acc[traitKey] = "";
|
|
68
|
-
}
|
|
69
|
-
acc[traitKey] += String(topic.topic);
|
|
70
|
-
return acc;
|
|
71
|
-
}, {});
|
|
72
|
-
this.profile(traits);
|
|
73
|
-
})
|
|
74
|
-
.catch(() => { });
|
|
75
|
-
};
|