// Bundle time - 2025-10-15T12:49:40Z - SalesforceInteractions // SDK - npm/@salesforce/interactions/2.0/target/dist/scripts/interactions-bundle.min.js [2.0.9] /* regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE js-cookie v3.0.5 | MIT */ 'use strict';var SalesforceInteractions=function(e){function ma(b,a){(null==a||a>b.length)&&(a=b.length);for(var c=0,d=Array(a);c=b.length?{done:!0}:{done:!1,value:b[d++]}},e:function(a){throw a;},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var f,h=!0,l=!1;return{s:function(){c=c.call(b)},n:function(){var a=c.next();return h=a.done,a},e:function(a){l=!0;f=a},f:function(){try{h||null==c.return||c.return()}finally{if(l)throw f; }}}}function X(b,a,c){return(a=cb(a))in b?Object.defineProperty(b,a,{value:c,enumerable:!0,configurable:!0,writable:!0}):b[a]=c,b}function pa(){return pa="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(b,a,c){var d;for(d=b;!{}.hasOwnProperty.call(d,a)&&null!==(d=K(d)););if(d)return d=Object.getOwnPropertyDescriptor(d,a),d.get?d.get.call(3>arguments.length?b:c):d.value},pa.apply(null,arguments)}function K(b){return K=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__|| Object.getPrototypeOf(a)},K(b)}function mc(b,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function");b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,writable:!0,configurable:!0}});Object.defineProperty(b,"prototype",{writable:!1});a&&qa(b,a)}function ab(){try{var b=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(a){}return(ab=function(){return!!b})()}function db(b,a){var c=Object.keys(b);if(Object.getOwnPropertySymbols){var d= Object.getOwnPropertySymbols(b);a&&(d=d.filter(function(a){return Object.getOwnPropertyDescriptor(b,a).enumerable}));c.push.apply(c,d)}return c}function q(b){for(var a=1;a>2]|=e.charCodeAt(p)<<8*~p--;for(a=p=0;ap;c=[c[4]+(f[p]=16>p?~~l[a+p]:2*e|0>e)+1518500249+[d&g|~d&k,e=341275144+(d^g^k),882459459+(d&g|d&k|g&k),e+1535694389][p++/5>>2]+((e=c[0])<<5|e>>>27),e,d<<30|d>>>2,g,k]){e=f[p-3]^f[p-8]^f[p-14]^f[p-16];d=c[1];var g=c[2];var k=c[3]}for(p=5;p;)h[--p]+= c[p]}for(e="";40>p;)e+=(h[p>>3]>>4*(7-p++)&15).toString(16);return e}function Z(b){for(var a=1;ab.indexOf(a)})}function wc(b, a,c,d,f){f.guid=f.guid||k.guid++;var h=b.___ce=b.___ce||{};h[a]=h[a]||[];h[a].push([c,d,f]);b.addEventListener(a,f)}function Ba(b){b=b.split(".");return[b[0],b.slice(1).sort()]}function da(b,a,c,d,f){var h=b.___ce=b.___ce||{};if(a)h[a]&&(h[a]=h[a].filter(function(l){var h=Y(l,3);l=h[0];var e=h[1];h=h[2];if(f&&h.guid!==f.guid||!qb(l,c)||d&&d!==e)return!0;b.removeEventListener(a,h)}));else for(a in h)da(b,a,c,d,f)}function rb(b){return b.multiple&&b.options?B(xa.call(b.options,function(a){return a.selected&& !a.disabled&&!a.parentNode.disabled}),"value"):b.value||""}function sb(b){if(!u(b))return[];if(xc.test(b))return[J(RegExp.$1)];var a=yc.test(b)&&RegExp.$1;a=tb[a]||tb["*"];a.innerHTML=b;return k(a.childNodes).detach().get()}function zc(b,a){b=k(b);b.filter("script").add(b.find("script")).each(function(b,d){if(Ac.test(d.type)&&Ca.contains(d)){var c=J("script");c.text=d.textContent.replace(Bc,"");t(Cc,function(a,b){d[b]&&(c[b]=d[b])});a.head.insertBefore(c,null);a.head.removeChild(c)}})}function E(b, a,c,d,f,h,l,e){t(b,function(b,h){t(k(h),function(b,h){t(k(a),function(a,b){var l=c?b:h;b=c?h:b;a=a?l.cloneNode(!0):l;f?b.insertBefore(a,d?b.firstElementChild:null):b.parentNode.insertBefore(a,d?b:b.nextElementSibling);zc(a,b.ownerDocument)},e)},l)},h);return a}function Dc(b){var a=b.pageTypeDefault;b=0/,pc=/^\w+$/,ba=function(){function b(a){var c=1a?0:1;carguments.length?this[0]&&this[0][b]:this.each(function(c,f){f[b]=a});for(var c in b)this.prop(c,b[c]);return this}};g.get=function(b){return void 0===b?Ib.call(this):this[0>b?b+this.length:b]};g.eq=function(b){return k(this.get(b))};g.first=function(){return this.eq(0)};g.last=function(){return this.eq(-1)};g.filter=function(b){var a=wa(b);return k(xa.call(this,function(b,d){return a.call(b,d,b)}))};var rc=/\S+/g;g.hasClass=function(b){return!!b&&Aa.call(this,function(a){return a.classList.contains(b)})}; g.removeAttr=function(b){var a=ca(b);return this.each(function(b,d){t(a,function(a,b){d.removeAttribute(b)})})};g.attr=function(b,a){if(b){if(u(b)){if(2>arguments.length){if(!this[0])return;var c=this[0].getAttribute(b);return null===c?void 0:c}return void 0===a?this:null===a?this.removeAttr(b):this.each(function(c,f){f.setAttribute(b,a)})}for(c in b)this.attr(c,b[c]);return this}};g.toggleClass=function(b,a){var c=ca(b),d=void 0!==a;return this.each(function(b,h){t(c,function(b,c){d?a?h.classList.add(c): h.classList.remove(c):h.classList.toggle(c)})})};g.addClass=function(b){return this.toggleClass(b,!0)};g.removeClass=function(b){return arguments.length?this.toggleClass(b,!1):this.attr("class","")};k.unique=A;g.add=function(b,a){return k(A(this.get().concat(k(b,a).get())))};var ya=/^--/,za={},uc=Gb.style,tc=["webkit","moz","ms"];k.prefixedProp=mb;var vc={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0}; g.css=function(b,a){if(u(b)){var c=ya.test(b);b=mb(b,c);if(2>arguments.length)return this[0]&&I(this[0],b,c);if(!b)return this;a=nb(b,a,c);return this.each(function(d,h){h&&1===h.nodeType&&(c?h.style.setProperty(b,a):h.style[b]=a)})}for(var d in b)this.css(d,b[d]);return this};g.data=function(b,a){if(!b){if(!this[0])return;var c={},d;for(d in this[0].dataset)c[d]=ob(this[0],d);return c}if(u(b))return 2>arguments.length?this[0]&&ob(this[0],b):this.each(function(c,d){c=a;try{c=JSON.stringify(c)}catch(l){}d.dataset[S(b)]= c});for(c in b)this.data(c,b[c]);return this};t([!0,!1],function(b,a){t(["Width","Height"],function(b,d){var c="".concat(a?"outer":"inner").concat(d);g[c]=function(f){if(this[0])return va(this[0])?T[c]:this[0]["".concat(a?"offset":"client").concat(d)]+(f&&a?O(this[0],"margin".concat(b?"Top":"Left"))+O(this[0],"margin".concat(b?"Bottom":"Right")):0)}})});t(["width","height"],function(b,a){g[a]=function(c){if(!this[0])return void 0===c?void 0:this;if(!arguments.length)return va(this[0])?this[0][S("outer-".concat(a))]: this[0].getBoundingClientRect()[a]-pb(this[0],!b);var d=parseInt(c,10);return this.each(function(c,h){h&&1===h.nodeType&&(c=I(h,"boxSizing"),h.style[a]=nb(a,d+("border-box"===c?pb(h,!b):0)))})}});var Na={};g.toggle=function(b){return this.each(function(a,c){if(void 0===b?"none"===I(c,"display"):b){if(c.style.display=c.___cd||"","none"===I(c,"display")){a=c.style;c=c.tagName;if(Na[c])c=Na[c];else{var d=J(c);z.body.insertBefore(d,null);var f=I(d,"display");z.body.removeChild(d);c=Na[c]="none"!==f?f: "block"}a.display=c}}else c.___cd=I(c,"display"),c.style.display="none"})};g.hide=function(){return this.toggle(!1)};g.show=function(){return this.toggle(!0)};var Oa={focus:"focusin",blur:"focusout"},Jb={mouseenter:"mouseover",mouseleave:"mouseout"},Nc=/^(mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;g.off=function(b,a,c){var d=this;if(void 0===b)this.each(function(a,b){da(b)});else if(u(b))H(a)&&(c=a,a=""),t(ca(b),function(b,f){b=Ba(Jb[f]||Oa[f]||f);b=Y(b,2);var l=b[0],h=b[1];d.each(function(b, d){da(d,l,h,a,c)})});else for(var f in b)this.off(f,b[f]);return this};g.on=function(b,a,c,d){var f=this;if(!u(b)){for(var h in b)this.on(h,a,b[h]);return this}H(a)&&(c=a,a="");t(ca(b),function(b,h){b=Ba(Jb[h]||Oa[h]||h);b=Y(b,2);var l=b[0],e=b[1];f.each(function(b,f){var h=function(b){if(!b.namespace||qb(e,b.namespace.split("."))){var g=f;if(a){for(var k=b.target;!ua(k,a);){if(k===f)return;k=k.parentNode;if(!k)return}g=k;b.___cd=!0}b.___cd&&Object.defineProperty(b,"currentTarget",{configurable:!0, get:function(){return g}});k=c.call(g,b,b.data);d&&da(f,l,e,a,h);!1===k&&(b.preventDefault(),b.stopPropagation())}};h.guid=c.guid=c.guid||k.guid++;wc(f,l,e,a,h)})});return this};g.one=function(b,a,c){return this.on(b,a,c,!0)};g.ready=function(b){"loading"!==z.readyState?b(k):z.addEventListener("DOMContentLoaded",function(){b(k)});return this};g.trigger=function(b,a){if(u(b)){var c=Ba(b),d=Y(c,2);c=d[0];d=d[1];var f=Nc.test(c)?"MouseEvents":"HTMLEvents";b=z.createEvent(f);b.initEvent(c,!0,!0);b.namespace= d.join(".")}b.data=a;var h=b.type in Oa;return this.each(function(a,c){if(h&&H(c[b.type]))c[b.type]();else c.dispatchEvent(b)})};var Oc=/%20/g,Pc=/file|reset|submit|button|image/i,Qc=/radio|checkbox/i;g.serialize=function(){var b="";this.each(function(a,c){t(c.elements||[c],function(a,c){c.disabled||!c.name||"FIELDSET"===c.tagName||Pc.test(c.type)||Qc.test(c.type)&&!c.checked||(a=rb(c),void 0!==a&&(a=Ma(a)?a:[a],t(a,function(a,d){a=b;d="&".concat(encodeURIComponent(c.name),"=").concat(encodeURIComponent(d).replace(Oc, "+"));b=a+d})))})});return b.slice(1)};g.val=function(b){return void 0===b?this[0]&&rb(this[0]):this.each(function(a,c){if("SELECT"===c.tagName){var d=Ma(b)?b:null===b?[]:[b];t(c.options,function(a,b){b.selected=0<=d.indexOf(b.value)})}else c.value=null===b?"":b})};g.clone=function(){return this.map(function(b,a){return a.cloneNode(!0)})};g.detach=function(){return this.each(function(b,a){a.parentNode&&a.parentNode.removeChild(a)})};var yc=/^\s*<(\w+)[^>]*>/,xc=/^\s*<(\w+)\s*\/?>(?:<\/\1>)?\s*$/, tb={"*":Gb,tr:Ic,td:Hb,th:Hb,thead:La,tbody:La,tfoot:La};k.parseHTML=sb;g.empty=function(){return this.each(function(b,a){for(;a.firstChild;)a.removeChild(a.firstChild)})};g.html=function(b){return void 0===b?this[0]&&this[0].innerHTML:this.each(function(a,c){c.innerHTML=b})};g.remove=function(){return this.detach().off()};g.text=function(b){return void 0===b?this[0]?this[0].textContent:"":this.each(function(a,c){c.textContent=b})};g.unwrap=function(){this.parent().each(function(b,a){b=k(a);b.replaceWith(b.children())}); return this};g.offset=function(){var b=this[0];if(b)return b=b.getBoundingClientRect(),{top:b.top+T.pageYOffset-Ca.clientTop,left:b.left+T.pageXOffset-Ca.clientLeft}};g.offsetParent=function(){return k(this[0]&&this[0].offsetParent)};g.position=function(){var b=this[0];if(b)return{left:b.offsetLeft,top:b.offsetTop}};g.children=function(b){return N(k(A(B(this,function(a){return a.children}))),b)};g.contents=function(){return k(A(B(this,function(b){return"IFRAME"===b.tagName?[b.contentDocument]:b.childNodes})))}; g.find=function(b){return k(A(B(this,function(a){return ta(b,a)})))};var Bc=/^\s*\s*$/g,Ac=/^$|^module$|\/(java|ecma)script/i,Cc=["type","src","nonce","noModule"];g.after=function(){return E(arguments,this,!1,!1,!1,!0,!0)};g.append=function(){return E(arguments,this,!1,!1,!0)};g.appendTo=function(b){return E(arguments,this,!0,!1,!0)};g.before=function(){return E(arguments,this,!1,!0)};g.insertAfter=function(b){return E(arguments,this,!0,!1,!1,!1,!1,!0)};g.insertBefore= function(b){return E(arguments,this,!0,!0)};g.prepend=function(){return E(arguments,this,!1,!0,!0,!0,!0)};g.prependTo=function(b){return E(arguments,this,!0,!0,!0,!1,!1,!0)};g.replaceWith=function(b){return this.before(b).remove()};g.replaceAll=function(b){k(b).replaceWith(this);return this};g.wrapAll=function(b){b=k(b);for(var a=b[0];a.children.length;)a=a.firstElementChild;this.first().before(b);return this.appendTo(a)};g.wrap=function(b){return this.each(function(a,c){var d=k(b)[0];k(c).wrapAll(a? d.cloneNode(!0):d)})};g.wrapInner=function(b){return this.each(function(a,c){a=k(c);c=a.contents();c.length?c.wrapAll(b):a.append(b)})};g.has=function(b){var a=u(b)?function(a,d){return ta(b,d).length}:function(a,d){return d.contains(b)};return this.filter(a)};g.is=function(b){var a=wa(b);return Aa.call(this,function(b,d){return a.call(b,d,b)})};g.next=function(b,a){return N(k(A(B(this,"nextElementSibling",a))),b)};g.nextAll=function(b){return this.next(b,!0)};g.not=function(b){var a=wa(b);return this.filter(function(b, d){return!a.call(d,b,d)})};g.parent=function(b){return N(k(A(B(this,"parentNode"))),b)};g.index=function(b){var a=b?k(b)[0]:this[0];b=b?this:k(a).parent().children();return lb.call(b,a)};g.closest=function(b){var a=this.filter(b);if(a.length)return a;var c=this.parent();return c.length?c.closest(b):a};g.parents=function(b){return N(k(A(B(this,"parentElement",!0))),b)};g.prev=function(b,a){return N(k(A(B(this,"previousElementSibling",a))),b)};g.prevAll=function(b){return this.prev(b,!0)};g.siblings= function(b){return N(k(A(B(this,function(a){return k(a).parent().children().not(a)}))),b)};var ja=function(){function b(){L(this,b);this.listeners=[]}return M(b,[{key:"on",value:function(a){var b=this;(this.listeners=this.listeners||[]).push(a);return function(){b.listeners=b.listeners.filter(function(b){return b!==a})}}},{key:"once",value:function(a){var b=this;return this.on(function(){b.unbindAll();try{for(var c=arguments.length,f=Array(c),h=0;h=new Date(a.lastSentTime)}).map(function(a){return a.consent});Vc(a.consents)};document.addEventListener(e.CustomEvents.OnConsentGrant,function(a){a.detail&&a.detail.grantedConsent&&Vb(a.detail.grantedConsent)});document.addEventListener(e.CustomEvents.OnConsentRevoke,function(a){a.detail&&a.detail.revokedConsent&&Vb(a.detail.revokedConsent)});var Ua=function(a){return Wb(a,Tb).catch(function(c){r.error(c.message); n.onFireException.emit(c,"Site-wide JavaScript");return a})},Vb=function(a){Wb({interaction:{name:e.MetadataUpdateInteractionName.MetadataUpdate},consents:[a.consent]},function(){return!0}).then(function(){return r.debug("Consent event: ".concat(a.consent.status))},function(a){return n.onFireException.emit(a,"Site-wide JavaScript")})},Wb=function(a,c){a:{var d=a,f=m.result.matchedConfig;try{d=f&&f.onActionEvent?f.onActionEvent(d):d;if("object"===x(d)){a=d;break a}n.onFireException.emit(Error("onActionEvent failed for the ".concat(m.result.matchedConfig.name, " page config. Must return an object or null.")),"Site-wide Javascript")}catch(h){n.onFireException.emit(Error("onActionEvent failed for the ".concat(m.result.matchedConfig.name," page config. ").concat(h.message,".")),"Site-wide Javascript")}a=void 0}a:{d=a;f=m.config;try{d=f.global&&f.global.onActionEvent?f.global.onActionEvent(d):d;if("object"===x(d)){a=d;break a}n.onFireException.emit(Error("onActionEvent failed for the global page config. Must return an object or null."),"Site-wide Javascript")}catch(h){n.onFireException.emit(Error("onActionEvent failed for the global page config. ".concat(h.message, ".")),"Site-wide Javascript")}a=void 0}Ub(a);c&&!c()&&r.debug("No opt-in consents provided. Event will still be dispatched.");r.debug("Sent event: ",a);n.onEventSend.emit(a);return Promise.resolve(a)},$c=function(a){return new Promise(function(c,d){n.onInitSitemap.once(function(){return d("sitemap_reinit")});var f={name:null},h=[];Object.keys(a.interaction).forEach(function(c){var d=Xb(a.interaction[c],c).then(function(a){f[c]=a});h.push(d)});Promise.all(h).then(function(){c(f)}).catch(function(a){n.onFireException.emit(Error("Catalog object interaction config was rejected"), "Site-wide Javascript")})})},Xb=function(a,c){try{return v=c,"object"===x(a)&&!Array.isArray(a)&&0=d&&(W(c),e(!1))}catch(eb){W(c),l(eb)}},f);G[c]=function(){clearInterval(g)}})},unbind:W,getBindings:function(){return G},clearBindings:function(){for(var a in G)G.hasOwnProperty(a)&&"function"===typeof G[a]&&W(a)}}},bc=function(a){a.global=a.global||{};"object"!=x(a.global)&&n.onFireException.emit(Error("The global config has a type of ".concat(x(a.global),", but it must be an object")),"Sitewide Javascript");Object.assign(m.config,q({}, a));n.onInitSitemap.emit(m.config)},Wa=function(a){bd(a);return!0},ec=function(a){Ra(a.pageTypes).then(cc).then(dc).catch(function(a){"sitemap_reinit"!==a&&n.onFireException.emit(Error("Unhandled exception: ".concat(a)),"Site-wide Javascript")})},dc=function(a){m.result.matchedConfig=q(q({},a),{},{listeners:cd(a)});m.result.currentPage=q(q({},m.result.currentPage||{}),{},{source:{pageType:a.name,locale:dd(a)},user:{anonymousId:null},interaction:null,pageView:!0});return a.interaction?$c(a).then(function(a){m.result.currentPage.interaction= a}):Promise.resolve()},cd=function(a){return(a.listeners||[]).map(function(a){return Va(a)})},dd=function(a){return"function"===typeof a.locale?a.locale():a.locale},fc=function(){for(var a=arguments.length,c=Array(a),d=0;d"+f,e);d[c]=function(){m&&m.disconnect()}})},pageElementVisible:function(f,g){var l=g||0;if("string"!==typeof f||""===f||"number"!==typeof l||0>l||1"+ f,e);d[c]=function(){m.disconnect()}})},pageExit:function(f){f=f||0;if("number"!==typeof f||0>f)throw Error("[pageExit] Invalid arguments");return new Promise(function(g){function l(a){clearTimeout(n);10>=a.pageY-window.pageYOffset&&(n=0",e);d[c]=function(){m.off("mousemove",l)}})},pageInactive:function(f){function g(a,d){var e= new Promise(function(e){function f(a){a=a||new Event("pageInactive");c&&!d.isSubscribe?h.unbind(c):l.off("mousemove click scroll keyup keydown",g);e(a)}function g(c){clearTimeout(k);k=setTimeout(f.bind(this,c),a)}var l=y(document),k;g();l.on("mousemove click scroll keyup keydown",g)});e.subscribe=function(f){delete e.subscribe;d.isSubscribe=!0;e.then(function(e){e.disconnect=function(){c?h.unbind(c):d.isDisconnected=!0};f(e);!d.isDisconnected&&g(a,d).subscribe(f)});return e};return e}if("number"!== typeof f||0>=f)throw Error("[pageInactive] Invalid arguments");var l={isDisconnected:!1,isSubscribe:!1};c=a(c,"",e);d[c]=function(){l.isDisconnected=!0};return g(f,l)},pageScroll:function(f){if("number"!==typeof f||0>f||1=f&&(g(a),c?h.unbind(c):k.off("scroll",l))}var k=y(document);k.on("scroll",l);c=a(c,"", e);d[c]=function(){k.off("scroll",l)}})}}}var d={},e=c(null,!0),h=function(){return{bind:function(a){a&&d[a]&&(d[a](),delete d[a]);return c(a)},unbind:function(a){if(!a||"string"!==typeof a||"function"!==typeof d[a])return null;d[a]();delete d[a]},getBindings:function(){return d},clearBindings:function(){for(var a in d)d.hasOwnProperty(a)&&(d[a](),delete d[a])}}}();return Object.assign(e,h)}(),jc=function(){function a(c){var d=this;L(this,a);this.clearRateLimiter=function(){d.sentEvents=[]};this.eventWithinLimitTimeRange= function(a,c,d){return d-c.time f)?(r.info("Event rate limit exceeded. More than ".concat(f," events ")+"sent in ".concat(e,"ms.")),!0):!1};this.checkLimits=function(a,c){return d.checkGlobalLimits(a,c.time)};this.sentEvents=[];this.eventRateLimiterConfig=c}return M(a,[{key:"resetCounters",value:function(){this.globalCounter=0}},{key:"isTriggerLimitExceeded",value:function(a){var c=Date.now();a=q(q({},a),{},{time:c});this.sentEvents.push(a);this.removeOldEvents(c);this.resetCounters();for(c=this.sentEvents.length-1;0<=c;c--)if(this.checkLimits(c, a))return!0;return!1}}])}(),gd=function(a){function c(a){L(this,c);var d=lc(this,c,[a]);d.getTimeRangeMax=function(){return d.eventRateLimiterConfig.perInteractionTimeRange?Math.max(d.eventRateLimiterConfig.globalTimeRange,d.eventRateLimiterConfig.perInteractionTimeRange):d.eventRateLimiterConfig.globalTimeRange};d.checkInteractionLimits=function(a,c,e){return d.eventRateLimiterConfig.perInteractionLimit&&d.eventRateLimiterConfig.perInteractionTimeRange&&d.eventWithinLimitTimeRange(d.eventRateLimiterConfig.perInteractionTimeRange, d.sentEvents[a],c)&&d.sentEvents[a].name===e&&(d.perEventCounter++,d.perEventCounter>d.eventRateLimiterConfig.perInteractionLimit)?(r.info("Event rate limit exceeded. More than ".concat(d.eventRateLimiterConfig.perInteractionLimit," events ")+"with interaction name of ".concat(e," sent in ").concat(d.eventRateLimiterConfig.perInteractionTimeRange,"ms.")),!0):!1};d.checkLimits=function(a,c){return d.checkGlobalLimits(a,c.time)||d.checkInteractionLimits(a,c.time,c.name)};return d}mc(c,a);return M(c, [{key:"resetCounters",value:function(){fb(c,"resetCounters",this,3)([]);this.perEventCounter=0}},{key:"isTriggerLimitExceeded",value:function(a){return fb(c,"isTriggerLimitExceeded",this,3)([a])}}])}(jc),Da,Ea,Fa,Ga,$a=function(){var a=0{if(null==e||!1===Object.prototype.hasOwnProperty.call(e,t)||null==e[t])throw new Error(`missing required option "${String(t)}"`)})}function n(e,t){const n=new CustomEvent(e,{detail:t});document.dispatchEvent(n)}async function r(e){return await new Promise((t,n)=>{const r=new XMLHttpRequest;r.onload=()=>t(r),r.onerror=()=>t(r),r.abort=()=>n(new Error("Request aborted")),e(r)})}async function o(e){await new Promise(t=>{setTimeout(t,e)})}function a(e){return 200===(null==e?void 0:e.status)||204===(null==e?void 0:e.status)}function i(){return window.SalesforceInteractions}function c(){const e=i().getAnonymousId();if(null==e||""===e)throw new Error("sessionId is missing");return e}function s(e){var t;return null!==(t=e.deviceId)&&void 0!==t?t:c()}function u(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>{const n=t.toString();return String.fromCharCode(parseInt(`0x${n}`,16))}))}var l;let d;!function(e){e.OnBeforeEventSend="dataCloud:onBeforeEventSend",e.OnEventSend="dataCloud:onEventSend"}(l||(l={})),null!=window.SalesforceInteractions&&(window.SalesforceInteractions.DataCloud={CustomEvents:l,profileHasChanged:!1});const p=new Uint8Array(16);function f(){if(!d&&(d="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!d))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return d(p)}var g=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const v=[];for(let e=0;e<256;++e)v.push((e+256).toString(16).slice(1));function m(e,t=0){return v[e[t+0]]+v[e[t+1]]+v[e[t+2]]+v[e[t+3]]+"-"+v[e[t+4]]+v[e[t+5]]+"-"+v[e[t+6]]+v[e[t+7]]+"-"+v[e[t+8]]+v[e[t+9]]+"-"+v[e[t+10]]+v[e[t+11]]+v[e[t+12]]+v[e[t+13]]+v[e[t+14]]+v[e[t+15]]}function y(e){if(!function(e){return"string"==typeof e&&g.test(e)}(e))throw TypeError("Invalid UUID");let t;const n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n}function h(e,t,n){function r(e,r,o,a){var i;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let n=0;n>>9<<4)+1}function b(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function I(e,t,n,r,o,a){return b((i=b(b(t,e),b(r,a)))<<(c=o)|i>>>32-c,n);var i,c}function O(e,t,n,r,o,a,i){return I(t&n|~t&r,e,t,o,a,i)}function C(e,t,n,r,o,a,i){return I(t&r|n&~r,e,t,o,a,i)}function j(e,t,n,r,o,a,i){return I(t^n^r,e,t,o,a,i)}function E(e,t,n,r,o,a,i){return I(n^(t|~r),e,t,o,a,i)}h("v3",48,function(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let n=0;n>5]>>>o%32&255,a=parseInt(r.charAt(n>>>4&15)+r.charAt(15&n),16);t.push(a)}return t}(function(e,t){e[t>>5]|=128<>5]|=(255&e[r/8])<>>32-t}function N(e){return("number"==typeof(null==e?void 0:e.time)?new Date(e.time):new Date).toISOString()}function x(e,t){return{eventId:T(),dateTime:N(e),sessionId:c(),deviceId:s(t)}}function R(t,n){var r;const o=null!==(r=t.consents)&&void 0!==r?r:[];if(0===o.length)return[];const a=[];return o.forEach(r=>{const o=function(t,n,r){try{let o;if(t.status===e.ConsentStatus.OptIn)o="opt-in";else{if(t.status!==e.ConsentStatus.OptOut)return i().log.error(`Consent value should be either "${e.ConsentStatus.OptIn}" or "${e.ConsentStatus.OptOut}"`,n),null;o="opt-out"}return Object.assign(Object.assign({},x(n,r)),{eventType:"consentLog",category:"Engagement",purpose:t.purpose,provider:t.provider,status:o})}catch(e){const t=e instanceof Error?e.message:"Unknown error occurred during consent extraction";return i().log.error(t),null}}(r,t,n);null!=o&&a.push(o)}),a}function $(e){var t,n,r,o,a,i;return{interactionName:null===(t=null==e?void 0:e.interaction)||void 0===t?void 0:t.name,pageView:null==e?void 0:e.pageView,sourceUrl:null===(n=null==e?void 0:e.source)||void 0===n?void 0:n.url,sourceUrlReferrer:null===(r=null==e?void 0:e.source)||void 0===r?void 0:r.urlReferrer,sourceChannel:null===(o=null==e?void 0:e.source)||void 0===o?void 0:o.channel,sourceLocale:null===(a=null==e?void 0:e.source)||void 0===a?void 0:a.locale,sourcePageType:null===(i=null==e?void 0:e.source)||void 0===i?void 0:i.pageType}}h("v5",80,function(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let n=0;n>>0;u=s,s=c,c=U(i,30)>>>0,i=o,o=a}n[0]=n[0]+o>>>0,n[1]=n[1]+i>>>0,n[2]=n[2]+c>>>0,n[3]=n[3]+s>>>0,n[4]=n[4]+u>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]});const L=/^[a-zA-Z](?!.*__)(?!.*_$)\w{0,79}$/;function D(e){return"string"==typeof e&&L.test(e)?e:(i().log.warn(`[Invalid eventType: "${e}"] Must begin with a letter (a-zA-Z) and can only contain alphanumeric characters and underscores (no spaces.) Also cannot end with or have consecutive underscores. Max 80 characters.`),null)}function k(e){return{eventId:T(),category:e.category,dateTime:e.dateTime,deviceId:e.deviceId,sessionId:e.sessionId,eventType:"",interactionName:e.interactionName}}function q(e){return null!=(null==e?void 0:e.catalogObjectId)&&null!=(null==e?void 0:e.catalogObjectType)&&null!=(null==e?void 0:e.quantity)}function P(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var M,V={exports:{}};var H=function(){if(M)return V.exports;M=1;const e=/[\p{Lu}]/u,t=/[\p{Ll}]/u,n=/^[\p{Lu}](?![\p{Lu}])/gu,r=/([\p{Alpha}\p{N}_]|$)/u,o=/[_.\- ]+/,a=new RegExp("^"+o.source),i=new RegExp(o.source+r.source,"gu"),c=new RegExp("\\d+"+r.source,"gu"),s=(r,o)=>{if("string"!=typeof r&&!Array.isArray(r))throw new TypeError("Expected the input to be `string | string[]`");if(o={pascalCase:!1,preserveConsecutiveUppercase:!1,...o},0===(r=Array.isArray(r)?r.map(e=>e.trim()).filter(e=>e.length).join("-"):r.trim()).length)return"";const s=!1===o.locale?e=>e.toLowerCase():e=>e.toLocaleLowerCase(o.locale),u=!1===o.locale?e=>e.toUpperCase():e=>e.toLocaleUpperCase(o.locale);if(1===r.length)return o.pascalCase?u(r):s(r);return r!==s(r)&&(r=((n,r,o)=>{let a=!1,i=!1,c=!1;for(let s=0;s(n.lastIndex=0,e.replace(n,e=>t(e))))(r,s):s(r),o.pascalCase&&(r=u(r.charAt(0))+r.slice(1)),((e,t)=>(i.lastIndex=0,c.lastIndex=0,e.replace(i,(e,n)=>t(n)).replace(c,e=>t(e))))(r,u)};return V.exports=s,V.exports.default=s,V.exports}(),_=P(H);function J(e,t,n={}){return null==e||("object"==typeof e?Object.keys(e).forEach(r=>J(e[r],_(null!=t?t+"."+r:r),n)):null!=t&&(n[t]=e)),n}function B(e){return t(e,"catalogObjectType","catalogObjectId","quantity"),Object.assign({catalogObjectType:e.catalogObjectType,catalogObjectId:e.catalogObjectId,price:e.price,quantity:e.quantity,currency:e.currency},J(e.attributes,"attribute"))}function F(e,t,n){const r=function(e,t){return Object.assign(Object.assign(Object.assign({},x(e,t)),$(e)),{category:"Engagement",eventType:"cart"})}(e,n);return[r,...z(r,t)]}function z(n,r){const o=[];if(function(t){return t.name===e.CartInteractionName.AddToCart}(r)||function(t){return t.name===e.CartInteractionName.RemoveFromCart}(r)){t(r,"lineItem");const e=K(n,r.lineItem);null!=e&&o.push(e)}else!function(t){return t.name===e.CartInteractionName.ReplaceCart}(r)?new Set(r.lineItems).add(r.lineItem).forEach(e=>{if(q(e)){const t=K(n,e);null!=t&&o.push(t)}}):(t(r,"lineItems"),r.lineItems.forEach(e=>{const t=K(n,e);null!=t&&o.push(t)}));return o}function K(e,t){try{return Object.assign(Object.assign(Object.assign({},k(e)),B(t)),{eventType:"cartItem",cartEventId:e.eventId})}catch(e){const t=e instanceof Error?e.message:"Unknown error occurred during cart event extraction";return i().log.error(t),null}}function Z(e,n,r){t(n,"catalogObject");return[Q(e,n.catalogObject,r)]}function Q(e,n,r){return t(n,"id","type"),Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},x(e,r)),$(e)),J(n.attributes,"attribute")),J(n.relatedCatalogObjects,"relatedCatalogObject")),{category:"Engagement",eventType:"catalog",id:n.id,type:n.type})}function W(e,n,r){t(n,"order");const o=n.order,a=function(e,n,r){return t(n,"id"),Object.assign(Object.assign(Object.assign(Object.assign({},x(e,r)),$(e)),J(n.attributes,"attribute")),{category:"Engagement",eventType:"order",orderId:n.id,orderCurrency:n.currency,orderTotalValue:n.totalValue})}(e,o,r);return[a,...X(a,o)]}function X(e,t){if(null==t.lineItems)return[];const n=[];return t.lineItems.forEach(t=>{const r=function(e,t){try{return Object.assign(Object.assign(Object.assign({},k(e)),B(t)),{eventType:"orderItem",orderEventId:e.eventId})}catch(e){const t=e instanceof Error?e.message:"Unknown error occurred during order event extraction";return i().log.error(t),null}}(e,t);null!=r&&n.push(r)}),n}function G(e,t,n){var r;const o=D(null!==(r=t.eventType)&&void 0!==r?r:t.name);if(null==o)return[];const a=Object.keys(e.interaction).reduce((e,n)=>("name"!==n&&(e[n]=t[n]),e),{});return[Object.assign(Object.assign(Object.assign(Object.assign({},J(a)),x(e,n)),$(e)),{eventType:o,category:"Engagement"})]}function Y(e,t,n){return null==(null==t?void 0:t.eventType)?[...ee(e,t,n),...te(e,t,n),...ne(e,t,n)]:[]}function ee(e,t,n){return function(e){return t=null==e?void 0:e.order,null!=(null==t?void 0:t.id);var t}(t)?W(e,t,n):[]}function te(e,t,n){return function(e){return t=null==e?void 0:e.catalogObject,null!=(null==t?void 0:t.id)&&null!=(null==t?void 0:t.type);var t}(t)?Z(e,t,n):[]}function ne(e,t,n){return function(e){var t;return q(null==e?void 0:e.lineItem)||(null===(t=null==e?void 0:e.lineItems)||void 0===t?void 0:t.some(q))}(t)?F(e,t,n):[]}function re(n,r){const o=null==n?void 0:n.interaction;return null==o?[]:(t(n.interaction,"name"),function(t){return e.OrderInteractionName.Return===t.name||e.OrderInteractionName.Ship===t.name||e.OrderInteractionName.Preorder===t.name||e.OrderInteractionName.Cancel===t.name||e.OrderInteractionName.Exchange===t.name||e.OrderInteractionName.Purchase===t.name||e.OrderInteractionName.Deliver===t.name}(o)?W(n,o,r):function(t){return e.CatalogObjectInteractionName.ViewCatalogObject===t.name||e.CatalogObjectInteractionName.CommentCatalogObject===t.name||e.CatalogObjectInteractionName.FavoriteCatalogObject===t.name||e.CatalogObjectInteractionName.ReviewCatalogObject===t.name||e.CatalogObjectInteractionName.ShareCatalogObject===t.name||e.CatalogObjectInteractionName.QuickViewCatalogObject===t.name||e.CatalogObjectInteractionName.ViewCatalogObjectDetail===t.name}(o)?Z(n,o,r):function(t){return e.CartInteractionName.ReplaceCart===t.name||e.CartInteractionName.AddToCart===t.name||e.CartInteractionName.RemoveFromCart===t.name}(o)?F(n,o,r):function(e,t,n){return[...Y(e,t,n),...G(e,t,n)]}(n,o,r))}function oe(e,t){var n,r;const o=R(e,t);if(function(e){return e.length>0&&e.every(e=>"opt-out"===e.status)}(o))return o;const a=function(e,t){var n;const r=null===(n=null==e?void 0:e.user)||void 0===n?void 0:n.attributes;if("object"!=typeof r)return[];const o=D(null==r?void 0:r.eventType);if(null==o)throw new Error(`Missing or invalid required "user.attributes.eventType" string in action: ${JSON.stringify(e,null,"\t")}`);return[Object.assign(Object.assign(Object.assign(Object.assign({},x(e,t)),$(e)),r),{eventType:o,category:"Profile"})]}(e,t);return(null===(r=null===(n=i())||void 0===n?void 0:n.DataCloud)||void 0===r?void 0:r.profileHasChanged)&&(0===a.length&&(a.push(Object.assign(Object.assign({},x(e,t)),{category:"Profile",eventType:"identity",isAnonymous:1})),i().log.debug(`Attaching new anonymous identity: ${s(t)}`)),i().DataCloud.profileHasChanged=!1),[...o,...a,...re(e,t)]}const ae="application/json, text/javascript, */*; q=0.01";async function ie(e,t){const o=oe(e,t),c={actionEvent:e,events:o},s=!document.dispatchEvent(new CustomEvent(l.OnBeforeEventSend,{detail:c,cancelable:!0}));if(i().getLoggingLevel()>=4&&i().log.debug(`Events translated for Data Cloud: ${JSON.stringify(o,ce,"\t")}`),o.length>0&&!s){const e=t.tenantSpecificEndpoint+"/web/events/"+t.authenticator.appSourceId,i={events:o},c=JSON.stringify(i,ce);n(l.OnEventSend,JSON.parse(c)),await async function(e,t){!function(){if("function"!=typeof window.fetch)return!1;try{return!!new Request("_",{keepalive:!0}).keepalive}catch(e){return!1}}()?await async function(e,t){const n=await r(n=>{const r=encodeURIComponent(u(t));n.open("POST",e,!0),n.setRequestHeader("Accept",ae),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.send(`event=${r}`)});if(!a(n)){const e=new Error(`Response was not OK: ${n.responseText}`);throw Object.assign(e,{status:n.status,statusText:n.statusText}),e}}(e,t):await async function(e,t){const n=encodeURIComponent(u(t)),r=new Headers;r.append("Accept",ae),r.append("Content-Type","application/x-www-form-urlencoded");const o={method:"POST",headers:r,body:`event=${n}`,credentials:"omit",keepalive:!0},a=await fetch(e,o);if(await a.text(),!a.ok){const e=new Error(`Response was not OK. Type: ${a.type}, status: ${a.status} (${a.statusText})`);throw Object.assign(e,{status:a.status,statusText:a.statusText,type:a.type}),e}}(e,t)}(e,c)}}function ce(e,t){return"boolean"==typeof t?t?1:0:t}function se(e){const t=function(e){var t,n;const i=e.tenantSpecificEndpoint+"/web/v2/authentication",c=null!==(t=e.authenticator.maxAttempts)&&void 0!==t?t:5,u=null!==(n=e.authenticator.retryDelay)&&void 0!==n?n:5;let l=!1,d=!1;return async()=>{if(l)return!0;if(d)return!1;const t=async()=>{const t=await r(t=>{const n=btoa(JSON.stringify({appSourceId:e.authenticator.appSourceId,deviceId:s(e)}));t.open("POST",i),t.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),t.send(`auth=${n}`)});if(401===t.status)throw d=!0,new Error("Unauthorized");return a(t)};for(let e=c;e>0;e--)try{if(l=await t(),l)return!0}finally{!l&&!d&&e>1&&await o(u)}throw d=!0,new Error("No more authentication retries")}}(e);return async n=>{await t()&&await ie(n,e)}}function ue(e,t){document.addEventListener(e,t),window.addEventListener("pagehide",function n(){document.removeEventListener(e,t),window.removeEventListener("pagehide",n)})}return window.getSalesforceInteractions=()=>i(),window.getSalesforceInteractionsName=()=>"SalesforceInteractions",function(r){t(r,"tenantSpecificEndpoint","authenticator"),t(r.authenticator,"appSourceId"),r.tenantSpecificEndpoint=function(e,t=""){const n="https://";try{if(e=e.trim(),/^.+:\/\/.*/.test(e)||(e=n+e),!(e=n+new URL(e).hostname).endsWith(".salesforce.com"))throw new TypeError("Invalid URL: "+e)}catch(n){if(e="",""!==t)throw new Error(t)}return e}(r.tenantSpecificEndpoint,"tenantSpecificEndpoint is invalid");const o=se(r);ue(e.CustomEvents.OnBeforeInit,async e=>{void 0!==(null==e?void 0:e.detail.sdkConfig)&&(e.detail.sdkConfig.dataCloud=r)}),ue(e.CustomEvents.OnSetAnonymousId,async e=>{const{newAnonymousId:t,previousAnonymousId:n}=e.detail;"previousAnonymousId"in e.detail&&"newAnonymousId"in e.detail&&t!==n&&(i().DataCloud.profileHasChanged=!0,i().log.debug(`deviceId has changed from "${String(n)}" to "${String(t)}"`))}),ue(e.CustomEvents.OnEventSend,async t=>{try{const n=t.detail.actionEvent;i().getConsents().findIndex(t=>t.consent.status===e.ConsentStatus.OptIn)>=0||function(t){var n;return(null===(n=null==t?void 0:t.interaction)||void 0===n?void 0:n.name)===e.MetadataUpdateInteractionName.MetadataUpdate&&Array.isArray(t.consents)&&t.consents.some(t=>t.status===e.ConsentStatus.OptOut)}(n)?await o(n):i().log.debug("event not sent to CDP because consent was not given")}catch(t){const r=t instanceof Error?t.message:"Unknown error occurred during event send";i().log.error(r),n(e.CustomEvents.OnException,{error:t})}})}}(SalesforceInteractions); try { cdpEventReceiver({ tenantSpecificEndpoint: "https://gfrd1y3fh03dqnz-g1zwczd0g0.c360a.salesforce.com", authenticator: { appSourceId: "c9c0214b-9fa3-4fe1-9fa7-c2841b826697" } }); } catch (e) { console.error("[Salesforce Data Cloud] Error initializing Web SDK:", e); } })(); (function () { // ----- module personalization - npm/@salesforce/interactions-personalization/1.0/build/dist/index.min.js [1.0.12] try { (function(y){"use strict";function vl(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var P=vl(y),El=Object.defineProperty,ji=Object.getOwnPropertySymbols,yl=Object.prototype.hasOwnProperty,_l=Object.prototype.propertyIsEnumerable,Wi=(e,t,n)=>t in e?El(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Tl=(e,t)=>{for(var n in t||(t={}))yl.call(t,n)&&Wi(e,n,t[n]);if(ji)for(var n of ji(t))_l.call(t,n)&&Wi(e,n,t[n]);return e},Sl=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});function qi(e,t=(n=>(n=window==null?void 0:window.location)==null?void 0:n.search)()){if(S(e)&&S(t)){const n=new URLSearchParams(t);return Array.from(n.keys()).find(r=>r.toLowerCase()===e.toLowerCase())!==void 0}return!1}function wl(e,t=(n=>(n=window==null?void 0:window.location)==null?void 0:n.search)()){if(S(e)&&S(t)){const n=new URLSearchParams(t),r=Array.from(n.keys()).find(i=>i.toLowerCase()===e.toLowerCase());if(S(r))return n.get(r)}return null}function bl(e,t=(n=>(n=window==null?void 0:window.location)==null?void 0:n.search)()){if(F(e)&&S(t)){const n=new URLSearchParams(t),r=e.map(o=>o.toLowerCase()),i=Array.from(n.keys()).filter(o=>r.includes(o.toLowerCase()));if(i.length>0){let o={};return i.forEach(s=>{var l;o=Tl({[s]:(l=n.get(s))!=null?l:""},o)}),o}}return null}function Il(e,t=(n=>(n=window==null?void 0:window.location)==null?void 0:n.href)()){const n=new URL(t);if(S(e)){const r=n.searchParams,i=Array.from(r.keys()).find(o=>o.toLowerCase()===e.toLowerCase());S(i)&&n.searchParams.delete(i)}return n}function S(e,t=!1,n=!0){return typeof e!="string"?!1:t?!0:(n?e.trim():e)!==""}function D(e){return typeof e=="undefined"||e===null}function F(e,t=!1){return Array.isArray(e)?t?!0:e.length!==0:!1}function Al(e,t=!1){return e instanceof Map?t?!0:e.size!==0:!1}function Cl(e,t=!1){return e instanceof Set?t?!0:e.size!==0:!1}function O(e,t=!0){if(typeof e!="object"||e===null||Array.isArray(e))return!1;if(!t){for(const n in e)return!0;return!1}return!0}function J(e,t){return O(e)&&!!Object.prototype.hasOwnProperty.call(e,t)}function kt(e,t=!0){return typeof e=="number"&&(t?Number.isFinite(e):!0)}function et(e){return typeof e=="boolean"}function gn(e){return e!==null&&!isNaN(e)&&e instanceof Date}function ir(e){return typeof e=="function"}function or(e,t){return!S(e)||!S(t)?e===t:e.toLowerCase()===t.toLowerCase()}function ar(e){return e+":"+y.generateUuid()}function $i(e){return`[${e}]`}const Pl=function(){return{pageElementVisible:function(e){return Sl(this,null,function*(){return yield new Promise(function(t){const n=(i,o)=>{for(let s=0;s{r.disconnect()}),r.observe(e)})})}}}();class Nl{constructor(t,n=50,r=!0){this.name=t,this.maxEntries=n,this.entries=new Map,r&&document.addEventListener(y.CustomEvents.OnShutDown,()=>{this.clear()})}get(t){return this.entries.get(t)}set(t,n){y.log.debug(`Cache "${this.name}": adding ${t}`,n),this.entries.set(t,n),this.trimIfNecessary()}clear(){y.log.info(`Cache "${this.name}": clearing all ${this.entries.size} entries`),this.entries.clear()}delete(t){y.log.debug(`Cache "${this.name}": deleting ${t}`),this.entries.delete(t)}trimIfNecessary(){let t=this.entries.size-this.maxEntries;if(!(kt(t)||t<=0)){y.log.info(`Cache "${this.name}": removing oldest ${String(t)} entries`);for(const[n,r]of this.entries)if(y.log.info(`Cache "${this.name}": removing value:`,r),this.entries.delete(n),--t<=0)break}}}function Ut(e,t){let n=null;try{S(t)?n=new Date(t):kt(t)?n=new Date(t):gn(t)&&(n=t)}catch(r){}if(gn(n))return n;throw new Error(`${e} is not a valid date`)}function Yi(e,t){return e.endsWith("Date")?Ut(e,t):t}function Zi(e){let t=0;switch(e){case"ERROR":t=1;break;case"WARN":t=2;break;case"INFO":t=3;break;case"DEBUG":t=4;break;case"TRACE":t=5;break}return y.log.shouldLog(t)}class k{constructor(t,n=new Date){this.detail=t,this.timestamp=n}}class sr{constructor(t){this.updates=[],D(t)?this.setFinished(Promise.reject(new Error("Never updated")),!1):this.setFinished(t)}get finished(){return this._finished}update(t,n){this.updates.push(t),this.setFinished(n)}setFinished(t,n=!0){D(t)||(this._finished=t,this._finished.catch(r=>{if(!n)return;let i;if(r instanceof Error)i=r;else{let o;S(r)?o=r:S(r.message)?o=r.message:o=String(r),i=new Error(o)}this.updates.push(new k(i))}))}}class mn{constructor(t){this.pec=t,this.status=new sr}get revertStatus(){return this._revertStatus}revert(){return D(this._revertStatus)?(D(this.initiateRevert)?this._revertStatus=new sr(Promise.resolve()):this._revertStatus=this.initiateRevert(),this._revertStatus.update(new k("Requested")),this._revertStatus):this._revertStatus}static updateForAll(t,n,r){t.forEach(i=>{i.status.update(n,r)})}}class fe extends Error{constructor(t,n,r){super(),this.name=t,this.message=n,this.cause=r==null?void 0:r.cause,this.context=r==null?void 0:r.context}isContextWithConfigName(t){return O(t)&&"configName"in t&&typeof t.configName=="string"}getConfigName(){return this.isContextWithConfigName(this.context)?this.context.configName:""}getMessageWithContext(){return this.context!==void 0?`${this.message} Context: ${JSON.stringify(this.context)}`:this.message}}var de=(e=>(e.AnchorDmoNameRequired="ANCHOR_DMO_NAME_REQUIRED",e.AnchorIdNullOrNotEmpty="ANCHOR_ID_NULL_OR_NOT_EMPTY",e.AnchorIdRequiredWithDmoName="ANCHOR_ID_REQUIRED_WITH_DMO_NAME",e.ContextIsNotAnObject="CONTEXT_IS_NOT_AN_OBJECT",e.InitRequiresAppSource="INIT_REQUIRES_APP_SOURCE",e.InitRequiresTSE="INIT_REQUIRES_TSE",e.PersonalizationPointIsNotDefined="PERSONALIZATION_POINT_IS_NOT_DEFINED",e.PersonalizationPointNameIsNotAString="PERSONALIZATION_POINT_NAME_IS_NOT_A_STRING",e.PersonalizationPointDecisionIdIsNotAString="PERSONALIZATION_POINT_DECISION_ID_IS_NOT_A_STRING",e.PersonalizationPointDecisionIdProvidedNonPreview="PERSONALIZATION_POINT_DECISION_ID_PROVIDED_NON_PREVIEW",e.PersonalizationPointsIsNotAnArray="PERSONALIZATION_POINTS_IS_NOT_AN_ARRAY",e.DecisionIdNotValid="DECISION_ID_NOT_VALID",e.EndpointOverrideNotValid="ENDPOINT_OVERRIDE_NOT_VALID",e.IndividualIdNotValid="INDIVIDUAL_ID_NOT_VALID",e))(de||{});class Ee extends fe{}var Ki=(e=>(e.PersonalizationFetchFailed="PERSONALIZATION_FETCH_FAILED",e))(Ki||{});class Xi extends fe{}var gt=(e=>(e.InvalidJsonObject="INVALID_JSON_OBJECT",e.MissingPersonalizationId="MISSING_PERSONALIZATION_ID",e.MissingPersonalizationPointName="MISSING_PERSONALIZATION_POINT_NAME",e.MissingPersonalizationDecision="MISSING_PERSONALIZATION_DECISION",e.MissingPersonalizationsArray="MISSING_PERSONALIZATIONS_ARRAY",e))(gt||{});class Ft extends fe{}var le=(e=>(e.MissingPersonalization="MISSING_PERSONALIZATION",e.ElementsNotFound="ELEMENTS_NOT_FOUND",e.FoundNonElement="FOUND_NON_ELEMENT",e.AlreadyPersonalized="ALREADY_PERSONALIZED",e.NotSupported="NOT_SUPPORTED",e.MissingSubstitutions="MISSING_SUBSTITUTIONS",e.MissingPersonalizationDataAttributes="MISSING_PERSONALIZATION_DATA_ATTRIBUTES",e.FlickerDefenseRedisplayElapsed="FLICKER_DEFENSE_REDISPLAY_ELAPSED",e))(le||{});class ie extends fe{}var j=(e=>(e.DuplicateTransformer="DUPLICATE_TRANSFORMER",e.InvalidLastModifiedDate="INVALID_LAST_MODIFIED_DATE",e.InvalidPublishedDate="INVALID_PUBLISHED_DATE",e.InvalidSubstitutionConfigType="INVALID_SUBSTITUTION_CONFIG_TYPE",e.InvalidSubstitutionDefinitionConfigDataType="INVALID_SUBSTITUTION_DEFINITION_CONFIG_DATA_TYPE",e.InvalidSubstitutionDefinitionConfigType="INVALID_SUBSTITUTION_DEFINITION_CONFIG_TYPE",e.InvalidSubstitutionDefinitionDescription="INVALID_SUBSTITUTION_DEFINITION_DESCRIPTION",e.InvalidSubstitutionDefinitionLabel="INVALID_SUBSTITUTION_DEFINITION_LABEL",e.InvalidSubstitutionDefinitions="INVALID_SUBSTITUTION_DEFINITIONS",e.InvalidSubstitutionDefinitionValue="INVALID_SUBSTITUTION_DEFINITION_VALUE",e.InvalidTransformerCategory="INVALID_TRANSFORMER_CATEGORY",e.InvalidTransformerDescription="INVALID_TRANSFORMER_DESCRIPTION",e.InvalidTransformerLabel="INVALID_TRANSFORMER_LABEL",e.InvalidTransformerSchemaReference="INVALID_TRANSFORMER_SCHEMA_REFERENCE",e.InvalidTransformerType="INVALID_TRANSFORMER_TYPE",e.InvalidTransformerTypeDetails="INVALID_TRANSFORMER_TYPE_DETAILS",e.InvalidTransformerTypeDetailsType="INVALID_TRANSFORMER_TYPE_DETAILS_TYPE",e.InvalidTransformerTypeForCategory="INVALID_TRANSFORMER_TYPE_FOR_CATEGORY",e.MissingImplementation="MISSING_IMPLEMENTATION",e.MissingTransformer="MISSING_TRANSFORMER",e.MissingTransformerName="MISSING_TRANSFORMER_NAME",e.MissingTransformerSubstitutionDefinition="MISSING_TRANSFORMER_SUBSTITUTION_DEFINITION",e.MissingTransformerSubstitutionDefinitionKey="MISSING_TRANSFORMER_SUBSTITUTION_DEFINITION_KEY",e.MissingTransformerTypeDetails="MISSING_TRANSFORMER_TYPE_DETAILS",e.MissingTransformerTypeDetailsCss="MISSING_TRANSFORMER_TYPE_DETAILS_HTML",e.MissingTransformerTypeDetailsHtml="MISSING_TRANSFORMER_TYPE_DETAILS_HTML",e))(j||{});class G extends fe{}var R=(e=>(e.ContentZonesNotAvailable="CONTENT_ZONES_NOT_AVAILABLE",e.DisabledTransformer="TRANSFORMER_IS_DISABLED",e.DuplicatePersonalizationExperienceConfig="DUPLICATE_PERSONALIZATION_EXPERIENCE_CONFIG",e.EngagementDestinationsNotAvailable="ENGAGEMENT_DESTINATIONS_NOT_AVAILABLE",e.InvalidDataProviderDataSpaceReferenceType="INVALID_DATA_PROVIDER_DATA_SPACE_REFERENCE_TYPE",e.InvalidDataProviderGroupByReferenceType="INVALID_DATA_PROVIDER_GROUP_BY_REFERENCE_TYPE",e.InvalidDataProviderGroupByType="INVALID_DATA_PROVIDER_GROUP_BY_TYPE",e.InvalidDataProviderReferenceType="INVALID_DATA_PROVIDER_REFERENCE_TYPE",e.InvalidDataProviderType="INVALID_DATA_PROVIDER_TYPE",e.InvalidDescription="INVALID_DESCRIPTION",e.InvalidLabel="INVALID_LABEL",e.InvalidLastModifiedDate="INVALID_LAST_MODIFIED_DATE",e.InvalidPublishedDate="INVALID_PUBLISHED_DATE",e.InvalidRenderIfEmpty="INVALID_RENDER_IF_EMPTY",e.InvalidSourceMatchers="INVALID_SOURCE_MATCHERS",e.InvalidSourceMatcherType="INVALID_SOURCE_MATCHER_TYPE",e.InvalidSourceMatcherValueOnlyStar="INVALID_SOURCE_MATCHER_ONLY_STAR",e.InvalidSourceMatcherValueRepeatedStars="INVALID_SOURCE_MATCHER_REPEATED_STARS",e.InvalidSourceMatcherValueSpaceWithStars="INVALID_SOURCE_MATCHER_SPACE_WITH_STARS",e.InvalidTransformationConfigEngagementDestination="INVALID_TRANSFORMATION_CONFIG_ENGAGEMENT_DESTINATION",e.InvalidTransformationConfigEngagementDestinationName="INVALID_TRANSFORMATION_CONFIG_ENGAGEMENT_DESTINATION_NAME",e.InvalidTransformationConfigMethod="INVALID_TRANSFORMATION_CONFIG_METHOD",e.InvalidTransformationConfigWhen="INVALID_TRANSFORMATION_CONFIG_WHEN",e.InvalidTransformationConfigWhenTypes="INVALID_TRANSFORMATION_CONFIG_WHEN_TYPES",e.InvalidTransformationContentZone="INVALID_TRANSFORMATION_CONTENT_ZONE",e.InvalidTransformations="INVALID_TRANSFORMATIONS",e.InvalidTransformationSubstitutionValue="INVALID_TRANSFORMATION_SUBSTITUTION_VALUE",e.InvalidTransformationSubstitutionValues="INVALID_TRANSFORMATION_SUBSTITUTION_VALUES",e.InvalidTransformationSubstitutionValueType="INVALID_TRANSFORMATION_SUBSTITUTION_VALUE_TYPE",e.InvalidTransformationType="INVALID_TRANSFORMATION_TYPE",e.InvalidTransformerName="INVALID_TRANSFORMER_NAME",e.InvalidWhenValueDelay="INVALID_WHEN_VALUE_DELAY",e.InvalidWhenValuePath="INVALID_WHEN_VALUE_PATH",e.InvalidWhenValuePercent="INVALID_WHEN_VALUE_PERCENT",e.InvalidWhenValueTag="INVALID_WHEN_VALUE_TAG",e.MethodRequiresSpecificTransformations="METHOD_REQUIRES_SPECIFIC_TRANSFORMATIONS",e.MissingConfig="MISSING_CONFIG",e.MissingDataGroupByValue="MISSING_DATA_PROVIDER_GROUP_BY_VALUE",e.MissingDataProvider="MISSING_DATA_PROVIDER",e.MissingDataProviderValue="MISSING_DATA_PROVIDER_VALUE",e.MissingDataSpaceValue="MISSING_DATA_SPACE_VALUE",e.MissingEngagementConfig=" MISSING_ENGAGEMENT_CONFIG",e.MissingEngagementConfigDefaults=" MISSING_ENGAGEMENT_CONFIG_DEFAULTS",e.MissingEngagementConfigGlobalDefault=" MISSING_ENGAGEMENT_CONFIG_GLOBAL_DEFAULT",e.MissingName="MISSING_NAME",e.MissingSourceMatchers="MISSING_SOURCE_MATCHERS",e.MissingSourceMatcherValue="MISSING_SOURCE_MATCHER_VALUE",e.MissingSubstitutionDefinitionDefaultValue="MISSING_SUBSTITUTION_DEFINITION_DEFAULT_VALUE",e.MissingTransformation="MISSING_TRANSFORMATION",e.MissingTransformationConfig="MISSING_TRANSFORMATION_CONFIG",e.MissingTransformationConfigMethod="MISSING_TRANSFORMATION_CONFIG_METHOD",e.MissingTransformationName="MISSING_TRANSFORMATION_NAME",e.MissingTransformationPath="MISSING_TRANSFORMATION_PATH",e.MissingTransformationSubstitutionValues="MISSING_TRANSFORMATION_SUBSTITUTION_VALUES",e.MissingTransformationTag="MISSING_TRANSFORMATION_TAG",e.MissingTransformerName="MISSING_TRANSFORMER_NAME",e.PaddedSourceMatcherValue="PADDED_SOURCE_MATCHER_VALUE",e.SubstitutionDefinitionKeyNotSupported="SUBSTITUTION_DEFINITION_KEY_NOT_SUPPORTED",e.TransformerDoesNotSupportSubstitutionValues="TRANSFORMER_DOES_NOT_SUPPORT_SUBSTITUTION_VALUES",e.TransformationConfigMethodNotSupported="TRANSFORMATION_CONFIG_METHOD_NOT_SUPPORTED",e.TransformationNameNotSupported="TRANSFORMATION_NAME_NOT_SUPPORTED",e.TransformationPathNotSupported="TRANSFORMATION_PATH_NOT_SUPPORTED",e.TransformationTagNotSupported="TRANSFORMATION_TAG_NOT_SUPPORTED",e.TransformersNotAvailable="TRANSFORMATIONS_NOT_AVAILABLE",e.UnexpectedError="UNEXPECTED_ERROR",e.WhenValuesNotSupported="WHEN_VALUES_NOT_SUPPORTED",e.WhenValuesValidationLogicNotImplemented="WHEN_VALUES_VALIDATION_LOGIC_NOT_IMPLEMENTED",e.WhenTypeRequiresSpecificMethodType="WHEN_TYPE_REQUIRES_SPECIFIC_METHOD_TYPE",e))(R||{});class M extends fe{}var mt=(e=>(e.MissingPersonalizationExperienceConfig="MISSING_PERSONALIZATION_EXPERIENCE_CONFIG",e.DuplicatePersonalizationExperienceConfigs="DUPLICATE_PERSONALIZATION_EXPERIENCE_CONFIGS",e.PointOptionsNotValid="POINT_OPTIONS_NOT_VALID",e.PointOptionKeyInvalid="POINT_OPTION_KEY_INVALID",e))(mt||{});class zt extends fe{}var lr=(e=>(e.OnlySupportConfiguredDataSpace="ONLY_SUPPORT_CONFIGURED_DATA_SPACE",e.OnlySupportDataProviderApiName="ONLY_SUPPORT_DATA_PROVIDER_API_NAME",e.OnlySupportDataSpaceApiName="ONLY_SUPPORT_DATA_SPACE_API_NAME",e.OnlySupportPersonalizationPoint="ONLY_SUPPORT_PERSONALIZATION_POINT",e))(lr||{});class vn extends fe{}var De=(e=>(e.AddingClickListenerError="ADDING_CLICK_LISTENER_ERROR",e.DisplayUtilsPageExitError="DISPLAY_UTILS_PAGE_EXIT_ERROR",e.DisplayUtilsPageScrollError="DISPLAY_UTILS_PAGE_SCROLL_ERROR",e.NotWaitingForElementClick="NOT_WAITING_FOR_ELEMENT_CLICK",e.NotWaitingForElementPath="NOT_WAITING_FOR_ELEMENT_PATH",e.NotWaitingForPageExit="NOT_WAITING_FOR_PAGE_EXIT",e.NotWaitingForPageScroll="NOT_WAITING_FOR_PAGE_SCROLL",e))(De||{});class Ve extends fe{}var he=(e=>(e.InvalidAllowedElements="INVALID_ALLOWED_ELEMENTS",e.InvalidAllowedElementKey="INVALID_ALLOWED_ELEMENT_KEY",e.InvalidAllowedProperties="INVALID_ALLOWED_PROPERTIES",e.InvalidAllowedTargetMethodTypeMethod="INVALID_ALLOWED_TARGET_METHOD_TYPE_METHOD",e.InvalidAllowedTargetMethodTypes="INVALID_ALLOWED_TARGET_METHOD_TYPES",e.InvalidAllowedTransformers="INVALID_ALLOWED_TRANSFORMERS",e.InvalidConfig="INVALID_CONFIG",e.InvalidConfigOptions="INVALID_CONFIG_OPTIONS",e))(he||{});class ye extends fe{}var st=(e=>(e.ConfigIsRequired="CONFIG_IS_REQUIRED",e.TransformersAreRequired="TRANSFORMERS_ARE_REQUIRED",e.WpmConfigIsRequired="WPM_CONFIG_IS_REQUIRED",e))(st||{});class vt extends fe{}var Ae=(e=>(e.MethodIsRequired="METHOD_IS_REQUIRED",e.MethodNotAllowed="METHOD_NOT_ALLOWED",e.OnlyElementsSupported="ONLY_TARGET_ELEMENTS_ARE_SUPPORTED",e.OneSourceMatcherSupported="ONE_SOURCE_MATCHER_IS_SUPPORTED",e.OneTransformerSupported="ONE_TRANSFORMER_IS_SUPPORTED",e.PropertyNotAllowed="PROPERTY_NOT_ALLOWED",e.SubstitutionValuesNotAllowed="SUBSTITUTION_VALUES_NOT_ALLOWED",e.TagsNotAllowed="TAGS_NOT_ALLOWED",e.TransformersAreDisabled="TRANSFORMERS_ARE_DISABLED",e))(Ae||{});class Me extends fe{}var q=(e=>(e.DestinationEventModifiersAreRequired="DESTINATION_EVENT_MODIFIERS_ARE_REQUIRED",e.EngagementDestinationsAreRequired="ENGAGEMENT_DESTINATIONS_ARE_REQUIRED",e.EngagementDestinationDefaultsAreRequired="ENGAGEMENT_DESTINATION_DEFAULTS_ARE_REQUIRED",e.InvalidConfig="INVALID_CONFIG",e.InvalidDestinationEventModifier="INVALID_DESTINATION_EVENT_MODIFIER",e.InvalidEngagementDestinationDefaultByName="INVALID_ENGAGEMENT_DESTINATION_DEFAULT_BY_NAME",e.InvalidEngagementDestinationDefaultByNameValue="INVALID_ENGAGEMENT_DESTINATION_DEFAULT_BY_NAME_VALUE",e.InvalidEngagementDestinationDefaultByType="INVALID_ENGAGEMENT_DESTINATION_DEFAULT_BY_TYPE",e.InvalidEngagementDestinationDefaultByTypeValue="INVALID_ENGAGEMENT_DESTINATION_DEFAULT_BY_TYPE_VALUE",e.InvalidEngagementDestinationDefaultGlobal="INVALID_ENGAGEMENT_DESTINATION_DEFAULT_GLOBAL",e.InvalidEngagementDestinationDescription="INVALID_ENGAGEMENT_DESTINATION_DESCRIPTION",e.InvalidEngagementDestinationAttributeDescription="INVALID_ENGAGEMENT_DESTINATION_ATTRIBUTE_DESCRIPTION",e.InvalidEngagementDestinationAttributeEngagements="INVALID_ENGAGEMENT_DESTINATION_ATTRIBUTE_ENGAGEMENTS",e.InvalidEngagementDestinationAttributeEngagementHandle="INVALID_ENGAGEMENT_DESTINATION_ATTRIBUTE_ENGAGEMENT_HANDLE",e.InvalidEngagementDestinationAttributeEngagementObserve="INVALID_ENGAGEMENT_DESTINATION_ATTRIBUTE_ENGAGEMENT_OBSERVE",e.InvalidEngagementDestinationAttributeEngagementQualify="INVALID_ENGAGEMENT_DESTINATION_ATTRIBUTE_ENGAGEMENT_QUALIFY",e.InvalidEngagementDestinationAttributeEngagementValue="INVALID_ENGAGEMENT_DESTINATION_ATTRIBUTE_ENGAGEMENT_VALUE",e.InvalidEngagementDestinationAttributeEventModifierModifyEvent="INVALID_ENGAGEMENT_DESTINATION_ATTRIBUTE_EVENT_MODIFIER_MODIFY_EVENT",e.InvalidEngagementDestinationAttributeEventModifiers="INVALID_ENGAGEMENT_DESTINATION_ATTRIBUTE_EVENT_MODIFIERS",e.InvalidEngagementDestinationAttributeEventModifiersValue="INVALID_ENGAGEMENT_DESTINATION_ATTRIBUTE_EVENT_MODIFIERS_VALUE",e.InvalidEngagementDestinationAttributeEventModifierValueDefault="INVALID_ENGAGEMENT_DESTINATION_ATTRIBUTE_EVENT_MODIFIER_VALUE_DEFAULT",e.InvalidEngagementDestinationAttributeEventModifierValueType="INVALID_ENGAGEMENT_DESTINATION_ATTRIBUTE_EVENT_MODIFIER_VALUE_TYPE",e.InvalidEngagementDestinationAttributes="INVALID_ENGAGEMENT_DESTINATION_ATTRIBUTES",e.InvalidEngagementDestinationAttributeScope="INVALID_ENGAGEMENT_DESTINATION_ATTRIBUTE_SCOPE",e.MissingEngagementDestinationAttributeEngagementHandle="MISSING_ENGAGEMENT_DESTINATION_ATTRIBUTE_ENGAGEMENT_HANDLE",e.MissingEngagementDestinationAttributeEngagementObserve="MISSING_ENGAGEMENT_DESTINATION_ATTRIBUTE_ENGAGEMENT_OBSERVE",e.MissingEngagementDestinationAttributeEngagementQualify="MISSING_ENGAGEMENT_DESTINATION_ATTRIBUTE_ENGAGEMENT_QUALIFY",e.MissingEngagementDestinationAttributeEventModifierModifyEvent="MISSING_ENGAGEMENT_DESTINATION_ATTRIBUTE_EVENT_MODIFIER_MODIFY_EVENT",e))(q||{});class Y extends fe{}var Be=(e=>(e.InvalidContentZoneHandlerName="INVALID_CONTENT_ZONE_HANDLER_NAME",e.InvalidContentZoneHandlerProperties="INVALID_CONTENT_ZONE_HANDLER_PROPERTIES",e.InvalidContentZoneHandlerProperty="INVALID_CONTENT_ZONE_HANDLER_PROPERTY",e))(Be||{});class tt extends fe{}class ur extends Error{constructor(t){super(t),this.name=this.constructor.name}}function Ol(e){return O(e)&&"message"in e&&typeof e.message=="string"}function X(e){if(e instanceof fe)return{message:e.getMessageWithContext()};if(Ol(e))return e;if(S(e))return{message:e};try{return new Error(JSON.stringify(e))}catch(t){return new Error(String(e))}}const Dl="personalization/decisions";var Ml=Object.defineProperty,Qi=Object.getOwnPropertySymbols,Rl=Object.prototype.hasOwnProperty,Ll=Object.prototype.propertyIsEnumerable,Ji=(e,t,n)=>t in e?Ml(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,eo=(e,t)=>{for(var n in t||(t={}))Rl.call(t,n)&&Ji(e,n,t[n]);if(Qi)for(var n of Qi(t))Ll.call(t,n)&&Ji(e,n,t[n]);return e};let En,cr,to="",Et={};function fr(){return En!=null?En:""}function xl(){return cr!=null?cr:""}function kl(){return Et}function Ht(){var e;return(e=Et==null?void 0:Et.dataspace)!=null?e:""}function Vt(){return to}function Ul(){document.addEventListener(P.CustomEvents.OnBeforeInit,e=>{var t;const n=e==null?void 0:e.detail.sdkConfig;n!==void 0&&(Et=eo(eo({},Et),(t=n.personalization)!=null?t:{}),e.detail.sdkConfig.personalization=Et)})}function Fl(){document.addEventListener(P.CustomEvents.OnInit,e=>{var t,n,r;const i=(n=(t=e==null?void 0:e.detail)==null?void 0:t.sdkConfig)==null?void 0:n.dataCloud;if(D(i)){P.log.warn("OnInit did not include Data Cloud config");return}if(!S(i.tenantSpecificEndpoint))P.log.warn("Tenant Specific Endpoint URL was not provided in Data Cloud config");else try{En=new URL(Dl,i.tenantSpecificEndpoint).toString()}catch(o){P.log.warn(`Tenant Specific Endpoint URL is not valid: ${i.tenantSpecificEndpoint}`)}!O(i.authenticator)||!S(i.authenticator.appSourceId)?P.log.warn("App Source Id was not provided in Data Cloud config"):cr=i.authenticator.appSourceId,O(document.currentScript)&&(to=(r=document.currentScript.nonce)!=null?r:"")})}function no(e){if(e===void 0){if(!S(En))throw new Ee(de.InitRequiresTSE,"Tenant Specific Endpoint URL must be set by calling SalesforceInteractions.init.")}else if(!S(e))throw new Ee(de.EndpointOverrideNotValid,"Endpoint URL must be a valid string if provided.")}function nt(){return!S(fr())}var rt=(e=>(e.EmbeddedContent="EmbeddedContent",e.Agent="Agent",e))(rt||{}),pe=(e=>(e.HtmlElementModifier="HTMLElementModifier",e.Handlebars="Handlebars",e.AgentScript="AgentScript",e))(pe||{});const zl={EmbeddedContent:{supportedTypes:["HTMLElementModifier","Handlebars"]},Agent:{supportedTypes:["AgentScript"]}};var yn=(e=>(e.String="String",e))(yn||{}),Re=(e=>(e.SchemaPath="SchemaPath",e.Static="Static",e))(Re||{}),_n=(e=>(e.PersonalizationPoint="PersonalizationPoint",e))(_n||{}),Tn=(e=>(e.ApiName="ApiName",e))(Tn||{}),ro=(e=>(e.DataGraph="DataGraph",e))(ro||{}),Ce=(e=>(e.Immediately="Immediately",e.ExitIntent="ExitIntent",e.ElementClick="ElementClick",e.ScrollPercent="ScrollPercent",e))(Ce||{}),$=(e=>(e.ReplaceContentZoneContent="ReplaceContentZoneContent",e.ReplaceElementContent="ReplaceElementContent",e.AddAfterElement="AddAfterElement",e.AddBeforeElement="AddBeforeElement",e.AddOverlay="AddOverlay",e.ContentZoneHandler="ContentZoneHandler",e))($||{});function yt(e){return e!==void 0&&e==="AddOverlay"}function it(e){return(e==null?void 0:e.tag)!==void 0}function Bt(e){return(e==null?void 0:e.name)!==void 0}function Sn(e,t){return Bt(e)&&t!==void 0&&t==="ReplaceContentZoneContent"}function dr(e,t){return Bt(e)&&t!==void 0&&t==="ContentZoneHandler"}function io(e){return e===pe.AgentScript}function oo(e){return(e==null?void 0:e.path)!==void 0}function ao(e){return(e==null?void 0:e.percent)!==void 0}function so(e){return(e==null?void 0:e.delay)!==void 0}function wn(e){return D(e)||e==="PersonalizationPoint"}const Hl="_unknown_";/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:lo,setPrototypeOf:uo,isFrozen:Vl,getPrototypeOf:Bl,getOwnPropertyDescriptor:Gl}=Object;let{freeze:ge,seal:Se,create:co}=Object,{apply:hr,construct:pr}=typeof Reflect!="undefined"&&Reflect;ge||(ge=function(t){return t}),Se||(Se=function(t){return t}),hr||(hr=function(t,n,r){return t.apply(n,r)}),pr||(pr=function(t,n){return new t(...n)});const bn=ve(Array.prototype.forEach),jl=ve(Array.prototype.lastIndexOf),fo=ve(Array.prototype.pop),Gt=ve(Array.prototype.push),Wl=ve(Array.prototype.splice),In=ve(String.prototype.toLowerCase),gr=ve(String.prototype.toString),ho=ve(String.prototype.match),jt=ve(String.prototype.replace),ql=ve(String.prototype.indexOf),$l=ve(String.prototype.trim),Pe=ve(Object.prototype.hasOwnProperty),me=ve(RegExp.prototype.test),Wt=Yl(TypeError);function ve(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i2&&arguments[2]!==void 0?arguments[2]:In;uo&&uo(e,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){const o=n(i);o!==i&&(Vl(t)||(t[r]=o),i=o)}e[i]=!0}return e}function Zl(e){for(let t=0;t/gm),eu=Se(/\$\{[\w\W]*/gm),tu=Se(/^data-[\-\w.\u00B7-\uFFFF]+$/),nu=Se(/^aria-[\-\w]+$/),Eo=Se(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ru=Se(/^(?:\w+script|data):/i),iu=Se(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),yo=Se(/^html$/i),ou=Se(/^[a-z][.\w]*(-[.\w]+)+$/i);var _o=Object.freeze({__proto__:null,ARIA_ATTR:nu,ATTR_WHITESPACE:iu,CUSTOM_ELEMENT:ou,DATA_ATTR:tu,DOCTYPE_NAME:yo,ERB_EXPR:Jl,IS_ALLOWED_URI:Eo,IS_SCRIPT_OR_DATA:ru,MUSTACHE_EXPR:Ql,TMPLIT_EXPR:eu});const $t={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},au=function(){return typeof window=="undefined"?null:window},su=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));const o="dompurify"+(r?"#"+r:"");try{return t.createPolicy(o,{createHTML(s){return s},createScriptURL(s){return s}})}catch(s){return console.warn("TrustedTypes policy "+o+" could not be created."),null}},To=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function So(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:au();const t=x=>So(x);if(t.version="3.2.6",t.removed=[],!e||!e.document||e.document.nodeType!==$t.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,i=r.currentScript,{DocumentFragment:o,HTMLTemplateElement:s,Node:l,Element:a,NodeFilter:u,NamedNodeMap:f=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:c,trustedTypes:h}=e,d=a.prototype,g=qt(d,"cloneNode"),v=qt(d,"remove"),w=qt(d,"nextSibling"),_=qt(d,"childNodes"),I=qt(d,"parentNode");if(typeof s=="function"){const x=n.createElement("template");x.content&&x.content.ownerDocument&&(n=x.content.ownerDocument)}let m,T="";const{implementation:N,createNodeIterator:A,createDocumentFragment:U,getElementsByTagName:Q}=n,{importNode:W}=r;let V=To();t.isSupported=typeof lo=="function"&&typeof I=="function"&&N&&N.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Fe,ERB_EXPR:ze,TMPLIT_EXPR:Mi,DATA_ATTR:cg,ARIA_ATTR:fg,IS_SCRIPT_OR_DATA:dg,ATTR_WHITESPACE:qs,CUSTOM_ELEMENT:hg}=_o;let{IS_ALLOWED_URI:$s}=_o,oe=null;const Ys=z({},[...po,...mr,...vr,...Er,...go]);let se=null;const Zs=z({},[...mo,...yr,...vo,...An]);let ne=Object.seal(co(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),fn=null,Ri=null,Ks=!0,Li=!0,Xs=!1,Qs=!0,Nt=!1,Kn=!0,pt=!1,xi=!1,ki=!1,Ot=!1,Xn=!1,Qn=!1,Js=!0,el=!1;const pg="user-content-";let Ui=!0,dn=!1,Dt={},Mt=null;const tl=z({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let nl=null;const rl=z({},["audio","video","img","source","image","track"]);let Fi=null;const il=z({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Jn="http://www.w3.org/1998/Math/MathML",er="http://www.w3.org/2000/svg",Xe="http://www.w3.org/1999/xhtml";let Rt=Xe,zi=!1,Hi=null;const gg=z({},[Jn,er,Xe],gr);let tr=z({},["mi","mo","mn","ms","mtext"]),nr=z({},["annotation-xml"]);const mg=z({},["title","style","font","a","script"]);let hn=null;const vg=["application/xhtml+xml","text/html"],Eg="text/html";let ae=null,Lt=null;const yg=n.createElement("form"),ol=function(E){return E instanceof RegExp||E instanceof Function},Vi=function(){let E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Lt&&Lt===E)){if((!E||typeof E!="object")&&(E={}),E=Ge(E),hn=vg.indexOf(E.PARSER_MEDIA_TYPE)===-1?Eg:E.PARSER_MEDIA_TYPE,ae=hn==="application/xhtml+xml"?gr:In,oe=Pe(E,"ALLOWED_TAGS")?z({},E.ALLOWED_TAGS,ae):Ys,se=Pe(E,"ALLOWED_ATTR")?z({},E.ALLOWED_ATTR,ae):Zs,Hi=Pe(E,"ALLOWED_NAMESPACES")?z({},E.ALLOWED_NAMESPACES,gr):gg,Fi=Pe(E,"ADD_URI_SAFE_ATTR")?z(Ge(il),E.ADD_URI_SAFE_ATTR,ae):il,nl=Pe(E,"ADD_DATA_URI_TAGS")?z(Ge(rl),E.ADD_DATA_URI_TAGS,ae):rl,Mt=Pe(E,"FORBID_CONTENTS")?z({},E.FORBID_CONTENTS,ae):tl,fn=Pe(E,"FORBID_TAGS")?z({},E.FORBID_TAGS,ae):Ge({}),Ri=Pe(E,"FORBID_ATTR")?z({},E.FORBID_ATTR,ae):Ge({}),Dt=Pe(E,"USE_PROFILES")?E.USE_PROFILES:!1,Ks=E.ALLOW_ARIA_ATTR!==!1,Li=E.ALLOW_DATA_ATTR!==!1,Xs=E.ALLOW_UNKNOWN_PROTOCOLS||!1,Qs=E.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Nt=E.SAFE_FOR_TEMPLATES||!1,Kn=E.SAFE_FOR_XML!==!1,pt=E.WHOLE_DOCUMENT||!1,Ot=E.RETURN_DOM||!1,Xn=E.RETURN_DOM_FRAGMENT||!1,Qn=E.RETURN_TRUSTED_TYPE||!1,ki=E.FORCE_BODY||!1,Js=E.SANITIZE_DOM!==!1,el=E.SANITIZE_NAMED_PROPS||!1,Ui=E.KEEP_CONTENT!==!1,dn=E.IN_PLACE||!1,$s=E.ALLOWED_URI_REGEXP||Eo,Rt=E.NAMESPACE||Xe,tr=E.MATHML_TEXT_INTEGRATION_POINTS||tr,nr=E.HTML_INTEGRATION_POINTS||nr,ne=E.CUSTOM_ELEMENT_HANDLING||{},E.CUSTOM_ELEMENT_HANDLING&&ol(E.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ne.tagNameCheck=E.CUSTOM_ELEMENT_HANDLING.tagNameCheck),E.CUSTOM_ELEMENT_HANDLING&&ol(E.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ne.attributeNameCheck=E.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),E.CUSTOM_ELEMENT_HANDLING&&typeof E.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ne.allowCustomizedBuiltInElements=E.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Nt&&(Li=!1),Xn&&(Ot=!0),Dt&&(oe=z({},go),se=[],Dt.html===!0&&(z(oe,po),z(se,mo)),Dt.svg===!0&&(z(oe,mr),z(se,yr),z(se,An)),Dt.svgFilters===!0&&(z(oe,vr),z(se,yr),z(se,An)),Dt.mathMl===!0&&(z(oe,Er),z(se,vo),z(se,An))),E.ADD_TAGS&&(oe===Ys&&(oe=Ge(oe)),z(oe,E.ADD_TAGS,ae)),E.ADD_ATTR&&(se===Zs&&(se=Ge(se)),z(se,E.ADD_ATTR,ae)),E.ADD_URI_SAFE_ATTR&&z(Fi,E.ADD_URI_SAFE_ATTR,ae),E.FORBID_CONTENTS&&(Mt===tl&&(Mt=Ge(Mt)),z(Mt,E.FORBID_CONTENTS,ae)),Ui&&(oe["#text"]=!0),pt&&z(oe,["html","head","body"]),oe.table&&(z(oe,["tbody"]),delete fn.tbody),E.TRUSTED_TYPES_POLICY){if(typeof E.TRUSTED_TYPES_POLICY.createHTML!="function")throw Wt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof E.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Wt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');m=E.TRUSTED_TYPES_POLICY,T=m.createHTML("")}else m===void 0&&(m=su(h,i)),m!==null&&typeof T=="string"&&(T=m.createHTML(""));ge&&ge(E),Lt=E}},al=z({},[...mr,...vr,...Kl]),sl=z({},[...Er,...Xl]),_g=function(E){let C=I(E);(!C||!C.tagName)&&(C={namespaceURI:Rt,tagName:"template"});const L=In(E.tagName),ee=In(C.tagName);return Hi[E.namespaceURI]?E.namespaceURI===er?C.namespaceURI===Xe?L==="svg":C.namespaceURI===Jn?L==="svg"&&(ee==="annotation-xml"||tr[ee]):!!al[L]:E.namespaceURI===Jn?C.namespaceURI===Xe?L==="math":C.namespaceURI===er?L==="math"&&nr[ee]:!!sl[L]:E.namespaceURI===Xe?C.namespaceURI===er&&!nr[ee]||C.namespaceURI===Jn&&!tr[ee]?!1:!sl[L]&&(mg[L]||!al[L]):!!(hn==="application/xhtml+xml"&&Hi[E.namespaceURI]):!1},He=function(E){Gt(t.removed,{element:E});try{I(E).removeChild(E)}catch(C){v(E)}},xt=function(E,C){try{Gt(t.removed,{attribute:C.getAttributeNode(E),from:C})}catch(L){Gt(t.removed,{attribute:null,from:C})}if(C.removeAttribute(E),E==="is")if(Ot||Xn)try{He(C)}catch(L){}else try{C.setAttribute(E,"")}catch(L){}},ll=function(E){let C=null,L=null;if(ki)E=""+E;else{const re=ho(E,/^[\r\n\t ]+/);L=re&&re[0]}hn==="application/xhtml+xml"&&Rt===Xe&&(E=''+E+"");const ee=m?m.createHTML(E):E;if(Rt===Xe)try{C=new c().parseFromString(ee,hn)}catch(re){}if(!C||!C.documentElement){C=N.createDocument(Rt,"template",null);try{C.documentElement.innerHTML=zi?T:ee}catch(re){}}const ue=C.body||C.documentElement;return E&&L&&ue.insertBefore(n.createTextNode(L),ue.childNodes[0]||null),Rt===Xe?Q.call(C,pt?"html":"body")[0]:pt?C.documentElement:ue},ul=function(E){return A.call(E.ownerDocument||E,E,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Bi=function(E){return E instanceof p&&(typeof E.nodeName!="string"||typeof E.textContent!="string"||typeof E.removeChild!="function"||!(E.attributes instanceof f)||typeof E.removeAttribute!="function"||typeof E.setAttribute!="function"||typeof E.namespaceURI!="string"||typeof E.insertBefore!="function"||typeof E.hasChildNodes!="function")},cl=function(E){return typeof l=="function"&&E instanceof l};function Qe(x,E,C){bn(x,L=>{L.call(t,E,C,Lt)})}const fl=function(E){let C=null;if(Qe(V.beforeSanitizeElements,E,null),Bi(E))return He(E),!0;const L=ae(E.nodeName);if(Qe(V.uponSanitizeElement,E,{tagName:L,allowedTags:oe}),Kn&&E.hasChildNodes()&&!cl(E.firstElementChild)&&me(/<[/\w!]/g,E.innerHTML)&&me(/<[/\w!]/g,E.textContent)||E.nodeType===$t.progressingInstruction||Kn&&E.nodeType===$t.comment&&me(/<[/\w]/g,E.data))return He(E),!0;if(!oe[L]||fn[L]){if(!fn[L]&&hl(L)&&(ne.tagNameCheck instanceof RegExp&&me(ne.tagNameCheck,L)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(L)))return!1;if(Ui&&!Mt[L]){const ee=I(E)||E.parentNode,ue=_(E)||E.childNodes;if(ue&&ee){const re=ue.length;for(let _e=re-1;_e>=0;--_e){const Je=g(ue[_e],!0);Je.__removalCount=(E.__removalCount||0)+1,ee.insertBefore(Je,w(E))}}}return He(E),!0}return E instanceof a&&!_g(E)||(L==="noscript"||L==="noembed"||L==="noframes")&&me(/<\/no(script|embed|frames)/i,E.innerHTML)?(He(E),!0):(Nt&&E.nodeType===$t.text&&(C=E.textContent,bn([Fe,ze,Mi],ee=>{C=jt(C,ee," ")}),E.textContent!==C&&(Gt(t.removed,{element:E.cloneNode()}),E.textContent=C)),Qe(V.afterSanitizeElements,E,null),!1)},dl=function(E,C,L){if(Js&&(C==="id"||C==="name")&&(L in n||L in yg))return!1;if(!(Li&&!Ri[C]&&me(cg,C))){if(!(Ks&&me(fg,C))){if(!se[C]||Ri[C]){if(!(hl(E)&&(ne.tagNameCheck instanceof RegExp&&me(ne.tagNameCheck,E)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(E))&&(ne.attributeNameCheck instanceof RegExp&&me(ne.attributeNameCheck,C)||ne.attributeNameCheck instanceof Function&&ne.attributeNameCheck(C))||C==="is"&&ne.allowCustomizedBuiltInElements&&(ne.tagNameCheck instanceof RegExp&&me(ne.tagNameCheck,L)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(L))))return!1}else if(!Fi[C]){if(!me($s,jt(L,qs,""))){if(!((C==="src"||C==="xlink:href"||C==="href")&&E!=="script"&&ql(L,"data:")===0&&nl[E])){if(!(Xs&&!me(dg,jt(L,qs,"")))){if(L)return!1}}}}}}return!0},hl=function(E){return E!=="annotation-xml"&&ho(E,hg)},pl=function(E){Qe(V.beforeSanitizeAttributes,E,null);const{attributes:C}=E;if(!C||Bi(E))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:se,forceKeepAttr:void 0};let ee=C.length;for(;ee--;){const ue=C[ee],{name:re,namespaceURI:_e,value:Je}=ue,pn=ae(re),Gi=Je;let ce=re==="value"?Gi:$l(Gi);if(L.attrName=pn,L.attrValue=ce,L.keepAttr=!0,L.forceKeepAttr=void 0,Qe(V.uponSanitizeAttribute,E,L),ce=L.attrValue,el&&(pn==="id"||pn==="name")&&(xt(re,E),ce=pg+ce),Kn&&me(/((--!?|])>)|<\/(style|title)/i,ce)){xt(re,E);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){xt(re,E);continue}if(!Qs&&me(/\/>/i,ce)){xt(re,E);continue}Nt&&bn([Fe,ze,Mi],ml=>{ce=jt(ce,ml," ")});const gl=ae(E.nodeName);if(!dl(gl,pn,ce)){xt(re,E);continue}if(m&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!_e)switch(h.getAttributeType(gl,pn)){case"TrustedHTML":{ce=m.createHTML(ce);break}case"TrustedScriptURL":{ce=m.createScriptURL(ce);break}}if(ce!==Gi)try{_e?E.setAttributeNS(_e,re,ce):E.setAttribute(re,ce),Bi(E)?He(E):fo(t.removed)}catch(ml){xt(re,E)}}Qe(V.afterSanitizeAttributes,E,null)},Tg=function x(E){let C=null;const L=ul(E);for(Qe(V.beforeSanitizeShadowDOM,E,null);C=L.nextNode();)Qe(V.uponSanitizeShadowNode,C,null),fl(C),pl(C),C.content instanceof o&&x(C.content);Qe(V.afterSanitizeShadowDOM,E,null)};return t.sanitize=function(x){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C=null,L=null,ee=null,ue=null;if(zi=!x,zi&&(x=""),typeof x!="string"&&!cl(x))if(typeof x.toString=="function"){if(x=x.toString(),typeof x!="string")throw Wt("dirty is not a string, aborting")}else throw Wt("toString is not a function");if(!t.isSupported)return x;if(xi||Vi(E),t.removed=[],typeof x=="string"&&(dn=!1),dn){if(x.nodeName){const Je=ae(x.nodeName);if(!oe[Je]||fn[Je])throw Wt("root node is forbidden and cannot be sanitized in-place")}}else if(x instanceof l)C=ll(""),L=C.ownerDocument.importNode(x,!0),L.nodeType===$t.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?C=L:C.appendChild(L);else{if(!Ot&&!Nt&&!pt&&x.indexOf("<")===-1)return m&&Qn?m.createHTML(x):x;if(C=ll(x),!C)return Ot?null:Qn?T:""}C&&ki&&He(C.firstChild);const re=ul(dn?x:C);for(;ee=re.nextNode();)fl(ee),pl(ee),ee.content instanceof o&&Tg(ee.content);if(dn)return x;if(Ot){if(Xn)for(ue=U.call(C.ownerDocument);C.firstChild;)ue.appendChild(C.firstChild);else ue=C;return(se.shadowroot||se.shadowrootmode)&&(ue=W.call(r,ue,!0)),ue}let _e=pt?C.outerHTML:C.innerHTML;return pt&&oe["!doctype"]&&C.ownerDocument&&C.ownerDocument.doctype&&C.ownerDocument.doctype.name&&me(yo,C.ownerDocument.doctype.name)&&(_e=" `+_e),Nt&&bn([Fe,ze,Mi],Je=>{_e=jt(_e,Je," ")}),m&&Qn?m.createHTML(_e):_e},t.setConfig=function(){let x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Vi(x),xi=!0},t.clearConfig=function(){Lt=null,xi=!1},t.isValidAttribute=function(x,E,C){Lt||Vi({});const L=ae(x),ee=ae(E);return dl(L,ee,C)},t.addHook=function(x,E){typeof E=="function"&&Gt(V[x],E)},t.removeHook=function(x,E){if(E!==void 0){const C=jl(V[x],E);return C===-1?void 0:Wl(V[x],C,1)[0]}return fo(V[x])},t.removeHooks=function(x){V[x]=[]},t.removeAllHooks=function(){V=To()},t}var lu=So();class uu{sanitizeString(t){if(!S(t))return"";try{return lu.sanitize(t)}catch(n){return y.log.error("could not verify that content was safe",n),""}}sanitizeObject(t){const n=F(t);if(!O(t)&&!n)if(S(t))try{return this.sanitizeString(String(t))}catch(r){return y.log.error("could not verify that content was safe",r),""}else return t;if(n)return this.sanitizeArray(t);for(const r in t)O(t[r])?t[r]=this.sanitizeObject(t[r]):F(t[r])?t[r]=this.sanitizeArray(t[r]):J(t,r)&&(t[r]=this.sanitizeObject(t[r]));return t}sanitizeArray(t){if(!F(t))return[];for(let n=0;n(e.TransformerConfig="TransformerConfig",e.Element="Element",e.Any="Any",e))(ut||{}),Nn=(e=>(e.SchemaPath="SchemaPath",e))(Nn||{});class du{add(t,n,r){if(typeof arguments[0]!="string")for(let i in arguments[0])this.add(i,arguments[0][i],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(i){this[i]=this[i]||[],n&&this[i][r?"unshift":"push"](n)},this)}run(t,n){this[t]=this[t]||[],this[t].forEach(function(r){r.call(n&&n.context?n.context:n,n)})}}class hu{constructor(t){this.jsep=t,this.registered={}}register(){for(var t=arguments.length,n=new Array(t),r=0;r{if(typeof i!="object"||!i.name||!i.init)throw new Error("Invalid JSEP plugin format");this.registered[i.name]||(i.init(this.jsep),this.registered[i.name]=i)})}}class b{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+b.version}static addUnaryOp(t){return b.max_unop_len=Math.max(t.length,b.max_unop_len),b.unary_ops[t]=1,b}static addBinaryOp(t,n,r){return b.max_binop_len=Math.max(t.length,b.max_binop_len),b.binary_ops[t]=n,r?b.right_associative.add(t):b.right_associative.delete(t),b}static addIdentifierChar(t){return b.additional_identifier_chars.add(t),b}static addLiteral(t,n){return b.literals[t]=n,b}static removeUnaryOp(t){return delete b.unary_ops[t],t.length===b.max_unop_len&&(b.max_unop_len=b.getMaxKeyLen(b.unary_ops)),b}static removeAllUnaryOps(){return b.unary_ops={},b.max_unop_len=0,b}static removeIdentifierChar(t){return b.additional_identifier_chars.delete(t),b}static removeBinaryOp(t){return delete b.binary_ops[t],t.length===b.max_binop_len&&(b.max_binop_len=b.getMaxKeyLen(b.binary_ops)),b.right_associative.delete(t),b}static removeAllBinaryOps(){return b.binary_ops={},b.max_binop_len=0,b}static removeLiteral(t){return delete b.literals[t],b}static removeAllLiterals(){return b.literals={},b}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new b(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(n=>n.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return b.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!b.binary_ops[String.fromCharCode(t)]||b.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return b.isIdentifierStart(t)||b.isDecimalDigit(t)}throwError(t){const n=new Error(t+" at character "+this.index);throw n.index=this.index,n.description=t,n}runHook(t,n){if(b.hooks[t]){const r={context:this,node:n};return b.hooks.run(t,r),r.node}return n}searchHook(t){if(b.hooks[t]){const n={context:this};return b.hooks[t].find(function(r){return r.call(n.context,n),n.node}),n.node}}gobbleSpaces(){let t=this.code;for(;t===b.SPACE_CODE||t===b.TAB_CODE||t===b.LF_CODE||t===b.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const t=this.gobbleExpressions(),n=t.length===1?t[0]:{type:b.COMPOUND,body:t};return this.runHook("after-all",n)}gobbleExpressions(t){let n=[],r,i;for(;this.index0;){if(b.binary_ops.hasOwnProperty(t)&&(!b.isIdentifierStart(this.code)||this.index+t.lengtho.right_a&&p.right_a?r>p.prec:r<=p.prec;for(;i.length>2&&f(i[i.length-2]);)l=i.pop(),n=i.pop().value,s=i.pop(),t={type:b.BINARY_EXP,operator:n,left:s,right:l},i.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+u),i.push(o,t)}for(a=i.length-1,t=i[a];a>1;)t={type:b.BINARY_EXP,operator:i[a-1].value,left:i[a-2],right:t},a-=2;return t}gobbleToken(){let t,n,r,i;if(this.gobbleSpaces(),i=this.searchHook("gobble-token"),i)return this.runHook("after-token",i);if(t=this.code,b.isDecimalDigit(t)||t===b.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===b.SQUOTE_CODE||t===b.DQUOTE_CODE)i=this.gobbleStringLiteral();else if(t===b.OBRACK_CODE)i=this.gobbleArray();else{for(n=this.expr.substr(this.index,b.max_unop_len),r=n.length;r>0;){if(b.unary_ops.hasOwnProperty(n)&&(!b.isIdentifierStart(this.code)||this.index+n.length=n.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(o===b.COMMA_CODE){if(this.index++,i++,i!==n.length){if(t===b.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===b.CBRACK_CODE)for(let s=n.length;s":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),b.max_unop_len=b.getMaxKeyLen(b.unary_ops),b.max_binop_len=b.getMaxKeyLen(b.binary_ops);const je=e=>new b(e).parse(),gu=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(b).filter(e=>!gu.includes(e)&&je[e]===void 0).forEach(e=>{je[e]=b[e]}),je.Jsep=b;const mu="ConditionalExpression";var vu={name:"ternary",init(e){e.hooks.add("after-expression",function(n){if(n.node&&this.code===e.QUMARK_CODE){this.index++;const r=n.node,i=this.gobbleExpression();if(i||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const o=this.gobbleExpression();if(o||this.throwError("Expected expression"),n.node={type:mu,test:r,consequent:i,alternate:o},r.operator&&e.binary_ops[r.operator]<=.9){let s=r;for(;s.right.operator&&e.binary_ops[s.right.operator]<=.9;)s=s.right;n.node.test=s.right,s.right=n.node,n.node=r}}else this.throwError("Expected :")}})}};je.plugins.register(vu);const Ao=47,Eu=92;var yu={name:"regex",init(e){e.hooks.add("gobble-token",function(n){if(this.code===Ao){const r=++this.index;let i=!1;for(;this.index=97&&a<=122||a>=65&&a<=90||a>=48&&a<=57)s+=this.char;else break}let l;try{l=new RegExp(o,s)}catch(a){this.throwError(a.message)}return n.node={type:e.LITERAL,value:l,raw:this.expr.slice(r-1,this.index)},n.node=this.gobbleTokenProperty(n.node),n.node}this.code===e.OBRACK_CODE?i=!0:i&&this.code===e.CBRACK_CODE&&(i=!1),this.index+=this.code===Eu?2:1}this.throwError("Unclosed Regex")}})}};const Tr=43,At={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[Tr,45],assignmentPrecedence:.9,init(e){const t=[e.IDENTIFIER,e.MEMBER_EXP];At.assignmentOperators.forEach(r=>e.addBinaryOp(r,At.assignmentPrecedence,!0)),e.hooks.add("gobble-token",function(i){const o=this.code;At.updateOperators.some(s=>s===o&&s===this.expr.charCodeAt(this.index+1))&&(this.index+=2,i.node={type:"UpdateExpression",operator:o===Tr?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},(!i.node.argument||!t.includes(i.node.argument.type))&&this.throwError(`Unexpected ${i.node.operator}`))}),e.hooks.add("after-token",function(i){if(i.node){const o=this.code;At.updateOperators.some(s=>s===o&&s===this.expr.charCodeAt(this.index+1))&&(t.includes(i.node.type)||this.throwError(`Unexpected ${i.node.operator}`),this.index+=2,i.node={type:"UpdateExpression",operator:o===Tr?"++":"--",argument:i.node,prefix:!1})}}),e.hooks.add("after-expression",function(i){i.node&&n(i.node)});function n(r){At.assignmentOperators.has(r.operator)?(r.type="AssignmentExpression",n(r.left),n(r.right)):r.operator||Object.values(r).forEach(i=>{i&&typeof i=="object"&&n(i)})}}};je.plugins.register(yu,At),je.addUnaryOp("typeof"),je.addLiteral("null",null),je.addLiteral("undefined",void 0);const _u=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),Z={evalAst(e,t){switch(e.type){case"BinaryExpression":case"LogicalExpression":return Z.evalBinaryExpression(e,t);case"Compound":return Z.evalCompound(e,t);case"ConditionalExpression":return Z.evalConditionalExpression(e,t);case"Identifier":return Z.evalIdentifier(e,t);case"Literal":return Z.evalLiteral(e,t);case"MemberExpression":return Z.evalMemberExpression(e,t);case"UnaryExpression":return Z.evalUnaryExpression(e,t);case"ArrayExpression":return Z.evalArrayExpression(e,t);case"CallExpression":return Z.evalCallExpression(e,t);case"AssignmentExpression":return Z.evalAssignmentExpression(e,t);default:throw SyntaxError("Unexpected expression",e)}},evalBinaryExpression(e,t){return{"||":(r,i)=>r||i(),"&&":(r,i)=>r&&i(),"|":(r,i)=>r|i(),"^":(r,i)=>r^i(),"&":(r,i)=>r&i(),"==":(r,i)=>r==i(),"!=":(r,i)=>r!=i(),"===":(r,i)=>r===i(),"!==":(r,i)=>r!==i(),"<":(r,i)=>r":(r,i)=>r>i(),"<=":(r,i)=>r<=i(),">=":(r,i)=>r>=i(),"<<":(r,i)=>r<>":(r,i)=>r>>i(),">>>":(r,i)=>r>>>i(),"+":(r,i)=>r+i(),"-":(r,i)=>r-i(),"*":(r,i)=>r*i(),"/":(r,i)=>r/i(),"%":(r,i)=>r%i()}[e.operator](Z.evalAst(e.left,t),()=>Z.evalAst(e.right,t))},evalCompound(e,t){let n;for(let r=0;r-Z.evalAst(r,t),"!":r=>!Z.evalAst(r,t),"~":r=>~Z.evalAst(r,t),"+":r=>+Z.evalAst(r,t),typeof:r=>typeof Z.evalAst(r,t)}[e.operator](e.argument)},evalArrayExpression(e,t){return e.elements.map(n=>Z.evalAst(n,t))},evalCallExpression(e,t){const n=e.arguments.map(i=>Z.evalAst(i,t));return Z.evalAst(e.callee,t)(...n)},evalAssignmentExpression(e,t){if(e.left.type!=="Identifier")throw SyntaxError("Invalid left-hand side in assignment");const n=e.left.name,r=Z.evalAst(e.right,t);return t[n]=r,t[n]}};class Tu{constructor(t){this.code=t,this.ast=je(this.code)}runInNewContext(t){const n=Object.assign(Object.create(null),t);return Z.evalAst(this.ast,n)}}function ot(e,t){return e=e.slice(),e.push(t),e}function Sr(e,t){return t=t.slice(),t.unshift(e),t}class Su extends Error{constructor(t){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=t,this.name="NewError"}}function B(e,t,n,r,i){if(!(this instanceof B))try{return new B(e,t,n,r,i)}catch(s){if(!s.avoidNew)throw s;return s.value}typeof e=="string"&&(i=r,r=n,n=t,t=e,e=null);const o=e&&typeof e=="object";if(e=e||{},this.json=e.json||n,this.path=e.path||t,this.resultType=e.resultType||"value",this.flatten=e.flatten||!1,this.wrap=Object.hasOwn(e,"wrap")?e.wrap:!0,this.sandbox=e.sandbox||{},this.eval=e.eval===void 0?"safe":e.eval,this.ignoreEvalErrors=typeof e.ignoreEvalErrors=="undefined"?!1:e.ignoreEvalErrors,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||r||null,this.otherTypeCallback=e.otherTypeCallback||i||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},e.autostart!==!1){const s={path:o?e.path:t};o?"json"in e&&(s.json=e.json):s.json=n;const l=this.evaluate(s);if(!l||typeof l!="object")throw new Su(l);return l}}B.prototype.evaluate=function(e,t,n,r){let i=this.parent,o=this.parentProperty,{flatten:s,wrap:l}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,n=n||this.callback,this.currOtherTypeCallback=r||this.otherTypeCallback,t=t||this.json,e=e||this.path,e&&typeof e=="object"&&!Array.isArray(e)){if(!e.path&&e.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),s=Object.hasOwn(e,"flatten")?e.flatten:s,this.currResultType=Object.hasOwn(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=Object.hasOwn(e,"sandbox")?e.sandbox:this.currSandbox,l=Object.hasOwn(e,"wrap")?e.wrap:l,this.currEval=Object.hasOwn(e,"eval")?e.eval:this.currEval,n=Object.hasOwn(e,"callback")?e.callback:n,this.currOtherTypeCallback=Object.hasOwn(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,i=Object.hasOwn(e,"parent")?e.parent:i,o=Object.hasOwn(e,"parentProperty")?e.parentProperty:o,e=e.path}if(i=i||null,o=o||null,Array.isArray(e)&&(e=B.toPathString(e)),!e&&e!==""||!t)return;const a=B.toPathArray(e);a[0]==="$"&&a.length>1&&a.shift(),this._hasParentSelector=null;const u=this._trace(a,t,["$"],i,o,n).filter(function(f){return f&&!f.isParentSelector});return u.length?!l&&u.length===1&&!u[0].hasArrExpr?this._getPreferredOutput(u[0]):u.reduce((f,p)=>{const c=this._getPreferredOutput(p);return s&&Array.isArray(c)?f=f.concat(c):f.push(c),f},[]):l?[]:void 0},B.prototype._getPreferredOutput=function(e){const t=this.currResultType;switch(t){case"all":{const n=Array.isArray(e.path)?e.path:B.toPathArray(e.path);return e.pointer=B.toPointer(n),e.path=typeof e.path=="string"?e.path:B.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return B.toPathString(e[t]);case"pointer":return B.toPointer(e.path);default:throw new TypeError("Unknown result type")}},B.prototype._handleCallback=function(e,t,n){if(t){const r=this._getPreferredOutput(e);e.path=typeof e.path=="string"?e.path:B.toPathString(e.path),t(r,n,e)}},B.prototype._trace=function(e,t,n,r,i,o,s,l){let a;if(!e.length)return a={path:n,value:t,parent:r,parentProperty:i,hasArrExpr:s},this._handleCallback(a,o,"value"),a;const u=e[0],f=e.slice(1),p=[];function c(h){Array.isArray(h)?h.forEach(d=>{p.push(d)}):p.push(h)}if((typeof u!="string"||l)&&t&&Object.hasOwn(t,u))c(this._trace(f,t[u],ot(n,u),t,u,o,s));else if(u==="*")this._walk(t,h=>{c(this._trace(f,t[h],ot(n,h),t,h,o,!0,!0))});else if(u==="..")c(this._trace(f,t,n,r,i,o,s)),this._walk(t,h=>{typeof t[h]=="object"&&c(this._trace(e.slice(),t[h],ot(n,h),t,h,o,!0))});else{if(u==="^")return this._hasParentSelector=!0,{path:n.slice(0,-1),expr:f,isParentSelector:!0};if(u==="~")return a={path:ot(n,u),value:i,parent:r,parentProperty:null},this._handleCallback(a,o,"property"),a;if(u==="$")c(this._trace(f,t,n,null,null,o,s));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(u))c(this._slice(u,f,t,n,r,i,o));else if(u.indexOf("?(")===0){if(this.currEval===!1)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const h=u.replace(/^\?\((.*?)\)$/u,"$1"),d=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(h);d?this._walk(t,g=>{const v=[d[2]],w=d[1]?t[g][d[1]]:t[g];this._trace(v,w,n,r,i,o,!0).length>0&&c(this._trace(f,t[g],ot(n,g),t,g,o,!0))}):this._walk(t,g=>{this._eval(h,t[g],g,n,r,i)&&c(this._trace(f,t[g],ot(n,g),t,g,o,!0))})}else if(u[0]==="("){if(this.currEval===!1)throw new Error("Eval [(expr)] prevented in JSONPath expression.");c(this._trace(Sr(this._eval(u,t,n.at(-1),n.slice(0,-1),r,i),f),t,n,r,i,o,s))}else if(u[0]==="@"){let h=!1;const d=u.slice(1,-2);switch(d){case"scalar":(!t||!["object","function"].includes(typeof t))&&(h=!0);break;case"boolean":case"string":case"undefined":case"function":typeof t===d&&(h=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(h=!0);break;case"number":Number.isFinite(t)&&(h=!0);break;case"nonFinite":typeof t=="number"&&!Number.isFinite(t)&&(h=!0);break;case"object":t&&typeof t===d&&(h=!0);break;case"array":Array.isArray(t)&&(h=!0);break;case"other":h=this.currOtherTypeCallback(t,n,r,i);break;case"null":t===null&&(h=!0);break;default:throw new TypeError("Unknown value type "+d)}if(h)return a={path:n,value:t,parent:r,parentProperty:i},this._handleCallback(a,o,"value"),a}else if(u[0]==="`"&&t&&Object.hasOwn(t,u.slice(1))){const h=u.slice(1);c(this._trace(f,t[h],ot(n,h),t,h,o,s,!0))}else if(u.includes(",")){const h=u.split(",");for(const d of h)c(this._trace(Sr(d,f),t,n,r,i,o,!0))}else!l&&t&&Object.hasOwn(t,u)&&c(this._trace(f,t[u],ot(n,u),t,u,o,s,!0))}if(this._hasParentSelector)for(let h=0;h{t(n)})},B.prototype._slice=function(e,t,n,r,i,o,s){if(!Array.isArray(n))return;const l=n.length,a=e.split(":"),u=a[2]&&Number.parseInt(a[2])||1;let f=a[0]&&Number.parseInt(a[0])||0,p=a[1]&&Number.parseInt(a[1])||l;f=f<0?Math.max(0,f+l):Math.min(l,f),p=p<0?Math.max(0,p+l):Math.min(l,p);const c=[];for(let h=f;h{c.push(g)});return c},B.prototype._eval=function(e,t,n,r,i,o){this.currSandbox._$_parentProperty=o,this.currSandbox._$_parent=i,this.currSandbox._$_property=n,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;const s=e.includes("@path");s&&(this.currSandbox._$_path=B.toPathString(r.concat([n])));const l=this.currEval+"Script:"+e;if(!B.cache[l]){let a=e.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(s&&(a=a.replaceAll("@path","_$_path")),this.currEval==="safe"||this.currEval===!0||this.currEval===void 0)B.cache[l]=new this.safeVm.Script(a);else if(this.currEval==="native")B.cache[l]=new this.vm.Script(a);else if(typeof this.currEval=="function"&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const u=this.currEval;B.cache[l]=new u(a)}else if(typeof this.currEval=="function")B.cache[l]={runInNewContext:u=>this.currEval(a,u)};else throw new TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return B.cache[l].runInNewContext(this.currSandbox)}catch(a){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+a.message+": "+e)}},B.cache={},B.toPathString=function(e){const t=e,n=t.length;let r="$";for(let i=1;itypeof t[u]=="function");const o=r.map(u=>t[u]);n=i.reduce((u,f)=>{let p=t[f].toString();return/function/u.test(p)||(p="function "+p),"var "+f+"="+p+";"+u},"")+n,!/(['"])use strict\1/u.test(n)&&!r.includes("arguments")&&(n="var arguments = undefined;"+n),n=n.replace(/;\s*$/u,"");const l=n.lastIndexOf(";"),a=l!==-1?n.slice(0,l+1)+" return "+n.slice(l+1):" return "+n;return new Function(...r,a)(...o)}}B.prototype.vm={Script:bu};class Iu{constructor(t){this._highlight=!1,D(t)||this.setProperties(t)}setProperties(t){this.validateProperties(t),this.path=t.path,this.label=t.label,this._onRevert=t.onRevert,this._onReady=t.onReady,!D(this._onReady)&&!D(this._content)&&!D(this._metadata)&&this._onReady(this._content,this._metadata),this._onHighlight=t.onHighlight,!D(this._onHighlight)&&this._highlight&&D(this.path)&&(D(this._metadata)?this._onHighlight(this._highlight):this._onHighlight(this._highlight,this._metadata))}validateProperties(t){if(D(t.onReady))throw new tt(Be.InvalidContentZoneHandlerProperty,"onReady property must defined");if(J(t,"onReady")&&!ir(t.onReady))throw new tt(Be.InvalidContentZoneHandlerProperty,"onReady property must be a function");if(J(t,"onRevert")&&!ir(t.onRevert))throw new tt(Be.InvalidContentZoneHandlerProperty,"onRevert property must be a function");if(J(t,"onHighlight")&&!ir(t.onHighlight))throw new tt(Be.InvalidContentZoneHandlerProperty,"onHighlight property must be a function");if(J(t,"path")&&!S(t.path))throw new tt(Be.InvalidContentZoneHandlerProperty,"Path property must be a non-empty string");if(J(t,"label")&&!S(t.label))throw new tt(Be.InvalidContentZoneHandlerProperty,"Label property must be a non-empty string")}triggerReady(t,n){if(D(t)||D(n)){y.log.warn("Handling a call to ready for a content zone handler transformation, but the content or the metadata parameter is not defined. The ready handler will not be called.");return}this._content=t,this._metadata=n,D(this._onReady)||this._onReady(t,n)}triggerRevert(){this._content=null;const t=this._metadata;if(this._metadata=null,D(t)){y.log.warn("Handling a call to revert for a content zone handler transformation, but the content zone handler metadata is not defined. The revert handler will not be called.");return}D(this._onRevert)||this._onRevert(t)}triggerHighlight(t){if(!et(t)){y.log.warn("Handling a call to highlight for a content zone handler transformation, but the highlight parameter is not a boolean. The highlight handler will not be called.");return}this._highlight=t,!D(this._onHighlight)&&D(this.path)&&(D(this._metadata)?this._onHighlight(this._highlight):this._onHighlight(this._highlight,this._metadata))}}let Yt={};function Au(){Yt={}}function Cu(e,t){try{if(!O(t,!1))throw new tt(Be.InvalidContentZoneHandlerProperties,"Content Zone Handler Properties must be a non-empty object");const n=wr(e);D(n)?Co(e,t):n.setProperties(t)}catch(n){y.log.error(`Content Zone Handler could not be set due to: ${X(n).message}`)}}function Pu(e){const t=wr(e);if(D(t))return t;const{label:n,path:r}=t;return{label:n,path:r}}function wr(e){if(!S(e))throw new tt(Be.InvalidContentZoneHandlerName,"Name must be a non-empty string");return Yt[e]}function Co(e,t){return Yt[e]=new Iu(t),Yt[e]}function Nu(){return Yt}var Ou=Object.defineProperty,Du=Object.defineProperties,Mu=Object.getOwnPropertyDescriptors,Po=Object.getOwnPropertySymbols,Ru=Object.prototype.hasOwnProperty,Lu=Object.prototype.propertyIsEnumerable,No=(e,t,n)=>t in e?Ou(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xu=(e,t)=>{for(var n in t||(t={}))Ru.call(t,n)&&No(e,n,t[n]);if(Po)for(var n of Po(t))Lu.call(t,n)&&No(e,n,t[n]);return e},ku=(e,t)=>Du(e,Mu(t));let Oo=null;function Uu(e){var t;if(O(e)&&(J(e,"anchorId")||J(e,"anchorDmoName"))){const n=ku(xu({},J(e,"anchorDmoName")&&{anchorDmoName:e.anchorDmoName}),{anchorId:(t=e.anchorId)!=null?t:""});return Fu(n),n.anchorId===null?null:n}else return Oo}function Fu(e){if(J(e,"anchorDmoName")&&(!S(e.anchorDmoName)||!S(e.anchorId)))throw S(e.anchorId)?new Ee(de.AnchorDmoNameRequired,"Anchor Dmo Name must be a non-empty string when provided."):new Ee(de.AnchorIdRequiredWithDmoName,"Anchor Id cannot be null if Anchor Dmo Name is provided.");if(e.anchorId!==null&&!S(e.anchorId))throw new Ee(de.AnchorIdNullOrNotEmpty,"Anchor Id must be null or a non-empty string.")}document.addEventListener(P.CustomEvents.OnEventSend,e=>{var t,n,r;if(((r=(n=(t=e==null?void 0:e.detail)==null?void 0:t.actionEvent)==null?void 0:n.interaction)==null?void 0:r.name)===P.CatalogObjectInteractionName.ViewCatalogObject){const i=e.detail.actionEvent.interaction.catalogObject;O(i)&&S(i.id)&&S(i.type)&&Do({anchorId:i.id})}}),document.addEventListener(P.CustomEvents.OnInit,()=>{Do(null)});function Do(e){Oo=e}var Mo=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});const Ro="TestMode",Lo="Web";class zu{constructor(t,n){this.statuses=t,this.finished=Promise.allSettled(Object.values(t).map(r=>Mo(this,null,function*(){return yield r.finished}))).then(r=>{const i=r.filter(o=>o.status==="rejected").map(o=>X(o.reason).message);if(i.length>0)throw new Error(`Issue(s) with preview (see 'statuses' for more detail): ${JSON.stringify(i)}`)}),this.finished.catch(()=>{}),this.revert=()=>(D(this._revertResponse)&&(this._revertResponse=n()),this._revertResponse)}}class Hu{constructor(t){this.statuses=t,this.finished=Promise.allSettled(Object.values(t).map(n=>Mo(this,null,function*(){return yield n.finished}))).then(n=>{const r=n.filter(i=>i.status==="rejected").map(i=>X(i.reason).message);if(r.length>0)throw new Error(`Issue(s) with revert (see 'statuses' for more detail): ${JSON.stringify(r)}`)}),this.finished.catch(()=>{})}}let We=null;function Vu(e){const t={};let n=!1;return S(e==null?void 0:e.pageType)?(t.pageType=e.pageType,n=!0):S(We==null?void 0:We.pageType)&&(t.pageType=We==null?void 0:We.pageType,n=!0),S(e==null?void 0:e.interaction)?(t.interaction=e.interaction,n=!0):S(We==null?void 0:We.interaction)&&(t.interaction=We==null?void 0:We.interaction,n=!0),n?t:null}function br(e){We=e}function Bu(){document.addEventListener(y.CustomEvents.OnShutDown,()=>br(null)),document.addEventListener(y.CustomEvents.OnInit,()=>br(null)),document.addEventListener(y.CustomEvents.OnSettledSitemap,e=>{var t,n;((t=e==null?void 0:e.detail)==null?void 0:t.result)!==void 0&&Gu((n=e==null?void 0:e.detail)==null?void 0:n.result)})}function Gu(e){var t,n,r,i,o,s,l,a,u,f,p,c;const h={};let d=!1;const g=(i=(t=e==null?void 0:e.matchedConfig)==null?void 0:t.name)!=null?i:(r=(n=e==null?void 0:e.currentPage)==null?void 0:n.source)==null?void 0:r.pageType;S(g)&&(h.pageType=g,d=!0),S((s=(o=e==null?void 0:e.matchedConfig)==null?void 0:o.interaction)==null?void 0:s.name)?(h.interaction=(a=(l=e==null?void 0:e.matchedConfig)==null?void 0:l.interaction)==null?void 0:a.name,d=!0):S((f=(u=e==null?void 0:e.currentPage)==null?void 0:u.interaction)==null?void 0:f.name)&&(h.interaction=(c=(p=e==null?void 0:e.currentPage)==null?void 0:p.interaction)==null?void 0:c.name,d=!0),br(d?h:null)}var Ir=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});function ju(e){return Ir(this,null,function*(){var t,n;const r=y.getSitemapResult(),i=y.getSitemapConfig();return(r==null?void 0:r.matchedConfig)!=null?(y.log.trace(`Evaluating context attributes from matched page type [${r==null?void 0:r.matchedConfig.name}] for dataspace [${(t=e==null?void 0:e.dataspace)!=null?t:""}].`),yield Ar(r.matchedConfig,e)):(i==null?void 0:i.global)!=null?(y.log.trace(`Evaluating context attributes from global page type for dataspace [${(n=e==null?void 0:e.dataspace)!=null?n:""}].`),yield Ar(i.global,e)):{}})}function Ar(e,t){return Ir(this,null,function*(){if((e==null?void 0:e.contextualAttributes)==null)return{};const n=e.contextualAttributes,r=Object.keys(n),i={},o={};return r.forEach(s=>{i[s]=Wu(s,n[s],t)}),yield Promise.all(Object.values(i)).then(s=>(s.forEach((l,a)=>{if(l!==void 0){const u=r[a];o[u]=l}}),o))})}function Wu(e,t,n){return Ir(this,null,function*(){try{return O(n)&&J(n,e)?n[e]:yield Promise.resolve(t).then(r=>typeof r=="function"?r():r)}catch(r){y.log.error(`Error when evaluating contextual attribute [${e}]: ${X(r).message}`,r)}})}var qu=Object.defineProperty,$u=Object.defineProperties,Yu=Object.getOwnPropertyDescriptors,xo=Object.getOwnPropertySymbols,Zu=Object.prototype.hasOwnProperty,Ku=Object.prototype.propertyIsEnumerable,ko=(e,t,n)=>t in e?qu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ke=(e,t)=>{for(var n in t||(t={}))Zu.call(t,n)&&ko(e,n,t[n]);if(xo)for(var n of xo(t))Ku.call(t,n)&&ko(e,n,t[n]);return e},Xu=(e,t)=>$u(e,Yu(t)),On=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});const Zt=new Nl("PreviewMeta");function Uo(e,t){return On(this,null,function*(){let n=fr();const r=yield e;no(t==null?void 0:t.endpoint),D(t==null?void 0:t.endpoint)||(n=t.endpoint,P.log.debug(`Using specified endpoint of ${n} as endpoint for fetching personalization.`));const i={method:"POST",cache:"no-store",headers:{"Content-Type":"application/json",Accept:"application/json, text/javascript, */*; q=0.01"},body:JSON.stringify(r)};return zo(r)&&(i.credentials="include",i.mode="cors"),yield window.fetch(n,i).then(o=>On(this,null,function*(){if(!o.ok){const s=yield o.text();throw new Xi(Ki.PersonalizationFetchFailed,"Personalization fetch failed.",{context:{status:o.status,message:s}})}return yield o.json().then(s=>(sc(s),zo(r)&&s.personalizations.forEach(l=>{Vo({personalizationId:l.personalizationId,personalizationPointName:l.personalizationPointName})}),s))})).catch(o=>On(this,null,function*(){return o instanceof Xi||P.log.error("Unexpected error with browser fetch."),yield Promise.reject(o)}))})}function Qu(e,t){if(!F(e))throw new Ee(de.PersonalizationPointsIsNotAnArray,"The Personalization Points parameter must be an array of length >= 1.");e.forEach(n=>{if(D(n))throw new Ee(de.PersonalizationPointIsNotDefined,"The Personalization Point must be an object containing a name value.",{context:{value:n}});if(!S(n.name))throw new Ee(de.PersonalizationPointNameIsNotAString,"The Personalization Point name parameter must be a non empty string.",{context:{value:n.name}});if(J(n,"decisionId")){if(t!==!0)throw new Ee(de.PersonalizationPointDecisionIdProvidedNonPreview,"The Personalization Point decisionId parameter can only be provided during previews.",{context:{value:n.decisionId}});if(!S(n.decisionId))throw new Ee(de.PersonalizationPointDecisionIdIsNotAString,"The Personalization Point decisionId parameter must be a non empty string if provided.",{context:{value:n.decisionId}})}})}function Ju(e){if(!O(e))throw new Ee(de.ContextIsNotAnObject,"The Context parameter must be an object.")}function Fo(e,t,n){return On(this,null,function*(){Qu(e,n),t!==void 0&&Ju(t);const r=et(n)&&n;t=ke(ke({},yield ju(t)),t);const i={personalizationPoints:e,context:ke(ke(Xu(ke(ke(ke(ke(ke(ke({},t),Uu(t)),nc(t)),rc(t)),Vu(t)),ic(t)),{individualId:oc(r,t)}),ec(t)),tc())};return r&&(i.executionFlags=[Ro]),i})}function ec(e){const t={};if(S(e==null?void 0:e.dataspace))t.dataspace=e==null?void 0:e.dataspace;else{const n=Ht();S(n)&&(t.dataspace=n)}return t}function tc(){var e;const t=(e=window==null?void 0:window.location)==null?void 0:e.hostname;return t===void 0?(P.log.warn("Channel context (window.location.hostname) is undefined \u2014 not sending channelContext"),{channel:Lo}):{channel:Lo,channelContext:t}}function nc(e){var t;const n={};if(S(e==null?void 0:e.requestUrl))n.requestUrl=e==null?void 0:e.requestUrl;else{const r=(t=window==null?void 0:window.location)==null?void 0:t.href;S(r)&&(n.requestUrl=r)}return n}function rc(e){const t={};if(S(e==null?void 0:e.p13n_sys_requestTimeZone))t.p13n_sys_requestTimeZone=e.p13n_sys_requestTimeZone;else try{const n=window.Intl.DateTimeFormat().resolvedOptions().timeZone;S(n)&&(t.p13n_sys_requestTimeZone=n)}catch(n){P.log.error("Error getting request time zone from browser. The contextual attribute p13n_sys_requestTimeZone will not be set.",n)}return t}function ic(e){const t={};if([Kt(e==null?void 0:e.utm_source,n=>{t.utm_source=n}),Kt(e==null?void 0:e.utm_campaign,n=>{t.utm_campaign=n}),Kt(e==null?void 0:e.utm_medium,n=>{t.utm_medium=n}),Kt(e==null?void 0:e.utm_content,n=>{t.utm_content=n}),Kt(e==null?void 0:e.utm_term,n=>{t.utm_term=n})].every(n=>!n)){const n=bl(["utm_source","utm_campaign","utm_medium","utm_content","utm_term"]);Xt("utm_source",n,r=>{t.utm_source=r}),Xt("utm_campaign",n,r=>{t.utm_campaign=r}),Xt("utm_medium",n,r=>{t.utm_medium=r}),Xt("utm_content",n,r=>{t.utm_content=r}),Xt("utm_term",n,r=>{t.utm_term=r})}return t}function Kt(e,t){return S(e)?(t(e),!0):!1}function Xt(e,t,n){const r=t!==null?t[e]:null;S(r)&&n(r)}function oc(e,t){if(e&&O(t)&&J(t,"individualId")){const n=t.individualId;if(S(n))return n}return P.getAnonymousId()}function zo(e){var t,n;return(n=(t=e==null?void 0:e.executionFlags)==null?void 0:t.includes(Ro))!=null?n:!1}function Cr(e,t){return S(e)&&Ho(e)||S(t)&&ac(t)}function Ho(e){return!D(Zt.get(e))}function ac(e){return!D(Zt.get(e))}function Vo(e){J(e,"personalizationId")?Zt.set(e.personalizationId,e):J(e,"personalizationExperienceConfigName")&&Zt.set(e.personalizationExperienceConfigName,e)}function Pr(e){Zt.delete(e)}function Bo(e){return F(e.data)||O(e.attributes,!1)}function sc(e){let t=!0;if(!O(e))throw new Ft(gt.InvalidJsonObject,"Personalization response invalid: Expected a JSON object.");if(!F(e.personalizations,!0))throw new Ft(gt.MissingPersonalizationsArray,'Personalization response invalid: Expected "personalizations" array.');if(e.personalizations.length===0&&(t=!1),e.personalizations.forEach(n=>{if(!S(n.personalizationId))throw new Ft(gt.MissingPersonalizationId,'Personalization response invalid: Expected each "personalization" to include "personalizationId".');if(!S(n.personalizationPointName))throw new Ft(gt.MissingPersonalizationPointName,'Personalization response invalid: Expected each "personalization" to include "personalizationPointName".');if(!Bo(n)){P.log.debug(`Personalization invalid, does not contain "data" nor "attributes". Id ${n.personalizationId}, Name ${n.personalizationPointName}`);return}t=!1}),t)throw new Ft(gt.MissingPersonalizationDecision,'Personalization response invalid. Expected each "personalization" to include either "data" or "attributes".')}function lc(e){var t;return(t=e==null?void 0:e.contentZones)!=null?t:[]}function Go(e,t=!0){return lc(e).reduce((n,r)=>{const[i,o]=uc(r,t);return S(i==null?void 0:i.name)&&o&&n.push(r),n},[])}function uc(e,t=!0){const n=O(e)?e:{name:"",selector:""},r=S(n==null?void 0:n.selector);S(n==null?void 0:n.name)&&!r&&y.log.debug(`Content Zone ${n.name} has no Selector configured`);const i=r&&(!t||cc(n==null?void 0:n.selector));return[e,i]}const cc=e=>y.cashDom(e).length>0;function jo(e){if(!S(e))return null;const t=y.getSitemapResult().matchedConfig;if(t.contentZones!==void 0){const n=t.contentZones;if(!F(n))return null;const r=n.find(i=>i.name===e);return S(r==null?void 0:r.selector)?r.selector:null}return null}function Nr(e,t=!0){return Go(e,t).map(n=>n.name)}function fc(e,t=!0){return Or([e],void 0,void 0,!0,t)}function dc(e,t=!0){return Or(e,void 0,void 0,!0,t)}function hc(e){return O(e)?Or(e.pageTypes,e.global,e.pageTypeDefault,!0,!1):[]}function Or(e,t,n,r=!0,i=!0){const o=[];if(O(t)&&o.push(...Nr(t,i)),F(e)&&e.forEach(s=>{o.push(...Nr(s,i))}),O(n)&&o.push(...Nr(n,i)),r){const s=pc(o);if(s.length>0)return y.log.warn(`The following content zones are duplicated which are not supported by personalization: ${gc(s).join(", ")}`),mc(o,s)}return o}function pc(e){return e.filter((t,n)=>e.indexOf(t)!==n)}function gc(e){return e.filter((t,n)=>e.indexOf(t)===n)}function mc(e,t){return e.filter(n=>!t.includes(n))}const vc={redisplayTimeoutMilliseconds:2e3,renderPersonalizationAfterTimeoutElapsed:!1};var Te=(e=>(e.PageType="PageType",e.PageUrlMatcher="PageUrlMatcher",e))(Te||{}),Ec=Object.defineProperty,Wo=Object.getOwnPropertySymbols,yc=Object.prototype.hasOwnProperty,_c=Object.prototype.propertyIsEnumerable,qo=(e,t,n)=>t in e?Ec(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$o=(e,t)=>{for(var n in t||(t={}))yc.call(t,n)&&qo(e,n,t[n]);if(Wo)for(var n of Wo(t))_c.call(t,n)&&qo(e,n,t[n]);return e};let Dn=vc,Yo=!1;const Tc="head > style.personalizationFlickerDefense",ct={PageUrlMatcher:[],PageType:[]};function Mn(){return Dn!=null?Dn:{}}function Sc(e){Dn=$o($o({},Dn),e)}function wc(e){if(!O(e))throw new ur("flicker defense config is required");if(J(e,"redisplayTimeoutMilliseconds")&&(!kt(e.redisplayTimeoutMilliseconds)||e.redisplayTimeoutMilliseconds<0))throw new ur("redisplayTimeoutMilliseconds must be a number greater than or equal to 0");if(J(e,"renderPersonalizationAfterTimeoutElapsed")&&!et(e.renderPersonalizationAfterTimeoutElapsed))throw new ur("renderPersonalizationAfterTimeoutElapsed must be a boolean")}function Zo(e){Yo=e}function bc(){return Yo}function Ic(e){try{return document.querySelector(e),!0}catch(t){return P.log.warn(`Invalid path ${e} detected while trying to prevent flicker.`),!1}}function Ac(){const e=Cc();return Object.values(ct).flat().map(t=>{var n;if(Bt(t)){const r=(n=e.find(i=>t.name===i.name))==null?void 0:n.selector;if(S(r))return r}else if(it(t))return t.path;return""}).filter(Ic).join(",")}function Cc(){const{pageTypes:e,global:t,pageTypeDefault:n}=P.getSitemapConfig();return[...e,...O(t)?[t]:[],...O(n)?[n]:[]].flatMap(r=>Go(r,!1))}function Pc(e){return e.transformationConfig.transformations.filter(it).length>0}function Ko(e){if(et(e.isEnabled)&&!e.isEnabled)return!1;const t=e.transformationConfig.method;return t===$.ReplaceContentZoneContent||t===$.ReplaceElementContent||D(t)&&Pc(e)}function Xo(e){return e.filter(Ko).flatMap(t=>t.transformationConfig.transformations)}function Nc(){const e=P.cashDom(""),t=Vt();return S(t)&&e.attr("nonce",t),e.attr({type:"text/css",class:"personalizationFlickerDefense"}).appendTo(document.head)}function Dr(){const e=()=>{let t=P.cashDom(Tc);t.length===0&&(t=Nc());const n=Ac();S(n)?(P.log.debug(`flicker defense style tag updated to ${n}`),t.text(`${n} { visibility: hidden !important; }`)):(P.log.debug("flicker defense style tag removed"),t.remove())};window.requestAnimationFrame(e)}function Mr(e){const t=Xo(e);for(const n of t)Rn(n)}function Rn(e){for(const t of Object.values(Te))ct[t]=ct[t].filter(n=>(n===e&&P.log.debug(`flicker defense reshowing hidden transformation with source matcher type of ${t}: ${JSON.stringify(e)}`),n!==e));Dr()}function Qo(e,t,n){if(!Cr(e,t.pec.name)&&Ko(t.pec)&&!Mn().renderPersonalizationAfterTimeoutElapsed&&bc()){const r=`Blocking transform and render of following transformation for config ${t.pec.name} due to flicker defense: ${JSON.stringify(n)}`;throw t.status.update(new k(r)),Rn(n),new ie(le.FlickerDefenseRedisplayElapsed,`Blocking transform and render of following transformation for config ${t.pec.name} due to flicker defense`)}}function Jo(e){if(nt()){if(!O(e,!1)){P.log.error("A config is required when setting Flicker Defense Config.");return}try{wc(e),Sc(e),P.log.info("Set Flicker Defense Config to the following: ",e)}catch(t){P.log.error(`Flicker Defense Config could not be set due to: ${X(t).message}`)}}else P.log.error("Flicker Defense Config can only be set before SalesforceInteractions.init is called.")}var Oc=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});const ea=class rr{validateTransformerDetails(t){}validateMethod(t){}validateSubstitutionValues(t){}supportsEngagementSelection(){return!0}setContent(t,n,r,i,o,s,l=$.ReplaceElementContent){const a=`pec ${o.pec.name}, transformation ${r.transformerName}`+(s!==void 0?`, personalizationId ${s}`:"");o.status.update(new k(`Awaiting element/conditions ${a}`));const u=t.then(f=>{if(!(f instanceof Element))throw new ie(le.FoundNonElement,"Found non-Element");if(s!==void 0&&Qo(s,o,r),!D(o.revertStatus)){const p=`Aborting ${a}, revert has been called`;return y.log.info(p),o.status.update(new k(p)),c=>{c.update(new k(`Nothing to revert, since revert was requested before transformation, ${a}`))}}if(o.status.update(new k(`About to transform/render, element/conditions ready ${a}`)),io(i)){const p=document.head;if(D(p))throw new ie(le.ElementsNotFound,"Could not add agent script, head not found");const c=document.createElement("script");return c.type="text/javascript",c.textContent=n(),c.nonce=Vt(),this.insertAdjacentHtmlUnlessAlreadyPersonalized(p,"beforeend",()=>c,a)}else{if(dr(r,l))return this.triggerReadyHandlerWithHtml(r.name,o,s,n,a);if(yt(l)){const p=f.closest("body");if(D(p))throw new ie(le.ElementsNotFound,"Could not add overlay, body not found");return this.insertAdjacentHtmlUnlessAlreadyPersonalized(p,"beforeend",n,a)}else{if(Sn(r,l))return this.setInnerHtmlUnlessAlreadyPersonalized(f,n,a);if(it(r)){const p=l!=null?l:$.ReplaceElementContent;switch(p){case $.ReplaceElementContent:return this.setInnerHtmlUnlessAlreadyPersonalized(f,n,a);case $.AddAfterElement:return this.insertAdjacentHtmlUnlessAlreadyPersonalized(f,"afterend",n,a);case $.AddBeforeElement:return this.insertAdjacentHtmlUnlessAlreadyPersonalized(f,"beforebegin",n,a);default:throw new ie(le.NotSupported,`method "${p}" is not supported for Element transformations`)}}else throw new ie(le.NotSupported,"transformation is not of a known type")}}});return u.catch(f=>{const p=new Error(`Could not set content for ${a}: ${X(f).message}`);o.status.update(new k(p)),y.log.error(p.message)}),{promise:u.then(),revert:f=>Oc(this,null,function*(){f.update(new k("Awaiting transformPromise"));const p=u.then(c=>{c(f)},c=>{if(c instanceof ie){f.update(new k(`Nothing to revert, no transformation attempt, ${a}`));return}throw c});p.catch(c=>{const h=new Error(`Issue reverting ${a}: `+X(c).message);y.log.error(h),f.update(new k(h))}),yield p})}}setInnerHtmlUnlessAlreadyPersonalized(t,n,r){if(t.children.length>0&&this.isElementAlreadyPersonalized(t.children[0]))throw new ie(le.AlreadyPersonalized,`Aborting setting innerHTML, element ${t.localName} already personalized`);const i=n();y.log.trace(`Setting element ${t.localName}'s innerHTML to ${i}, ${r}`,t);const o=t.innerHTML;return t.innerHTML=i,s=>{let l=`Reverting, ${r}`;s.update(new k(l)),y.log.debug(l),t.innerHTML=o,l=`Reverted, ${r}`,s.update(new k(l)),y.log.debug(l)}}insertAdjacentHtmlUnlessAlreadyPersonalized(t,n,r,i){let o;switch(n){case"beforebegin":o=t.previousSibling;break;case"afterbegin":o=t.firstChild;break;case"beforeend":o=t.lastChild;break;case"afterend":o=t.nextSibling;break;default:throw new Error(`Unsupported insertAdjacentHTML position: ${String(n)}`)}if(o instanceof Element&&this.isElementAlreadyPersonalized(t))throw new ie(le.AlreadyPersonalized,`Aborting inserting adjacent HTML, adjacent element ${o.localName} ${n} from ${t.localName} is already personalized`);const s=r();y.log.trace(`Inserting adjacent HTML ${n} element ${t.localName}'s with ${S(s)?s:s.outerHTML}, ${i}`,t);const l=S(s)?this.getHTMLElements(s):[s];return this.insertAdjacentElements(t,n,l),a=>{let u=`Reverting, ${i}`;a.update(new k(u)),y.log.debug(u),l.forEach(f=>f.remove()),u=`Reverted, ${i}`,a.update(new k(u)),y.log.debug(u)}}triggerReadyHandlerWithHtml(t,n,r,i,o){var s;const l=i(),a=(s=wr(t))!=null?s:Co(t);return a.triggerReady(l,{personalizationExperienceConfig:n.pec,isPreview:Cr(r,n.pec.name)}),u=>{let f=`Reverting, ${o}`;u.update(new k(f)),y.log.debug(f),a.triggerRevert(),f=`Reverted, ${o}`,u.update(new k(f)),y.log.debug(f)}}isElementAlreadyPersonalized(t){return t.getAttributeNames().some(n=>n.startsWith(_t))}autoInjectDefaultRootAttributes(t,n,r,i=!0){const o=[];t.hasAttribute(Le)?y.log.debug(`Element already has root attribute "${Le}"`,t):(y.log.debug(`Adding root attribute "${Le}"="${n}" to element`,t),t.setAttribute(Le,n),o.push(()=>{t.removeAttribute(Le)}));const s={};S(r)&&(s[wt]=r);const l=JSON.stringify(s);return i&&(t.hasAttribute(Tt)?y.log.debug(`Element already has root attribute "${Tt}"`,t):(y.log.debug(`Adding root attribute "${Tt}"="${l}" to element`,t),t.setAttribute(Tt,l),o.push(()=>{t.removeAttribute(Tt)}))),t.hasAttribute(St)?y.log.debug(`Element already has attribute "${St}"`,t):(y.log.debug(`Adding attribute "${St}"="${l}" to element`,t),t.setAttribute(St,l),o.push(()=>{t.removeAttribute(St)})),a=>{o.forEach(u=>u==null?void 0:u(a))}}autoInjectDefaultItemAttributes(t,n,r,i=!0){const o=[];D(n)||(t.setAttribute(Le,n),o.push(()=>{t.removeAttribute(Le)}));const s=JSON.stringify(r);if(i){const a=this.assignMaybeOverrideAttribute(t,Tt,s);o.push(a)}const l=this.assignMaybeOverrideAttribute(t,St,s);return o.push(l),a=>{o.forEach(u=>u==null?void 0:u(a))}}assignMaybeOverrideAttribute(t,n,r){return t.hasAttribute(n)?y.log.debug(`Overwriting item attribute "${n}"="${r}" on element`,t):y.log.debug(`Adding item attribute "${n}"="${r}" to element`,t),t.setAttribute(n,r),()=>{t.removeAttribute(n)}}static findValueDefaultForContentId(t){var n,r,i;return(i=(r=(n=t.attributes)==null?void 0:n.eventModifiers)==null?void 0:r[It])==null?void 0:i.valueDefault}static findValueDefaultForObjectId(t){var n,r,i;return(i=(r=(n=t.attributes)==null?void 0:n.eventModifiers)==null?void 0:r[bt])==null?void 0:i.valueDefault}buildModifiersIfItemRelated(t,n,r){if(!O(t))return;const i={},o=rr.findValueDefaultForContentId(r);if(S(o)){const l=this.getSanitizedContentString(o,t);S(l)&&(i[It]=l)}const s=rr.findValueDefaultForObjectId(r);if(S(s)){const l=this.getSanitizedContentString(s,t);S(l)&&(i[bt]=l)}if(Object.keys(i).length!==0)return S(n)&&(i[wt]=n),i}getHTMLElements(t){const n=document.createElement("div");return n.innerHTML=t,Array.from(n.children)}getPathParentObject(t,n){if(!S(t))return;const r=B({path:`$.${t}`,json:n,wrap:!1,resultType:"parent"});return O(r)?r:void 0}getSanitizedContentString(t,n){const r=B({path:`$${t}`,json:n,wrap:!1});if(D(r))return;const i=String(r),o=rr.sanitizer.sanitizeString(i);return y.log.debug(`sanitized data for dataPath ${t}: ${o}`),o}insertAdjacentElement(t,n,r){if(r==="beforeend")t.appendChild(n);else{if(t.parentNode===null)throw new Error("Unable to find parent element");r==="beforebegin"?t.parentNode.insertBefore(n,t):r==="afterbegin"?t.parentNode.insertBefore(n,t.firstChild):r==="afterend"&&t.parentNode.insertBefore(n,t.nextSibling)}}insertAdjacentElements(t,n,r){const i=[];if(n==="beforeend"||n==="afterend"?r.forEach(o=>{try{this.insertAdjacentElement(t,o,n)}catch(s){i.push(X(s).message)}}):(n==="beforebegin"||n==="afterbegin")&&r.reverse().forEach(o=>{try{this.insertAdjacentElement(t,o,n)}catch(s){i.push(X(s).message)}}),i.length>0)throw new Error(`Issues with insertAdjacentElements: ${JSON.stringify(i)}`)}};ea.sanitizer=new uu;let Rr=ea;function Ln(e,t,n){var r,i;if(!S(e,!0))throw new M(R.MissingTransformerName,"Transformer Name is required.");if(!O(n))throw new M(R.MissingEngagementConfig,"Engagement Configuration or Destinations are not defined.");const o=n.destinationDefaults;if(o===void 0)throw new M(R.MissingEngagementConfigDefaults,"Engagement Configuration Defaults are not defined.");let s=e!==""?(r=o.byName)==null?void 0:r[e]:void 0;if(S(s)||(s=(i=o.byType)==null?void 0:i[t],S(s)))return s;if(!S(o.global))throw new M(R.MissingEngagementConfigGlobalDefault,"Engagement Configuration Global Default is not defined.");return o.global}function ta(e,t,n,r){if(S(e))return e;try{return Ln(t,n,r)}catch(i){return}}const Dc={destinations:{[wo]:{label:"Product Engagement",description:"Engagement events (e.g. view/click) on this personalization are intended for the stock Product Browse Engagement DMO",disableSendingNonItemEngagementEvents:!0,eventModifiers:{[Pn]:"catalog",[Cn]:e=>{switch(e.name){case lt:return"catalog-object-view-start";case xe:return"catalog-object-click";default:return}},[_r]:"Product"}},[bo]:{label:"Website Engagement",description:"Engagement events (e.g. view/click) on this personalization are intended for the stock Website Engagement DMO",eventModifiers:{[Pn]:"userEngagement",[Cn]:e=>{switch(e.name){case lt:return"personalization-view";case xe:return"personalization-click";default:return}}}}},destinationDefaults:{byType:{HTMLElementModifier:"Other",Handlebars:"Product",AgentScript:"Other"},global:"Other"},attributes:{engagements:{[lt]:{description:'Apply to specific items/recs, and to the entire personalization (to generate an "overall" view/impression, especially relevant for a banner not using recs).',scope:ut.Any,qualify:()=>ua(lt),observe:(e,t)=>kc(e,t),handle:e=>ca(lt,e)},[xe]:{description:"Apply to an element in the personalization, to listen for click events (including bubbled ones), for engagement/attribution.",scope:ut.Element,qualify:()=>ua(xe),observe:(e,t)=>Uc(e,t),handle:e=>ca(xe,e)}},eventModifiers:{[It]:{description:"Apply to an Engagement attribute, to specify the personalization content id (which rec in the decision) in the resulting engagement event.",scope:ut.Element,valueType:Nn.SchemaPath,valueDefault:"[personalizationContentId]",modifyEvent:(e,t,n)=>{D(n.personalization)&&(n.personalization={}),n.personalization.contentId=e}},[bt]:{description:"Apply to an Engagement attribute, to specify the object id (e.g. product id) in the resulting engagement event.",scope:ut.Element,valueType:Nn.SchemaPath,valueDefault:"[ssot__Id__c]",modifyEvent:(e,t,n)=>{if(t.eventModifiers===void 0)return;const r=t.eventModifiers[wt];switch(r){case"Product":n.interaction.id=e;return;case"Other":n.interaction.catalogObjectId=e;return;default:P.log.warn(`Unknown Engagement Destination "${r!=null?r:""}"`)}}},[wt]:{description:'Chosen entry from "engagementDestinations", which will modify the resulting engagement event accordingly.',scope:ut.Any,modifyEvent:(e,t,n)=>{const r=sa(e);if(r===void 0){P.log.warn(`Destination name "${e}" not found, cannot be applied to the event.`);return}for(const i in r.eventModifiers){const o=Lr(i);if(o===void 0){P.log.warn(`Modifier name "${i}" unknown, cannot be applied to the event.`);continue}const s=r.eventModifiers[i];let l;if(S(s)?l=s:l=s(t),l===void 0){P.log.warn(`Modifier Name "${i}" resulted in no value and as such is not applied to the event.`);continue}o.modifyEvent(l,t,n)}}},[Cn]:{description:'Defined by chosen entry in "engagementDestinations", for the "interaction name" in the resulting engagement event.',modifyEvent:(e,t,n)=>{D(n.interaction)?n.interaction={name:e}:n.interaction.name=e}},[Pn]:{description:'Defined by chosen entry in "engagementDestinations", for the "event type" in the resulting engagement event.',modifyEvent:(e,t,n)=>{D(n.interaction)&&(n.interaction={name:""}),n.interaction.eventType=e}},[_r]:{description:'Defined by chosen entry in "engagementDestinations", for the "type" in the resulting engagement event.',modifyEvent:(e,t,n)=>{D(n.interaction)&&(n.interaction={name:""}),n.interaction.type=e}}}}},na={destinations:{},destinationDefaults:{global:""}};let Qt=Dc,ra=!0;function Ue(){return Qt!=null?Qt:na}function Mc(e){e===void 0?Qt=na:Qt=e,ra=Rc(Qt)}function Rc(e){var t,n;return!(!O((t=e==null?void 0:e.attributes)==null?void 0:t.engagements)||cu.some(r=>{var i;return D((i=e.attributes)==null?void 0:i.engagements[r])})||!O((n=e==null?void 0:e.attributes)==null?void 0:n.eventModifiers)||fu.some(r=>{var i;return D((i=e.attributes)==null?void 0:i.eventModifiers[r])})||!O(e==null?void 0:e.destinations,!1)||Io.some(r=>D(e.destinations[r]))||!O(e==null?void 0:e.destinationDefaults)||!Io.includes(e.destinationDefaults.global))}function ia(){return ra}function oa(){const e=Ue();if(e===void 0||e.destinations===void 0||Object.keys(e.destinations).length===0){P.log.warn("Engagement Configuration does not have any Config for Destinations");return}return e}function aa(){const e=oa();return e===void 0?[]:Object.keys(e.destinations)}function sa(e){if(!S(e)){P.log.warn("A valid destination string must be provided in order to find its Engagement Destination configuration");return}const t=oa();if(t!==void 0){if(!(e in t.destinations)){P.log.warn(`Engagement Configuration does not Config for Destination "${e}"`);return}return t.destinations[e]}}function la(e){if(!S(e)){P.log.warn("A valid attribute name string must be provided in order to find its Engagement Attribute configuration");return}const t=Ue();if(t===void 0||t.attributes===void 0){P.log.warn("Engagement Configuration does not have any Config for Attributes");return}if(!(e in t.attributes.engagements)){P.log.warn(`Engagement Configuration does not Config for Attribute "${e}"`);return}return t.attributes.engagements[e]}function Lr(e){if(!S(e)){P.log.warn("A valid modifier name string must be provided in order to find its Engagement Modifier configuration");return}const t=Ue();if(t===void 0||t.attributes===void 0){P.log.warn("Engagement Configuration does not have any Config for Attributes");return}if(!(e in t.attributes.eventModifiers)){P.log.warn(`Engagement Configuration does not have Config for Event Modifier "${e}"`);return}return t.attributes.eventModifiers[e]}function ua(e){const t=la(e);if(t===void 0)return;const n=`${_t}${e}`,r=$i(n),i=Array.of(...document.querySelectorAll(r));for(const s of i)t.observe(s,t);const o=new MutationObserver(s=>{if(document===void 0){o.disconnect();return}s.forEach(l=>{switch(l.type){case"attributes":Lc(l,n,t);break;case"childList":xc(l,n,t);break;default:P.log.error(`Unsupported mutation type: ${l.type}`)}})});o.observe(document,{attributes:!0,attributeFilter:[n],attributeOldValue:!1,childList:!0,subtree:!0}),document.addEventListener(P.CustomEvents.OnShutDown,()=>{o.disconnect()})}function Lc(e,t,n){if(!(e.target instanceof Element)||t!==e.attributeName)return;const r=e.target.getAttribute(t);S(r)&&n.observe(e.target,n)}function xc(e,t,n){if(!(e.target instanceof Element))return;const r=Array.from(e.addedNodes).filter(o=>o instanceof Element);if(r.length===0)return;const i=$i(t);r.forEach(o=>{o.hasAttribute(t)&&n.observe(o,n),o.querySelectorAll(i).forEach(s=>{n.observe(s,n)})})}let Ct=new WeakMap;function kc(e,t){if(Ct.has(e)){P.log.debug("Already observing element for visibility",e);return}P.log.debug("Observing element for visibility",e);const n=Pl.pageElementVisible(e);Ct.set(e,n),n.then(r=>{if(Ct.get(r)!==n){P.log.debug("Element now visible, but aborting, no longer current observer",r);return}P.log.debug("Element now visible, calling handle",r),t.handle(r)}).catch(r=>{P.log.warn("Failed to observe element for visibility",e,r)}).finally(()=>{if(Ct.get(e)!==n){P.log.debug("Observing element for visibility completed, was no longer current observer",e);return}P.log.debug("Observing element for visibility completed",e),Ct.delete(e)})}let xn=new WeakMap;function Uc(e,t){if(xn.has(e)){P.log.debug("Already observing element for click",e);return}P.log.debug("Observing element for click",e);const n=r=>{r.target instanceof Element?e.contains(r.target)?xn.get(e)!==n?(P.log.debug("Click within element, but aborting, no longer current observer",r.target,e),e.removeEventListener(xe,n)):(P.log.debug("Click within element, calling handle",r.target,e),t.handle(e)):P.log.warn("Click event target is not contained by expected element",r.target,e):P.log.warn("Click event target is not an element",r.target,e)};xn.set(e,n),e.addEventListener(xe,n),document.addEventListener(P.CustomEvents.OnShutDown,()=>{e.removeEventListener(xe,n)})}function Fc(){Ct=new WeakMap,xn=new WeakMap}function ca(e,t){const n=zc(e,t);if(D(n))return;const r=Hc(n);D(r)||P.sendEvent(r).catch(i=>{P.log.error(`Failed to send personalization engagement event ${JSON.stringify(r)}`,i)})}function zc(e,t){var n,r;const i=(n=t.closest(`[${Le}]`))==null?void 0:n.getAttribute(Le);if(!S(i))return P.log.warn(`${Le} not found in DOM hierarchy for element`,t),null;if(la(e)===void 0)return P.log.warn(`No engagement attribute definition found for ${e}`),null;const o=`${_t}${e}`;if(!t.hasAttribute(o))return P.log.warn(`Engagement attribute ${e} not found on element`,t),null;const s={},l=o.substring(5),a=(r=P.cashDom(t).attr(o))!=null?r:"",u=P.cashDom(t).data(l);P.log.debug(`Found ${e} with modifiers ${a}`,t),O(u,!1)?Object.keys(u).forEach(p=>{if(!S(p)){P.log.warn(`Ignoring empty/non-string modifier key within: ${a}`);return}const c=Lr(p);if(D(c)){P.log.warn(`Ignoring unknown modifier: ${p}`);return}const h=u[p];if(!S(h)){P.log.warn(`The value for event modifier "${p}" for engagement attribute of "${e}" is not a string and thus can't be used`);return}s[p]=h}):a.trim().length>0&&P.log.warn(`The value for engagement attribute ${e} was not valid JSON, so cannot process modifiers.`);const f={name:e,element:t,eventModifiers:s,personalizationId:i};return Ho(i)&&(f.isPreview=!0),f}function Hc(e){var t,n,r;if(D(e))return null;const i={interaction:{name:""},personalization:{id:e.personalizationId}};et(e.isPreview)&&e.isPreview&&(i.personalization.isTesting=!0);for(const l in e.eventModifiers){const a=Lr(l);if(D(a)){P.log.warn(`Ignoring unknown modifier: ${l}`);break}const u=e.eventModifiers[l];if(!S(u)){P.log.warn(`The value for event modifier "${l}" for engagement attribute of "${e.name}" is not a string and thus can't be used`);break}try{a.modifyEvent(u,e,i)}catch(f){P.log.error(`Could not set the value for event modifier "${l}" for engagement attribute of "${e.name}"`,f)}}S((t=i.interaction)==null?void 0:t.name)||P.log.warn("Resulting engagement event has no/empty interaction.name, is likely misconfigured, and will likely be suppressed from sending");const o=(n=e.eventModifiers)==null?void 0:n[wt],s=S(o)?sa(o):void 0;return(s==null?void 0:s.disableSendingNonItemEngagementEvents)===!0&&!S((r=i.personalization)==null?void 0:r.contentId)?(P.log.debug(`Not sending event due to disableSendingNonItemEngagementEvents and no contentId string: ${JSON.stringify(i)}`),null):i}function Vc(e){if(!O(e))throw new Y(q.DestinationEventModifiersAreRequired,"Engagement destination event modifiers are required.");Object.entries(e).forEach(([t,n])=>{if(!S(n)&&typeof n!="function")throw new Y(q.InvalidDestinationEventModifier,"Engagement destinations event modifier must be a function or a valid string.")})}function Bc(e){if(!O(e)||Object.keys(e).length===0)throw new Y(q.EngagementDestinationsAreRequired,"Engagement destinations are required.");Object.entries(e).forEach(([t,n])=>{if(n.description!==void 0&&!S(n.description))throw new Y(q.InvalidEngagementDestinationDescription,"Engagement destination description must be a string if provided.");Vc(n.eventModifiers)})}function Gc(e){if(!O(e))throw new Y(q.EngagementDestinationDefaultsAreRequired,"Engagement destination defaults are required.");if(e.byName!==void 0){if(!O(e.byName))throw new Y(q.InvalidEngagementDestinationDefaultByName,"Engagement destination defaults by name must be an object if provided.");Object.entries(e.byName).forEach(([,t])=>{if(!S(t))throw new Y(q.InvalidEngagementDestinationDefaultByNameValue,"Engagement destination by name must have a valid string value.")})}if(e.byType!==void 0){if(!O(e.byType))throw new Y(q.InvalidEngagementDestinationDefaultByType,"Engagement destination defaults by type must be an object if provided.");Object.entries(e.byType).forEach(([,t])=>{if(!S(t))throw new Y(q.InvalidEngagementDestinationDefaultByTypeValue,"Engagement destination by type must have a valid string value.")})}if(!S(e.global))throw new Y(q.InvalidEngagementDestinationDefaultGlobal,"Engagement destination global default must be valid string value.")}function fa(e,t){var n;if(e.description!==void 0&&!S(e.description))throw new Y(q.InvalidEngagementDestinationAttributeDescription,"Engagement destination attribute description must be a valid string if provided.",{context:{type:t}});if(e.scope!==void 0&&!((n=Object.values(ut))!=null&&n.includes(e.scope)))throw new Y(q.InvalidEngagementDestinationAttributeScope,"Engagement destination attribute scope should be a valid Engagement Attribute Scope if provided.",{context:{type:t,scope:e.scope}})}function jc(e){if(!O(e))throw new Y(q.InvalidEngagementDestinationAttributeEngagements,"Engagement destination attribute engagements must be a valid object.");Object.entries(e).forEach(([,t])=>{if(!O(t))throw new Y(q.InvalidEngagementDestinationAttributeEngagementValue,"Engagement destination attribute engagements value must be a valid object.");if(fa(t,"engagements"),t.qualify===void 0)throw new Y(q.MissingEngagementDestinationAttributeEngagementQualify,"Engagement destination attribute engagements must define a qualify function.");if(typeof t.qualify!="function")throw new Y(q.InvalidEngagementDestinationAttributeEngagementQualify,"Engagement destination attribute engagements qualify must be a function.");if(t.observe===void 0)throw new Y(q.MissingEngagementDestinationAttributeEngagementObserve,"Engagement destination attribute engagements must define an observe function.");if(typeof t.observe!="function")throw new Y(q.InvalidEngagementDestinationAttributeEngagementObserve,"Engagement destination attribute engagements observe must be a function.");if(t.handle===void 0)throw new Y(q.MissingEngagementDestinationAttributeEngagementHandle,"Engagement destination attribute engagements must define a handle function.");if(typeof t.handle!="function")throw new Y(q.InvalidEngagementDestinationAttributeEngagementHandle,"Engagement destination attribute engagements handle must be a function.")})}function Wc(e){if(!O(e))throw new Y(q.InvalidEngagementDestinationAttributeEventModifiers,"Engagement destination attribute event modifiers must be a valid object.");Object.entries(e).forEach(([,t])=>{var n;if(!O(t))throw new Y(q.InvalidEngagementDestinationAttributeEventModifiersValue,"Engagement destination attribute event modifiers value must be a valid object.");if(fa(t,"eventModifiers"),t.modifyEvent===void 0)throw new Y(q.MissingEngagementDestinationAttributeEventModifierModifyEvent,"Engagement destination attribute event modifiers must define a modifyEvent function.");if(typeof t.modifyEvent!="function")throw new Y(q.InvalidEngagementDestinationAttributeEventModifierModifyEvent,"Engagement destination attribute event modifiers modifyEvent must be a function.");if(t.valueType!==void 0&&!((n=Object.values(Nn))!=null&&n.includes(t.valueType)))throw new Y(q.InvalidEngagementDestinationAttributeEventModifierValueType,"Engagement destination attribute event modifiers value type should be a valid Engagement Attribute Value Type if provided.",{context:{valueType:t.valueType}});if(t.valueDefault!==void 0&&!S(t.valueDefault,!1,!0))throw new Y(q.InvalidEngagementDestinationAttributeEventModifierValueDefault,"Engagement destination attribute event modifiers value default should be a valid non-empty string if provided.")})}function qc(e){if(!O(e))throw new Y(q.InvalidEngagementDestinationAttributes,"Engagement destination attributes must be a valid object if provided.");jc(e.engagements),Wc(e.eventModifiers)}function da(e){if(!O(e))throw new Y(q.InvalidConfig,"Config is required.");Bc(e.destinations),Gc(e.destinationDefaults),e.attributes!==void 0&&qc(e.attributes)}function ha(e){if(nt()){if(!O(e,!1)){P.log.error("A config is required when setting Engagement Config.");return}try{da(e),Mc(e),P.log.info("Set Engagement Config to the following: ",e)}catch(t){P.log.error(`Engagement Config could not be set due to: ${X(t).message}`)}}else P.log.error("Engagement Config can only be set before SalesforceInteractions.init is called.")}var xr=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});class $c extends Rr{validateMethod(t){if(t!==void 0&&t!==$.ReplaceElementContent)throw new M(R.TransformationConfigMethodNotSupported,"Transformation Config method not supported for the specific type of transformer.",{context:{transformerType:pe.HtmlElementModifier,provided:t,required:$.ReplaceElementContent}})}validateSubstitutionValues(t){if(t===void 0||Object.entries(t).length===0)throw new M(R.MissingTransformationSubstitutionValues,"Transformation substitution values are required for the specific type of transformer.",{context:{transformerType:pe.HtmlElementModifier}})}transform(t,n,r,i,o){const s=o.pec.name,l=i.personalizationId,a=n.transformerName,u=`pec ${s} transformer ${a} for personalization ${l}`;if(n.substitutionValues===void 0){const p=new ie(le.MissingSubstitutions,`missing substitutionValues for transformation so cannot get the data from Personalization response, ${u}`);return y.log.warn(p.message),o.status.update(new k(p)),{promise:Promise.reject(p),revert:c=>xr(this,null,function*(){c.update(new k(`Nothing to revert, no transformation attempt, ${p.message}`)),yield Promise.resolve()})}}if(Object.entries(n.substitutionValues).length===0){const p=new ie(le.MissingSubstitutions,"missing an entry in substitutionValues for transformation so cannot get the data from Personalization response");return y.log.warn(p.message),o.status.update(new k(p)),{promise:Promise.reject(p),revert:c=>xr(this,null,function*(){c.update(new k(`Nothing to revert, no transformation attempt, ${p.message}`)),yield Promise.resolve()})}}o.status.update(new k(`Awaiting element/conditions ${u}`));const f=r.then(p=>{if(this.isElementAlreadyPersonalized(p)){y.log.error("Aborting personalization, element is already personalized",p);const I=new ie(le.AlreadyPersonalized,`Aborting ${u}, element is already personalized`);throw o.status.update(new k(I)),I}if(Qo(l,o,n),!D(o.revertStatus)){const I=`Aborting ${u}, revert has been called`;return y.log.info(I),o.status.update(new k(I)),m=>{m.update(new k(`Nothing to revert, since revert was requested before transformation, ${u}`))}}o.status.update(new k(`About to transform/render, element/conditions ready ${u}`));const c=p.outerHTML;let h,d;const g=Ue(),v=ta(o.pec.transformationConfig.engagementDestination,t.name,t.transformerType,g),w=ia();for(const I in n.substitutionValues){const m=n.substitutionValues[I];if(!S(m)){const N=`substitutionValues is missing a value for property "${I}" for transformation so cannot get the data from Personalization response`;y.log.warn(N),o.status.update(new k(N));continue}if(y.log.debug(`using dataPath ${m} to get data from personalization response`),w){const N=this.getPathParentObject(m,i),A=this.buildModifiersIfItemRelated(N,v,g);D(A)||(D(d)?(y.log.debug(`Using item-related modifiers ${JSON.stringify(A)} found adjacent to path "${m}"`),h=m,d=A):(A[It]!==d[It]||A[bt]!==d[bt])&&y.log.warn(`Ignoring different item-related modifiers ${JSON.stringify(A)} found adjacent to path "${m}", already using modifiers from path "${h}"`))}const T=this.isAttributeAssignment(I);if(T!==void 0)try{const N=this.getSanitizedContentString(m,i);if(S(N))if(T){this.setAttributeContent(p,I,N);const A=`Set attribute ${I} to ${N}, ${u}`;y.log.trace(A+", element:",p),o.status.update(new k(A))}else{this.setProperty(p,I,N);const A=`Set property ${I} to ${N}, ${u}`;y.log.trace(A+", element:",p),o.status.update(new k(A))}else{const A=`Could not set property ${I}, nothing found at path ${m}`;y.log.debug(A+", element:",p),o.status.update(new k(A))}}catch(N){const A=`Could not set content for ${u}, subVal "${I}"`;y.log.error(A,N);const U=new Error(A+": "+X(N).message);o.status.update(new k(U))}}let _;return w?(D(d)?(this.autoInjectDefaultRootAttributes(p,l,v,!0),_="Auto-injected engagement attributes without item ids"):(this.autoInjectDefaultItemAttributes(p,l,d,!0),_="Auto-injected engagement attributes with item ids"),y.log.trace(_+`, ${u}`)):(_="Engagement Config does not support auto-injection of default engagement attributes",y.log.trace(_)),o.status.update(new k(_)),I=>{let m=`Reverting ${u}`;y.log.debug(m,p),I.update(new k(m)),p.insertAdjacentHTML("beforebegin",c),p.remove(),m=`Reverted ${u}`,y.log.debug(m,p),I.update(new k(m))}});return{promise:f.then(),revert:p=>xr(this,null,function*(){p.update(new k("Awaiting transformPromise"));const c=f.then(h=>{h(p)},h=>{if(h instanceof ie){p.update(new k(`Nothing to revert, no transformation attempt, ${u}`));return}throw h});c.catch(h=>{const d=new Error(`Issue reverting ${u}: `+X(h).message);y.log.error(d),p.update(new k(d))}),yield c})}}isAttributeAssignment(t){const n=t.split(".");if(n[0].toLowerCase()==="attributes"){if(n.length===2)return!0;y.log.warn(`multiple objects for 'attributes' with propertyName '${t}' is not supported`);return}return!1}getAttributeContent(t,n){const r=n.split(".");return t.getAttribute(r[1])}removeAttribute(t,n){const r=n.split(".");t.removeAttribute(r[1])}setAttributeContent(t,n,r){const i=n.split(".");t.setAttribute(i[1],r)}setProperty(t,n,r){r=this.handleSpecialValues(n,r);const i=n.split(".");i.length>1?this.setProperty(t[i[0]],i[1],r):Object.assign(t,{[n]:r})}getProperty(t,n){const r=n.split(".");return r.length>1?this.getProperty(t[r[0]],r[1]):t[n]}handleSpecialValues(t,n){if(t.toLowerCase()==="style.backgroundimage"&&S(n))try{return`url(${encodeURI(n)})`}catch(r){y.log.warn(`Could not set style.backgroundImage to a URL "${n}" due to: `,r)}return n}}function Yc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kr={exports:{}},Ur={exports:{}},we={},K={};K.__esModule=!0,K.extend=pa,K.indexOf=Jc,K.escapeExpression=ef,K.isEmpty=tf,K.createFrame=nf,K.blockParams=rf,K.appendContextPath=of;var Zc={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},Kc=/[&<>"'`=]/g,Xc=/[&<>"'`=]/;function Qc(e){return Zc[e]}function pa(e){for(var t=1;t0?(o.ids&&(o.ids=[o.name]),r.helpers.each(i,o)):s(this);if(o.data&&o.ids){var a=n.createFrame(o.data);a.contextPath=n.appendContextPath(o.data.contextPath,o.name),o={data:a}}return l(i,o)})},e.exports=t.default})(Vr,Vr.exports);var af=Vr.exports,Br={exports:{}};(function(e,t){t.__esModule=!0;function n(s){return s&&s.__esModule?s:{default:s}}var r=K,i=Ne,o=n(i);t.default=function(s){s.registerHelper("each",function(l,a){if(!a)throw new o.default("Must pass iterator to #each");var u=a.fn,f=a.inverse,p=0,c="",h=void 0,d=void 0;a.data&&a.ids&&(d=r.appendContextPath(a.data.contextPath,a.ids[0])+"."),r.isFunction(l)&&(l=l.call(this)),a.data&&(h=r.createFrame(a.data));function g(m,T,N){h&&(h.key=m,h.index=T,h.first=T===0,h.last=!!N,d&&(h.contextPath=d+m)),c=c+u(l[m],{data:h,blockParams:r.blockParams([l[m],m],[d+m,null])})}if(l&&typeof l=="object")if(r.isArray(l))for(var v=l.length;p=0?o=s:o=parseInt(o,10)}return o},log:function(o){if(o=r.lookupLevel(o),typeof console!="undefined"&&r.lookupLevel(r.level)<=o){var s=r.methodMap[o];console[s]||(s="log");for(var l=arguments.length,a=Array(l>1?l-1:0),u=1;u= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};we.REVISION_CHANGES=Xf;var Jr="[object Object]";function ei(e,t,n){this.helpers=e||{},this.partials=t||{},this.decorators=n||{},jf.registerDefaultHelpers(this),Wf.registerDefaultDecorators(this)}ei.prototype={constructor:ei,logger:Un.default,log:Un.default.log,registerHelper:function(t,n){if(dt.toString.call(t)===Jr){if(n)throw new Qr.default("Arg not supported with multiple helpers");dt.extend(this.helpers,t)}else this.helpers[t]=n},unregisterHelper:function(t){delete this.helpers[t]},registerPartial:function(t,n){if(dt.toString.call(t)===Jr)dt.extend(this.partials,t);else{if(typeof n=="undefined")throw new Qr.default('Attempting to register a partial called "'+t+'" as undefined');this.partials[t]=n}},unregisterPartial:function(t){delete this.partials[t]},registerDecorator:function(t,n){if(dt.toString.call(t)===Jr){if(n)throw new Qr.default("Arg not supported with multiple decorators");dt.extend(this.decorators,t)}else this.decorators[t]=n},unregisterDecorator:function(t){delete this.decorators[t]},resetLoggedPropertyAccesses:function(){$f.resetLoggedProperties()}};var Qf=Un.default.log;we.log=Qf,we.createFrame=dt.createFrame,we.logger=Un.default;var ti={exports:{}};(function(e,t){t.__esModule=!0;function n(r){this.string=r}n.prototype.toString=n.prototype.toHTML=function(){return""+this.string},t.default=n,e.exports=t.default})(ti,ti.exports);var Jf=ti.exports,at={},ni={};ni.__esModule=!0,ni.wrapHelper=ed;function ed(e,t){if(typeof e!="function")return e;var n=function(){var i=arguments[arguments.length-1];return arguments[arguments.length-1]=t(i),e.apply(this,arguments)};return n}at.__esModule=!0,at.checkRevision=ad,at.template=sd,at.wrapProgram=Fn,at.resolvePartial=ld,at.invokePartial=ud,at.noop=Sa;function td(e){return e&&e.__esModule?e:{default:e}}function nd(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}var rd=K,qe=nd(rd),id=Ne,$e=td(id),Ye=we,_a=Jt,od=ni,Ta=Pt;function ad(e){var t=e&&e[0]||1,n=Ye.COMPILER_REVISION;if(!(t>=Ye.LAST_COMPATIBLE_COMPILER_REVISION&&t<=Ye.COMPILER_REVISION))if(t2&&V.push("'"+this.terminals_[U]+"'");this.lexer.showPosition?Fe="Parse error on line "+(d+1)+`: `+this.lexer.showPosition()+` Expecting `+V.join(", ")+", got '"+(this.terminals_[I]||I)+"'":Fe="Parse error on line "+(d+1)+": Unexpected "+(I==1?"end of input":"'"+(this.terminals_[I]||I)+"'"),this.parseError(Fe,{text:this.lexer.match,token:this.terminals_[I]||I,line:this.lexer.yylineno,loc:v,expected:V})}}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+I);switch(T[0]){case 1:u.push(I),f.push(this.lexer.yytext),p.push(this.lexer.yylloc),u.push(T[1]),I=null,g=this.lexer.yyleng,h=this.lexer.yytext,d=this.lexer.yylineno,v=this.lexer.yylloc;break;case 2:if(Q=this.productions_[T[1]][1],A.$=f[f.length-Q],A._$={first_line:p[p.length-(Q||1)].first_line,last_line:p[p.length-1].last_line,first_column:p[p.length-(Q||1)].first_column,last_column:p[p.length-1].last_column},w&&(A._$.range=[p[p.length-(Q||1)].range[0],p[p.length-1].range[1]]),N=this.performAction.call(A,h,g,d,this.yy,T[1],f,p),typeof N!="undefined")return N;Q&&(u=u.slice(0,-1*Q*2),f=f.slice(0,-1*Q),p=p.slice(0,-1*Q)),u.push(this.productions_[T[1]][0]),f.push(A.$),p.push(A._$),W=c[u[u.length-2]][u[u.length-1]],u.push(W);break;case 3:return!0}}return!0}},i=function(){var s={EOF:1,parseError:function(a,u){if(this.yy.parser)this.yy.parser.parseError(a,u);else throw new Error(a)},setInput:function(a){return this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var u=a.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var u=a.length,f=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u-1),this.offset-=u;var p=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),f.length-1&&(this.yylineno-=f.length-1);var c=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:f?(f.length===p.length?this.yylloc.first_column:0)+p[p.length-f.length].length-f[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[c[0],c[0]+this.yyleng-u]),this},more:function(){return this._more=!0,this},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),u=new Array(a.length+1).join("-");return a+this.upcomingInput()+` `+u+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,u,f,p,c;this._more||(this.yytext="",this.match="");for(var h=this._currentRules(),d=0;du[0].length)&&(u=f,p=d,!this.options.flex)));d++);return u?(c=u[0].match(/(?:\r\n?|\n).*/g),c&&(this.yylineno+=c.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:c?c[c.length-1].length-c[c.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+u[0].length},this.yytext+=u[0],this.match+=u[0],this.matches=u,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(u[0].length),this.matched+=u[0],a=this.performAction.call(this,this.yy,this,h[p],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),a||void 0):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return typeof a!="undefined"?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(a){this.begin(a)}};return s.options={},s.performAction=function(a,u,f,p){function c(h,d){return u.yytext=u.yytext.substring(h,u.yyleng-d+h)}switch(f){case 0:if(u.yytext.slice(-2)==="\\\\"?(c(0,1),this.begin("mu")):u.yytext.slice(-1)==="\\"?(c(0,1),this.begin("emu")):this.begin("mu"),u.yytext)return 15;break;case 1:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),this.conditionStack[this.conditionStack.length-1]==="raw"?15:(c(5,9),"END_RAW_BLOCK");case 5:return 15;case 6:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:return this.popState(),44;case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:return 48;case 21:this.unput(u.yytext),this.popState(),this.begin("com");break;case 22:return this.popState(),14;case 23:return 48;case 24:return 73;case 25:return 72;case 26:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return u.yytext=c(1,2).replace(/\\"/g,'"'),80;case 32:return u.yytext=c(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:return 82;case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 41:return 72;case 42:return u.yytext=u.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},s.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],s.conditions={mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}},s}();r.lexer=i;function o(){this.yy={}}return o.prototype=r,r.Parser=o,new o}();t.default=n,e.exports=t.default})(oi,oi.exports);var pd=oi.exports,ai={exports:{}},si={exports:{}};(function(e,t){t.__esModule=!0;function n(u){return u&&u.__esModule?u:{default:u}}var r=Ne,i=n(r);function o(){this.parents=[]}o.prototype={constructor:o,mutating:!1,acceptKey:function(f,p){var c=this.accept(f[p]);if(this.mutating){if(c&&!o.prototype[c.type])throw new i.default('Unexpected node type "'+c.type+'" found when accepting '+p+" on "+f.type);f[p]=c}},acceptRequired:function(f,p){if(this.acceptKey(f,p),!f[p])throw new i.default(f.type+" requires "+p)},acceptArray:function(f){for(var p=0,c=f.length;p0)throw new li.default("Invalid path: "+r,{loc:n});a===".."&&o++}else i.push(a)}return{type:"PathExpression",data:e,depth:o,parts:i,original:r,loc:n}}function wd(e,t,n,r,i,o){var s=r.charAt(3)||r.charAt(2),l=s!=="{"&&s!=="&",a=/\*/.test(r);return{type:a?"Decorator":"MustacheStatement",path:e,params:t,hash:n,escaped:l,strip:i,loc:this.locInfo(o)}}function bd(e,t,n,r){ui(e,n),r=this.locInfo(r);var i={type:"Program",body:t,strip:{},loc:r};return{type:"BlockStatement",path:e.path,params:e.params,hash:e.hash,program:i,openStrip:{},inverseStrip:{},closeStrip:{},loc:r}}function Id(e,t,n,r,i,o){r&&r.path&&ui(e,r);var s=/\*/.test(e.open);t.blockParams=e.blockParams;var l=void 0,a=void 0;if(n){if(s)throw new li.default("Unexpected inverse block on decorator",n);n.chain&&(n.program.body[0].closeStrip=r.strip),a=n.strip,l=n.program}return i&&(i=l,l=t,t=i),{type:s?"DecoratorBlock":"BlockStatement",path:e.path,params:e.params,hash:e.hash,program:t,inverse:l,openStrip:e.strip,inverseStrip:a,closeStrip:r&&r.strip,loc:this.locInfo(o)}}function Ad(e,t){if(!t&&e.length){var n=e[0].loc,r=e[e.length-1].loc;n&&r&&(t={source:n.source,start:{line:n.start.line,column:n.start.column},end:{line:r.end.line,column:r.end.column}})}return{type:"Program",body:e,strip:{},loc:t}}function Cd(e,t,n,r){return ui(e,n),{type:"PartialBlockStatement",name:e.path,params:e.params,hash:e.hash,program:t,openStrip:e.strip,closeStrip:n&&n.strip,loc:this.locInfo(r)}}en.__esModule=!0,en.parseWithoutProcessing=Pa,en.parse=xd;function Pd(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function Ca(e){return e&&e.__esModule?e:{default:e}}var Nd=pd,ci=Ca(Nd),Od=gd,Dd=Ca(Od),Md=be,Rd=Pd(Md),Ld=K;en.parser=ci.default;var zn={};Ld.extend(zn,Rd);function Pa(e,t){if(e.type==="Program")return e;ci.default.yy=zn,zn.locInfo=function(r){return new zn.SourceLocation(t&&t.srcName,r)};var n=ci.default.parse(e);return n}function xd(e,t){var n=Pa(e,t),r=new Dd.default(t);return r.accept(n)}var tn={};tn.__esModule=!0,tn.Compiler=fi,tn.precompile=zd,tn.compile=Hd;function Na(e){return e&&e.__esModule?e:{default:e}}var kd=Ne,nn=Na(kd),rn=K,Ud=Ia,on=Na(Ud),Fd=[].slice;function fi(){}fi.prototype={compiler:fi,equals:function(t){var n=this.opcodes.length;if(t.opcodes.length!==n)return!1;for(var r=0;r1)throw new nn.default("Unsupported number of partial arguments: "+r.length,t);r.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):r.push({type:"PathExpression",parts:[],depth:0}));var i=t.name.original,o=t.name.type==="SubExpression";o&&this.accept(t.name),this.setupFullMustacheParams(t,n,void 0,!0);var s=t.indent||"";this.options.preventIndent&&s&&(this.opcode("appendContent",s),s=""),this.opcode("invokePartial",o,i,s),this.opcode("append")},PartialBlockStatement:function(t){this.PartialStatement(t)},MustacheStatement:function(t){this.SubExpression(t),t.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(t){this.DecoratorBlock(t)},ContentStatement:function(t){t.value&&this.opcode("appendContent",t.value)},CommentStatement:function(){},SubExpression:function(t){Da(t);var n=this.classifySexpr(t);n==="simple"?this.simpleSexpr(t):n==="helper"?this.helperSexpr(t):this.ambiguousSexpr(t)},ambiguousSexpr:function(t,n,r){var i=t.path,o=i.parts[0],s=n!=null||r!=null;this.opcode("getContext",i.depth),this.opcode("pushProgram",n),this.opcode("pushProgram",r),i.strict=!0,this.accept(i),this.opcode("invokeAmbiguous",o,s)},simpleSexpr:function(t){var n=t.path;n.strict=!0,this.accept(n),this.opcode("resolvePossibleLambda")},helperSexpr:function(t,n,r){var i=this.setupFullMustacheParams(t,n,r),o=t.path,s=o.parts[0];if(this.options.knownHelpers[s])this.opcode("invokeKnownHelper",i.length,s);else{if(this.options.knownHelpersOnly)throw new nn.default("You specified knownHelpersOnly, but used the unknown helper "+s,t);o.strict=!0,o.falsy=!0,this.accept(o),this.opcode("invokeHelper",i.length,o.original,on.default.helpers.simpleId(o))}},PathExpression:function(t){this.addDepth(t.depth),this.opcode("getContext",t.depth);var n=t.parts[0],r=on.default.helpers.scopedId(t),i=!t.depth&&!r&&this.blockParamIndex(n);i?this.opcode("lookupBlockParam",i,t.parts):n?t.data?(this.options.data=!0,this.opcode("lookupData",t.depth,t.parts,t.strict)):this.opcode("lookupOnContext",t.parts,t.falsy,t.strict,r):this.opcode("pushContext")},StringLiteral:function(t){this.opcode("pushString",t.value)},NumberLiteral:function(t){this.opcode("pushLiteral",t.value)},BooleanLiteral:function(t){this.opcode("pushLiteral",t.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(t){var n=t.pairs,r=0,i=n.length;for(this.opcode("pushHash");r=0)return[n,o]}}};function zd(e,t,n){if(e==null||typeof e!="string"&&e.type!=="Program")throw new nn.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+e);t=t||{},"data"in t||(t.data=!0),t.compat&&(t.useDepths=!0);var r=n.parse(e,t),i=new n.Compiler().compile(r,t);return new n.JavaScriptCompiler().compile(i,t)}function Hd(e,t,n){if(t===void 0&&(t={}),e==null||typeof e!="string"&&e.type!=="Program")throw new nn.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+e);t=rn.extend({},t),"data"in t||(t.data=!0),t.compat&&(t.useDepths=!0);var r=void 0;function i(){var s=n.parse(e,t),l=new n.Compiler().compile(s,t),a=new n.JavaScriptCompiler().compile(l,t,void 0,!0);return n.template(a)}function o(s,l){return r||(r=i()),r.call(this,s,l)}return o._setup=function(s){return r||(r=i()),r._setup(s)},o._child=function(s,l,a,u){return r||(r=i()),r._child(s,l,a,u)},o}function Oa(e,t){if(e===t)return!0;if(rn.isArray(e)&&rn.isArray(t)&&e.length===t.length){for(var n=0;n>1;return a?-u:u}return Hn.encode=function(a){var u="",f,p=o(a);do f=p&r,p>>>=t,p>0&&(f|=i),u+=e.encode(f);while(p>0);return u},Hn.decode=function(a,u,f){var p=a.length,c=0,h=0,d,g;do{if(u>=p)throw new Error("Expected more digits in base 64 VLQ value.");if(g=e.decode(a.charCodeAt(u++)),g===-1)throw new Error("Invalid base64 digit: "+a.charAt(u-1));d=!!(g&i),g&=r,c=c+(g<=0;V--)Q=U[V],Q==="."?U.splice(V,1):Q===".."?W++:W>0&&(Q===""?(U.splice(V+1,W),W=0):(U.splice(V,2),W--));return T=U.join("/"),T===""&&(T=A?"/":"."),N?(N.path=T,o(N)):T}e.normalize=s;function l(m,T){m===""&&(m="."),T===""&&(T=".");var N=i(T),A=i(m);if(A&&(m=A.path||"/"),N&&!N.scheme)return A&&(N.scheme=A.scheme),o(N);if(N||T.match(r))return T;if(A&&!A.host&&!A.path)return A.host=T,o(A);var U=T.charAt(0)==="/"?T:s(m.replace(/\/+$/,"")+"/"+T);return A?(A.path=U,o(A)):U}e.join=l,e.isAbsolute=function(m){return m.charAt(0)==="/"||n.test(m)};function a(m,T){m===""&&(m="."),m=m.replace(/\/$/,"");for(var N=0;T.indexOf(m+"/")!==0;){var A=m.lastIndexOf("/");if(A<0||(m=m.slice(0,A),m.match(/^([^\/]+:\/)?\/*$/)))return T;++N}return Array(N+1).join("../")+T.substr(m.length+1)}e.relative=a;var u=function(){var m=Object.create(null);return!("__proto__"in m)}();function f(m){return m}function p(m){return h(m)?"$"+m:m}e.toSetString=u?f:p;function c(m){return h(m)?m.slice(1):m}e.fromSetString=u?f:c;function h(m){if(!m)return!1;var T=m.length;if(T<9||m.charCodeAt(T-1)!==95||m.charCodeAt(T-2)!==95||m.charCodeAt(T-3)!==111||m.charCodeAt(T-4)!==116||m.charCodeAt(T-5)!==111||m.charCodeAt(T-6)!==114||m.charCodeAt(T-7)!==112||m.charCodeAt(T-8)!==95||m.charCodeAt(T-9)!==95)return!1;for(var N=T-10;N>=0;N--)if(m.charCodeAt(N)!==36)return!1;return!0}function d(m,T,N){var A=v(m.source,T.source);return A!==0||(A=m.originalLine-T.originalLine,A!==0)||(A=m.originalColumn-T.originalColumn,A!==0||N)||(A=m.generatedColumn-T.generatedColumn,A!==0)||(A=m.generatedLine-T.generatedLine,A!==0)?A:v(m.name,T.name)}e.compareByOriginalPositions=d;function g(m,T,N){var A=m.generatedLine-T.generatedLine;return A!==0||(A=m.generatedColumn-T.generatedColumn,A!==0||N)||(A=v(m.source,T.source),A!==0)||(A=m.originalLine-T.originalLine,A!==0)||(A=m.originalColumn-T.originalColumn,A!==0)?A:v(m.name,T.name)}e.compareByGeneratedPositionsDeflated=g;function v(m,T){return m===T?0:m===null?1:T===null?-1:m>T?1:-1}function w(m,T){var N=m.generatedLine-T.generatedLine;return N!==0||(N=m.generatedColumn-T.generatedColumn,N!==0)||(N=v(m.source,T.source),N!==0)||(N=m.originalLine-T.originalLine,N!==0)||(N=m.originalColumn-T.originalColumn,N!==0)?N:v(m.name,T.name)}e.compareByGeneratedPositionsInflated=w;function _(m){return JSON.parse(m.replace(/^\)]}'[^\n]*\n/,""))}e.parseSourceMapInput=_;function I(m,T,N){if(T=T||"",m&&(m[m.length-1]!=="/"&&T[0]!=="/"&&(m+="/"),T=m+T),N){var A=i(N);if(!A)throw new Error("sourceMapURL could not be parsed");if(A.path){var U=A.path.lastIndexOf("/");U>=0&&(A.path=A.path.substring(0,U+1))}T=l(o(A),T)}return s(T)}e.computeSourceURL=I}(gi)),gi}var mi={},ka;function Ua(){if(ka)return mi;ka=1;var e=sn(),t=Object.prototype.hasOwnProperty,n=typeof Map!="undefined";function r(){this._array=[],this._set=n?new Map:Object.create(null)}return r.fromArray=function(o,s){for(var l=new r,a=0,u=o.length;a=0)return s}else{var l=e.toSetString(o);if(t.call(this._set,l))return this._set[l]}throw new Error('"'+o+'" is not in the set.')},r.prototype.at=function(o){if(o>=0&&oo||s==o&&a>=l||e.compareByGeneratedPositionsInflated(r,i)<=0}function n(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}return n.prototype.unsortedForEach=function(i,o){this._array.forEach(i,o)},n.prototype.add=function(i){t(this._last,i)?(this._last=i,this._array.push(i)):(this._sorted=!1,this._array.push(i))},n.prototype.toArray=function(){return this._sorted||(this._array.sort(e.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},vi.MappingList=n,vi}var za;function Ha(){if(za)return pi;za=1;var e=La(),t=sn(),n=Ua().ArraySet,r=Bd().MappingList;function i(o){o||(o={}),this._file=t.getArg(o,"file",null),this._sourceRoot=t.getArg(o,"sourceRoot",null),this._skipValidation=t.getArg(o,"skipValidation",!1),this._sources=new n,this._names=new n,this._mappings=new r,this._sourcesContents=null}return i.prototype._version=3,i.fromSourceMap=function(s){var l=s.sourceRoot,a=new i({file:s.file,sourceRoot:l});return s.eachMapping(function(u){var f={generated:{line:u.generatedLine,column:u.generatedColumn}};u.source!=null&&(f.source=u.source,l!=null&&(f.source=t.relative(l,f.source)),f.original={line:u.originalLine,column:u.originalColumn},u.name!=null&&(f.name=u.name)),a.addMapping(f)}),s.sources.forEach(function(u){var f=u;l!==null&&(f=t.relative(l,u)),a._sources.has(f)||a._sources.add(f);var p=s.sourceContentFor(u);p!=null&&a.setSourceContent(u,p)}),a},i.prototype.addMapping=function(s){var l=t.getArg(s,"generated"),a=t.getArg(s,"original",null),u=t.getArg(s,"source",null),f=t.getArg(s,"name",null);this._skipValidation||this._validateMapping(l,a,u,f),u!=null&&(u=String(u),this._sources.has(u)||this._sources.add(u)),f!=null&&(f=String(f),this._names.has(f)||this._names.add(f)),this._mappings.add({generatedLine:l.line,generatedColumn:l.column,originalLine:a!=null&&a.line,originalColumn:a!=null&&a.column,source:u,name:f})},i.prototype.setSourceContent=function(s,l){var a=s;this._sourceRoot!=null&&(a=t.relative(this._sourceRoot,a)),l!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[t.toSetString(a)]=l):this._sourcesContents&&(delete this._sourcesContents[t.toSetString(a)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))},i.prototype.applySourceMap=function(s,l,a){var u=l;if(l==null){if(s.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);u=s.file}var f=this._sourceRoot;f!=null&&(u=t.relative(f,u));var p=new n,c=new n;this._mappings.unsortedForEach(function(h){if(h.source===u&&h.originalLine!=null){var d=s.originalPositionFor({line:h.originalLine,column:h.originalColumn});d.source!=null&&(h.source=d.source,a!=null&&(h.source=t.join(a,h.source)),f!=null&&(h.source=t.relative(f,h.source)),h.originalLine=d.line,h.originalColumn=d.column,d.name!=null&&(h.name=d.name))}var g=h.source;g!=null&&!p.has(g)&&p.add(g);var v=h.name;v!=null&&!c.has(v)&&c.add(v)},this),this._sources=p,this._names=c,s.sources.forEach(function(h){var d=s.sourceContentFor(h);d!=null&&(a!=null&&(h=t.join(a,h)),f!=null&&(h=t.relative(f,h)),this.setSourceContent(h,d))},this)},i.prototype._validateMapping=function(s,l,a,u){if(l&&typeof l.line!="number"&&typeof l.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(s&&"line"in s&&"column"in s&&s.line>0&&s.column>=0&&!l&&!a&&!u)){if(s&&"line"in s&&"column"in s&&l&&"line"in l&&"column"in l&&s.line>0&&s.column>=0&&l.line>0&&l.column>=0&&a)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:s,source:a,original:l,name:u}))}},i.prototype._serializeMappings=function(){for(var s=0,l=1,a=0,u=0,f=0,p=0,c="",h,d,g,v,w=this._mappings.toArray(),_=0,I=w.length;_0){if(!t.compareByGeneratedPositionsInflated(d,w[_-1]))continue;h+=","}h+=e.encode(d.generatedColumn-s),s=d.generatedColumn,d.source!=null&&(v=this._sources.indexOf(d.source),h+=e.encode(v-p),p=v,h+=e.encode(d.originalLine-1-u),u=d.originalLine-1,h+=e.encode(d.originalColumn-a),a=d.originalColumn,d.name!=null&&(g=this._names.indexOf(d.name),h+=e.encode(g-f),f=g)),c+=h}return c},i.prototype._generateSourcesContent=function(s,l){return s.map(function(a){if(!this._sourcesContents)return null;l!=null&&(a=t.relative(l,a));var u=t.toSetString(a);return Object.prototype.hasOwnProperty.call(this._sourcesContents,u)?this._sourcesContents[u]:null},this)},i.prototype.toJSON=function(){var s={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(s.file=this._file),this._sourceRoot!=null&&(s.sourceRoot=this._sourceRoot),this._sourcesContents&&(s.sourcesContent=this._generateSourcesContent(s.sources,s.sourceRoot)),s},i.prototype.toString=function(){return JSON.stringify(this.toJSON())},pi.SourceMapGenerator=i,pi}var ln={},Ei={},Va;function Gd(){return Va||(Va=1,function(e){e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2;function t(n,r,i,o,s,l){var a=Math.floor((r-n)/2)+n,u=s(i,o[a],!0);return u===0?a:u>0?r-a>1?t(a,r,i,o,s,l):l==e.LEAST_UPPER_BOUND?r1?t(n,a,i,o,s,l):l==e.LEAST_UPPER_BOUND?a:n<0?-1:n}e.search=function(r,i,o,s){if(i.length===0)return-1;var l=t(-1,i.length,r,i,o,s||e.GREATEST_LOWER_BOUND);if(l<0)return-1;for(;l-1>=0&&o(i[l],i[l-1],!0)===0;)--l;return l}}(Ei)),Ei}var yi={},Ba;function jd(){if(Ba)return yi;Ba=1;function e(r,i,o){var s=r[i];r[i]=r[o],r[o]=s}function t(r,i){return Math.round(r+Math.random()*(i-r))}function n(r,i,o,s){if(o=0){var g=this._originalMappings[d];if(f.column===void 0)for(var v=g.originalLine;g&&g.originalLine===v;)h.push({line:e.getArg(g,"generatedLine",null),column:e.getArg(g,"generatedColumn",null),lastColumn:e.getArg(g,"lastGeneratedColumn",null)}),g=this._originalMappings[++d];else for(var w=g.originalColumn;g&&g.originalLine===p&&g.originalColumn==w;)h.push({line:e.getArg(g,"generatedLine",null),column:e.getArg(g,"generatedColumn",null),lastColumn:e.getArg(g,"lastGeneratedColumn",null)}),g=this._originalMappings[++d]}return h},ln.SourceMapConsumer=o;function s(u,f){var p=u;typeof u=="string"&&(p=e.parseSourceMapInput(u));var c=e.getArg(p,"version"),h=e.getArg(p,"sources"),d=e.getArg(p,"names",[]),g=e.getArg(p,"sourceRoot",null),v=e.getArg(p,"sourcesContent",null),w=e.getArg(p,"mappings"),_=e.getArg(p,"file",null);if(c!=this._version)throw new Error("Unsupported version: "+c);g&&(g=e.normalize(g)),h=h.map(String).map(e.normalize).map(function(I){return g&&e.isAbsolute(g)&&e.isAbsolute(I)?e.relative(g,I):I}),this._names=n.fromArray(d.map(String),!0),this._sources=n.fromArray(h,!0),this._absoluteSources=this._sources.toArray().map(function(I){return e.computeSourceURL(g,I,f)}),this.sourceRoot=g,this.sourcesContent=v,this._mappings=w,this._sourceMapURL=f,this.file=_}s.prototype=Object.create(o.prototype),s.prototype.consumer=o,s.prototype._findSourceIndex=function(u){var f=u;if(this.sourceRoot!=null&&(f=e.relative(this.sourceRoot,f)),this._sources.has(f))return this._sources.indexOf(f);var p;for(p=0;p1&&(U.source=v+W[1],v+=W[1],U.originalLine=d+W[2],d=U.originalLine,U.originalLine+=1,U.originalColumn=g+W[3],g=U.originalColumn,W.length>4&&(U.name=w+W[4],w+=W[4])),A.push(U),typeof U.originalLine=="number"&&N.push(U)}i(A,e.compareByGeneratedPositionsDeflated),this.__generatedMappings=A,i(N,e.compareByOriginalPositions),this.__originalMappings=N},s.prototype._findMapping=function(f,p,c,h,d,g){if(f[c]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+f[c]);if(f[h]<0)throw new TypeError("Column must be greater than or equal to 0, got "+f[h]);return t.search(f,p,d,g)},s.prototype.computeColumnSpans=function(){for(var f=0;f=0){var h=this._generatedMappings[c];if(h.generatedLine===p.generatedLine){var d=e.getArg(h,"source",null);d!==null&&(d=this._sources.at(d),d=e.computeSourceURL(this.sourceRoot,d,this._sourceMapURL));var g=e.getArg(h,"name",null);return g!==null&&(g=this._names.at(g)),{source:d,line:e.getArg(h,"originalLine",null),column:e.getArg(h,"originalColumn",null),name:g}}}return{source:null,line:null,column:null,name:null}},s.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(f){return f==null}):!1},s.prototype.sourceContentFor=function(f,p){if(!this.sourcesContent)return null;var c=this._findSourceIndex(f);if(c>=0)return this.sourcesContent[c];var h=f;this.sourceRoot!=null&&(h=e.relative(this.sourceRoot,h));var d;if(this.sourceRoot!=null&&(d=e.urlParse(this.sourceRoot))){var g=h.replace(/^file:\/\//,"");if(d.scheme=="file"&&this._sources.has(g))return this.sourcesContent[this._sources.indexOf(g)];if((!d.path||d.path=="/")&&this._sources.has("/"+h))return this.sourcesContent[this._sources.indexOf("/"+h)]}if(p)return null;throw new Error('"'+h+'" is not in the SourceMap.')},s.prototype.generatedPositionFor=function(f){var p=e.getArg(f,"source");if(p=this._findSourceIndex(p),p<0)return{line:null,column:null,lastColumn:null};var c={source:p,originalLine:e.getArg(f,"line"),originalColumn:e.getArg(f,"column")},h=this._findMapping(c,this._originalMappings,"originalLine","originalColumn",e.compareByOriginalPositions,e.getArg(f,"bias",o.GREATEST_LOWER_BOUND));if(h>=0){var d=this._originalMappings[h];if(d.source===c.source)return{line:e.getArg(d,"generatedLine",null),column:e.getArg(d,"generatedColumn",null),lastColumn:e.getArg(d,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},ln.BasicSourceMapConsumer=s;function a(u,f){var p=u;typeof u=="string"&&(p=e.parseSourceMapInput(u));var c=e.getArg(p,"version"),h=e.getArg(p,"sections");if(c!=this._version)throw new Error("Unsupported version: "+c);this._sources=new n,this._names=new n;var d={line:-1,column:0};this._sections=h.map(function(g){if(g.url)throw new Error("Support for url field in sections not implemented.");var v=e.getArg(g,"offset"),w=e.getArg(v,"line"),_=e.getArg(v,"column");if(w=0;a--)this.prepend(l[a]);else if(l[i]||typeof l=="string")this.children.unshift(l);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+l);return this},o.prototype.walk=function(l){for(var a,u=0,f=this.children.length;u0){for(a=[],u=0;u0&&(g+=", "+v.join(", "));var w=0;Object.keys(this.aliases).forEach(function(m){var T=d.aliases[m];T.children&&T.referenceCount>1&&(g+=", alias"+ ++w+"="+m,T.children[0]="alias"+w)}),this.lookupPropertyFunctionIsUsed&&(g+=", "+this.lookupPropertyFunctionVarDeclaration());var _=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&_.push("blockParams"),this.useDepths&&_.push("depths");var I=this.mergeSource(g);return h?(_.push(I),Function.apply(this,_)):this.source.wrap(["function(",_.join(","),`) { `,I,"}"])},mergeSource:function(h){var d=this.environment.isSimple,g=!this.forceBuffer,v=void 0,w=void 0,_=void 0,I=void 0;return this.source.each(function(m){m.appendToBuffer?(_?m.prepend(" + "):_=m,I=m):(_&&(w?_.prepend("buffer += "):v=!0,I.add(";"),_=I=void 0),w=!0,d||(g=!1))}),g?_?(_.prepend("return "),I.add(";")):w||this.source.push('return "";'):(h+=", buffer = "+(v?"":this.initializeBuffer()),_?(_.prepend("return buffer + "),I.add(";")):this.source.push("return buffer;")),h&&this.source.prepend("var "+h.substring(2)+(v?"":`; `)),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return` lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined } `.trim()},blockValue:function(h){var d=this.aliasable("container.hooks.blockHelperMissing"),g=[this.contextName(0)];this.setupHelperArgs(h,0,g);var v=this.popStack();g.splice(1,0,v),this.push(this.source.functionCall(d,"call",g))},ambiguousBlockValue:function(){var h=this.aliasable("container.hooks.blockHelperMissing"),d=[this.contextName(0)];this.setupHelperArgs("",0,d,!0),this.flushInline();var g=this.topStack();d.splice(1,0,g),this.pushSource(["if (!",this.lastHelper,") { ",g," = ",this.source.functionCall(h,"call",d),"}"])},appendContent:function(h){this.pendingContent?h=this.pendingContent+h:this.pendingLocation=this.source.currentLocation,this.pendingContent=h},append:function(){if(this.isInline())this.replaceStack(function(d){return[" != null ? ",d,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var h=this.popStack();this.pushSource(["if (",h," != null) { ",this.appendToBuffer(h,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(h){this.lastContext=h},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(h,d,g,v){var w=0;!v&&this.options.compat&&!this.lastContext?this.push(this.depthedLookup(h[w++])):this.pushContext(),this.resolvePath("context",h,w,d,g)},lookupBlockParam:function(h,d){this.useBlockParams=!0,this.push(["blockParams[",h[0],"][",h[1],"]"]),this.resolvePath("context",d,1)},lookupData:function(h,d,g){h?this.pushStackLiteral("container.data(data, "+h+")"):this.pushStackLiteral("data"),this.resolvePath("data",d,0,!0,g)},resolvePath:function(h,d,g,v,w){var _=this;if(this.options.strict||this.options.assumeObjects){this.push(p(this.options.strict&&w,this,d,g,h));return}for(var I=d.length;gthis.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var h=this.inlineStack;this.inlineStack=[];for(var d=0,g=h.length;dt in e?Xd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ya=(e,t)=>{for(var n in t||(t={}))Qd.call(t,n)&&$a(e,n,t[n]);if(qa)for(var n of qa(t))Jd.call(t,n)&&$a(e,n,t[n]);return e};class Za extends Rr{constructor(){super(),Ze.registerHelper("subVar",lh),Ze.registerHelper("each",fh),Ze.registerHelper("isPreview",ch)}getContent(t,n,r,i){var o,s;let l=`transformation ${n.transformerName}`;r!==void 0&&(l=`personalization ${r.personalizationId}, `+l);const a=this,u=this.getHandlebarsTemplate(t),f=Ya({},(o=n.substitutionValues)!=null?o:{}),p=(s=t.substitutionDefinitions)!=null?s:{},c={},h=Cr(r==null?void 0:r.personalizationId,i.pec.name);Zi("DEBUG")&&y.log.debug(`For ${l}, rendering of template: \r ${u} \r SubstitutionValues: \r ${JSON.stringify(f)} \r Preview: ${String(h)}`),Object.entries(p).forEach(([T,N])=>{var A;c[T]=(A=N.configType)!=null?A:Re.SchemaPath,(!(T in f)||T in f&&(D(f[T])||f[T]===""))&&(f[T]=N.defaultValue)});const d=Ue(),g=ta(i.pec.transformationConfig.engagementDestination,t.name,t.transformerType,d),v=ia(),w=this.transformerSupportsAutoInjection(t),_={data:{_sf_personalization:{subVar:f,subConfigTypes:c,destinationName:g,engagementConfig:d,ecSupportsAutoInjection:v,transformerSupportsAutoInjection:w,transformerInstance:a,isPreview:h}}};let I=a.compileTransformerDetails(u,r,_,i.status);v&&w&&r!==void 0?I=th(a,I,r.personalizationId,g):(y.log.trace(`${v?"Transformer":"Engagement Config"} does not support auto-injection of default engagement attributes`),i.status.update(new k("No auto-injection of default engagement attributes")));const m=Vt();return S(m)&&(I=eh(I,m)),y.log.trace(`Rendered Content: ${I}`),i.status.update(new k("Rendered Content")),String(I)}compileTransformerDetails(t,n,r,i){const o=document.createElement("script");i.update(new k("Precompiling template"));const s=Ze.precompile(t);if(!S(s))throw new Error("Error while compiling handlebars template, precompilation did not result in a string");o.textContent="window.SalesforceInteractions.Personalization.precompiledTemplate = "+s;const l=Vt();S(l)&&(y.log.debug("Adding nonce to inline script for handlebars precompile"),o.nonce=l),document.head.appendChild(o);const a=window.SalesforceInteractions.Personalization.precompiledTemplate;let u;try{if(!O(a))throw new Error("Error while compiling handlebars template, compiled template is undefined. This is likely due to a Content Security Policy (CSP) violation.");i.update(new k("Forming template")),u=Ze.template(a)}finally{delete window.SalesforceInteractions.Personalization.precompiledTemplate,document.head.removeChild(o)}const f=n!==void 0?Rr.sanitizer.sanitizeObject(n):{};return i.update(new k("Using template")),u(f,r)}}function eh(e,t){return Ti(e,n=>{for(const r of n)r instanceof HTMLStyleElement&&(y.log.debug("Adding nonce to inline style",r),r.nonce=t)})}function th(e,t,n,r){return Ti(t,i=>{for(let o=0;o{if(!i&&!(t&&o==="root")){const s=parseInt(o);!isNaN(s)&&F(e)?(e=e[s],r=!0):o in e?(e=e[o],r=!0):(i=!0,r=!1,e=void 0)}}),[e,r]}function ih(e){let t;return S(e,!0)?t=e:D(e)?(y.log.debug("Null/undefined substitution value provided to handlebars"),t=""):(y.log.debug("Coercing ${} substitution value provided to handlebars"),t=String(e)),t}function oh(e,t,n,r){const i=ih(t);try{return n===Re.Static?sh(i):ah(e,i,r)}catch(o){y.log.warn(`Could not parse the substitution value path ${i} due to an error`,o)}return null}function ah(e,t,n){const r=Ze.parseWithoutProcessing(`{{${t}}}`);if((r==null?void 0:r.body)===void 0||r.body.length===0||r.body[0].type!=="MustacheStatement")return y.log.warn(`Could not parse the substitution value path ${t} via handlebars`),null;const i=r.body[0];if(i.path===void 0)return y.log.warn(`Could not parse the substitution value path ${t} via handlebars treating it as a Mustache Statement`),null;const o=i.path;if(o.type!=="PathExpression")return y.log.warn(`Could not parse the substitution value path ${t} via handlebars expecting it to be a Path Expression`),null;const s=o,[l,a]=nh(e,t,s,n),[u,f]=rh(l,a,s);return f?u:null}function sh(e){const t=Ze.parseWithoutProcessing(`${e}`);return(t==null?void 0:t.body)===void 0||t.body.length===0||t.body[0].type!=="ContentStatement"?(y.log.warn(`Could not parse the substitution value ${e} via handlebars`),null):e}function lh(e,t){var n,r,i;if(!S(e)||((r=(n=t==null?void 0:t.data)==null?void 0:n._sf_personalization)==null?void 0:r.subVar)===void 0||!(e in t.data._sf_personalization.subVar))return null;const o=t.data._sf_personalization.subVar[e],s=(i=t.data._sf_personalization.subConfigTypes[e])!=null?i:Re.SchemaPath;return oh(this,o,s,t)}function uh(e,t,n){let r=n;if(e._sf_personalization.ecSupportsAutoInjection&&e._sf_personalization.transformerSupportsAutoInjection){const i=e._sf_personalization.transformerInstance.buildModifiersIfItemRelated(t,e._sf_personalization.destinationName,e._sf_personalization.engagementConfig);!D(i)&&S(n)&&(r=Ti(n,o=>{for(let s=0,l=o.length;s{s!==void 0&&(s.key=a,s.index=f,s.first=f===0,s.last=!!p);const c=n(u,{data:s,blockParams:[e[a],a]}),h=uh(s,u,c);o=o+h};if(!D(e)&&typeof e=="object"){const a=e;if(F(e,!0))for(let u=e.length;i{u!==void 0&&l(u,a[u],i-1,!1),u=f,i++}),u!==void 0&&l(u,a[u],i-1,!0)}}return i===0&&(o=r(this)),o}class dh extends Za{validateTransformerDetails(t){if(!this.isHandlebarsTransformerDetails(t))throw new G(j.InvalidTransformerTypeDetails,"Transformer Type Details is not the correct type.",{context:{expectedType:"HandlebarsTransformerDetails"}});this.validateHandlebarsTransformerDetails(t)}isHandlebarsTransformerDetails(t){return(t==null?void 0:t.html)!==void 0}validateHandlebarsTransformerDetails(t){if(!O(t))throw new G(j.InvalidTransformerTypeDetailsType,"Transformer Type Details is not a valid object.");if(!S(t.html))throw new G(j.MissingTransformerTypeDetailsHtml,"Transformer Type Details html is required for the specific Transformer Type Details.",{context:{type:"HandlebarsTransformerDetails"}});if(t.css!==void 0&&!S(t.css))throw new G(j.MissingTransformerTypeDetailsCss,"Transformer Type Details css must be a string when defined for the specific Transformer Type Details.",{context:{type:"HandlebarsTransformerDetails"}})}validateMethod(t){if(t===void 0)throw new M(R.MissingTransformationConfigMethod,"Transformation Config method is required for specific transformer type.",{context:{transformerType:pe.Handlebars}})}setCSS(t){if(this.isHandlebarsTransformerDetails(t.transformerTypeDetails)){const n=t.transformerTypeDetails.css;if(S(n))try{const r=document.createElement("style");r.textContent=n;const i=Vt();S(i)&&(y.log.debug("Adding nonce to inline style",r),r.nonce=i),document.head.appendChild(r)}catch(r){y.log.error(`could not apply styles ${n} for "${t.name}"`,r)}}}transform(t,n,r,i,o){const s=()=>this.getContent(t,n,i,o);return this.setCSS(t),this.setContent(r,s,n,t.transformerType,o,i==null?void 0:i.personalizationId,o.pec.transformationConfig.method)}getHandlebarsTemplate(t){return t.transformerTypeDetails.html}transformerSupportsAutoInjection(t){var n;return!((n=t.transformerTypeDetails.disableAutoInjectionOfEngagementAttributes)!=null&&n)}}class hh extends Za{validateTransformerDetails(t){if(!this.isAgentTransformerDetails(t))throw new G(j.InvalidTransformerTypeDetails,"Transformer Type Details is not the correct type.",{context:{expectedType:"AgentScriptTransformerDetails"}});this.validateAgentTransformerDetails(t)}isAgentTransformerDetails(t){return(t==null?void 0:t.script)!==void 0}validateAgentTransformerDetails(t){if(!O(t))throw new G(j.InvalidTransformerTypeDetailsType,"Transformer Type Details is not a valid object.");if(!S(t.script))throw new G(j.MissingTransformerTypeDetailsHtml,"Transformer Type Details script is required for the specific Transformer Type Details.",{context:{expectedType:"AgentScriptTransformerDetails"}})}validateMethod(t){if(t!==void 0)throw new M(R.InvalidTransformationConfigMethod,"Transformation Config method is not allowed for specific transformer type.",{context:{transformerType:pe.AgentScript}})}transform(t,n,r,i,o){const s=()=>this.getContent(t,n,i,o);return this.setContent(r,s,n,t.transformerType,o,i==null?void 0:i.personalizationId,o.pec.transformationConfig.method)}getHandlebarsTemplate(t){return t.transformerTypeDetails.script}transformerSupportsAutoInjection(){return!1}supportsEngagementSelection(){return!1}}function Ka(e){switch(e){case pe.HtmlElementModifier:return new $c;case pe.Handlebars:return new dh;case pe.AgentScript:return new hh;default:return}}function Si(e){const t=Ka(e);if(t===void 0)throw new G(j.MissingImplementation,"Transformer does not have an implementation",{context:{transformerType:e}});return t}var ph={name:"HTMLElementModifier",transformerType:pe.HtmlElementModifier,transformerCategory:rt.EmbeddedContent,transformerTypeDetails:{}};let Ke=Object.assign([],[ph]);function Gn(){return Ke!=null?Ke:[]}function Xa(e,t=!1){function n(r){if(nt()){if(!F(r,!0)){y.log.error("A list of transformers is required when adding to Transformers.");return}Ke===void 0&&(Ke=[]);let i=r;if(t){const o=Ke.map(s=>s.name);i=[],r.forEach(s=>{!S(s.name)||!o.includes(s.name)?i.push(s):y.log.debug(`Not adding Transformer "${s.name}" because it already exists`)})}i.forEach(o=>{try{if(yh(o),Ke.find(s=>o.name===s.name)!==void 0)throw new G(j.DuplicateTransformer,"Transformer already exists.",{context:{transformerName:o.name}});y.log.info("Adding the following Transformer: ",o),Ke.push(o)}catch(s){y.log.error(`Transformers could not be added due to: ${X(s).message}`,o)}})}else y.log.error("The list of Transformers can only be modified before SalesforceInteractions.init is called.")}if(S(e))try{const r=JSON.parse(e,Yi);n(r)}catch(r){y.log.error("JSON Transformers list could not be added due to: ",r)}else n(e)}function Qa(e){Xa(e)}function gh(e){Xa(e,!0)}function Ja(e=Re.SchemaPath){switch(e){case Re.SchemaPath:case Re.Static:return yn.String;default:throw new G(j.InvalidSubstitutionConfigType,"Substitution Definition config type is not supported.",{context:{configType:e}})}}function mh(e,t=rt.EmbeddedContent){if(!zl[t].supportedTypes.includes(e))throw new G(j.InvalidTransformerTypeForCategory,"Transformer Type is not allowed for Transformer Category.",{context:{category:t,type:e}})}function es(e=yn.String,t){switch(e){case yn.String:if(!S(t))throw new G(j.InvalidSubstitutionDefinitionValue,"Substitution Definition value is incorrect type.",{context:{expectedType:e,value:t}});break;default:throw new G(j.InvalidSubstitutionDefinitionConfigDataType,"",{context:{configDataType:e}})}}function vh(e){var t;if(!O(e))throw new G(j.MissingTransformerSubstitutionDefinition,"Transformer substitution definition object is required.");if(e.label!==void 0&&!S(e.label))throw new G(j.InvalidSubstitutionDefinitionLabel,"Transformer substitution definition label is required to be a string if provided.");if(e.description!==void 0&&!S(e.description))throw new G(j.InvalidSubstitutionDefinitionDescription,"Transformer substitution definition description is required to be a string if provided.");if(e.configType!==void 0&&!((t=Object.values(Re))!=null&&t.includes(e.configType)))throw new G(j.InvalidSubstitutionDefinitionConfigType,"Transformer substitution definition config type should be a valid Substitution Definition Config Type if provided.",{context:{configType:e.configType}});e.defaultValue!==void 0&&es(Ja(e.configType),e.defaultValue)}function Eh(e){if(!O(e))throw new G(j.InvalidSubstitutionDefinitions,"Transformer substitution definitions is not a record.");Object.entries(e).forEach(([t,n])=>{if(!S(t))throw new G(j.MissingTransformerSubstitutionDefinitionKey,"Transformer substitution definition key is required.");vh(n)})}function yh(e){var t,n;if(!O(e))throw new G(j.MissingTransformer,"Transformer is required.");if(!S(e.name))throw new G(j.MissingTransformerName,"Transformer name is required.");if(e.label!==void 0&&!S(e.label))throw new G(j.InvalidTransformerLabel,"Transformer label is required to be a string if provided.");if(e.description!==void 0&&!S(e.description))throw new G(j.InvalidTransformerDescription,"Transformer description is required to be a string if provided.");if(e.schemaReference!==void 0&&!S(e.schemaReference))throw new G(j.InvalidTransformerSchemaReference,"Transformer schema reference is required to be a string if provided.");if(!((t=Object.values(pe))!=null&&t.includes(e.transformerType)))throw new G(j.InvalidTransformerType,"Transformer type is not a valid Transformer Type.",{context:{transformerType:e.transformerType}});if(e.transformerCategory!==void 0&&!((n=Object.values(rt))!=null&&n.includes(e.transformerCategory)))throw new G(j.InvalidTransformerCategory,"Transformer category is not a valid Transformer Category.",{context:{transformerCategory:e.transformerCategory}});if(mh(e.transformerType,e.transformerCategory),e.substitutionDefinitions!==void 0&&Eh(e.substitutionDefinitions),!O(e.transformerTypeDetails))throw new G(j.MissingTransformerTypeDetails,"Transformer transformer type details are required.");if(e.publishedDate!==void 0)try{e.publishedDate=Ut("publishedDate",e.publishedDate)}catch(r){throw new G(j.InvalidPublishedDate,"Transformer published date should be a number or date if provided.")}if(e.lastModifiedDate!==void 0)try{e.lastModifiedDate=Ut("lastModifiedDate",e.lastModifiedDate)}catch(r){throw new G(j.InvalidLastModifiedDate,"Transformer last modified date should be a number or date if provided.")}Si(e.transformerType).validateTransformerDetails(e.transformerTypeDetails)}function ts(e){return F(Ke)?Ke.filter(t=>{var n;return((n=t.transformerCategory)!=null?n:rt.EmbeddedContent)===e}):[]}function _h(e){return Si(e.transformerType).supportsEngagementSelection()}const ns=/\*\s*\*/;function Th(e){var t;if(!O(e))throw new M(R.InvalidSourceMatchers,"Source Matchers is not a valid array.");if(!((t=Object.values(Te))!=null&&t.includes(e.type)))throw new M(R.InvalidSourceMatcherType,"Source Matcher type is not a valid Source Matcher Type.",{context:{sourceMatcherType:e.type}});if(!S(e.value))throw new M(R.MissingSourceMatcherValue,"Source Matcher value is required.");if(e.value!==e.value.trim())throw new M(R.PaddedSourceMatcherValue,"Source Matcher value has leading or trailing spaces.",{context:{sourceMatcherValue:e.value}});if(e.type===Te.PageUrlMatcher){if(e.value==="*")throw new M(R.InvalidSourceMatcherValueOnlyStar,"Source Matcher value cannot be only * char.");if(e.value.includes("**"))throw new M(R.InvalidSourceMatcherValueRepeatedStars,"Source Matcher value cannot have repeated * chars.");if(ns.lastIndex=0,ns.test(e.value))throw new M(R.InvalidSourceMatcherValueSpaceWithStars,"Source Matcher value cannot have * followed by a space followed by a *.")}}function Sh(e){if(!F(e))throw new M(R.MissingSourceMatchers,"Source Matchers are required.");e.forEach(t=>Th(t))}function rs(e,t,n){switch(e.type){case Te.PageType:return Ah(e,t);case Te.PageUrlMatcher:return Ih(e,n);default:return y.log.warn(`Support missing for SourceMatcherType: ${e.type}`),!1}}function wh(e){if(e.type!==Te.PageUrlMatcher){y.log.warn("Ignoring SourceMatcher, since type is not PageUrlMatcher");return}let t=encodeURIComponent(e.value.trim());return t=t.replace(/[.()!']/g,"\\$&"),t=t.replace(/\*/g,".*"),new RegExp(t,"i")}function bh(e){if(S(e))return encodeURIComponent(e)}function Ih(e,t){const n=bh(t);if(!S(n))return y.log.debug("Ignoring match, url is not a non-empty string"),!1;const r=wh(e);return D(r)?!1:r.test(n)}function Ah(e,t){return S(t)?t===e.value.trim():(y.log.debug("Ignoring match, pageType is not a non-empty string"),!1)}var Ch=Object.defineProperty,Ph=Object.defineProperties,Nh=Object.getOwnPropertyDescriptors,is=Object.getOwnPropertySymbols,Oh=Object.prototype.hasOwnProperty,Dh=Object.prototype.propertyIsEnumerable,os=(e,t,n)=>t in e?Ch(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,as=(e,t)=>{for(var n in t||(t={}))Oh.call(t,n)&&os(e,n,t[n]);if(is)for(var n of is(t))Dh.call(t,n)&&os(e,n,t[n]);return e},ss=(e,t)=>Ph(e,Nh(t)),wi=(e=>(e.DataCloudModuleConfig="DATA_CLOUD_MODULE_CONFIG",e.Other="OTHER",e))(wi||{});let un=[];const jn={DATA_CLOUD_MODULE_CONFIG:null,OTHER:[]};function Ie(){return un!=null?un:[]}function Mh(e){un=[...e]}function Rh(e,t){const n=F(t,!0)?t:Ie();if(!(!F(n)||!S(e)))return n.find(r=>or(r.name,e))}function ls(e,t){return S(e)?(F(t,!0)?t:Ie()).filter(n=>n.sourceMatchers.some(r=>r.type===Te.PageUrlMatcher&&rs(r,"",e))):[]}function us(e,t){return S(e)?(F(t,!0)?t:Ie()).filter(n=>n.sourceMatchers.some(r=>r.type===Te.PageType&&rs(r,e,""))):[]}function Lh(e,t){return Object.values(Te).includes(e)?(F(t,!0)?t:Ie()).filter(n=>n.sourceMatchers.some(r=>r.type===e)):[]}function xh(e){var t,n,r,i;if(!O(e))throw new M(R.MissingDataProvider,"DataProvider is required.");if(e.type!==void 0&&!((t=Object.values(_n))!=null&&t.includes(e.type)))throw new M(R.InvalidDataProviderType,"Data Provider type should be a valid Data Provider Type if provided.",{context:{type:e.type}});if(e.referenceType!==void 0&&!((n=Object.values(Tn))!=null&&n.includes(e.referenceType)))throw new M(R.InvalidDataProviderReferenceType,"Data Provider reference type should be a valid Reference Type if provided.",{context:{referenceType:e.referenceType}});if(!S(e.value))throw new M(R.MissingDataProviderValue,"Data Provider value is required.");if(e.dataSpaceReferenceType!==void 0&&!((r=Object.values(Tn))!=null&&r.includes(e.dataSpaceReferenceType)))throw new M(R.InvalidDataProviderDataSpaceReferenceType,"Data Provider data space reference type should be a valid Reference Type if provided.",{context:{referenceType:e.dataSpaceReferenceType}});if(!S(e.dataSpaceValue)&&e.dataSpaceReferenceType!==void 0)throw new M(R.MissingDataSpaceValue,"Data Provider data space value is required if Data Provider data space reference type is set.");if(e.groupByType!==void 0&&!Object.values(ro).includes(e.groupByType))throw new M(R.InvalidDataProviderGroupByType,"Data Provider group by type should be a valid Data Provider Group By Type if provided.",{context:{groupByType:e.groupByType}});if(e.groupByReferenceType!==void 0&&!((i=Object.values(Tn))!=null&&i.includes(e.groupByReferenceType)))throw new M(R.InvalidDataProviderGroupByReferenceType,"Data Provider group by reference type should be a valid Reference Type if provided.",{context:{referenceType:e.groupByReferenceType}});if(!S(e.groupByValue)&&(e.groupByType!==void 0||e.groupByReferenceType!==void 0))throw new M(R.MissingDataGroupByValue,"Data Provider group by value is required if Data Provider group by type or reference type is set.")}function kh(e){if(J(e,"name"))throw new M(R.TransformationNameNotSupported,"Transformation Name is not supported for method type.",{context:{methodType:$.AddOverlay}});if(J(e,"tag"))throw new M(R.TransformationTagNotSupported,"Transformation Tag is not supported for method type.",{context:{methodType:$.AddOverlay}});if(J(e,"path"))throw new M(R.TransformationPathNotSupported,"Transformation Path is not supported for method type.",{context:{methodType:$.AddOverlay}})}function Uh(e){if(!S(e.name))throw new M(R.MissingTransformationName,"Transformation Name is required.",{context:{transformationType:"ContentZone"}})}function Fh(e){if(!S(e.tag))throw new M(R.MissingTransformationTag,"Transformation Tag is required.",{context:{transformationType:"Element"}});if(!S(e.path))throw new M(R.MissingTransformationPath,"Transformation Path is required.",{context:{transformationType:"Element"}})}function zh(e){return Object.keys(e).some(t=>!["transformerName","substitutionValues"].includes(t))}function Hh(e){return Vh(e,Gn())}function Vh(e,t){if(!S(e))throw new M(R.MissingTransformerName,"Transformer Name is required.");if(t.length===0)throw new M(R.TransformersNotAvailable,"There are no transformers available.");const n=t.find(r=>r.name===e);if(n===void 0)throw new M(R.InvalidTransformerName,"Transformation Transformer Name is not a valid transformer.",{context:{transformerName:e}});return n}function cs(e,t,n){Object.entries(t).forEach(([r,i])=>{var o;if(r in e)y.log.debug(`using substitution value for Substitution Definition of ${r} for Transformer ${n}`);else{if(i.defaultValue===void 0&&((o=i.required)==null||o))throw new M(R.MissingSubstitutionDefinitionDefaultValue,"Substitution Definition value is required and there is no default value specified.",{context:{key:r}});y.log.debug(`using default value for Substitution Definition of ${r} for Transformer ${n}`)}})}function Bh(e,t,n){var r;if(!((r=t.overrideable)!=null&&r)&&n!==void 0)throw new M(R.InvalidTransformationSubstitutionValue,"Substitution Value is not allowed when Substitution Definition is not overridable.",{context:{key:e}})}function Gh(e,t){if(e.substitutionDefinitions!==void 0&&Object.values(e.substitutionDefinitions).find(n=>{var r;return((r=n.configType)!=null?r:Re.SchemaPath)===Re.SchemaPath})!==void 0&&(!O(t)||!wn(t==null?void 0:t.type)))throw new M(R.InvalidTransformationSubstitutionValueType,"Personalization Point Data Provider is required when using Schema Path Substitution Definitions")}function jh(e,t,n){var r;if(Gh(t,n),e===void 0){t.substitutionDefinitions!==void 0&&cs({},t.substitutionDefinitions,t.name);return}if(!O(e))throw new M(R.InvalidTransformationSubstitutionValues,"Substitution Values is not a valid object.");if(t.substitutionDefinitions!==void 0){const i=(r=t.substitutionDefinitions)!=null?r:{};Object.entries(e).forEach(([o,s])=>{if(o in i){const l=i[o];Bh(o,l,s),es(Ja(l.configType),s)}else throw new M(R.SubstitutionDefinitionKeyNotSupported,"Transformer does not support Substitution Definition Key.",{context:{key:o}})}),cs(e,t.substitutionDefinitions,t.name)}else if(t.transformerType!==pe.HtmlElementModifier)if(Object.entries(e).length===0)y.log.warn(`transformer "${t.name}" does not accept substitutionValues`);else throw new M(R.TransformerDoesNotSupportSubstitutionValues,"Substitution Values are provided when transformer does not support Substitution Definitions.")}function fs(e,t,n){var r;const i=Hh(e.transformerName);if(!((r=i.isEnabled)==null||r))throw new M(R.DisabledTransformer,"Transformer is disabled.",{context:{transformer:i.name}});jh(e.substitutionValues,i,n);const o=Si(i.transformerType);o.validateMethod(t),o.validateSubstitutionValues(e.substitutionValues)}function Wh(e,t,n){if(!O(e))throw new M(R.MissingTransformation,"Transformation is required.");if(!S(e.transformerName))throw new M(R.MissingTransformerName,"Transformer Name is required.");if(e.substitutionValues!==void 0&&!O(e.substitutionValues))throw new M(R.InvalidTransformationSubstitutionValues,"Substitution Values is not a valid object.");if(yt(t))kh(e);else if(zh(e))if(Bt(e))Uh(e);else if(it(e))Fh(e);else throw new M(R.InvalidTransformationType,"Transformation is not one of the supported types.");nt()||fs(e,t,n)}function qh(e,t,n){if(!F(e))throw new M(R.InvalidTransformations,"Transformations is required to be an array.");if(e.forEach(r=>Wh(r,t,n)),t!==void 0&&t!==$.AddOverlay){if(t===$.ReplaceContentZoneContent&&!e.every(r=>Sn(r,t)))throw new M(R.MethodRequiresSpecificTransformations,"Method requires specific transformation type(s).",{context:{transformationType:"ContentZone",methods:[$.ReplaceContentZoneContent]}});if(t===$.ContentZoneHandler&&!e.every(r=>dr(r,t)))throw new M(R.MethodRequiresSpecificTransformations,"Method requires specific transformation type(s).",{context:{transformationType:"ContentZone",methods:[$.ContentZoneHandler]}});if(t!==$.ReplaceContentZoneContent&&t!==$.ContentZoneHandler&&!e.every(r=>it(r)))throw new M(R.MethodRequiresSpecificTransformations,"Method requires specific transformation type(s).",{context:{transformationType:"Element",methods:[$.ReplaceElementContent,$.AddAfterElement,$.AddBeforeElement]}})}}function $h(e,t){var n,r;if(!O(e))throw new M(R.MissingTransformationConfig,"Transformation Config is required.");if(e.renderIfEmpty!==void 0&&!et(e.renderIfEmpty))throw new M(R.InvalidRenderIfEmpty,"Transformation Config Render If Empty should be a boolean if provided.");if(!((n=Object.values(Ce))!=null&&n.includes(e.when)))throw new M(R.InvalidTransformationConfigWhen,"Transformation Config has an invalid Transformation Config When Type.",{context:{whenType:e.when}});if(e.method!==void 0&&!((r=Object.values($))!=null&&r.includes(e.method)))throw new M(R.InvalidTransformationConfigMethod,"Transformation Config has an invalid Target Method Type.",{context:{methodType:e.method}});switch(e.when){case Ce.Immediately:if(e.whenValues!==void 0)throw new M(R.WhenValuesNotSupported,"Transformation Config does not support when values for the specific Transformation Config When Type.",{context:{whenType:e.when}});break;case Ce.ExitIntent:if(!yt(e.method))throw new M(R.WhenTypeRequiresSpecificMethodType,"Transformation Config when type requires specific method type.",{context:{whenType:e.when,methodType:$.AddOverlay}});if(!so(e.whenValues))throw new M(R.InvalidTransformationConfigWhenTypes,"Transformation Config when values is invalid for the specific Transformation Config When Type.",{context:{whenType:e.when}});if(!kt(e.whenValues.delay)||e.whenValues.delay<0)throw new M(R.InvalidWhenValueDelay,"Transformation Config requires a numeric when values delay of 0 or greater for the specific Transformation Config When Type.",{context:{whenType:e.when}});break;case Ce.ElementClick:if(!yt(e.method))throw new M(R.WhenTypeRequiresSpecificMethodType,"Transformation Config when type requires specific method type.",{context:{whenType:e.when,methodType:$.AddOverlay}});if(!oo(e.whenValues))throw new M(R.InvalidTransformationConfigWhenTypes,"Transformation Config when values is invalid for the specific Transformation Config When Type.",{context:{whenType:e.when}});if(!S(e.whenValues.path))throw new M(R.InvalidWhenValuePath,"Transformation Config requires a string when values path for the specific Transformation Config When Type.",{context:{whenType:e.when}});if(e.whenValues.tag!==void 0&&!S(e.whenValues.tag))throw new M(R.InvalidWhenValueTag,"Transformation Config requires a string when values tag, if provided, for the specific Transformation Config When Type.",{context:{whenType:e.when}});break;case Ce.ScrollPercent:if(!yt(e.method))throw new M(R.WhenTypeRequiresSpecificMethodType,"Transformation Config when type requires specific method type.",{context:{whenType:e.when,methodType:$.AddOverlay}});if(!ao(e.whenValues))throw new M(R.InvalidTransformationConfigWhenTypes,"Transformation Config when values is invalid for the specific Transformation Config When Type.",{context:{whenType:e.when}});if(!kt(e.whenValues.percent)||e.whenValues.percent<0||e.whenValues.percent>1)throw new M(R.InvalidWhenValuePercent,"Transformation Config requires a numeric when values percent between 0 and 1 for the specific Transformation Config When Type.",{context:{whenType:e.when}});break;default:throw new M(R.WhenValuesValidationLogicNotImplemented,"Transformation Config when values validation logic has not been implemented for the specific Transformation Config When Type.",{context:{whenType:e.when}})}if(e.engagementDestination!==void 0&&!S(e.engagementDestination))throw new M(R.InvalidTransformationConfigEngagementDestination,"Transformation Config engagement destination should be a valid string if provided.");qh(e.transformations,e.method,t)}function bi(e,t,n,r){if(!O(e))throw new M(R.MissingConfig,"Config is required.");if(!S(e.name))throw new M(R.MissingName,"Name is required.");if(e.label!==void 0&&!S(e.label))throw new M(R.InvalidLabel,"Label is required to be a string if provided.");if(e.description!==void 0&&!S(e.description))throw new M(R.InvalidDescription,"Description is required to be a string if provided.");if(e.dataProvider!==void 0&&xh(e.dataProvider),Sh(e.sourceMatchers),$h(e.transformationConfig,e.dataProvider),e.publishedDate!==void 0&&!gn(e.publishedDate))try{e.publishedDate=Ut("publishedDate",e.publishedDate)}catch(i){throw new M(R.InvalidPublishedDate,"Published date should be a number or date if provided.")}if(e.lastModifiedDate!==void 0&&!gn(e.lastModifiedDate))try{e.lastModifiedDate=Ut("lastModifiedDate",e.lastModifiedDate)}catch(i){throw new M(R.InvalidLastModifiedDate,"Last modified date should be a number or date if provided.")}if(t!=null&&t&&n!==void 0){const i=[];if(hs(e,n,[],i),i.length>0)throw i[0]}if(r!=null&&r){const i=[];if(ps(e,[],i),i.length>0)throw i[0]}}function Ii(e){var t,n,r,i;if(((t=e==null?void 0:e.dataProvider)==null?void 0:t.type)!==void 0&&((n=e==null?void 0:e.dataProvider)==null?void 0:n.type)!==_n.PersonalizationPoint)throw new vn(lr.OnlySupportPersonalizationPoint,"Personalization Experience Config has Data Provider Type that is not Personalization Point, which is not currently supported.",{context:{configName:e.name}});!nt()&&(((r=e==null?void 0:e.dataProvider)==null?void 0:r.type)===_n.PersonalizationPoint||S((i=e==null?void 0:e.dataProvider)==null?void 0:i.dataSpaceValue))&&ds(e)}function ds(e){var t,n,r;const i=D((t=e==null?void 0:e.dataProvider)==null?void 0:t.dataSpaceValue)?"":(n=e==null?void 0:e.dataProvider)==null?void 0:n.dataSpaceValue;if(Ht()!==i)throw new vn(lr.OnlySupportConfiguredDataSpace,"Personalization Experience Config has Data Provider Data Space Value that does not match Sitemap value, which is not currently supported.",{context:{configName:e.name,configDataSpace:(r=e==null?void 0:e.dataProvider)==null?void 0:r.dataSpaceValue,configuredDataSpace:Ht()}})}function Ai(e,t="OTHER"){function n(r){if(nt()){if(!F(r,!0)){y.log.error("A list of personalization experience configs is required.");return}t==="OTHER"&&jn.OTHER.push(...r);const i=[];r.forEach(o=>{!S(o.name)||un.findIndex(s=>or(s.name,o.name))<0&&i.findIndex(s=>or(s.name,o.name))<0?i.push(o):y.log.error(`Not adding Personalization Experience Config "${o.name}" because it already exists`)}),i.forEach(o=>{try{bi(o),Ii(o),y.log.info("Adding the following Personalization Experience Config: ",o),un.push(o)}catch(s){y.log.error(`Personalization Experience Configs could not be added due to: ${X(s).message}`,o)}})}else y.log.error("The list of Personalization Experience Configs can only be modified before SalesforceInteractions.init is called.")}if(S(e))try{const r=JSON.parse(e,Yi);n(r)}catch(r){y.log.error(`JSON Personalization Experience Config list could not be initialized due to: ${X(r).message}`,r)}else n(e)}function Yh(e){Ai(e)}function Zh(){document.addEventListener(y.CustomEvents.OnInit,()=>{rp(),ep(),op()}),document.addEventListener(y.CustomEvents.OnInitSitemap,e=>{Qh(e.detail.sitemapConfig)})}function Kh(e){if(!F(e))return y.log.debug("Ignoring non/empty array of personalizationExperienceConfigs"),{};const t={};return e.forEach(n=>{var r,i,o;if(!wn((r=n.dataProvider)==null?void 0:r.type))y.log.warn(`Ignoring config: ${n.name} with unsupported dataProvider.type: ${String((i=n.dataProvider)==null?void 0:i.type)}`);else{const s=(o=n.dataProvider.groupByValue)!=null?o:Hl;let l=t[s];D(l)&&(l={},t[s]=l);const a=n.dataProvider.value;let u=l[a];D(u)&&(u={point:{name:a},pecNames:[]},l[a]=u),u.pecNames.includes(n.name)||u.pecNames.push(n.name)}}),t}function Wn(e){const t=e.filter(n=>S(n.getConfigName()));if(t.length>0){t.forEach(r=>{const i=r.getConfigName(),o=Ie().find(s=>s.name===i);o===void 0?y.log.error(`Could not find Personalization Experience Config with name ${i}`):y.log.error(`Personalization Experience Config with name ${i} is invalid due to: ${r.getMessageWithContext()} Config: `,o)});const n=t.map(r=>r.getConfigName());Mh(Ie().filter(r=>!n.includes(r.name)))}}function hs(e,t,n,r){e.transformationConfig.transformations.forEach(i=>{Sn(i,e.transformationConfig.method)&&(n.length===0&&hc(t).forEach(o=>n.push(o)),n.length===0?r.push(new M(R.ContentZonesNotAvailable,"There are no content zones configured in the sitemap or content zone is defined more than once.",{context:{configName:e.name}})):n.find(o=>o===i.name)===void 0&&r.push(new M(R.InvalidTransformationContentZone,"Content zone is not defined in the sitemap or content zone is defined more than once.",{context:{configName:e.name,contentZone:i.name}})))})}function Xh(e){const t=[],n=[];return Ie().forEach(r=>{hs(r,e,t,n)}),n}function Qh(e){const t=Xh(e);Wn(t)}function ps(e,t,n){S(e.transformationConfig.engagementDestination)&&(t.length===0&&aa().forEach(r=>t.push(r)),t.length===0?n.push(new M(R.EngagementDestinationsNotAvailable,"There are no engagement destinations configured.",{context:{configName:e.name}})):t.find(r=>r===e.transformationConfig.engagementDestination)===void 0&&n.push(new M(R.InvalidTransformationConfigEngagementDestinationName,"Engagement destination is not defined.",{context:{configName:e.name,engagementDestination:e.transformationConfig.engagementDestination}})))}function Jh(){const e=[],t=[];return Ie().forEach(n=>{ps(n,e,t)}),t}function ep(){const e=Jh();Wn(e)}function gs(){return jn}function tp(e,t){e==="DATA_CLOUD_MODULE_CONFIG"&&"list"in t&&F(t.list,!0)?jn.DATA_CLOUD_MODULE_CONFIG=t:e==="OTHER"&&F(t,!0)&&(jn.OTHER=t)}function np(){const e=[];return Ie().forEach(t=>{var n;try{const r=t.transformationConfig.method;t.transformationConfig.transformations.forEach(i=>{fs(i,r,t.dataProvider)})}catch(r){if(r instanceof Error)if(r instanceof M||r instanceof G){const i={context:ss(as({},r.context),{configName:t.name}),cause:(n=r.cause)!=null?n:r},o=r instanceof M?new M(r.name,r.message,i):new G(r.name,r.message,i);e.push(o)}else e.push(new M(R.UnexpectedError,r.message,{context:{configName:t.name}}))}}),e}function rp(){const e=np();Wn(e)}function ip(){const e=[];return Ie().forEach(t=>{var n;try{ds(t)}catch(r){if(r instanceof Error)if(r instanceof vn){const i=new vn(r.name,r.message,{context:ss(as({},r.context),{configName:t.name}),cause:(n=r.cause)!=null?n:r});e.push(i)}else e.push(new M(R.UnexpectedError,r.message,{context:{configName:t.name}}))}}),e}function op(){const e=ip();Wn(e)}var H=(e=>(e.SingleElementHtmlTransformer="SingleElementHtmlTransformer",e.MultiElementModifier="MultiElementModifier",e.WhenElementClick="WhenElementClick",e.Agent="Agent",e))(H||{}),cn=(e=>(e.Prod="prod",e.Test="test",e.ProdSandbox="prod_sandbox",e.TestSandbox="test_sandbox",e))(cn||{});const ap={configOptions:{SingleElementHtmlTransformer:{allowedElements:{div:{},p:{},header:{},footer:{},section:{},article:{},nav:{},table:{}}},MultiElementModifier:{allowedElements:{h1:{allowedProperties:["innerText"]},h2:{allowedProperties:["innerText"]},h3:{allowedProperties:["innerText"]},h4:{allowedProperties:["innerText"]},h5:{allowedProperties:["innerText"]},h6:{allowedProperties:["innerText"]},p:{allowedProperties:["innerText"]},div:{allowedProperties:["innerText","style.backgroundImage"]},a:{allowedProperties:["innerText","attributes.href"]},img:{allowedProperties:["attributes.src"]}}},WhenElementClick:{allowedElements:{input:{},button:{},img:{}}}}};var ms=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});const te={pageUrl:{},pageType:{}};function vs(){return ms(this,null,function*(){return D(te.pageUrl.matchedPromise)?yield Promise.reject(new Error("getPromiseUrlMatch called too soon")):yield te.pageUrl.matchedPromise})}function Es(){return ms(this,null,function*(){return D(te.pageType.matchedPromise)?yield Promise.reject(new Error("getPromisePageMatch called too soon")):yield te.pageType.matchedPromise})}const qn="sf_personalization_wpm";function sp(){Pi(!1);const e=Il(qn);window.history.replaceState({},document==null?void 0:document.title,e.toString()),window.location.reload()}function Ci(){try{return window.localStorage.getItem(qn)==="true"}catch(e){return!1}}function Pi(e){try{window.localStorage.setItem(qn,e?"true":"false")}catch(t){throw y.log.error("Error trying to save client side editor mode.",t),t}}const ys="sf_personalization_wpm_env",_s="2",lp=`https://cdn.c360a.salesforce.com/npm/@salesforce/interactions-website-personalization-manager/${_s}/build/dist/index.min.js`,up=`https://cdn.pc-rnd.c360a.salesforce.com/npm/@salesforce/interactions-website-personalization-manager/${_s}/build/dist/index.min.js`,Ts={configOptions:{}};let $n=ap;function Ss(){return $n!=null?$n:Ts}function cp(e){e===void 0?$n=Ts:$n=e}function fp(){qi(qn)&&Pi(!0),document.addEventListener(y.CustomEvents.OnInit,Is)}function ws(){if(qi(ys)){const e=wl(ys);if(e!==null){const t=e.toLowerCase();if(Object.values(cn).includes(t))return t}}return cn.Prod}function dp(){const e=ws(),t=e===cn.Test||e===cn.TestSandbox?up:lp;return y.log.debug(`WPM (client side editor) CDN Script is set to ${t}`),t}function hp(e,t){return Ln(e,t,Ue())}function pp(){const e=Gn();if(e.length>0){const t=e.find(n=>n.transformerType===pe.HtmlElementModifier);if(t!==void 0)return Ln(t.name,t.transformerType,Ue())}return Ln("",pe.HtmlElementModifier,Ue())}function gp(){return ts(rt.EmbeddedContent)}function mp(){return ts(rt.Agent)}function bs(){var e;const t={closeEditorMode:sp,determineEditorOption:Cs,getConfig:Ss,getAppSourceId:xl,getPspConfig:kl,isInEditorMode:Ci,isPECSupported:Cp,checkPECSupport:Ns,getPromiseUrlMatch:vs,getPromisePageMatch:Es,findContentZoneNamesForPageConfig:fc,findContentZoneNamesForPageConfigs:dc,getEngagementDestinationNames:aa,determineHtmlElementModifierTransformerEngagementDestination:pp,determineTransformerEngagementDestination:hp,findPersonalizationExperienceConfigsMatchingPageType:us,findPersonalizationExperienceConfigsMatchingPageUrl:ls,getContentZoneSelectorByName:jo,getPersonalizationExperienceConfigsByInitializationSource:gs,matchesDataCloudHostname:Pp,determineWpmEnvironment:ws,getAllContentZoneHandlers:Nu,evaluateContextualAttributes:Ar,getAllEmbeddedContentTransformers:gp,isEngagementSelectionSupported:_h,getAllWebAgentTransformers:mp};(e=window.SalesforceInteractions.Wpm)==null||e.initialize(t)}function Is(){var e;if(Ci())if(((e=window.SalesforceInteractions.Wpm)==null?void 0:e.initialize)!==void 0)bs();else{const t=document.createElement("script");t.src=dp(),t.type="text/javascript",t.onload=bs,t.onerror=n=>{y.log.error("Error trying to initialize WPM (client side editor)",n)},document.head.appendChild(t)}}function vp(){Pi(!0),Is()}function Ep(e){if(!O(e))throw new ye(he.InvalidConfig,"Config is invalid.",{context:{configType:H.SingleElementHtmlTransformer}});if((e==null?void 0:e.allowedElements)!==void 0){const t=e==null?void 0:e.allowedElements;if(!O(t))throw new ye(he.InvalidAllowedElements,"Allowed Elements is invalid.",{context:{configType:H.SingleElementHtmlTransformer}});Object.entries(t).forEach(([n])=>{if(!O(t[n]))throw new ye(he.InvalidAllowedElementKey,"Allowed Elements key is invalid.",{context:{configType:H.SingleElementHtmlTransformer,key:n}})})}if((e==null?void 0:e.allowedTargetMethodTypes)!==void 0){if(!F(e==null?void 0:e.allowedTargetMethodTypes,!0))throw new ye(he.InvalidAllowedTargetMethodTypes,"Allowed Target Method Types is invalid.",{context:{configType:H.SingleElementHtmlTransformer}});e==null||e.allowedTargetMethodTypes.forEach(t=>{var n;if(!((n=Object.values($))!=null&&n.includes(t)))throw new ye(he.InvalidAllowedTargetMethodTypeMethod,"Allowed Target Method Types method is not a valid Target Method Type.",{context:{configType:H.SingleElementHtmlTransformer,method:t}})})}if((e==null?void 0:e.allowedTransformers)!==void 0&&!F(e==null?void 0:e.allowedTransformers,!0))throw new ye(he.InvalidAllowedTransformers,"Allowed Transformers is invalid.",{context:{configType:H.SingleElementHtmlTransformer}})}function yp(e){if(!O(e))throw new ye(he.InvalidConfig,"Config is invalid.",{context:{configType:H.MultiElementModifier}});if((e==null?void 0:e.allowedElements)!==void 0){const t=e==null?void 0:e.allowedElements;if(!O(t))throw new ye(he.InvalidAllowedElements,"Allowed Elements is invalid.",{context:{configType:H.MultiElementModifier}});Object.entries(t).forEach(([n])=>{var r,i;if(!O(t[n]))throw new ye(he.InvalidAllowedElementKey,"Allowed Elements key is invalid.",{context:{configType:H.MultiElementModifier,key:n}});if(((r=t[n])==null?void 0:r.allowedProperties)!==void 0&&!F((i=t[n])==null?void 0:i.allowedProperties,!0))throw new ye(he.InvalidAllowedProperties,"Allowed Elements allowed properties is invalid.",{context:{configType:H.MultiElementModifier,key:n}})})}}function _p(e){if(!O(e))throw new ye(he.InvalidConfig,"Config is invalid.",{context:{configType:H.WhenElementClick}});if((e==null?void 0:e.allowedElements)!==void 0){const t=e==null?void 0:e.allowedElements;if(!O(t))throw new ye(he.InvalidAllowedElements,"Allowed Elements is invalid.",{context:{configType:H.WhenElementClick}});Object.entries(t).forEach(([n])=>{if(!O(t[n]))throw new ye(he.InvalidAllowedElementKey,"Allowed Elements key is invalid.",{context:{configType:H.WhenElementClick,key:n}})})}}function As(e){if(!O(e))throw new vt(st.WpmConfigIsRequired,"Wpm Config is required.");if(!O(e.configOptions))throw new ye(he.InvalidConfigOptions,"Config Options are required.");H.SingleElementHtmlTransformer in e.configOptions?Ep(e.configOptions[H.SingleElementHtmlTransformer]):y.log.info("WPM Config does not contain any restrictions for SingleElementHtmlTransformer"),H.MultiElementModifier in e.configOptions?yp(e.configOptions[H.MultiElementModifier]):y.log.info("WPM Config does not contain any restrictions for MultiElementModifier"),H.WhenElementClick in e.configOptions?_p(e.configOptions[H.WhenElementClick]):y.log.info("WPM Config does not contain any restrictions for WhenElementClick")}function Cs(e,t){var n;if(!O(e))throw new vt(st.ConfigIsRequired,"Config is required.");if(!F(t))throw new vt(st.TransformersAreRequired,"Transformers are required.");const r=t.filter(i=>i.transformerType===pe.HtmlElementModifier).map(i=>i.name);return r.length>0&&e.transformationConfig.transformations.length>0&&(e.transformationConfig.method===void 0||e.transformationConfig.method===$.ReplaceElementContent)&&e.transformationConfig.transformations.every(i=>r.includes(i.transformerName))?H.MultiElementModifier:((n=t==null?void 0:t[0])==null?void 0:n.transformerCategory)===rt.Agent?H.Agent:H.SingleElementHtmlTransformer}function Ps(e,t,n){if(e===void 0)return;const r=t.filter(i=>it(i)).map(i=>i.tag).filter(i=>!Object.keys(e).includes(i.toLowerCase()));if(r.length>0)throw new Me(Ae.TagsNotAllowed,"Tags are not allowed.",{context:{configType:n,disallowedTags:JSON.stringify(r)}})}function Tp(e,t,n){e!==void 0&&t.filter(r=>it(r)).map(r=>r).forEach(r=>{const i=e[r.tag.toLowerCase()].allowedProperties;i!==void 0&&(r.substitutionValues!==void 0?Object.keys(r.substitutionValues):[]).forEach(o=>{if(!i.includes(o))throw new Me(Ae.PropertyNotAllowed,"Property is not allowed.",{context:{configType:n,property:`${r.tag}.${o}`}})})})}function Sp(e,t,n){if(e!==void 0&&t.method!==void 0&&!e.includes(t.method))throw new Me(Ae.MethodNotAllowed,"Method is not allowed.",{context:{configType:n,method:t.method}})}function wp(e,t,n){if(e!==void 0)if(e.length===0){const r=t.map(i=>i.transformerName);throw new Me(Ae.TransformersAreDisabled,"Transformers are disabled.",{context:{configType:n,transformers:JSON.stringify(r)}})}else{const r=t.filter(i=>!e.includes(i.transformerName)).map(i=>i.transformerName);if(r.length>0)throw new Me(Ae.TransformersAreDisabled,"Transformers are disabled.",{context:{configType:n,transformers:JSON.stringify(r)}})}}function bp(e,t){t!==void 0&&(Ps(t.allowedElements,e.transformationConfig.transformations,"SingleElementHtmlTransformer"),Sp(t.allowedTargetMethodTypes,e.transformationConfig,"SingleElementHtmlTransformer"),wp(t.allowedTransformers,e.transformationConfig.transformations,"SingleElementHtmlTransformer"))}function Ip(e,t){t!==void 0&&(Ps(t.allowedElements,e.transformationConfig.transformations,"MultiElementModifier"),Tp(t.allowedElements,e.transformationConfig.transformations,"MultiElementModifier"))}function Ap(e,t){var n,r;if(t!==void 0&&t.allowedElements!==void 0){const i=(r=(n=e.transformationConfig.whenValues)==null?void 0:n.tag)!=null?r:"";if(!Object.keys(t.allowedElements).includes(i))throw new Me(Ae.TagsNotAllowed,"Tags are not allowed.",{context:{configType:H.WhenElementClick,disallowedTags:i}})}}function Ns(e,t,n){if(!O(e))throw new vt(st.ConfigIsRequired,"Config is required.");if(!O(t))throw new vt(st.WpmConfigIsRequired,"Wpm Config is required.");if(!F(n))throw new vt(st.TransformersAreRequired,"Transformers are required.");if(e.sourceMatchers.length>1)throw new Me(Ae.OneSourceMatcherSupported,"Only one source matcher is allowed.");switch(Cs(e,n)){case H.SingleElementHtmlTransformer:if(e.transformationConfig.transformations.length>1)throw new Me(Ae.OneTransformerSupported,"Only one transformation is allowed.",{context:{configType:H.SingleElementHtmlTransformer}});if(e.transformationConfig.method===void 0)throw new Me(Ae.MethodIsRequired,"Method is required.",{context:{configType:H.SingleElementHtmlTransformer}});H.SingleElementHtmlTransformer in t.configOptions&&bp(e,t.configOptions[H.SingleElementHtmlTransformer]);break;case H.MultiElementModifier:if(e.transformationConfig.transformations.some(r=>Bt(r)))throw new Me(Ae.OnlyElementsSupported,"Can only target elements.",{context:{configType:H.MultiElementModifier}});H.MultiElementModifier in t.configOptions&&Ip(e,t.configOptions[H.MultiElementModifier]);break}H.WhenElementClick in t.configOptions&&e.transformationConfig.when===Ce.ElementClick&&Ap(e,t.configOptions[H.WhenElementClick])}function Cp(e,t,n){try{return Ns(e,t,n),!0}catch(r){return!1}}function Os(e){function t(n){if(nt()){if(!O(n,!1)){y.log.error("A config is required when setting WPM Config.");return}try{As(n),cp(n),y.log.info("Set WPMConfig to the following: ",n)}catch(r){y.log.error(`WPMConfig could not be set due to: ${X(r).message}`,r)}}else y.log.error("WPMConfig can only be set before SalesforceInteractions.init is called.")}if(S(e))try{const n=JSON.parse(e);t(n)}catch(n){y.log.error("JSON WPM Config list could not be initialized due to: ",n)}else t(e)}function Pp(e){const t=fr();if(S(t)){const n=new URL(e),r=new URL(t);return n.hostname===r.hostname}return!0}var Ds=(e=>(e.Cart="cart",e.CartItem="cartItem",e.Catalog="catalog",e.Consent="consentLog",e.Order="order",e.OrderItem="orderItem",e))(Ds||{}),Ms=(e=>(e.Engagement="Engagement",e.Profile="Profile",e))(Ms||{}),Ni=(e=>(e.Category="category",e.DateTime="dateTime",e.DeviceId="deviceId",e.EventId="eventId",e.EventType="eventType",e.SessionId="sessionId",e))(Ni||{}),Rs=(e=>(e.OnBeforeEventSend="dataCloud:onBeforeEventSend",e))(Rs||{}),ht=(e=>(e.Id="personalizationId",e.ContentId="personalizationContentId",e))(ht||{});function Np(){document.addEventListener(Rs.OnBeforeEventSend,e=>{const t=e.detail.actionEvent;if(!Op(t))return;const n=t.personalization;if(O(n)){if((n==null?void 0:n.isTesting)===!0)Ls(e,xs,"Cancelling event since we are in test mode and all events are engagement events","Not sending engagement event since we are in test mode");else if((S(n.id)||S(n.contentId))&&!Ls(e,Dp,"Cancelling event since Personalization fields are already present in events with different values","Not sending event since Personalization fields are already present in event with different values")){const r=e.detail.events;Mp(n,r)}}})}function Op(e){return"personalization"in e}function Ls(e,t,n,r){let i=e.detail.events;const o=t(i,e.detail.actionEvent.personalization);if(o.length>0){if(o.length===i.length)return P.log.warn(n,JSON.stringify(i)),e.detail.events=[],e.preventDefault(),!0;o.forEach(s=>P.log.warn(r,JSON.stringify(s))),i=i.filter(s=>!o.includes(s)),e.detail.events=i}return!1}function xs(e,t){return e.filter(n=>n[Ni.Category]===Ms.Engagement.toString()&&n[Ni.EventType]!==Ds.Consent)}function Dp(e,t){return e.filter(n=>J(n,ht.Id)&&n[ht.Id]!==t.id||J(n,ht.ContentId)&&n[ht.ContentId]!==t.contentId)}function Mp(e,t){xs(t).forEach(n=>{S(e.id)&&(n[ht.Id]=e.id),S(e.contentId)&&(n[ht.ContentId]=e.contentId)})}function Rp(){document.addEventListener(P.CustomEvents.OnInit,()=>{const e=Ue();if(e===void 0||e.attributes===void 0){P.log.warn("Engagement Configuration does not have any Config for Attributes");return}const t=e.attributes.engagements;Object.keys(t).forEach(n=>{t[n].qualify()})}),document.addEventListener(P.CustomEvents.OnShutDown,()=>{Fc()})}var Oe=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});function ks(e){const t=Gn().find(r=>r.name===e.transformerName);if(t===void 0){y.log.error(`transformer with name ${e.transformerName} could not be found`);return}const n=Ka(t.transformerType);if(n===void 0){y.log.error(`transformer ${t.transformerType} does not have an implementation`);return}return[n,t]}function Us(e,t,n,r){return e.map((i,o)=>{const s=n+`, transformer ${i.transformation.transformerName}, element index ${o}`,l=ks(i.transformation);if(D(l)){const c=new Error(`Cannot transform, handler not found for ${s}`);return y.log.error(c.message),t.status.update(new k(c)),Rn(i.transformation),null}const[a,u]=l,f=`Providing transformer with element promise etc, ${s}`;y.log.trace(f),t.status.update(new k(f));const p=a.transform(u,i.transformation,i.pageElementReady,r,t);return p.promise=p.promise.then(()=>{const c=`Finished transformation for ${s}`;y.log.trace(c),t.status.update(new k(c))}).catch(c=>{const h=new Error(`Issue handling transformation for ${s}`+X(c).message);throw y.log.error(h.message),t.status.update(new k(h)),c}).finally(()=>Rn(i.transformation)),p}).filter(i=>!D(i))}function Lp(e,t=!1){const n=`PEC ${e.pec.name}`,r=Vs(e.pec);if(!F(r)){const o=new ie(le.MissingPersonalization,`Could not find any elements, PEC ${n}`);throw y.log.warn(o.message),o}t&&Vo({personalizationExperienceConfigName:e.pec.name});const i=Us(r,e,n);Fs(e,Promise.resolve({transformResponses:i}),n)}function Fs(e,t,n,r){e.status.update(new k(`Awaiting response and processing for ${n}`),t.then(i=>Oe(this,null,function*(){yield Promise.allSettled(i.transformResponses.map(o=>Oe(this,null,function*(){return yield o.promise}))).then(o=>{const s=o.filter(l=>l.status==="rejected").map(l=>X(l.reason).message);if(s.length>0)throw new Error(`Issue(s) with transformation(s) for ${n}: ${JSON.stringify(s)}`)})}))),e.initiateRevert=()=>{const i=new sr(t.then(o=>Oe(this,null,function*(){yield Promise.allSettled(o.transformResponses.map(s=>Oe(this,null,function*(){yield s.revert(i)}))).then(s=>{const l=s.filter(a=>a.status==="rejected").map(a=>X(a.reason).message);if(l.length>0)throw new Error(`Issue(s) with revert (see 'statuses' for more detail): ${JSON.stringify(l)}`);i.update(new k("Revert (as applicable) finished")),!D(o.personalizationId)&&et(r)&&!r?Pr(o.personalizationId):D(o.personalizationId)&&Pr(e.pec.name)})}),o=>{if(o instanceof ie)i.update(new k("Nothing to revert, no transformation attempt"));else throw o}));return i}}function xp(e,t,n){const r=e.pec.name;let i=`PEC ${r}`;const o=t.then(s=>{const l=s.personalizations.filter(p=>{var c;return wn((c=e.pec.dataProvider)==null?void 0:c.type)&&e.pec.dataProvider.value===p.personalizationPointName});if(F(l)){if(l.length>1){const p=`Received multiple responses for [${i}] when only one is expected. Using the first response.`;y.log.warn(p),e.status.update(new k(p))}}else{const p=new ie(le.MissingPersonalization,`Did not receive a personalization response for ${i}`);throw y.log.warn(p.message),p}const a=l[0];if(!Bo(a)){const p=new ie(le.MissingPersonalizationDataAttributes,'Personalization invalid. Expected to include either "data" or "attributes".',{context:{configName:r,personalization:a}});throw y.log.warn(p.message),p}const u=a.personalizationId;e.status.update(new k(`Found response personalizationId ${u} ${i}`));const f=Vs(e.pec);if(!F(f)){const p=new ie(le.MissingPersonalization,`Could not find any elements, ${i}, personalization ${u}`);throw y.log.warn(p.message),n||Pr(u),p}return i=i+`, personalization ${u}`,{personalizationId:u,transformResponses:Us(f,e,i,a)}});Fs(e,o,i,n)}function kp(e,t,n){if(!F(e)){y.log.warn("ignoring empty personalization experience configs");return}if(D(t)){const i="null/undefined personalization response promise";y.log.warn(`ignoring ${i}`);const o=new Error(i);mn.updateForAll(e,new k(o),Promise.reject(o)),Mr(e.map(s=>s.pec));return}const r=t.then(i=>{if(!O(i)){const o=D(i)?new Error("null/undefined personalization response"):new Error("unexpected personalization response type");throw y.log.error(o.message),Mr(e.map(s=>s.pec)),o}return Zi("DEBUG")&&y.log.debug(`handling personalization response: ${JSON.stringify(i)}`),i},i=>{y.log.error("error handling personalization response",i);const o=new Error("Personalization response promise rejection: "+X(i).message);throw Mr(e.map(s=>s.pec)),o});e.filter(i=>{var o;return wn((o=i.pec.dataProvider)==null?void 0:o.type)}).forEach(i=>{const o=Object.values(n!=null?n:{}).flatMap(s=>Object.values(s)).filter(s=>{var l;return s.point.name===((l=i.pec.dataProvider)==null?void 0:l.value)}).flatMap(s=>s.pecNames).length>1;xp(i,r,o)})}function Up(e){var t;const n=e.name;return(t=jo(n))!=null?t:""}function Fp(e){return e.path}function zs(e,t){var n;if(dr(e,t))return"html";if(Sn(e,t))return Up(e);if(it(e))return Fp(e);if(yt(t))return"body";if(io((n=ks(e))==null?void 0:n[1].transformerType))return"head"}function Hs(e){return Oe(this,null,function*(){return yield new Promise((t,n)=>{const r=ar("findElementOnPage:"+e);document.addEventListener(y.CustomEvents.OnShutDown,()=>{y.DisplayUtils.unbind(r),n(new Ve(De.NotWaitingForElementPath,"No longer waiting for element at path.",{context:{path:e}}))}),y.DisplayUtils.bind(r).pageElementLoaded(e).then(i=>{t(i)}).catch(i=>{y.log.warn("error with DisplayUtils",i),n(i)})})})}function Yn(e){const t=[];for(const n of e.transformations){const r=zs(n,e.method),i=r!==void 0?t.find(o=>zs(o.transformation,e.method)===r):void 0;i!==void 0?t.push({transformation:n,pageElementReady:i.pageElementReady}):r!==void 0?t.push({transformation:n,pageElementReady:Hs(r)}):y.log.warn(`could not get the element path for transformerConfig: ${JSON.stringify(e)}`)}return t}function zp(e){return Yn(e.transformationConfig)}function Hp(e){var t;const n=e.transformationConfig,r=ao(n.whenValues)&&(t=n.whenValues.percent)!=null?t:0,i=new Promise((s,l)=>{const a=ar("pageElementsReadyOnPageScroll:"+e.name);document.addEventListener(y.CustomEvents.OnShutDown,()=>{y.DisplayUtils.unbind(a),l(new Ve(De.NotWaitingForPageScroll,"No longer waiting for page scroll.",{context:{config:e.name}}))});const u=window.scrollY/(document.documentElement.scrollHeight-window.innerHeight);try{u>=r?s():y.DisplayUtils.bind(a).pageScroll(r).then(s).catch(f=>{l(new Ve(De.DisplayUtilsPageScrollError,"Error with DisplayUtils pageScroll method.",{cause:f}))})}catch(f){l(new Ve(De.DisplayUtilsPageScrollError,"Error with DisplayUtils pageScroll method.",{cause:f}))}}),o=s=>Oe(this,null,function*(){const[l]=yield Promise.all([s,i]);return l});return Yn(n).map(s=>(s.pageElementReady=o(s.pageElementReady),s))}function Vp(e){var t;const n=e.transformationConfig,r=so(n.whenValues)&&(t=n.whenValues.delay)!=null?t:0,i=new Promise((s,l)=>{const a=ar("pageElementsReadyOnExitIntent:"+e.name);document.addEventListener(y.CustomEvents.OnShutDown,()=>{y.DisplayUtils.unbind(a),l(new Ve(De.NotWaitingForPageExit,"No longer waiting for page exit.",{context:{config:e.name}}))});try{y.DisplayUtils.bind(a).pageExit(r).then(s).catch(u=>{l(new Ve(De.DisplayUtilsPageExitError,"Error with DisplayUtils pageExit method.",{cause:u}))})}catch(u){l(new Ve(De.DisplayUtilsPageExitError,"Error with DisplayUtils pageExit method.",{cause:u}))}}),o=s=>Oe(this,null,function*(){const[l]=yield Promise.all([s,i]);return l});return Yn(n).map(s=>(s.pageElementReady=o(s.pageElementReady),s))}function Bp(e){const t=e.transformationConfig,n=oo(t.whenValues)?t.whenValues.path:"";if(!S(n))return[];function r(s){return Oe(this,null,function*(){return yield new Promise((l,a)=>{const u=()=>{y.log.debug(`Add Overlay Personalization Element '${s.id}' was clicked`),l(s)};document.addEventListener(y.CustomEvents.OnShutDown,()=>{s.removeEventListener("click",u),a(new Ve(De.NotWaitingForElementClick,"No longer waiting for element click.",{context:{element:s.id}}))});try{s.addEventListener("click",u)}catch(f){a(new Ve(De.AddingClickListenerError,"Error with adding click listener",{cause:f}))}})})}function i(){return Oe(this,null,function*(){yield Hs(n).then(s=>Oe(this,null,function*(){return yield r(s)}))})}const o=s=>Oe(this,null,function*(){const[l]=yield Promise.all([s,i()]);return l});return Yn(t).map(s=>(s.pageElementReady=o(s.pageElementReady),s))}function Vs(e){const t=e.transformationConfig.when;return t===Ce.Immediately?zp(e):t===Ce.ScrollPercent?Hp(e):t===Ce.ExitIntent?Vp(e):t===Ce.ElementClick?Bp(e):(y.log.warn(`whenType [${t}] not explicitly handled`),[])}var Zn=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});function Gp(){document.addEventListener(y.CustomEvents.OnShutDown,Bs),Bs()}function Bs(){Au(),jp(),Wp(),Yp(),Zp()}function jp(){const e=te.pageUrl.listener,t=te.pageUrl.reject,n=te.pageUrl={};D(e)||document.removeEventListener(y.CustomEvents.OnInitSitemap,e),D(t)||t(new Error("shutdown/reinit")),n.matchedPromise=new Promise((r,i)=>{n.reject=i,n.listener=()=>{const o=qp();n.matchedPECs=o,r(o)},document.addEventListener(y.CustomEvents.OnInitSitemap,n.listener)}),n.matchedPromise.catch(r=>{y.log.error(`Issue matching page URLs: ${X(r).message}`,r)})}function Wp(){const e=te.pageType.listener,t=te.pageType.reject,n=te.pageType={};D(e)||document.removeEventListener(y.CustomEvents.OnSettledSitemap,e),D(t)||t(new Error("shutdown/reinit")),n.matchedPromise=new Promise((r,i)=>{n.reject=i,n.listener=o=>{const s=$p(o.detail.result);n.matchedPECs=s,r(s)},document.addEventListener(y.CustomEvents.OnSettledSitemap,n.listener)}),n.matchedPromise.catch(r=>{y.log.error(`Issue matching page types: ${X(r).message}`,r)})}function qp(){var e;const t=(e=window==null?void 0:window.location)==null?void 0:e.href;return y.log.debug(`current page url: ${t}`),ls(t)}function $p(e){var t,n;const r=(t=e==null?void 0:e.matchedConfig)==null?void 0:t.name,i=(n=window==null?void 0:window.location)==null?void 0:n.href;return y.log.debug(`sitemap result pageType: ${r} url: ${i}`),us(r)}function Yp(){if(te.pageUrl.processedPromise=void 0,D(te.pageUrl.matchedPromise)){y.log.error("Unable to process page URL matches. Missing Promise.");return}te.pageUrl.processedPromise=te.pageUrl.matchedPromise.then(e=>Zn(this,null,function*(){yield Ws(e)})),te.pageUrl.processedPromise.catch(e=>{y.log.error(`Issue processing page URL matches: ${X(e).message}`,e)})}function Zp(){if(te.pageType.processedPromise=void 0,D(te.pageUrl.matchedPromise)||D(te.pageType.matchedPromise)){y.log.error("Unable to process page type matches. Missing Promise(s).");return}te.pageType.processedPromise=Promise.all([te.pageUrl.matchedPromise,te.pageType.matchedPromise]).then(e=>Zn(this,null,function*(){if(e.length!==2)throw new Error(`Unable to process page type matches. Expected results for 2 promises (url matches, page-type matches), but found: ${e==null?void 0:e.length}`);const t=[],n=[];e[1].forEach(r=>{e[0].some(i=>i.name===r.name)?n.push(r.name):t.push(r)}),n.length>0&&y.log.debug(`Avoiding processing, already url-matched: ${JSON.stringify(n)}`),yield Ws(t)})),te.pageType.processedPromise.catch(e=>{y.log.error(`Issue processing page type matches: ${X(e).message}`,e)})}function Kp(e){if(!D(e)){if(!D(e.individualId)&&!S(e.individualId))throw new Ee(de.IndividualIdNotValid,"Individual Id must be a valid string if provided.",{context:{value:e.individualId}});if(D(e.endpoint)||no(e.endpoint),!D(e.perPersonalizationPoint)){if(!O(e.perPersonalizationPoint))throw new zt(mt.PointOptionsNotValid,"perPersonalizationPoint must be an object if provided.",{context:{value:e.perPersonalizationPoint}});Object.entries(e.perPersonalizationPoint).forEach(([t,n])=>{if(!S(t))throw new zt(mt.PointOptionKeyInvalid,"perPersonalizationPoint key must be a valid string.",{context:{value:t}});if(!O(n))throw new zt(mt.PointOptionsNotValid,"PreviewPersonalizationPointOptions must be an object.",{context:{value:n}});if(!D(n.decisionId)&&!S(n.decisionId))throw new Ee(de.DecisionIdNotValid,"PreviewPersonalizationPointOptions decisionId must be a valid string if provided.",{context:{value:n.decisionId}})})}}}function Xp(e,t){if(!F(e))throw new zt(mt.MissingPersonalizationExperienceConfig,"Valid PersonalizationExperienceConfig(s) expected to Preview.");Qp(e),y.log.debug(`Previewing personalization experience config(s): ${JSON.stringify(e.map(s=>s==null?void 0:s.name))}`),e.forEach(s=>{bi(s),Ii(s)}),Kp(t);const n={individualId:t==null?void 0:t.individualId,dataspaceApiName:Ht(),isPreview:!0,endpoint:t==null?void 0:t.endpoint},r=e.map(s=>new mn(s));Gs(r,!0),js(r,n,t);const i=r.reduce((s,l)=>(s[l.pec.name]=l.status,s),{}),o=()=>{const s=r.reduce((l,a)=>(l[a.pec.name]=a.revert(),l),{});return new Hu(s)};return new zu(i,o)}function Qp(e){const t=e.map(r=>r.name),n=Jp(t);if(n.length>0)throw new zt(mt.DuplicatePersonalizationExperienceConfigs,"",{context:{value:n}})}function Jp(e){const t=new Set,n=new Array;return e.forEach(r=>{const i=r.toLowerCase();t.has(i)?n.push(r):t.add(i)}),n}function eg(e){const t=new Set,n=new Set;return e.forEach(r=>{r.isEnabled===void 0||r.isEnabled?t.add(r):n.add(r.name)}),y.log.debug(`skipping matched disabled personalization experience config names: ${JSON.stringify(n)}`),[...t]}function Gs(e,t=!1){e.filter(n=>D(n.pec.dataProvider)).forEach(n=>{Lp(n,t)})}function js(e,t,n){const r=e.filter(s=>!D(s.pec.dataProvider));if(y.log.debug(`matched enabled and with data providers personalization experience config names: ${JSON.stringify(r.map(s=>s.pec.name))}`),r.length<=0)return;const i=r.map(s=>s.pec),o=Kh(i);t=t!=null?t:{dataspaceApiName:Ht()},et(t.isPreview)&&t.isPreview&&Object.values(o).forEach(s=>{Object.values(s).forEach(l=>{var a,u;const f=(u=(a=n==null?void 0:n.perPersonalizationPoint)==null?void 0:a[l.point.name])==null?void 0:u.decisionId;S(f)&&(l.point.decisionId=f)})}),tg(r,o,t)}function Ws(e){return Zn(this,null,function*(){e=eg(e);const t=e.map(r=>r.name);if(y.log.debug(`matched enabled personalization experience config names: ${JSON.stringify(t)}`),e.length<=0)return;if(Ci()){y.log.info(`WPM (client side editor) active, suppressing live/non-preview fetch for PECs: ${JSON.stringify(t)}`);return}const n=e.map(r=>new mn(r));Gs(n),js(n),yield Promise.allSettled(n.map(r=>Zn(this,null,function*(){return yield r.status.finished}))).then(r=>{const i=r.filter(o=>o.status==="rejected").map(o=>X(o.reason));if(i.length>0)throw new Error(`Issues processing matched PECs: ${JSON.stringify(t)} : ${JSON.stringify(i.map(o=>o.message))}`)})})}function tg(e,t,n){var r;const i=(r=n==null?void 0:n.dataspaceApiName)!=null?r:"";if(y.log.debug(`fetching for dataspace ["${i}]" points: ${JSON.stringify(t)}`),Object.keys(t).length<1){const s=JSON.stringify(e.map(a=>a.pec.name)),l=new Error(`No personalization points across PECs ${s} using dataspace [${i}]`);mn.updateForAll(e,new k(l),Promise.reject(l));return}const o={};S(n==null?void 0:n.dataspaceApiName)&&(o.dataspace=n.dataspaceApiName),S(n==null?void 0:n.individualId)&&(o.individualId=n.individualId),Object.values(t).forEach(s=>{const l=Fo(Object.values(s).map(u=>u.point),o,n==null?void 0:n.isPreview),a=Uo(l,{endpoint:n==null?void 0:n.endpoint});kp(e,a,t)})}var Oi=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});function ng(){document.addEventListener(P.CustomEvents.OnInitSitemap,()=>{const e=Ie();for(const n of Object.values(Te))Di(n,e);const t=rg();Promise.race([ag(),t]).then(n=>{n=n!=null?n:[],Di(Te.PageUrlMatcher,n)}).catch(n=>{P.log.error("Unexpected error updating paths for flicker defense while evaluating Personalization Experience Config URL matches.",n)}),Promise.race([og(),t]).then(n=>{n=n!=null?n:[],Di(Te.PageType,n)}).catch(n=>{P.log.error("Unexpected error updating paths for flicker defense while evaluating Personalization Experience Config page type matches.",n)})})}function rg(){return Oi(this,null,function*(){yield new Promise(e=>{Zo(!1),setTimeout(()=>{P.log.debug(`flicker defense redisplay timeout of ${Mn().redisplayTimeoutMilliseconds}ms elapsed`),Zo(!0),ig(),e()},Mn().redisplayTimeoutMilliseconds)})})}function ig(){ct.PageUrlMatcher=[],ct.PageType=[],Dr()}function og(){return Oi(this,null,function*(){return[...yield Es()]})}function ag(){return Oi(this,null,function*(){return[...yield vs()]})}function Di(e,t){const n=Lh(e,t);ct[e]=Xo(n),P.log.debug(`flicker defense currently hiding the following transformations for source matcher type ${e}: ${JSON.stringify(Object.values(ct[e]))}`),Dr()}function sg(e){if(!nt()){y.log.error("The config can only be modified before SalesforceInteractions.init is called.");return}if(!O(e)){y.log.error("A config is required.");return}if(e.customEngagementConfig!==void 0&&ha(e.customEngagementConfig),e.customWpmConfig!==void 0&&Os(e.customWpmConfig),e.customFlickerDefenseConfig!==void 0&&Jo(e.customFlickerDefenseConfig),e.additionalTransformers!==void 0&&(J(e.additionalTransformers,"list")&&F(e.additionalTransformers.list,!0)?Qa(e.additionalTransformers.list):F(e.additionalTransformers,!0)?Qa(e.additionalTransformers):y.log.error("A list of transformers is required when adding to Transformers.")),e.personalizationExperienceConfigs!==void 0)if(J(e.personalizationExperienceConfigs,"list")&&F(e.personalizationExperienceConfigs.list,!0)){const t=gs().DATA_CLOUD_MODULE_CONFIG;if(O(t)){y.log.error("Initializing personalization experience configs using this format can only be used once.");return}tp(wi.DataCloudModuleConfig,e.personalizationExperienceConfigs),Ai(e.personalizationExperienceConfigs.list,wi.DataCloudModuleConfig)}else F(e.personalizationExperienceConfigs,!0)?Ai(e.personalizationExperienceConfigs):y.log.error("A list of personalization experience configs is required.")}var lg=(e,t,n)=>new Promise((r,i)=>{var o=a=>{try{l(n.next(a))}catch(u){i(u)}},s=a=>{try{l(n.throw(a))}catch(u){i(u)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((n=n.apply(e,t)).next())});function ug(e,t){return lg(this,null,function*(){try{if(!F(e))throw new Ee(de.PersonalizationPointsIsNotAnArray,"The Personalization Points parameter must be an array of length >= 1.",{context:{value:e}});const n=e.map(i=>({name:i})),r=Fo(n,t);return yield Uo(r)}catch(n){return y.log.error(n),yield Promise.reject(n)}})}Ul(),Fl(),Np(),Rp(),Gp(),Bu(),Zh(),fp(),ng(),window.SalesforceInteractions.Personalization={fetch:ug,Config:{initialize:sg,PersonalizationExperience:{findByName:Rh,getAll:Ie,addNew:Yh,isSupported:Ii,validate:bi,preview:Xp},Transformer:{getAll:Gn,addNew:gh},Engagement:{initializeCustom:ha,get:Ue,validate:da},Wpm:{initializeCustom:Os,get:Ss,validate:As},FlickerDefense:{initializeCustom:Jo,get:Mn},ContentZoneHandler:{set:Cu,get:Pu}},launchWpm:vp}})(window.SalesforceInteractions); } catch (e) { console.error("[Salesforce personalization] Error initializing module: personalization", e); } })(); // SITEMAP AND INIT try { (function () { /************************************************************************************************* * Salesforce Data Cloud Server-Side Sitemap for Strive & Co. * Version: 2.0.0 (Adds PLP, PDP, and Category pages) *************************************************************************************************/ (function () { if (window.striveInitSitemap) { return; } console.log("Server-Side Sitemap: Defining window.striveInitSitemap function."); window.striveInitSitemap = function () { console.log("Client has called striveInitSitemap. Initializing sitemap..."); SalesforceInteractions.init({ consents: new Promise(resolve => { const { OptIn, OptOut } = SalesforceInteractions.ConsentStatus; const purpose = SalesforceInteractions.ConsentPurpose.Tracking; const provider = 'Strive & Co.'; document.getElementById('opt-in')?.addEventListener( 'click', () => { console.log("User gave Tracking Consent."); resolve([{ purpose, provider, status: OptIn }]); }, { once: true } ); document.getElementById('opt-out')?.addEventListener( 'click', () => { console.log("User denied tracking Consent."); resolve([{ purpose, provider, status: OptOut }]); }, { once: true } ) }) }).then(() => { console.log("Consent resolved. Initializing Salesforce sitemap..."); SalesforceInteractions.log.level = 'debug'; const sitemapConfig = { global: { onActionEvent: (event) => { console.log("SF Event Captured:", event); return event; }, identity: { id: SalesforceInteractions.resolvers.fromWindow("strive_user_data.id"), email: SalesforceInteractions.resolvers.fromWindow("strive_user_data.email") } }, pageTypes: [ { name: 'Homepage', isMatch: () => document.body.classList.contains('home'), interaction: { name: 'viewHomepage' } // Custom name is fine here }, { name: 'Shop Page', isMatch: () => document.body.classList.contains('post-type-archive-product'), interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Category", id: "All Products" } } }, { name: 'Category Page', isMatch: () => document.body.classList.contains('product-category'), interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Category", id: () => { return document.title.split(' | ')[0]; } } } }, { name: 'Product Detail Page', isMatch: () => document.body.classList.contains('single-product'), interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Product", id: () => document.querySelector('.sku')?.innerText || '', name: () => document.querySelector('.product_title.entry-title')?.innerText || '', price: () => { const priceEl = document.querySelector('.price .woocommerce-Price-amount.amount'); return priceEl ? parseFloat(priceEl.innerText.replace(/[^\d.]/g, '')) : 0; } } }, listeners: [ SalesforceInteractions.listener("click", ".single_add_to_cart_button", (event) => { const productForm = event.target.closest('form.cart'); if (productForm) { const id = productForm.querySelector('[name="add-to-cart"]')?.value || ''; const quantity = productForm.querySelector('input.qty')?.value || '1'; SalesforceInteractions.sendEvent({ interaction: { name: SalesforceInteractions.CartInteractionName.AddToCart, lineItem: { catalogObject: { type: "Product", id: document.querySelector('.sku')?.innerText || id }, quantity: parseInt(quantity, 10) } } }); } }) ] }, { name: 'Cart Page', isMatch: () => document.body.classList.contains('woocommerce-cart'), interaction: { name: SalesforceInteractions.CartInteractionName.ReplaceCart, lineItems: () => { const lineItems = []; document.querySelectorAll('tr.woocommerce-cart-form__cart-item').forEach(itemEl => { const id = itemEl.querySelector('[data-product_sku]')?.dataset.product_sku || ''; const quantity = parseInt(itemEl.querySelector('input.qty')?.value || '0', 10); if (id && quantity > 0) { lineItems.push({ catalogObject: { type: "Product", id: id }, quantity: quantity }); } }); return lineItems; } } } ] }; SalesforceInteractions.initSitemap(sitemapConfig); console.log('SFDC Server-Side Sitemap logic has been successfully initialized.'); }); }; })(); })() } catch (e) { console.error("[Salesforce Data Cloud] Error loading sitemap:", e); }