@optable/web-sdk 0.44.5 → 0.45.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/README.md CHANGED
@@ -42,7 +42,7 @@ If you're building a web application or want to bundle the SDK functionality wit
42
42
 
43
43
  ```shell
44
44
  # latest stable release:
45
- $ npm install @optable/web-sdk
45
+ npm install @optable/web-sdk
46
46
  ```
47
47
 
48
48
  And then simply `import` and use the `OptableSDK` class as shown in the _Usage_ section below.
@@ -92,7 +92,7 @@ const sdk = new OptableSDK({ host: "dcn.customer.com", site: "my-site", cookies:
92
92
 
93
93
  Note that the default is `cookies: true` and will be inferred if you do not specify the `cookies` parameter at all.
94
94
 
95
- # Using the npm module
95
+ ## Using the npm module
96
96
 
97
97
  ## Initialization Configuration (`InitConfig`)
98
98
 
@@ -125,6 +125,7 @@ When creating an instance of `OptableSDK`, you can pass an `InitConfig` object t
125
125
 
126
126
  - **`readOnly` (boolean, default: `false`)**
127
127
  When set to `true`, puts the SDK in a read-only mode, preventing any data modifications while still allowing API queries.
128
+
128
129
  - **`optableCacheTargeting` (string, defaults: `optable-cache:targeting`)**
129
130
  Local storage cache key used to store latest targeting response.
130
131
 
@@ -201,6 +202,28 @@ type ProfileTraits = {
201
202
  };
202
203
  ```
203
204
 
205
+ You can also override the main identifier (replacing the Optable Visitor ID) as the second argument of the function.
206
+ The third argument is to provide additional identifier(s) that you want to associate to that profile.
207
+
208
+ ```javascript
209
+ const onSuccess = () => console.log("Profile API success!");
210
+ const onFailure = (err) => console.warn("Profile API error: ${err.message}");
211
+
212
+ const visitorTraits = {
213
+ gender: "M",
214
+ age: 44,
215
+ favColor: "blue",
216
+ hasAccount: true,
217
+ };
218
+
219
+ const emailID = OptableSDK.eid("some.email@address.com");
220
+ const additionalIDs = [];
221
+ additionalIDs.push(OptableSDK.cid("id1"));
222
+ additionalIDs.push(OptableSDK.cid("id2", "c2"));
223
+
224
+ sdk.profile(visitorTraits, emailID, additionalIDs).then(onSuccess).catch(onFailure);
225
+ ```
226
+
204
227
  ### Targeting API
205
228
 
206
229
  To get the targeting information associated by the configured DCN with the user's browser in real-time, you can call the targeting API as follows:
@@ -519,7 +542,24 @@ To automatically capture GPT [SlotRenderEndedEvent](https://developers.google.co
519
542
  </script>
520
543
  ```
521
544
 
522
- The emitted event types are `gpt_events_slot_render_ended` and `gpt_events_impression_viewable`.
545
+ Advanced usage:
546
+ You can customize which GPT events are registered and which event properties to include, per event type, by passing an options object:
547
+
548
+ ```js
549
+ // Only listen to impressionViewable and emit only `slot_element_id`
550
+ optable.instance.installGPTEventListeners({ impressionViewable: ["slot_element_id"] });
551
+
552
+ // For slotRenderEnded, emit all properties. For impressionViewable, emit only the listed properties.
553
+ optable.instance.installGPTEventListeners({
554
+ slotRenderEnded: "all",
555
+ impressionViewable: ["slot_element_id", "is_empty"],
556
+ });
557
+ ```
558
+
559
+ The value for each event key can be "all" (to include all witness properties) or an array of property names from the set below (as mapped by the SDK):
560
+
561
+ `advertiser_id`, `campaign_id`, `creative_id`, `is_empty`, `line_item_id`, `service_name`, `size`, `slot_element_id`, `source_agnostic_creative_id`, `source_agnostic_line_item_id`.
562
+ If no argument is provided, the default behavior is unchanged and both slotRenderEnded and impressionViewable are captured with all properties.
523
563
 
524
564
  Note that you can call `installGPTEventListeners()` as many times as you like on an SDK instance, there will only be one set of registered event listeners per instance. Each SDK instance can register its own GPT event listeners.
525
565
 
@@ -774,7 +814,7 @@ If you send Email newsletters that contain links to your website, then you may w
774
814
 
775
815
  To enable automatic identification of visitors originating from your Email newsletter, you first need to include an **oeid** parameter in the query string of all links to your website in your Email newsletter template. The value of the **oeid** parameter should be set to the SHA256 hash of the lowercased Email address of the recipient. For example, if you are using [Braze](https://www.braze.com/) to send your newsletters, you can easily encode the SHA256 hash value of the recipient's Email address by setting the **oeid** parameter in the query string of any links to your website as follows:
776
816
 
777
- ```
817
+ ```javascript
778
818
  oeid={{${email_address} | downcase | sha2}}
779
819
  ```
780
820
 
@@ -833,16 +873,16 @@ It is recommended to call this method before making ad calls to ensure that the
833
873
 
834
874
  The demo pages are working examples of both `identify` and `targeting` APIs, as well as an integration with the [Google Ad Manager 360](https://admanager.google.com/home/) ad server, enabling the targeting of ads served by GAM360 to audiences activated in the [Optable](https://optable.co/) DCN.
835
875
 
836
- You can browse a recent (but not necessarily the latest) released version of the demo pages at [https://demo.optable.co/](https://demo.optable.co/). The source code to the demos can be found [here](https://github.com/Optable/optable-web-sdk/tree/master/demos). The demo pages will connect to the [Optable](https://optable.co/) demo DCN at `sandbox.optable.co` and reference the web site slug `web-sdk-demo`. The GAM360 targeting demo loads ads from a GAM360 account operated by [Optable](https://optable.co/).
876
+ You can browse a recent (but not necessarily the latest) released version of the demo pages at [https://demo.optable.co/](https://demo.optable.co/). The source code to the demos can be found in the [demos directory](https://github.com/Optable/optable-web-sdk/tree/master/demos). The demo pages will connect to the [Optable](https://optable.co/) demo DCN at `sandbox.optable.co` and reference the web site slug `web-sdk-demo`. The GAM360 targeting demo loads ads from a GAM360 account operated by [Optable](https://optable.co/).
837
877
 
838
- Note that the demo pages at [https://demo.optable.co/](https://demo.optable.co/) will by default rely on secure HTTP first-party cookies as described [here](https://github.com/Optable/optable-web-sdk#domains-and-cookies). To see an example based on [LocalStorage](https://github.com/Optable/optable-web-sdk#localstorage), see the [index-nocookies variant here](https://demo.optable.co/index-nocookies.html).
878
+ Note that the demo pages at [https://demo.optable.co/](https://demo.optable.co/) will by default rely on secure HTTP first-party cookies as described in [this section](https://github.com/Optable/optable-web-sdk#domains-and-cookies). To see an example based on [LocalStorage](https://github.com/Optable/optable-web-sdk#localstorage), see the [index-nocookies variant here](https://demo.optable.co/index-nocookies.html).
839
879
 
840
880
  To build and run the demos locally, you will need [Docker](https://www.docker.com/), `docker-compose` and `make`:
841
881
 
842
- ```
843
- $ cd path/to/optable-web-sdk
844
- $ make
845
- $ docker-compose up
882
+ ```shell
883
+ cd path/to/optable-web-sdk
884
+ make
885
+ docker-compose up
846
886
  ```
847
887
 
848
888
  Then head to [https://localhost:8180/](localhost:8180) to see the demo pages. You can modify the code in each demo, then run `make build` and finally refresh the demo pages to see your changes take effect. If you want to test the demos with your own DCN, make sure to update the configuration (hostname and site slug) given to the OptableSDK (see `webpack.config.js` for the react example).
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see sdk.js.LICENSE.txt */
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 _(r,t,!0).update(i)[e]()}},S=function(e){var t=A("hex",e);t.create=function(t){return new _(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 _(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},_.prototype=new b,_.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 P=w();P.sha256=P,P.sha224=w(!0),P.sha256.hmac=S(),P.sha224.hmac=S(!0),c?e.exports=P:(n.sha256=P.sha256,n.sha224=P.sha224,d&&(void 0===(i=function(){return P}.call(P,r,P,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.44.5"};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"),r.timeout&&o.searchParams.set("timeout",r.timeout),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,E=((_=E||{})[_.Banner=1]="Banner",_[_.Video=2]="Video",_[_.Audio=3]="Audio",_[_.Native=4]="Native",_),I={},T={},k={};(P=b||(b={})).Placement=T,P.Media=k,P.Context=I;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 K(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function N(){const e={};let t=0;return{refs:e,process:(r,i)=>{if(!r.refs)return i;for(const s of i.uids)if(K(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,timeout:e.timeout};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(K(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__");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)})),i.skipMatchers&&r.append("skip_matchers",i.skipMatchers.join(",")));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??[],abTestID:t.ab_test_id??void 0,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={id:t};return S("/v2/tokenize",e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}(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 j=V;function F(e){return{advertiser_id:e.advertiserId?.toString(),campaign_id:e.campaignId?.toString(),creative_id:e.creativeId?.toString(),is_empty:e.isEmpty?.toString(),line_item_id:e.lineItemId?.toString(),service_name:e.serviceName?.toString(),size:e.size?.toString(),slot_element_id:e.slot?.getSlotElementId(),source_agnostic_creative_id:e.sourceAgnosticCreativeId?.toString(),source_agnostic_line_item_id:e.sourceAgnosticLineItemId?.toString()}}j.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("gpt_events_slot_render_ended",F(t))})),t.pubads().addEventListener("impressionViewable",(function(t){e.witness("gpt_events_impression_viewable",F(t))}))}))},j.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 L=/^[a-f0-9]{64}$/i;j.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 L.test(e)}(s))&&this.identify((t||"e")+":"+s.toLowerCase())},window.optable=window.optable||{},window.optable.SDK=j,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,r=new Set,{refs:i,process:s}=N(),n={user:{data:[],eids:[]}},o=new Map,a=new Map,c=new Map;const d=e.map((e=>{let{targetingFn:t,matcher:r,mm:i,priority:d}=e;return t().then((e=>function(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const d=Math.max(0,i),{data:u=[],eids:h=[]}=e.ortb2?.user??{};n.user.data.push(...u),c.set(d,e.resolved_ids??[]),h.filter((e=>e.uids.length)).forEach((i=>{const n=i.matcher??t,c=o.get(d)??[];n&&o.set(d,[...c,n]);const u={...s(e,i),matcher:i.matcher??t,mm:i.mm??r},h=a.get(d)??[];a.set(d,[...h,u])}))}(e,r,i,d)))}));await Promise.allSettled(d);const u=Array.from(a.keys()).sort(((e,t)=>e-t)).filter((e=>a.get(e)?.length)).shift();if(u){const e=o.get(u)||[],i=c.get(u)||[];n.user.eids.push(...a.get(u)||[]),e.forEach((e=>t.add(e))),i.forEach((e=>r.add(e)))}return{ortb2:n,eidSources:t,refs:i,resolvedIds:r}}(e):async function(e){const t=new Set,r=new Set,{refs:i,process:s}=N(),n={user:{data:[],eids:[]}};const o=e.map((e=>{let{targetingFn:i,matcher:o,mm:a}=e;return i().then((e=>function(e,i,o){const{data:a=[],eids:c=[]}=e.ortb2?.user??{};n.user.data.push(...a),e.resolved_ids?.forEach((e=>r.add(e))),c.filter((e=>e.uids.length)).forEach((r=>{const a=r.matcher??i;a&&t.add(a),n.user.eids.push({...s(e,r),mm:r.mm??o,matcher:r.matcher??i})}))}(e,o,a)))}));return await Promise.allSettled(o),{ortb2:n,eidSources:t,refs:i,resolvedIds:r}}(e):Promise.reject("No targeting rules provided")}},window.optable.instance_config&&(window.optable.instance=new j(window.optable.instance_config))})()})();
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,l="0123456789abcdef".split(""),p=[-2147483648,8388608,32768,128],h=[24,16,8,0],f=[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],g=["hex","array","digest","arrayBuffer"],v=[];!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 S(e,!0).update(r)[t]()}},m=function(t){var e=y("hex",t);a&&(e=w(e,t)),e.create=function(){return new S(t)},e.update=function(t){return e.create().update(t)};for(var r=0;r<g.length;++r){var i=g[r];e[i]=y(i,t)}return e},w=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)}},b=function(t,e){return function(r,i){return new P(r,e,!0).update(i)[t]()}},A=function(t){var e=b("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<g.length;++r){var i=g[r];e[i]=b(i,t)}return e};function S(t,e){e?(v[0]=v[16]=v[1]=v[2]=v[3]=v[4]=v[5]=v[6]=v[7]=v[8]=v[9]=v[10]=v[11]=v[12]=v[13]=v[14]=v[15]=0,this.blocks=v):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 S(r,!0).update(t).array());var l=[],p=[];for(n=0;n<64;++n){var h=t[n]||0;l[n]=92^h,p[n]=54^h}S.call(this,r,i),this.update(p),this.oKeyPad=l,this.inner=!0,this.sharedMemory=i}S.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]<<h[3&s++];else for(s=this.start;o<a&&s<64;++o)(n=t.charCodeAt(o))<128?c[s>>>2]|=n<<h[3&s++]:n<2048?(c[s>>>2]|=(192|n>>>6)<<h[3&s++],c[s>>>2]|=(128|63&n)<<h[3&s++]):n<55296||n>=57344?(c[s>>>2]|=(224|n>>>12)<<h[3&s++],c[s>>>2]|=(128|n>>>6&63)<<h[3&s++],c[s>>>2]|=(128|63&n)<<h[3&s++]):(n=65536+((1023&n)<<10|1023&t.charCodeAt(++o)),c[s>>>2]|=(240|n>>>18)<<h[3&s++],c[s>>>2]|=(128|n>>>12&63)<<h[3&s++],c[s>>>2]|=(128|n>>>6&63)<<h[3&s++],c[s>>>2]|=(128|63&n)<<h[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}},S.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()}},S.prototype.hash=function(){var t,e,r,i,n,s,o,a,c,d=this.h0,u=this.h1,l=this.h2,p=this.h3,h=this.h4,g=this.h5,v=this.h6,y=this.h7,m=this.blocks;for(t=16;t<64;++t)e=((n=m[t-15])>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,r=((n=m[t-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,m[t]=m[t-16]+e+m[t-7]+r|0;for(c=u&l,t=0;t<64;t+=4)this.first?(this.is224?(s=300032,y=(n=m[0]-1413257819)-150054599|0,p=n+24177077|0):(s=704751109,y=(n=m[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&l^c,y=p+(n=y+(r=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&g^~h&v)+f[t]+m[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,v=l+(n=v+(r=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7))+(y&h^~y&g)+f[t+1]+m[t+1])|0,e=((l=n+(e+i)|0)>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),i=(a=l&p)^l&d^o,g=u+(n=g+(r=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7))+(v&y^~v&h)+f[t+2]+m[t+2])|0,e=((u=n+(e+i)|0)>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),i=(c=u&l)^u&p^a,h=d+(n=h+(r=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7))+(g&v^~g&y)+f[t+3]+m[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+l|0,this.h3=this.h3+p|0,this.h4=this.h4+h|0,this.h5=this.h5+g|0,this.h6=this.h6+v|0,this.h7=this.h7+y|0},S.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=l[t>>>28&15]+l[t>>>24&15]+l[t>>>20&15]+l[t>>>16&15]+l[t>>>12&15]+l[t>>>8&15]+l[t>>>4&15]+l[15&t]+l[e>>>28&15]+l[e>>>24&15]+l[e>>>20&15]+l[e>>>16&15]+l[e>>>12&15]+l[e>>>8&15]+l[e>>>4&15]+l[15&e]+l[r>>>28&15]+l[r>>>24&15]+l[r>>>20&15]+l[r>>>16&15]+l[r>>>12&15]+l[r>>>8&15]+l[r>>>4&15]+l[15&r]+l[i>>>28&15]+l[i>>>24&15]+l[i>>>20&15]+l[i>>>16&15]+l[i>>>12&15]+l[i>>>8&15]+l[i>>>4&15]+l[15&i]+l[n>>>28&15]+l[n>>>24&15]+l[n>>>20&15]+l[n>>>16&15]+l[n>>>12&15]+l[n>>>8&15]+l[n>>>4&15]+l[15&n]+l[s>>>28&15]+l[s>>>24&15]+l[s>>>20&15]+l[s>>>16&15]+l[s>>>12&15]+l[s>>>8&15]+l[s>>>4&15]+l[15&s]+l[o>>>28&15]+l[o>>>24&15]+l[o>>>20&15]+l[o>>>16&15]+l[o>>>12&15]+l[o>>>8&15]+l[o>>>4&15]+l[15&o];return this.is224||(c+=l[a>>>28&15]+l[a>>>24&15]+l[a>>>20&15]+l[a>>>16&15]+l[a>>>12&15]+l[a>>>8&15]+l[a>>>4&15]+l[15&a]),c},S.prototype.toString=S.prototype.hex,S.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},S.prototype.array=S.prototype.digest,S.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 S,P.prototype.finalize=function(){if(S.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();S.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(t),S.prototype.finalize.call(this)}};var _=m();_.sha256=_,_.sha224=m(!0),_.sha256.hmac=A(),_.sha224.hmac=A(!0),c?t.exports=_:(s.sha256=_.sha256,s.sha224=_.sha224,d&&(void 0===(i=function(){return _}.call(_,r,_,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";function t(e){return t="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},t(e)}function e(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}const i={r:"v0.45.0"};async function n(t){const e=await S("/config",t,{method:"GET",headers:{Accept:"application/json"}});return new b(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 l(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=h(e.gdprData,1,r.tcfeuVendorID),n.createProfilesForAdvertising=h(e.gdprData,3,r.tcfeuVendorID),n.useProfilesForAdvertising=h(e.gdprData,4,r.tcfeuVendorID),n.measureAdvertisingPerformance=h(e.gdprData,7,r.tcfeuVendorID)):e.gppData&&(n.deviceAccess=g(e.gppData,1,r.tcfeuVendorID),n.createProfilesForAdvertising=g(e.gppData,3,r.tcfeuVendorID),n.useProfilesForAdvertising=g(e.gppData,4,r.tcfeuVendorID),n.measureAdvertisingPerformance=g(e.gppData,7,r.tcfeuVendorID));break;case"can":n.deviceAccess=!0,e.gppData&&(n.createProfilesForAdvertising=f(e.gppData,3,r.tcfcaVendorID),n.useProfilesForAdvertising=f(e.gppData,4,r.tcfcaVendorID),n.measureAdvertisingPerformance=f(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(t){}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(t){}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(t){}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(t){}const i=r.__gppReturn;i&&"function"==typeof e[i.callId]&&(e[i.callId](i.returnValue,i.success),delete e[i.callId])}),!1))}();const i=l(t,r,e);return"function"==typeof window.__tcfapi&&(null===(o=(a=window).__tcfapi)||void 0===o||o.call(a,"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,l(t,r,e))})(n)}))),"function"==typeof window.__gpp&&(null===(n=(s=window).__gpp)||void 0===n||n.call(s,"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,l(t,r,e))})(n.pingData)}))),i;var n,s,o,a}function h(t,e,r){var i,n,s,o,a,c;return r?!!(null===(s=t.purpose)||void 0===s||null===(o=s.consents)||void 0===o?void 0:o[e])&&!!(null===(a=t.vendor)||void 0===a||null===(c=a.consents)||void 0===c?void 0:c[r]):!!(null===(i=t.publisher)||void 0===i||null===(n=i.consents)||void 0===n?void 0:n[e])}function f(t,e,r){var i;const n=e>1,s=(null===(i=t.parsedSections)||void 0===i?void 0:i[o])||[];if("number"==typeof r){const t=s.find((t=>"Version"in t));if(!t)return!1;let i=t.PurposesExpressConsent.includes(e)&&t.VendorExpressConsent.includes(r);return n&&(i||(i=t.PurposesImpliedConsent.includes(e)&&t.VendorImpliedConsent.includes(r))),i}const a=s.find((t=>"SubsectionType"in t&&3===t.SubsectionType));if(!a)return!1;let c=a.PubPurposesExpressConsent.includes(e);return n&&(c||(c=a.PubPurposesImpliedConsent.includes(e))),c}function g(t,e,r){var i;const n=e>1,s=(null===(i=t.parsedSections)||void 0===i?void 0:i[a])||[];if("number"==typeof r){const t=s.find((t=>"Version"in t));if(!t)return!1;let i=t.PurposeConsent.includes(e)&&t.VendorConsent.includes(r);return n&&(i||(i=t.PurposesLITransparency.includes(e)&&t.VendorLegitimateInterest.includes(r))),i}const o=s.find((t=>"SegmentType"in t&&3===t.SegmentType));if(!o)return!1;let c=o.PubPurposesConsent.includes(e);return n&&(c||(c=o.PubPurposesLITransparency.includes(e))),c}class v{constructor(t){e(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 m(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 w(t){return t.node?m("".concat(t.host,"/").concat(t.node)):m("".concat(t.host))}class b{constructor(t){this.config=t,e(this,"passportKeys",void 0),e(this,"targetingKeys",void 0),e(this,"siteKeys",void 0),e(this,"pairKeys",void 0),e(this,"storage",void 0),this.passportKeys=function(t){const e=[],r=[],i="OPTABLE_PASSPORT_".concat(w(t));return e.push(i),r.push(i),t.legacyHostCache?(r.push("OPTABLE_PASSPORT_".concat(m("".concat(t.legacyHostCache)))),r.push("OPTABLE_PASS_".concat(m("".concat(t.legacyHostCache,"/").concat(t.site))))):r.push("OPTABLE_PASS_".concat(m("".concat(t.host,"/").concat(t.site)))),{write:e,read:r}}(t),this.targetingKeys=function(t){const e="OPTABLE_TARGETING_".concat(w(t));return{write:[e,t.optableCacheTargeting],read:[e]}}(t),this.siteKeys=function(t){const e="OPTABLE_SITE_".concat(w(t));return{write:[e],read:[e]}}(t),this.pairKeys={write:[y],read:[y]},this.storage=new v(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){var e,r,i;const n=null===(e=t.ortb2)||void 0===e||null===(r=e.user)||void 0===r||null===(i=r.eids)||void 0===i?void 0:i.filter((t=>"pair-protocol.com"===t.source)),s=null==n?void 0:n.flatMap((t=>t.uids));if(!s)return;const o=new Set(s.map((t=>t.id)));this.writeToStorageKeys(this.pairKeys,btoa(JSON.stringify({envelope:[...o]})))}getPairIDs(){var t;const e=this.readStorageKeys(this.pairKeys);return e?null===(t=JSON.parse(atob(e)))||void 0===t?void 0: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)}}function A(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}async function S(t,r,n){const s=await globalThis.fetch(function(t,r,n){const{host:s,cookies:o}=r,a=new URL(t,"https://".concat(s));if(a.searchParams.set("osdk","web-".concat(i.r)),a.searchParams.set("sid",r.sessionID),r.skipEnrichment&&a.searchParams.set("skip_enrichment","".concat(r.skipEnrichment)),r.node&&a.searchParams.set("t",r.node),r.site&&a.searchParams.set("o",r.site),void 0!==r.consent.gpp&&a.searchParams.set("gpp",r.consent.gpp),void 0!==r.consent.gppSectionIDs&&a.searchParams.set("gpp_sid",r.consent.gppSectionIDs.join(",")),void 0!==r.consent.gdpr&&a.searchParams.set("gdpr_consent",r.consent.gdpr),void 0!==r.consent.gdprApplies&&a.searchParams.set("gdpr",Number(r.consent.gdprApplies).toString()),r.readOnly&&a.searchParams.set("ro","true"),r.timeout&&a.searchParams.set("timeout",r.timeout),o)a.searchParams.set("cookies","yes");else{const t=new b(r).getPassport();a.searchParams.set("cookies","no"),a.searchParams.set("passport",t||"")}const c=function(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?A(Object(i),!0).forEach((function(r){e(t,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):A(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({},n);return c.credentials=r.consent.deviceAccess?"include":"omit",r.mockedIP&&(c.headers=new Headers(c.headers),c.headers.set("X-Forwarded-For",r.mockedIP)),new Request(a.toString(),c)}(t,r,n)),o=s.headers.get("Content-Type"),a=(null==o?void 0:o.startsWith("application/json"))?await s.json():await s.text();if(!s.ok)throw new Error(a.error);return a.passport&&(new b(r).setPassport(a.passport),delete a.passport),a}var P,_,O,E=((_=E||{})[_.Banner=1]="Banner",_[_.Video=2]="Video",_[_.Audio=3]="Audio",_[_.Native=4]="Native",_),I={},k={},T={};(O=P||(P={})).Placement=k,O.Media=T,O.Context=I;const j={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 C(t){var e,r;return{user:{data:(null!==(e=null==t?void 0:t.audience)&&void 0!==e?e:[]).map((t=>({name:t.provider,segment:t.ids,ext:{segtax:t.rtb_segtax}}))),ext:{eids:(null!==(r=null==t?void 0:t.user)&&void 0!==r?r:[]).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 i of null!==(r=t.audience)&&void 0!==r?r:[]){var r;i.keyspace&&(i.keyspace in e||(e[i.keyspace]=[]),e[i.keyspace].push(...i.ids.map((t=>t.id))))}return e}function K(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function N(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function B(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?N(Object(i),!0).forEach((function(r){e(t,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):N(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function V(){const t={};let e=0;return{refs:t,process:(r,i)=>{if(!r.refs)return i;for(const s of i.uids){var n;if(K(null===(n=s.ext)||void 0===n?void 0:n.optable)&&"ref"in s.ext.optable&&"string"==typeof s.ext.optable.ref){const i=r.refs[s.ext.optable.ref];e+=1;const n=e.toString(10);t[n]=i,s.ext.optable.ref=n}}return i}}}function F(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function L(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?F(Object(i),!0).forEach((function(r){e(t,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):F(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}var M=r(312);class R{constructor(t){e(this,"dcn",void 0),e(this,"init",void 0),this.dcn=function(t){var e,r,i,n,o,a,c,d;const u={host:t.host,site:t.site,optableCacheTargeting:null!==(e=t.optableCacheTargeting)&&void 0!==e?e:"optable-cache:targeting",cookies:null!==(r=t.cookies)&&void 0!==r?r:j.cookies,initPassport:null!==(i=t.initPassport)&&void 0!==i?i:j.initPassport,consent:j.consent,readOnly:null!==(n=t.readOnly)&&void 0!==n?n:j.readOnly,node:t.node,legacyHostCache:t.legacyHostCache,experiments:null!==(o=t.experiments)&&void 0!==o?o:j.experiments,mockedIP:t.mockedIP,sessionID:null!==(a=t.sessionID)&&void 0!==a?a:D(),skipEnrichment:t.skipEnrichment,initTargeting:t.initTargeting,abTests:t.abTests,additionalTargetingSignals:t.additionalTargetingSignals,timeout:t.timeout};return(null===(c=t.consent)||void 0===c?void 0:c.static)?u.consent=t.consent.static:(null===(d=t.consent)||void 0===d?void 0:d.cmpapi)&&(u.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:null!=e?e:null}(),t.consent.cmpapi)),u}(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:[]};var e,r;if(K(t))return{ids:null!==(e=null==t?void 0:t.ids)&&void 0!==e?e:[],hids:null!==(r=null==t?void 0:t.hids)&&void 0!==r?r:[]};throw"Invalid request type for targeting. Expected string or object."}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"__passport__");return await this.init,async function(t,e){var r;const i=new URLSearchParams;e.ids.forEach((t=>i.append("id",t))),e.hids.forEach((t=>i.append("hid",t)));const n=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);n&&(i.append("ab_test_id",n.id),n.matcher_override&&[...n.matcher_override].sort(((t,e)=>t.rank-e.rank)).forEach((t=>{i.append("matcher_override",t.id)})),n.skipMatchers&&i.append("skip_matchers",n.skipMatchers.join(",")));(null===(r=t.additionalTargetingSignals)||void 0===r?void 0:r.ref)&&i.append("ref","".concat(window.location.protocol,"//").concat(window.location.host).concat(window.location.pathname));const s="/v2/targeting?"+i.toString(),o=await S(s,t,{method:"GET",headers:{Accept:"application/json"}});return o&&(new b(t).setTargeting(o),function(t,e){var r,i,n,s,o,a,c,d;const u=null===(r=e.ortb2)||void 0===r||null===(i=r.user)||void 0===i||null===(n=i.eids)||void 0===n?void 0:n.map((t=>t.matcher));window.dispatchEvent(new CustomEvent("optable-targeting:change",{detail:{instance:t.node||t.host,resolved:!!(null===(s=e.ortb2)||void 0===s||null===(o=s.user)||void 0===o||null===(a=o.eids)||void 0===a?void 0:a.length),resolvedIDs:null!==(c=e.resolved_ids)&&void 0!==c?c:[],abTestID:null!==(d=e.ab_test_id)&&void 0!==d?d:void 0,ortb2:e.ortb2,provenance:new Set(u)}}))}(t,o)),o}(this.dcn,t)}targetingFromCache(){return t=this.dcn,new b(t).getTargeting();var t}async site(){return n(this.dcn)}siteFromCache(){return t=this.dcn,new b(t).getSite();var t}targetingClearCache(){var t;t=this.dcn,new b(t).clearTargeting()}async prebidORTB2(){return C(await this.targeting())}prebidORTB2FromCache(){return C(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){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return await this.init,function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const n=L(L({traits:e},r&&{id:r}),i&&{neighbors:i});return S("/profile",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}(this.dcn,t,e,r)}async tokenize(t){return await this.init,function(t,e){let r={id:e};return S("/v2/tokenize",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}(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(null==t?void 0:t.lmpid)&&(e.lmpid=t.lmpid),!("clusters"in t)||!Array.isArray(null==t?void 0:t.clusters))return e;for(const r of t.clusters){const t={ids:[],traits:[]};if(Array.isArray(null==r?void 0:r.ids))for(const e of r.ids)"string"==typeof e&&t.ids.push(e);if(Array.isArray(null==r?void 0:r.traits))for(const e of r.traits)"string"==typeof(null==e?void 0:e.key)&&"string"==typeof(null==e?void 0: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:"+M.sha256.hex(t.toLowerCase().trim()):""}static sha256(t){return t?M.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".concat(e,":")),t?r+t.trim():""}static TargetingKeyValues(t){return x(t)}static PrebidORTB2(t){return C(t)}}e(R,"version",i.r);const J=R;function U(t){var e,r,i,n,s,o,a,c,d,u;return{advertiser_id:null===(e=t.advertiserId)||void 0===e?void 0:e.toString(),campaign_id:null===(r=t.campaignId)||void 0===r?void 0:r.toString(),creative_id:null===(i=t.creativeId)||void 0===i?void 0:i.toString(),is_empty:null===(n=t.isEmpty)||void 0===n?void 0:n.toString(),line_item_id:null===(s=t.lineItemId)||void 0===s?void 0:s.toString(),service_name:null===(o=t.serviceName)||void 0===o?void 0:o.toString(),size:null===(a=t.size)||void 0===a?void 0:a.toString(),slot_element_id:null===(c=t.slot)||void 0===c?void 0:c.getSlotElementId(),source_agnostic_creative_id:null===(d=t.sourceAgnosticCreativeId)||void 0===d?void 0:d.toString(),source_agnostic_line_item_id:null===(u=t.sourceAgnosticLineItemId)||void 0===u?void 0:u.toString()}}J.prototype.installGPTEventListeners=function(t){const e=this;e.installGPTEventListeners=function(){},window.googletag=window.googletag||{cmd:[]};const r=window.googletag,i=["slotRenderEnded","impressionViewable"];function n(t,e){if(!t||!e||!e.length)return{};const r={};for(const i of e)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i]);return r}r.cmd.push((function(){try{const s=r.pubads&&r.pubads();if(!s||"function"!=typeof s.addEventListener)return;const o=t?Object.keys(t):i;for(const r of o){const i=t?t[r]:"all";s.addEventListener(r,(function(t){const s=U(t),o=Array.isArray(i)&&i.length?n(s,i):s;e.witness("gpt_events_"+r.replace(/[A-Z]/g,(t=>"_"+t.toLowerCase())),o)}))}}catch(t){}}))},J.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 z=/^[a-f0-9]{64}$/i;J.prototype.tryIdentifyFromParams=function(t,e){const r=new RegExp("^".concat(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 z.test(t)}(n))&&this.identify((e||"e")+":"+n)},window.optable=window.optable||{},window.optable.SDK=J,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=new Set,{refs:i,process:n}=V(),s={user:{data:[],eids:[]}},o=new Map,a=new Map,c=new Map;const d=t.map((t=>{let{targetingFn:e,matcher:r,mm:i,priority:d}=t;return e().then((t=>function(t,e,r){var i,d,u;let l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const p=Math.max(0,l),{data:h=[],eids:f=[]}=null!==(i=null===(d=t.ortb2)||void 0===d?void 0:d.user)&&void 0!==i?i:{};s.user.data.push(...h),c.set(p,null!==(u=t.resolved_ids)&&void 0!==u?u:[]),f.filter((t=>t.uids.length)).forEach((i=>{var s,c,d,u,l;const h=null!==(s=i.matcher)&&void 0!==s?s:e,f=null!==(c=o.get(p))&&void 0!==c?c:[];h&&o.set(p,[...f,h]);const g=B(B({},n(t,i)),{},{matcher:null!==(d=i.matcher)&&void 0!==d?d:e,mm:null!==(u=i.mm)&&void 0!==u?u:r}),v=null!==(l=a.get(p))&&void 0!==l?l:[];a.set(p,[...v,g])}))}(t,r,i,d)))}));await Promise.allSettled(d);const u=Array.from(a.keys()).sort(((t,e)=>t-e)).filter((t=>{var e;return null===(e=a.get(t))||void 0===e?void 0:e.length})).shift();if(u){const t=o.get(u)||[],i=c.get(u)||[];s.user.eids.push(...a.get(u)||[]),t.forEach((t=>e.add(t))),i.forEach((t=>r.add(t)))}return{ortb2:s,eidSources:e,refs:i,resolvedIds:r}}(t):async function(t){const e=new Set,r=new Set,{refs:i,process:n}=V(),s={user:{data:[],eids:[]}};const o=t.map((t=>{let{targetingFn:i,matcher:o,mm:a}=t;return i().then((t=>function(t,i,o){var a,c,d;const{data:u=[],eids:l=[]}=null!==(a=null===(c=t.ortb2)||void 0===c?void 0:c.user)&&void 0!==a?a:{};s.user.data.push(...u),null===(d=t.resolved_ids)||void 0===d||d.forEach((t=>r.add(t))),l.filter((t=>t.uids.length)).forEach((r=>{var a,c,d;const u=null!==(a=r.matcher)&&void 0!==a?a:i;u&&e.add(u),s.user.eids.push(B(B({},n(t,r)),{},{mm:null!==(c=r.mm)&&void 0!==c?c:o,matcher:null!==(d=r.matcher)&&void 0!==d?d:i}))}))}(t,o,a)))}));return await Promise.allSettled(o),{ortb2:s,eidSources:e,refs:i,resolvedIds:r}}(t):Promise.reject("No targeting rules provided")}},window.optable.instance_config&&(window.optable.instance=new J(window.optable.instance_config))})()})();
@@ -14,24 +14,45 @@ function toWitnessProperties(event) {
14
14
  source_agnostic_line_item_id: (_k = event.sourceAgnosticLineItemId) === null || _k === void 0 ? void 0 : _k.toString(),
15
15
  };
16
16
  }
17
- /*
18
- * installGPTEventListeners() sets up event listeners on the Google Publisher Tag
19
- * "slotRenderEnded" and "impressionViewable" page events, and calls witness()
20
- * on the OptableSDK instance to send log data to a DCN.
21
- */
22
- OptableSDK.prototype.installGPTEventListeners = function () {
17
+ OptableSDK.prototype.installGPTEventListeners = function (eventSpec) {
23
18
  // Next time we get called is a no-op:
24
19
  const sdk = this;
25
20
  sdk.installGPTEventListeners = function () { };
26
21
  window.googletag = window.googletag || { cmd: [] };
27
22
  const gpt = window.googletag;
23
+ const DEFAULT_EVENTS = ["slotRenderEnded", "impressionViewable"];
24
+ function snakeCase(name) {
25
+ return name.replace(/[A-Z]/g, (m) => "_" + m.toLowerCase());
26
+ }
27
+ function filterProps(obj, keys) {
28
+ if (!obj || !keys || !keys.length)
29
+ return {};
30
+ const out = {};
31
+ for (const k of keys) {
32
+ if (Object.prototype.hasOwnProperty.call(obj, k)) {
33
+ out[k] = obj[k];
34
+ }
35
+ }
36
+ return out;
37
+ }
28
38
  gpt.cmd.push(function () {
29
- gpt.pubads().addEventListener("slotRenderEnded", function (event) {
30
- sdk.witness("gpt_events_slot_render_ended", toWitnessProperties(event));
31
- });
32
- gpt.pubads().addEventListener("impressionViewable", function (event) {
33
- sdk.witness("gpt_events_impression_viewable", toWitnessProperties(event));
34
- });
39
+ try {
40
+ const pubads = gpt.pubads && gpt.pubads();
41
+ if (!pubads || typeof pubads.addEventListener !== "function")
42
+ return;
43
+ const eventsToRegister = eventSpec ? Object.keys(eventSpec) : DEFAULT_EVENTS;
44
+ for (const eventName of eventsToRegister) {
45
+ const keysOrAll = eventSpec ? eventSpec[eventName] : "all";
46
+ pubads.addEventListener(eventName, function (event) {
47
+ const fullProps = toWitnessProperties(event);
48
+ const propsToSend = Array.isArray(keysOrAll) && keysOrAll.length ? filterProps(fullProps, keysOrAll) : fullProps;
49
+ sdk.witness("gpt_events_" + snakeCase(eventName), propsToSend);
50
+ });
51
+ }
52
+ }
53
+ catch (e) {
54
+ // fail silently to avoid breaking host page
55
+ }
35
56
  });
36
57
  };
37
58
  /*
@@ -106,7 +106,10 @@ class OptablePrebidAnalytics {
106
106
  auctionId,
107
107
  timeout,
108
108
  bidderRequests: bidderRequests.map((br) => {
109
- const { bidderCode, bidderRequestId, ortb2: { site: { domain }, user: { ext: { eids }, }, }, bids = [], } = br;
109
+ var _a, _b, _c;
110
+ const { bidderCode, bidderRequestId, ortb2, bids = [] } = br;
111
+ const domain = (_a = ortb2 === null || ortb2 === void 0 ? void 0 : ortb2.site) === null || _a === void 0 ? void 0 : _a.domain;
112
+ const eids = (_c = (_b = ortb2 === null || ortb2 === void 0 ? void 0 : ortb2.user) === null || _b === void 0 ? void 0 : _b.ext) === null || _c === void 0 ? void 0 : _c.eids;
110
113
  // Optable EIDs
111
114
  const optableEIDS = eids.filter((e) => e.inserter === "optable.co");
112
115
  const optableMatchers = [...new Set(optableEIDS.map((e) => e.matcher).filter(Boolean))];
@@ -16,5 +16,5 @@ OptableSDK.prototype.tryIdentifyFromParams = function (key, prefix) {
16
16
  if (eid == "" || (!prefix && !maybeValidEID(eid))) {
17
17
  return;
18
18
  }
19
- this.identify((prefix || "e") + ":" + eid.toLowerCase());
19
+ this.identify((prefix || "e") + ":" + eid);
20
20
  };
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "v0.44.5"
2
+ "version": "v0.45.0"
3
3
  }
@@ -55,8 +55,9 @@ interface RTDConfig {
55
55
  replaceMergeStrategy: MergeStrategy;
56
56
  appendNewMergeStrategy: MergeStrategy;
57
57
  targetingFromCache: (config?: RTDConfig) => TargetingData | null;
58
- handleRtd: (reqBidsConfigObj: ReqBidsConfigObj) => Promise<void | null>;
58
+ handleRtd: (reqBidsConfigObj: ReqBidsConfigObj, optableExtraData?: any, mergeFn?: any) => Promise<void | null>;
59
59
  instance: string;
60
+ waitForTargeting: boolean;
60
61
  }
61
62
  interface RTDOptions {
62
63
  enableLogging?: boolean;
@@ -71,6 +72,7 @@ interface RTDOptions {
71
72
  forceGlobalRouting?: boolean;
72
73
  mergeStrategy?: MergeStrategy;
73
74
  instance?: string;
75
+ waitForTargeting?: boolean;
74
76
  }
75
77
  declare function appendMergeStrategy(existingEids: EID[], newEids: EID[]): EID[];
76
78
  declare function prependMergeStrategy(existingEids: EID[], newEids: EID[]): EID[];
@@ -84,20 +84,62 @@ function targetingFromCache(config = {}) {
84
84
  }
85
85
  // Get targeting data from cache, if available
86
86
  function readTargetingData(config) {
87
- var _a, _b, _c, _d;
88
- const cachedData = targetingFromCache(config);
89
- if (!cachedData) {
90
- config.log("info", "No cached targeting data found");
91
- return {};
92
- }
93
- let targetingData = cachedData;
94
- // Validate targeting data structure
95
- if (!((_b = (_a = targetingData === null || targetingData === void 0 ? void 0 : targetingData.ortb2) === null || _a === void 0 ? void 0 : _a.user) === null || _b === void 0 ? void 0 : _b.eids) || !Array.isArray((_d = (_c = targetingData === null || targetingData === void 0 ? void 0 : targetingData.ortb2) === null || _c === void 0 ? void 0 : _c.user) === null || _d === void 0 ? void 0 : _d.eids)) {
96
- config.log("info", "No valid targeting data found");
97
- return {};
98
- }
99
- config.log("info", `Found targeting data with ${targetingData.ortb2.user.eids.length} EIDs`);
100
- return targetingData;
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
89
+ const cachedData = targetingFromCache(config);
90
+ // Get auction delay from pbjs config
91
+ const delay = (_d = (_c = (_b = (_a = window === null || window === void 0 ? void 0 : window.pbjs) === null || _a === void 0 ? void 0 : _a.getConfig) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c.realTimeData) === null || _d === void 0 ? void 0 : _d.auctionDelay;
92
+ // If waitForTargeting is disabled, cache is not empty, or no delay configured, return immediately
93
+ if (!config.waitForTargeting || cachedData || !delay) {
94
+ if (!cachedData) {
95
+ config.log("info", "No cached targeting data found");
96
+ return {};
97
+ }
98
+ // Validate targeting data structure
99
+ if (!((_f = (_e = cachedData === null || cachedData === void 0 ? void 0 : cachedData.ortb2) === null || _e === void 0 ? void 0 : _e.user) === null || _f === void 0 ? void 0 : _f.eids) ||
100
+ (!Array.isArray((_h = (_g = cachedData === null || cachedData === void 0 ? void 0 : cachedData.ortb2) === null || _g === void 0 ? void 0 : _g.user) === null || _h === void 0 ? void 0 : _h.eids) && Object.keys((_k = (_j = cachedData === null || cachedData === void 0 ? void 0 : cachedData.ortb2) === null || _j === void 0 ? void 0 : _j.user) !== null && _k !== void 0 ? _k : {}).length > 0)) {
101
+ config.log("info", "No valid targeting data found");
102
+ return {};
103
+ }
104
+ config.log("info", `Found targeting data with ${cachedData.ortb2.user.eids.length} EIDs`);
105
+ return cachedData;
106
+ }
107
+ // Cache is empty and delay is configured - wait for event or timeout
108
+ config.log("info", `Waiting for targeting data (max ${delay}ms)`);
109
+ const targetingData = yield new Promise((resolve) => {
110
+ let resolved = false;
111
+ const eventHandler = () => {
112
+ if (!resolved) {
113
+ resolved = true;
114
+ config.log("info", "Received optableResolved event");
115
+ const data = targetingFromCache(config);
116
+ resolve(data);
117
+ }
118
+ };
119
+ const timeoutId = setTimeout(() => {
120
+ if (!resolved) {
121
+ resolved = true;
122
+ config.log("warn", `Auction delay timeout (${delay}ms) - no targeting data available`);
123
+ window.removeEventListener("optableResolved", eventHandler);
124
+ resolve(null);
125
+ }
126
+ }, delay);
127
+ window.addEventListener("optableResolved", eventHandler, { once: true });
128
+ // Clean up timeout if event fires first
129
+ window.addEventListener("optableResolved", () => clearTimeout(timeoutId), { once: true });
130
+ });
131
+ if (!targetingData) {
132
+ config.log("info", "No targeting data available after waiting");
133
+ return {};
134
+ }
135
+ // Validate targeting data structure
136
+ if (!((_m = (_l = targetingData === null || targetingData === void 0 ? void 0 : targetingData.ortb2) === null || _l === void 0 ? void 0 : _l.user) === null || _m === void 0 ? void 0 : _m.eids) || !Array.isArray((_p = (_o = targetingData === null || targetingData === void 0 ? void 0 : targetingData.ortb2) === null || _o === void 0 ? void 0 : _o.user) === null || _p === void 0 ? void 0 : _p.eids)) {
137
+ config.log("info", "No valid targeting data found");
138
+ return {};
139
+ }
140
+ config.log("info", `Found targeting data with ${targetingData.ortb2.user.eids.length} EIDs after waiting`);
141
+ return targetingData;
142
+ });
101
143
  }
102
144
  function mergeStrategy(config, eidSource) {
103
145
  var _a;
@@ -134,7 +176,7 @@ function merge(config, targetORTB2, sourceORTB2) {
134
176
  return skipped;
135
177
  }
136
178
  // Custom handleRtd function to merge targeting data into the reqBidsConfigObj
137
- function handleRtd(config, reqBidsConfigObj, targetingData) {
179
+ function handleRtd(config, reqBidsConfigObj, targetingData, _optableExtraData, _mergeFn) {
138
180
  var _a, _b, _c;
139
181
  config.log("info", "Starting handleRtd function");
140
182
  // Filter EIDs for global ORTB2 and collect bidder-specific EIDs
@@ -203,7 +245,7 @@ function liveIntentUID2(ortb2) {
203
245
  return (((_c = (_b = (_a = ortb2.user) === null || _a === void 0 ? void 0 : _a.ext) === null || _b === void 0 ? void 0 : _b.eids) === null || _c === void 0 ? void 0 : _c.some((eid) => eid.source === "uidapi.com" && eid.uids.some((uid) => { var _a; return ((_a = uid.ext) === null || _a === void 0 ? void 0 : _a.provider) === "liveintent.com"; }))) || false);
204
246
  }
205
247
  function buildRTD(options = {}) {
206
- var _a, _b, _c, _d, _e, _f, _g;
248
+ var _a, _b, _c, _d, _e, _f, _g, _h;
207
249
  if (sessionStorage.optableForceGlobalRouting || options.forceGlobalRouting) {
208
250
  forceGlobalRouting();
209
251
  }
@@ -230,12 +272,13 @@ function buildRTD(options = {}) {
230
272
  appendNewMergeStrategy,
231
273
  targetingFromCache,
232
274
  instance: (_g = options.instance) !== null && _g !== void 0 ? _g : "instance",
233
- handleRtd(reqBidsConfigObj) {
275
+ waitForTargeting: (_h = options.waitForTargeting) !== null && _h !== void 0 ? _h : false,
276
+ handleRtd(reqBidsConfigObj, optableExtraData, mergeFn) {
234
277
  return __awaiter(this, void 0, void 0, function* () {
235
278
  var _a;
236
- const targetingData = (_a = options.targetingData) !== null && _a !== void 0 ? _a : readTargetingData(this);
279
+ const targetingData = (_a = options.targetingData) !== null && _a !== void 0 ? _a : (yield readTargetingData(this));
237
280
  try {
238
- return handleRtd(this, reqBidsConfigObj, targetingData);
281
+ return handleRtd(this, reqBidsConfigObj, targetingData, optableExtraData, mergeFn);
239
282
  }
240
283
  catch (error) {
241
284
  this.log("error", "Unexpected error in handleRtd function:", error);
@@ -2,6 +2,6 @@ import type { ResolvedConfig } from "../config";
2
2
  type ProfileTraits = {
3
3
  [key: string]: string | number | boolean;
4
4
  };
5
- declare function Profile(config: ResolvedConfig, traits: ProfileTraits): Promise<void>;
5
+ declare function Profile(config: ResolvedConfig, traits: ProfileTraits, id?: string | null, neighbors?: string[] | null): Promise<void>;
6
6
  export { Profile, ProfileTraits };
7
7
  export default Profile;
@@ -1,8 +1,6 @@
1
1
  import { fetch } from "../core/network";
2
- function Profile(config, traits) {
3
- const profile = {
4
- traits: traits,
5
- };
2
+ function Profile(config, traits, id = null, neighbors = null) {
3
+ const profile = Object.assign(Object.assign({ traits: traits }, (id && { id: id })), (neighbors && { neighbors: neighbors }));
6
4
  return fetch("/profile", config, {
7
5
  method: "POST",
8
6
  headers: {
package/lib/dist/sdk.d.ts CHANGED
@@ -24,7 +24,7 @@ declare class OptableSDK {
24
24
  targetingKeyValues(): Promise<TargetingKeyValues>;
25
25
  targetingKeyValuesFromCache(): TargetingKeyValues;
26
26
  witness(event: string, properties?: WitnessProperties): Promise<void>;
27
- profile(traits: ProfileTraits): Promise<void>;
27
+ profile(traits: ProfileTraits, id?: string | null, neighbors?: string[] | null): Promise<void>;
28
28
  tokenize(id: string): Promise<TokenizeResponse>;
29
29
  resolve(id?: string): Promise<ResolveResponse>;
30
30
  static eid(email: string): string;
package/lib/dist/sdk.js CHANGED
@@ -91,10 +91,10 @@ class OptableSDK {
91
91
  return Witness(this.dcn, event, properties);
92
92
  });
93
93
  }
94
- profile(traits) {
95
- return __awaiter(this, void 0, void 0, function* () {
94
+ profile(traits_1) {
95
+ return __awaiter(this, arguments, void 0, function* (traits, id = null, neighbors = null) {
96
96
  yield this.init;
97
- return Profile(this.dcn, traits);
97
+ return Profile(this.dcn, traits, id, neighbors);
98
98
  });
99
99
  }
100
100
  tokenize(id) {
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.44.5",
12
+ "version": "v0.45.0",
13
13
  "devDependencies": {
14
14
  "@babel/core": "^7.12.3",
15
15
  "@babel/plugin-proposal-class-properties": "^7.12.1",