var BingAds_RS=function(t){"use strict";function e(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function r(t){for(var r=1;ro(t,"name",{value:e,configurable:!0}),a=s((t=>null!==t&&"object"==typeof t),"isObject"),c=s(((t,e,n)=>"function"==typeof n.join?n.join(t):t[0]+e+t[1]),"join"),u=s(((t,e,n)=>"function"==typeof n.split?n.split(t):t.split(e)),"split"),l=s(((t,e={},n)=>"function"!=typeof(null==n?void 0:n.isValid)||n.isValid(t,e)),"isValid"),f=s((t=>a(t)||"function"==typeof t),"isValidObject"),d=s(((t,e,n={})=>{if(a(n)||(n={default:n}),!f(t))return void 0!==n.default?n.default:t;"number"==typeof e&&(e=String(e));const r=Array.isArray(e),i="string"==typeof e,o=n.separator||".",s=n.joinChar||("string"==typeof o?o:".");if(!i&&!r)return t;if(void 0!==t[e])return l(e,t,n)?t[e]:n.default;const d=r?e:u(e,o,n),p=d.length;let h=0;do{let e=d[h];for("string"!=typeof e&&(e=String(e));e&&"\\"===e.slice(-1);)e=c([e.slice(0,-1),d[++h]||""],s,n);if(void 0!==t[e]){if(!l(e,t,n))return n.default;t=t[e]}else{let r=!1,i=h+1;for(;i>>2]>>>24-o%4*8&255;e[r+o>>>2]|=s<<24-(r+o)%4*8}else for(var a=0;a>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=a.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],n=0;n>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new c.init(n,e/2)}},f=u.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new c.init(n,e)}},d=u.Utf8={stringify:function(t){try{return decodeURIComponent(escape(f.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return f.parse(unescape(encodeURIComponent(t)))}},p=s.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=d.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n,r=this._data,i=r.words,o=r.sigBytes,s=this.blockSize,a=o/(4*s),u=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*s,l=t.min(4*u,o);if(u){for(var f=0;f>>7)^(h<<14|h>>>18)^h>>>3,g=c[p-2],v=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;c[p]=y+c[p-7]+v+c[p-16]}var m=r&i^r&o^i&o,w=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),b=d+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&l^~u&f)+a[p]+c[p];d=f,f=l,l=u,u=s+b|0,s=o,o=i,i=r,r=b+(w+m)|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+u|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+d|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=t.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=i._createHelper(u),e.HmacSHA256=i._createHmacHelper(u)}(Math),S.SHA256)),m.exports));function E(t){return null!=t&&"object"==typeof t&&!0===t["@@functional/placeholder"]}function A(t){return function e(n){return 0===arguments.length||E(n)?e:t.apply(this,arguments)}}function R(t){return function e(n,r){switch(arguments.length){case 0:return e;case 1:return E(n)?e:A((function(e){return t(n,e)}));default:return E(n)&&E(r)?e:E(n)?A((function(e){return t(e,r)})):E(r)?A((function(e){return t(n,e)})):t(n,r)}}}var x=R((function(t,e){var n={};for(var r in e)t(e[r],r,e)&&(n[r]=e[r]);return n}));const I=t=>!(t=>void 0===t)(t)&&(t=>null!=t)(t),D=["event","category","category_id","currency","total","value","revenue","ecomm_category","transaction_id","order_id","checkout_id","ecomm_pagetype","pagetype","query","products","product_id","sku","event_action","items"],P=t=>{const{properties:e={}}=t,{category_id:n,total:i,value:o,ecomm_category:s,transaction_id:a,order_id:c,checkout_id:u,ecomm_pagetype:l,pagetype:f,query:d}=e,p={ecomm_totalvalue:i||o,search_term:d,ecomm_query:d,ecomm_category:s||n,transaction_id:a||c||u,ecomm_pagetype:l||f||"other"},h=(t=>{const e=[],n=[];(Array.isArray(t.products)?t.products:[t]).forEach((t=>{const{product_id:r,sku:i,price:o,quantity:s=1}=t,a=r||i;if(a){e.push(a);const t={id:a,quantity:s};o&&!Number.isNaN(o)&&(t.price=o),n.push(t)}}));const r={};return n.length>0&&(r.ecomm_prodid=e,r.items=n),r})(e);return r(r({},p),h)};const q=(t,e)=>{const n=d(t,"context.traits.email")||d(t,"traits.email"),r=d(t,"context.traits.phone")||d(t,"traits.phone"),i={};if(I(n)&&(i.em=e?(t=>{let e=t.trim().toLowerCase();if(e=e.replace(/\+[^@]+/g,""),e=e.replace(/\./g,((t,n)=>nt.value===e)).method(...this.getLogData(t))}}getLogData(t){if(Array.isArray(t)&&t.length>0){let e="%c RS SDK";this.scope&&(e=`${e} - ${this.scope}`);e=`${e} %c ${t[0].trim()}`;const n=[];return n.push(e),n.push("font-weight: bold; background: black; color: white;"),n.push("font-weight: normal;"),n.push(...t.slice(1)),n}return t}}("Bing Ads");return t.BingAds=class{constructor(t,n,i){e(this,"track",(t=>{const{type:e,properties:n,context:i}=t.message,o=(null==n?void 0:n.event_action)||e;if(!o)return void H.error("Event type is not present");let s=r(r({},(t=>{const{event:e,properties:n={}}=t,{category:r,currency:i,total:o,value:s,revenue:a}=n;return{event_label:e,event_category:r,currency:i,revenue_value:o||s||a}})(t.message)),P(t.message));const a=function(t,e,n,r){const i=[],o=e||{};return Array.isArray(n)?n.forEach((e=>{const n=d(t,e);n&&(Object.keys(n).forEach((t=>{r.includes(t)||i.push(t)})),i.forEach((t=>{void 0!==n[t]&&(o[t]=d(n,t))})))})):"root"===n&&(Object.keys(t).forEach((t=>{r.includes(t)||i.push(t)})),i.forEach((e=>{void 0!==t[e]&&(o[e]=d(t,e))}))),o}(t.message,{},["properties"],D);var c;(s=r(r({},s),a),!0===this.enableEnhancedConversions)&&(s.pid=(null==i||null===(c=i.traits)||void 0===c?void 0:c.pid)||q(i,this.isHashRequired));s=x(I,s),window[this.uniqueId].push("event",o,s)})),n.logLevel&&H.setLogLevel(n.logLevel),this.analytics=n,this.tagID=t.tagID,this.name="BINGADS",({shouldApplyDeviceModeTransformation:this.shouldApplyDeviceModeTransformation,propagateEventsUntransformedOnError:this.propagateEventsUntransformedOnError,destinationId:this.destinationId}=null!=i?i:{}),this.uniqueId=`bing${this.tagID}`,this.enableEnhancedConversions=t.enableEnhancedConversions,this.isHashRequired=t.isHashRequired}init(){var t,e;t=this.uniqueId,e=this.tagID,((t,n,r,i,o)=>{let s,a,c;t[o]=t[o]||[],s=()=>{const n={ti:e};n.q=t[o],t[o]=new UET(n)},a=n.createElement(r),a.src="https://bat.bing.com/bat.js",a.async=1,a.setAttribute("data-loader","RS_JS_SDK"),a.onload=a.onreadystatechange=function(){const e=this.readyState;e&&"loaded"!==e&&"complete"!==e&&"function"==typeof t.UET||(s(),a.onload=a.onreadystatechange=null)},c=n.getElementsByTagName(r)[0],c.parentNode.insertBefore(a,c)})(window,document,"script",0,t)}isLoaded(){return!!window.UET&&!!window[this.uniqueId]&&window[this.uniqueId].push!==Array.prototype.push}isReady(){return!(!window[this.uniqueId]||window[this.uniqueId].push===Array.prototype.push)}page(){window[this.uniqueId].push("pageLoad")}},Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({}); //# sourceMappingURL=BingAds.min.js.map