@rokt/dcui-orchestrator 0.1.1-rc.1 → 0.1.1-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. package/dist/index.cjs +23 -23
  2. package/dist/index.js +23 -23
  3. package/dist/libraries/dcui-components/src/components/style-mapper/index.d.ts +1 -0
  4. package/dist/libraries/dcui-components/src/components/style-mapper/transformers/dimension-value-transformer.d.ts +2 -1
  5. package/dist/libraries/domain/src/models/purchase.d.ts +5 -7
  6. package/dist/libraries/layout-renderer-utils/src/sagas/plugin/display.d.ts +58 -0
  7. package/dist/libraries/layout-renderer-utils/src/sagas/plugin/sagas.d.ts +3 -4
  8. package/dist/modules/instant-purchase/src/actions/instant-purchase.d.ts +11 -1
  9. package/dist/modules/instant-purchase/src/models/index.d.ts +1 -0
  10. package/dist/modules/instant-purchase/src/models/state/index.d.ts +2 -0
  11. package/dist/modules/instant-purchase/src/models/state/instant-purchase.d.ts +3 -0
  12. package/dist/modules/instant-purchase/src/reducers/index.d.ts +3 -1
  13. package/dist/modules/instant-purchase/src/reducers/instant-purchase/fulfillment-details/index.d.ts +1 -0
  14. package/dist/modules/instant-purchase/src/reducers/instant-purchase/fulfillment-details/reducer.d.ts +4 -0
  15. package/dist/modules/instant-purchase/src/reducers/instant-purchase/index.d.ts +2 -0
  16. package/dist/modules/instant-purchase/src/reducers/instant-purchase/utils/index.d.ts +1 -0
  17. package/dist/modules/instant-purchase/src/reducers/instant-purchase/utils/utils.d.ts +3 -0
  18. package/dist/modules/instant-purchase/src/sagas/error-codes.d.ts +2 -0
  19. package/dist/modules/instant-purchase/src/sagas/instant-purchase/sagas.d.ts +3 -2
  20. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("react-dom/client"),a=require("react-redux"),i=require("ramda"),o=require("@emotion/css"),r=require("redux-saga/effects"),s=require("@reduxjs/toolkit"),l=require("redux-saga"),c=require("@redux-saga/core/effects"),d=require("embla-carousel-react"),u=require("insane"),p=require("@emotion/css/create-instance");function f(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var y=f(t);function h(e){const t=["elements","own"],n=["default","dimension","width","type"],a=["default","dimension","width","value"],o=["default","dimension","minWidth"],r=i.path(t,e);return r&&Array.isArray(r)&&r.length?i.assocPath(t,r.map(i.when(i.allPass([i.hasPath(n),i.complement(i.hasPath(o)),i.pathEq("fixed",n)]),(e=>i.assocPath(o,i.path(a,e),e)))),e):e}function m(e){const t="DISABLED"===e;return{tabIndex:t?-1:void 0,styles:t?{pointerEvents:"none",userSelect:"none"}:void 0,isDisabled:t}}function v(e,t){if("EscapeHatch"===t.type)try{return JSON.parse(t.node.data).type===e}catch(e){return!1}return!1}function g(){return"ontouchstart"in document.documentElement}function b(e){return null!=e&&"object"==typeof e&&("url"in e||"name"in e)&&"config"in e}function E(e){return null!=e&&"object"==typeof e&&"id"in e&&"action"in e&&"instanceGuid"in e&&"signalType"in e}function I(e){return E(e)&&"Fulfillment"===e.action}function S(e){return E(e)&&"Url"===e.action}function x(e){return E(e)&&"ExternalPaymentTrigger"===e.action}function C(e){return(I(e)||S(e))&&"RealTime"===e.conversionType&&"rclid"in e}function w(e){return(I(e)||S(e))&&"RealTimeReferral"===e.conversionType&&"rclid"in e}const O={pluginId:"shared",pageInstanceGuid:"N/A"};var T;!function(e){e.DCUI="DCUI",e.Partner="partner"}(T||(T={}));const A=["SignalCartItemQuantitySelected"],R="ERROR",N="WARNING";class L extends Error{constructor(e,t){super(t),this.code=null!=e?e:"UNHANDLED_EXCEPTION"}toString(){return`CodedError (${this.code}): ${this.message}`}}const _=["V2_CART_ITEM_UPDATED","CART_ITEM_INSTANT_PURCHASE","OFFER_ENGAGEMENT","POSITIVE_ENGAGEMENT","UPSELL_CREATIVE_SENT","REALTIME_OFFER_FULFILLMENT_REFERRAL","REALTIME_OFFER_FULFILLMENT_CONVERSION","REALTIME_OFFER_FULFILLMENT_SUCCESS","INITIATE_INSTANT_PURCHASE_EVENT","PLACEMENT_CLOSED","PLACEMENT_COMPLETED","PLACEMENT_INTERACTIVE","PLACEMENT_FAILURE"];const j=(e,t)=>i.concat(e,i.slice(e.length,t.length,t)),D=(e,t)=>{if(Array.isArray(e)&&Array.isArray(t)){const n=e.length>t.length?j(t,e):t,a=t.length>e.length?j(e,t):e;return i.zipWith(G,a,n)}return t},k=e=>null==e,P=e=>!k(e),$=(e,t)=>k(t)?e:t,F=(e,t)=>{throw new L("MERGE_TYPE_INCONSISTENCY",`Unable to merge values for inconsistent types, left = ${e}, right = ${t}`)};function G(e,t){return i.cond([[(e,t)=>i.type(e)!==i.type(t)&&P(e)&&P(t),F],[(e,t)=>k(e)||k(t),$],[(e,t)=>"Object"===i.type(e),i.mergeDeepWith(G)],[(e,t)=>"Array"===i.type(e),D],[i.T,i.flip(i.unary(i.identity))]])(e,t)}function M(e,t){return G(e,t)}function B(e=0){return`breakpoint-${e}px`}function U(e,t){return t?`${t}-child${e}`:void 0}const V="GLOBAL/RAISE_METRIC",z="GLOBAL/OFFER_ENGAGEMENT";function q(e){return null!=e&&"object"==typeof e&&"responseOption"in e&&I(e.responseOption)&&"fulfillment"in e&&b(e.fulfillment)}function H(e){return x(e)}function W(e){return S(e)}function J(e){return function(e){return E(e)&&"CaptureOnly"===e.action}(e)}function K(e){return!!(C(e)||"responseOption"in e&&C(e.responseOption))&&(!!e.accountID&&!!e.referralCreativeID)}function Y(e){return!!(w(e)||"responseOption"in e&&w(e.responseOption))&&(!!e.accountID&&!!e.referralCreativeID)}const Z="GLOBAL/RAISE_SIGNAL",Q="GLOBAL/OFFER_LIFECYCLE",X="GLOBAL/SET_CUSTOM_STATE",ee="GLOBAL/SEND_PARTNER",te="GLOBAL/SET_DOMAIN_STATE",ne="GLOBAL/PREPARE_SIGNAL",ae="GLOBAL/OPEN_LINK",ie="GLOBAL/SET_PARTNER_VALIDATION_STATUS",oe="GLOBAL/SET_GLOBAL_OFFER_DATA_CART",re="GLOBAL/LAUNCH_CHILD_LAYOUT",se={RAISE_METRIC:V,PREPARE_SIGNAL:ne,OFFER_ENGAGEMENT:z,RAISE_SIGNAL:Z,OFFER_LIFECYCLE:Q,SEND_PARTNER:ee,SET_CUSTOM_STATE:X,SET_DOMAIN_STATE:te,OPEN_LINK:ae,SET_PARTNER_VALIDATION_STATUS:ie,SET_GLOBAL_OFFER_DATA_CART:oe,LAUNCH_CHILD_LAYOUT:re},le="data-open-in-app",ce="data-click-signal-context";function de(e,n){function a(e){var t;if(!(e.target&&e.target instanceof HTMLElement))return;const a=null===(t=e.target)||void 0===t?void 0:t.closest("a");if(a){const t=a.getAttribute("href"),i=a.getAttribute(ce);if(i&&n({type:Z,payload:{name:"SignalUserInteraction",action:"Click",context:i}}),t){e.preventDefault();let i="newTab";a.hasAttribute(le)&&(i="inApp"),n({type:ae,payload:{url:t,urlBehaviour:i}})}}}t.useEffect((()=>null!==e?(e.addEventListener("click",a),()=>{e.removeEventListener("click",a)}):()=>{}),[e])}function ue(){const e=t.useRef(null);return t.useEffect((()=>{const t=t=>{"Tab"===t.key&&pe(t,e)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)}),[e]),e}const pe=(e,t)=>{var n;const a=null===(n=t.current)||void 0===n?void 0:n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!a)return;const i=a[0],o=a[a.length-1],{activeElement:r}=window.document;if(1!==a.length)return r===i&&e.shiftKey?(o&&o.focus(),void e.preventDefault()):r!==o||e.shiftKey?void 0:(i&&i.focus(),void e.preventDefault());e.preventDefault()},fe="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DISPLAY_ERRORS:"true",REPORT_RENDER_ERRORS:"true",USE_MEDIA_QUERY_NESTING:"true"};function ye(e,t){return t?"false"!==fe.USE_MEDIA_QUERY_NESTING?`${n=e,`@media (min-width: ${n}px)`} {${t}}`:t.includes(" & ")?`#app-container.${B(e)} ${t.trim()}`:`#app-container.${B(e)} & {${t}}`:"";var n}const he={hovered:":hover",pressed:":active",focussed:":focus",disabled:":disabled"};function me(e){return function(e){return Object.keys(he).indexOf(e)>-1}(e)?he[e]:""}const ve={container:{justifyContent:"justify-content",alignItems:"align-items",shadow:"box-shadow",gap:"gap",overflow:"overflow",blur:"filter",opacity:"opacity"},text:{textColor:"color",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",fontStyle:"font-style",lineHeight:"line-height",lineLimit:"",letterSpacing:"letter-spacing",baselineTextAlign:"vertical-align",horizontalTextAlign:"text-align",textDecoration:"text-decoration",textTransform:"text-transform"},background:{backgroundColor:"background-color",backgroundImage:""},dimension:{width:"width",maxWidth:"max-width",minWidth:"min-width",height:"height",maxHeight:"max-height",minHeight:"min-height",rotateZ:"transform"},flexChild:{alignSelf:"align-self",weight:"flex",order:"order"},spacing:{margin:"margin",padding:"padding",offset:""},border:{borderColor:"border-color",borderRadius:"border-radius",borderWidth:"border-width",borderStyle:"border-style"}};function ge(e,t){if(!ve[e]||!ve[e][t])throw new Error(`No CSS property mapping exists for styling property: ${e}.${t.toString()}`);return ve[e][t]}function be(e,t){return n=>t(...Object.keys(e).map((t=>e[t](n[t]))))}function Ee(...e){let t="";const n=(...e)=>e.reduce(((e,n)=>(e&&n?e=e+t+n:n&&(e=n),e)),"");return 1===e.length?(t=e[0],n):n(...e)}function Ie(e,t){return`${e}:${t};`}function Se(e){return function(e,t){return`@media (${e}) {${t}}\n`}("prefers-color-scheme: dark",e)}class xe extends Error{constructor(e,t){super(`Invalid styling value '${t}': ${e}.`),this.name=this.constructor.name}}function Ce(e,t){if(null===t)return!1;const n=("function"==typeof e?[e]:e).map((e=>e(t))).reduce(((e,t)=>t?e?e+=`, ${t}`:t:e),void 0);if(n)throw new xe(n,JSON.stringify(t));return!0}function we(e){if(isNaN(e)||"number"!=typeof e&&"string"!=typeof e)return"value must be a number"}function Oe(e){return t=>{const n=t&&"symbol"!=typeof t?t.toString():t;if(!(e.indexOf(n)>=0))return`value must be one of [${e.join(",")}]`}}function Te(e){if(null==e||""===e)return"value must not be omitted"}function Ae(e){const t=new RegExp(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{3})$/);if("string"!=typeof e||!t.test(e))return"value must be a valid hex color"}function Re(e){const t=new RegExp(/^(?:(?:data:image\/[^;]+;base64[^"]+)|(?:(?:https?:)?\/\/[a-zA-Z\d-]+(?:\.[a-zA-Z\d-]+)*(?::\d{1,10})?)?(?:\.\.?\/?)*\/(?:[a-zA-Z\d\-_]+\/)*[a-zA-Z\d\-_]+\.[a-zA-Z\d]{2,6}(?:\?(?:.+=.+&?)*)?)(?:#.+)?$/);if("string"!=typeof e||!t.test(e))return"value must be a valid CSS URL string"}function Ne(e){if(null!=e&&""!==e)return"value must not be specified"}function Le(e){return t=>{if(t&&"object"==typeof t&&"value"in t&&"type"in t&&"string"==typeof t.type&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t.type)&&"function"==typeof e[t.type]){const n=e[t.type](t.value);if(!n)return;return`object must have valid "value" for type: ${t.type}: ${n}`}return`value must be an object that has a "type" property that matches one of: [${Object.keys(e).join(", ")}] and a "value" property`}}function _e(...e){return t=>{if("string"==typeof t){const n=t.split(" ");if(n.length>1&&e.indexOf(n.length)>-1){if(!n.reduce(((e,t)=>e||we(t)),void 0))return}}return`value must be a space separated list of numbers, of one of the following lengths: ${e.join(" ,")}`}}function je(e,t){return n=>{const a=e(n),i=t(n);if(a&&i)return`one of these must be true: ${a} -OR- ${i}`}}function De(e){if("string"!=typeof e)return"value must be a string"}const ke=i.is(Object);function Pe(e){const t=Object.entries(e);return n=>ke(n)&&!Array.isArray(n)?t.reduce(((e,[t,a])=>e||a(n[t])),void 0):`Input value (${e}) must be an object`}function $e(e){if("number"!=typeof e&&"string"!=typeof e||isNaN(e)||!(e>=0))return"value must be a positive number"}function Fe(e,t,n){return Ce(we,n)?Ie(ge(e,t),`${n}`):""}function Ge(e){return(t,n,a)=>Ce(Oe(Object.keys(e)),a)?Ie(ge(t,n),`${e[a]}`):""}function Me(e){return Ce(Te,e)?be({light:t(Re,!1),dark:t(je(Ne,Re),!0)},Ee("\n "))(e):"";function t(e,t){return n=>{if(Ce(e,n)&&n){const e=Ie("background-image",`url("${n}")`);return t?Se(e):e}return""}}}function Be(e){const t={crop:"auto",fit:"contain",fill:"cover"};return"string"==typeof e&&(e=e.toLowerCase()),Ce(je(Ne,Oe(Object.keys(t))),e)&&e?Ie("background-size",t[e]):""}const Ue=i.cond([[i.equals("top-left"),i.always("top left")],[i.equals("top-right"),i.always("top right")],[i.equals("bottom-left"),i.always("bottom left")],[i.equals("bottom-right"),i.always("bottom right")],[i.T,i.identity]]);function Ve(e){const t="string"==typeof e?e.toLowerCase():e;return Ce(je(Ne,Oe(["top","right","bottom","left","center","top-left","top-right","bottom-left","bottom-right"])),t)&&t?Ie("background-position",Ue(t)):""}function ze(e,t,n){return Ce(je(we,_e(2,3,4)),n)?Ie(ge(e,t),n.toString().split(" ").map((e=>`${e}px`)).join(" ")):""}function qe(e){return(t,n,a)=>Ce(Le({fit:Oe(e),percentage:we,fixed:we}),a)?Ie(ge(t,n),function(e){const t={"wrap-content":"fit-content","fit-width":"100%","fit-height":"100%"};switch(e.type){case"fixed":return`${e.value}px`;case"percentage":return`${e.value}%`;case"fit":return t[e.value]}}(a)):""}const He=Pe({light:Ae,dark:je(Ne,Ae)});function We(e,t,n){return a=>{if(a){const i=Ie(ge(e,t),Ke(String(a)));return n?Se(i):i}return""}}function Je(e,t,n){return Ce(He,n)?be({light:We(e,t,!1),dark:We(e,t,!0)},Ee("\n "))(n):""}function Ke(e){const t=e.toUpperCase();switch(t.length){case 5:return`#${t.substring(2,5)}${t[1]}`;case 9:return`#${t.substring(3,9)}${t[1]}${t[2]}`;default:return t.toUpperCase()}}const Ye=Pe({offsetX:je(Ne,we),offsetY:je(Ne,we),blurRadius:je(Ne,we),spreadRadius:je(Ne,we),color:He}),Ze=e=>t=>null!=t?String(t):e,Qe=i.compose(i.concat(i.__,"px"),Ze("0")),Xe=e=>t=>"string"==typeof t?e(t):t,et=i.compose(Xe(i.concat(i.__,"px")),Ze(void 0)),tt=i.compose(Xe(Ke),i.prop("dark"));function nt(e,t,n){return Ie(e,be({offsetX:Qe,offsetY:Qe,blurRadius:t.spreadRadius?Qe:et,spreadRadius:et,color:n},Ee(" "))(t))}const at={center:"center","flex-end":"flex-end","flex-start":"flex-start",stretch:"stretch"},it={container:{justifyContent:Ge(at),alignItems:Ge(at),shadow:function(e,t,n){var a,o,r;if(Ce(Ye,n)){const s=ge(e,t);return Ee("\n")(nt(s,n,(o="light",r="#80000000",i.compose(Ke,i.propOr(r,o)))),(null===(a=n.color)||void 0===a?void 0:a.dark)?Se(nt(s,n,tt)):"")}return""},gap:ze,overflow:Ge({hidden:"hidden",visible:"visible"}),blur:function(e,t,n){return Ce($e,n)?Ie(ge(e,t),`blur(${n.toString()}px)`):""},opacity:Fe},text:{textColor:Je,fontSize:ze,fontFamily:function(e,t,n){return Ce(De,n)?Ie(ge(e,t),(a=`${n}`,a.replace(/['();{}@:[\]!/=]/g,"")).split(",").map(((e,t)=>{const n=0===t?e:e.trim();if(n.includes(" ")){const e=n.startsWith('"')?"":'"',t=n.endsWith('"')?"":'"';return`${e}${n}${t}`}return n})).join(",")):"";var a},fontWeight:Ge({100:100,200:200,300:300,400:400,500:500,600:600,700:700,800:800,900:900}),fontStyle:Ge({normal:"normal",italic:"italic"}),lineHeight:ze,lineLimit:function(e,t,n){return Ce(we,n)?`\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: ${n};\n line-clamp: ${n}; \n -webkit-box-orient: vertical;\n `:""},letterSpacing:ze,baselineTextAlign:Ge({super:"super",sub:"sub",baseline:"baseline"}),horizontalTextAlign:Ge({left:"left",right:"right",center:"center",start:"start",end:"end",justify:"justify"}),textDecoration:Ge({underline:"underline","strike-through":"line-through",none:"none"}),textTransform:Ge({capitalize:"capitalize",uppercase:"uppercase",lowercase:"lowercase",none:"none"})},background:{backgroundColor:Je,backgroundImage:function(e,t,n){return Ce(Te,n)?be({url:Me,position:Ve,scale:Be},Ee)(n):""}},dimension:{width:qe(["wrap-content","fit-width"]),maxWidth:ze,minWidth:ze,height:qe(["wrap-content","fit-height"]),maxHeight:ze,minHeight:ze,rotateZ:(ot="Z",(e,t,n)=>{const a=`rotate${ot}`;return Ce(we,n)?Ie(ge(e,t),`${a}(${n.toString()}deg)`):""})},flexChild:{alignSelf:Ge(at),weight:Fe,order:Fe},spacing:{margin:ze,padding:ze,offset:function(e,t,n){return Ce(_e(2),n)?`transform:translate(${n.split(" ").join("px, ")}px)`:""}},border:{borderColor:Je,borderRadius:ze,borderWidth:ze,borderStyle:Ge({solid:"solid",dashed:"dashed"})}};var ot;function rt(e){return Object.keys(e).reduce(((t,n)=>(n&&e[n]&&Object.keys(e[n]).forEach((a=>{if(!it[n])throw new Error(`No styling transformers exist for styling category key: ${n}`);const i=it[n][a];if(!i)throw new Error(`No styling transformer exists for property: ${n}.${a.toString()}`);try{t+=i(n,a,e[n][a])}catch(e){throw e&&"object"==typeof e&&"message"in e&&(e.message=`Error parsing styling key ${n}.${a.toString()}: ${e.message}`),e}})),t)),"")}const st="FAILED_TEMPLATING_DATA",lt=new Map;function ct(e){return String.fromCharCode(97+e)}function dt(e,t,n){const a=`${e||O.pluginId}-${void 0!==t?String(t):"outer"}`,i=lt.get(a);if(i&&i.sheet.container.isConnected)return i.css;const o=function(e,t){const n={key:void 0!==e?`inner-css-${ct(e)}`:"outer-css",container:t};return t&&t.parentElement&&(n.container=t.parentElement),p(n)}(t,n);return lt.set(a,o),o.css}const ut="%%%OWN_CLASS_REF%%%",pt=i.memoizeWith(((e,t,n,a)=>`${String(e)}-${t}-${n}`),ft);function ft(e,t,n,a){const i=dt(t,n,a);let o=1;return function t(n,a=!1){var r;if("string"==typeof n){const e={scopeClass:n};return t.bind(e)}const s=n,l=this.scopeClass,c=Object.entries(null!==(r=s.elements)&&void 0!==r?r:{});try{const t=c.reduce(((t,[n,i])=>Object.assign(Object.assign({},t),{[n]:yt(i,l,a,String(n),e)})),{}),n=Object.entries(t),r=a?"parent-"+o++:"",s=function(e){return"own"in e&&"string"==typeof e.own&&e.own.length>0}(t)?i(t.own):"";return n.reduce(((e,[t,n=""])=>{if("own"===t)return e;const a=n.replace(ut,r);return Object.assign(Object.assign({},e),{[t]:a?i(a):""})}),{own:`${s}${s&&r?" ":""}${r}`})}catch(e){const t=e;throw t.code="FAILED_PARSING_STYLES",t}}.bind({})}function yt(e,t,n,a,i){return e.map(function(e,t,n){return a=>Object.entries(a).map((([a,i])=>{const o=i?rt(i):"";switch(!0){case"default"===a:return o?`\n${o}\n`:"";case Boolean(e):return`\n .${e}${me(a)} & {\n${o}\n}\n`;case t&&"own"!==n:return`\n .${ut}${me(a)} & {\n${o}\n}\n`;default:return`\n &${me(a)} {\n${o}\n}\n`}})).join("")}(t,n,a)).reduce(((e,t,n)=>{const a=i[n];return void 0!==a?e+(0===n?t:`${ye(a,t)}\n`):e}),"")}const ht=t.createContext(i.always(void 0)),mt=()=>t.useContext(ht),vt=t.createContext(null);function gt(e,n){var a;const i=t.useContext(vt);return i&&null!==(a=n(i))&&void 0!==a?a:e}const bt=t.createContext((()=>{throw Error("Node Mapper Context does not have a mapper. Use the NodeMapperProvider with the default nodeMapper as a value before you consume this mapper")})),Et=bt.Consumer,It=()=>t.useContext(bt),St=e=>t.createElement(bt.Provider,{value:(t,n,a)=>e.value(t,null!=n?n:e.overrides,a)},e.children),xt=t.createContext(null),Ct=()=>t.useContext(xt),wt=t.createContext({get(){throw Error("Offer context has not been set")}}),Ot=e=>t.createElement(wt.Provider,{value:{get:()=>e.context}},e.children),Tt=()=>t.useContext(wt).get(),At=()=>{try{return t.useContext(wt).get().creative.copy}catch(e){return}},Rt=new RegExp("<a ([^>]*>((?!</a>).)*</a>)","g"),Nt=i.compose(i.not,i.isEmpty),Lt=i.where({url:Nt,title:Nt});function _t(e,t,n){return t.reduce(((t,n)=>{const[a,i]=n.slice(0,-1).split("["),o=i?i.split(","):[];if(!a)throw new Error(Dt(e,"This Meta Attribute could not be parsed."));return function(e,t,n,a){switch(t){case"openLinks":return function(e,t,n){jt(t,e,"openLinks",1,2);const a=kt(t,e,0,(e=>"InApp"===e?"InApp":null),"openLinks meta attribute can only open InApp"),i=Pt(t,1,(e=>"string"==typeof e&&e.length?e:null));if("InApp"===a)return n.replace(Rt,((e,t)=>`<a ${le} ${i?`${ce}="${i}" `:""}${t}`));return n}(e,n,a);case"sliceText":return function(e,t,n){jt(t,e,"sliceText",2,2);const a=kt(t,e,0,(e=>"Chars"===e?"Chars":null),"sliceText meta attribute can only slice by Chars"),i=kt(t,e,1,(e=>{const t=Number(e);return!Number.isNaN(t)&&t>=0?t:null}),"sliceText meta attribute second argument must be a positive number");if("Chars"===a)return function(e,t){const n=new RegExp("(?<=<a.*>).*(?=</a>)");return e.startsWith("<a")?e.replace(n,(e=>e.slice(0,t))):e.slice(0,t)}(n,i);throw Error(Dt(e,`Unknown "SliceBy" value. ${a}`))}(e,n,a);default:throw new Error(Dt(e,`Unknown Meta Attribute '${t}'.`))}}(e,a,o,t)}),n)}function jt(e,t,n,a,i){const o=new Error(Dt(t,`${n} meta attribute takes ${a!=i?`between ${a} and ${i}`:a} arguments; received ${e.length}.`));if(e.length<a||e.length>i)throw o}function Dt(e,t){return`Malformed Meta Attribute: '${e}' - ${t}`}function kt(e,t,n,a,i){const o=Pt(e,n,a);if(null!==o)return o;throw Error(Dt(t,i||`Could not parse meta attribute argument at index ${n} from arguments ${JSON.stringify(e)}`))}function Pt(e,t,n){return n(e[t])}const $t="DATA",Ft="STATE",Gt=new RegExp(`^(${$t}|${Ft})`),Mt=new RegExp(`^${Ft}`),Bt=new RegExp(`%\\^(?:${$t}|${Ft})\\.[a-zA-Z0-9]+[a-zA-Z0-9\\.]*(?:\\:[a-zA-Z0-9]+\\[[a-zA-Z0-9\\.,]*\\])*(?:\\|.*?)?\\^%`,"g"),Ut=Symbol("invalid");function Vt(e,t="creativeCopy"){const n=zt({data:e},t);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:zt(t,n,this.dataMap)});let a=!1;const o=t,r=i.pipe(i.slice(2,-2),i.split("|"),(e=>{const t=i.reduce(((e,t)=>{let n;if(Gt.test(t)){if(!this.dataMap.has(t)&&Mt.test(t))throw new L(st,`Invalid use of STATE template key in a context it does not exist: ${t}`);const a=i.split(":",t);if(a[0]){if(n=this.dataMap.get(a[0]),n&&n===Ut)throw new L(st,`Invalid template key referenced: "${t}" is an object but expected a string, boolean, number or empty. \nDid you mean to reference a child property of ${t}?`);if(a.length>1&&n)try{n=_t(a[0],a.slice(1),n)}catch(e){throw new L(st,`Failed to apply meta attributes. ${function(e){return null!=e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message?e.message:String(e)}(e)}`)}}return n?i.reduced({provided:!0,value:n}):e}return i.reduced({provided:!0,value:t})}),{provided:!1,value:""},e);return t.provided||(a=!0),t.value})),s=i.replace(Bt,r,o);return!1===a?s:""}.bind({dataMap:n})}function zt(e,t,n){const a=new Map(n);return"data"in e&&o(e.data,`${$t}${t?"."+t:""}`),"state"in e&&o(e.state,`${Ft}${t?"."+t:""}`),a;function o(e,t){"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e?a.set(t,(null==e?void 0:e.toString())||""):a.set(t,Ut),e&&"object"==typeof e&&i.forEachObjIndexed(((e,n)=>o(e,`${t}.${n}`)),e)}}const qt=t.createContext(Vt({})),Ht=qt.Consumer,Wt=qt.Provider,Jt=()=>t.useContext(qt),Kt=t.createContext(null),Yt=Kt.Provider,Zt=t.createContext("OUTER"),Qt=()=>"VARIANT"===t.useContext(Zt),Xt=t.createContext(void 0),en=()=>t.useContext(Xt);var tn,nn,an,on,rn,sn,ln=function(e,t,n,a){return new(n||(n=Promise))((function(i,o){function r(e){try{l(a.next(e))}catch(e){o(e)}}function s(e){try{l(a.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,s)}l((a=a.apply(e,t||[])).next())}))},cn=function(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n},dn=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)};class un{constructor(e,t,n,a,o){tn.set(this,void 0),nn.set(this,void 0),an.set(this,new Set),on.set(this,void 0),rn.set(this,void 0),sn.set(this,void 0),cn(this,tn,i.partial(e.subscribe.bind(e),[n]),"f"),cn(this,nn,i.partial(e.dispatch.bind(e),[n]),"f"),cn(this,on,t,"f"),cn(this,rn,a,"f"),cn(this,sn,o,"f"),this.onGlobalStateChange=this.onGlobalStateChange.bind(this),this.onInteractivityChange=this.onInteractivityChange.bind(this),this.onEvent=this.onEvent.bind(this),this.globalDispatch=this.globalDispatch.bind(this),this.createChildPlugin=this.createChildPlugin.bind(this)}onGlobalStateChange(e){const t=dn(this,tn,"f").call(this,e),n=()=>{t(),dn(this,an,"f").delete(n)};return dn(this,an,"f").add(n),n}onInteractivityChange(e){return dn(this,rn,"f").subscribe(e)}onEvent(...e){const t=e.reduce(((e,t)=>{if("partner"===t.source||"*"===t.source){const n=dn(this,sn,"f").call(this,t.name).subscribe(t.callback);return[...e,()=>n.unsubscribe()]}return e}),[]),n=()=>{t.forEach((e=>{e()})),dn(this,an,"f").delete(n)};return dn(this,an,"f").add(n),n}globalDispatch(e){dn(this,nn,"f").call(this,e)}dispose(){dn(this,an,"f").forEach((e=>e())),cn(this,an,new Set,"f"),dn(this,rn,"f").clear()}createChildPlugin(e){return dn(this,on,"f").call(this,e)}}tn=new WeakMap,nn=new WeakMap,an=new WeakMap,on=new WeakMap,rn=new WeakMap,sn=new WeakMap;class pn{onGlobalStateChange(){return()=>{}}onInteractivityChange(){return()=>{}}onEvent(){return()=>{}}globalDispatch(){}dispose(){}createChildPlugin(){return{close:()=>ln(this,void 0,void 0,(function*(){})),onClose:()=>ln(this,void 0,void 0,(function*(){})),putConfig:()=>ln(this,void 0,void 0,(function*(){})),send:()=>ln(this,void 0,void 0,(function*(){})),onEvent:()=>({subscribe:()=>({unsubscribe:()=>{}})})}}}var fn,yn,hn=function(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n},mn=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)};class vn{constructor(e){fn.set(this,void 0),yn.set(this,new Set),hn(this,fn,e,"f")}subscribe(e){return mn(this,yn,"f").add(e),!0===e(mn(this,fn,"f"))&&mn(this,yn,"f").delete(e),()=>{mn(this,yn,"f").delete(e)}}publish(e){hn(this,fn,e,"f"),mn(this,yn,"f").forEach((e=>{!0===e(mn(this,fn,"f"))&&mn(this,yn,"f").delete(e)}))}clear(){mn(this,yn,"f").clear()}}fn=new WeakMap,yn=new WeakMap;var gn=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)},bn=function(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n};const En="breakpoint-0px";class In{constructor(){this.logger=()=>{}}withAppFactory(e){return this.appFactory=e,this}withLogger(e){return this.logger=e,this}withGatewayFactory(e){return this.gatewayFactory=e,this}build(){var e,t,n,a,i,o,r,s,l,c,d,u,p,f;const y=this.appFactory,h=this.logger,m=null!==(e=this.gatewayFactory)&&void 0!==e?e:()=>new pn;return f=class extends HTMLElement{static get observedAttributes(){return["visible","interactivity","active-breakpoint"]}constructor(){super(),t.add(this),n.set(this,(()=>null)),a.set(this,(()=>null)),i.set(this,void 0),o.set(this,!1),r.set(this,null),s.set(this,null),l.set(this,null);const e=this.attachShadow({mode:"open"});bn(this,i,document.createElement("div"),"f"),gn(this,i,"f").id="app-container",gn(this,i,"f").classList.add("default"),e.appendChild(gn(this,i,"f"))}attributeChangedCallback(e,i,o){if(o!==i)switch(e){case"visible":gn(this,n,"f").call(this,"true"===o);break;case"interactivity":"ENABLED"!==o&&"DISABLED"!==o||gn(this,a,"f").call(this,o);break;case"active-breakpoint":gn(this,t,"m",c).call(this,o,i)}}makeInteractivityUpdateHandler(e){bn(this,a,(t=>{e.publish(t)}),"f")}makeVisbilityUpdateHandler(e,a,i){const o="true"===this.getAttribute("visible"),r=this.getAttribute("slotInstanceGuid");bn(this,n,(o=>{o?(bn(this,n,(()=>null),"f"),0===e&&i.globalDispatch({type:Q,payload:{event:"Interactive"}}),a&&(i.globalDispatch({type:Z,payload:{name:"SignalImpression",parentGuid:a}}),this.trackViewability(a,i)),r&&i.globalDispatch({type:Z,payload:{name:"SignalImpression",parentGuid:r}})):gn(this,t,"m",p).call(this)}),"f"),gn(this,n,"f").call(this,o)}trackViewability(e,n){if(!gn(this,o,"f"))if("IntersectionObserver"in window&&!gn(this,r,"f")){const a=()=>{gn(this,o,"f")||(n.globalDispatch({type:Z,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!0}}),bn(this,o,!0,"f"),gn(this,t,"m",p).call(this),gn(this,i,"f").removeEventListener("click",a))};gn(this,i,"f").addEventListener("click",a),bn(this,r,new IntersectionObserver((r=>{r.forEach((r=>{r.isIntersecting&&r.intersectionRatio>=.5?gn(this,t,"m",u).call(this,(()=>{gn(this,o,"f")||(n.globalDispatch({type:Z,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!1}}),bn(this,o,!0,"f"),gn(this,t,"m",p).call(this),gn(this,i,"f").removeEventListener("click",a))})):gn(this,t,"m",d).call(this)}))}),{threshold:.5}),"f"),bn(this,l,(()=>{var e,n;"visible"===document.visibilityState?null===(e=gn(this,r,"f"))||void 0===e||e.observe(gn(this,i,"f")):(gn(this,t,"m",d).call(this),null===(n=gn(this,r,"f"))||void 0===n||n.disconnect())}),"f"),document.addEventListener("visibilitychange",gn(this,l,"f")),gn(this,l,"f").call(this)}else n.globalDispatch({type:Z,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!1,inferred:!1}}),bn(this,o,!0,"f")}getOfferPositionAttr(){const e=this.getAttribute("offerPositionIndex"),t=Number(e);return(null==e||isNaN(t)||t<0)&&v(`Offer position attribute (${e}) is invalid`),t}getJSONAttr(e,t="{}"){const n=this.getAttribute(e);try{return JSON.parse(null!=n?n:t)}catch(t){v(`Invalid JSON attribute ${e}: ${n}`)}}disconnectedCallback(){gn(this,t,"m",p).call(this)}connectedCallback(){var e,t,n;const a=this.getAttribute("container"),o=this.getAttribute("plugin-id");gn(this,i,"f").setAttribute("style","width:100%;display:flex;flex-direction:"+("column"===a?"column":"row"));const r=this.getOfferPositionAttr(),s=this.getJSONAttr("layoutSchema"),l=this.getJSONAttr("childLayouts","[]"),c=this.getJSONAttr("offerData"),d=new vn("DISABLED"===this.getAttribute("interactivity")?"DISABLED":"ENABLED"),u=null!==(e=this.getAttribute("schemaVersion"))&&void 0!==e?e:"",p=this.getJSONAttr("offerState","{}");y||v("Cannot create app without factory. Please build the connector withAppFactory.");const f=m({offerPositionIndex:r,creativeInstanceGuid:null===(t=null==c?void 0:c.creative)||void 0===t?void 0:t.instanceGuid},d);this.makeInteractivityUpdateHandler(d),y({rootElement:gn(this,i,"f"),gateway:f,logger:h,offerPositionIndex:r,offerData:c,layoutSchema:s,childLayouts:l,schemaVersion:u,pluginId:o||O.pluginId,offerState:p}),this.makeVisbilityUpdateHandler(r,null===(n=null==c?void 0:c.creative)||void 0===n?void 0:n.instanceGuid,f)}},n=new WeakMap,a=new WeakMap,i=new WeakMap,o=new WeakMap,r=new WeakMap,s=new WeakMap,l=new WeakMap,t=new WeakSet,c=function(e,t){gn(this,i,"f").classList.remove(t||En),gn(this,i,"f").classList.add(e||En)},d=function(){gn(this,s,"f")&&(clearTimeout(gn(this,s,"f")),bn(this,s,null,"f"))},u=function(e){gn(this,t,"m",d).call(this),bn(this,s,window.setTimeout(e,1e3),"f")},p=function(){gn(this,t,"m",d).call(this),gn(this,r,"f")&&(gn(this,r,"f").disconnect(),bn(this,r,null,"f")),gn(this,l,"f")&&(document.removeEventListener("visibilitychange",gn(this,l,"f")),bn(this,l,null,"f"))},f;function v(e){throw h({level:R,code:"MODULE_BUILDER/FAILED_TO_BUILD_MODULE",message:e}),Error(e)}}}const Sn=t.createContext({get:()=>new pn}),xn=e=>t.createElement(Sn.Provider,{value:{get:()=>e.context}},e.children);const Cn=t.createContext({get(){throw Error("Layout Schema context has not been set")}}),wn=e=>t.createElement(Cn.Provider,{value:{get:()=>e.context}},e.children),On=()=>t.useContext(Cn).get(),Tn=t.createContext("ENABLED"),An=()=>t.useContext(Tn);function Rn(e){const t=Ln(e);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Ln(t,this.dataMap)});if(!n)throw new L("FAILED_TO_MAP_STATIC_DATA","No namespace submitted to StaticData Mapper");const a=t;return i.path([n,a],this.dataMap)}.bind({dataMap:t})}const Nn={images:{},links:{},icons:{},copy:{},responseOptionsMap:{}};function Ln(e,t=Nn){return["images","links","icons","copy","responseOptionsMap"].reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Object.assign(Object.assign({},t[n]),e[n])})),t)}const _n=t.createContext(Rn({}));_n.Consumer;const jn=_n.Provider,Dn=()=>t.useContext(_n),kn=t.createContext({});function Pn({info:e,children:n}){const a=t.useContext(kn);return t.createElement(kn.Provider,{value:Object.assign(Object.assign({},a),e)},n)}const $n=t.createContext({get(){throw Error("Catalog Item context has not been set")}}),Fn=e=>t.createElement($n.Provider,{value:{get:()=>e.context}},e.children),Gn=()=>t.useContext($n).get(),Mn=t.createContext(""),Bn=()=>t.useContext(Mn),Un=t.createContext(""),Vn=t.createContext(void 0);function zn({children:e}){const n=t.useMemo((()=>{const e=document.createElement("div");return e.inert=!0,{inert:!0===e.inert}}),[]);return t.createElement(Vn.Provider,{value:n},e)}const qn=i.compose(i.anyPass([i.isEmpty,i.all(i.isEmpty)]),i.flatten,i.map(i.values),i.map(i.ifElse(i.isNil,i.always({}),i.identity)),i.values,i.propOr({},"value")),Hn=i.compose(i.isEmpty,i.prop("predicates"));function Wn(e,t){return`transition: ${t.map((t=>`${t} ${e}ms`)).join(", ")};`}const Jn=i.curry(((e,{duration:t,predicates:n,styles:a})=>{return{predicates:n,classname:e(rt(a)),transitionBaseClassname:e(Wn(t,(o=a,i.toPairs(o).flatMap((e=>{const[t,n]=null!=e?e:[];return n&&t?i.keys(n).map((e=>ge(t,e))):[]})))))};var o})),Kn=i.anyPass([qn,Hn]);const Yn={is:i.equals,"is-not":i.compose(i.not,i.equals),"is-below":i.lt,"is-above":i.gt};function Zn(e,t){return e.includes(t)}const Qn={is:i.equals,"is-not":i.compose(i.not,i.equals),exists:Zn,"not-exists":i.compose(i.not,Zn)},Xn={exists:i.compose(i.not,i.either(i.isNil,i.isEmpty)),"not-exists":i.either(i.isNil,i.isEmpty)},ea={"is-true":i.equals(!0),"is-false":i.equals(!1)},ta={is:i.equals,"is-not":i.compose(i.not,i.equals)};function na(e){return(t,n)=>n[e]}const aa=i.cond([[(e,t)=>i.equals("Breakpoint",e),na("activeBreakpoint")],[(e,t)=>i.equals("Progression",e),na("progressionIndex")],[(e,t)=>i.equals("Position",e),na("positionIndex")]]);function ia(e,t){return e.creativeCopy&&"string"==typeof e.creativeCopy[t]?e.creativeCopy[t]:void 0}const oa=i.cond([[i.equals("Breakpoint"),(e,t,n)=>{const a=i.lensPath(["breakpoints",t]);return i.pipe(i.over(a,Number),i.view(a))(n)}],[i.equals("Progression"),(e,t,n)=>i.cond([[i.gt(0),i.add(n.totalGroups)],[i.lte(0),i.identity]])(Number(t))],[i.equals("Position"),(e,t,n)=>i.cond([[i.gt(0),i.add(n.totalOffers)],[i.lte(0),i.identity]])(Number(t))]]),ra=i.compose(i.not,isNaN);function sa(e,t){return e.map((e=>{var n,a,i;switch(e.type){case"StaticString":return(0,ta[e.predicate.condition])(e.predicate.input,e.predicate.value);case"CreativeCopy":return(0,Xn[e.predicate.condition])(ia(t,e.predicate.value));case"StaticBoolean":return(0,ea[e.predicate.condition])(e.predicate.value);case"CustomState":return(0,Yn[e.predicate.condition])(null!==(n=t.customStates[e.predicate.key])&&void 0!==n?n:0,e.predicate.value);case"DomainState":return(0,Yn[e.predicate.condition])(null!==(a=t.domainStates[e.predicate.key])&&void 0!==a?a:0,e.predicate.value);case"DarkMode":throw new Error("DarkMode has not yet been implemented.");case"Placeholder":return function(e){switch(e.predicate.type){case"TextValue":return(0,Qn[e.predicate.content.condition])(e.predicate.content.input,e.predicate.content.value);case"TextLength":return(0,Yn[e.predicate.content.condition])(e.predicate.content.input.length,e.predicate.content.value);case"Numeric":return(0,Yn[e.predicate.content.condition])(Number(e.predicate.content.input),e.predicate.content.value);default:return!1}}(e);default:{const n=Yn[e.predicate.condition],a=null!==(i=aa(e.type,t))&&void 0!==i?i:NaN,o=oa(e.type,e.predicate.value,t);return!!ra(a)&&n(a,o)}}}))}function la(e){return i.pathOr(0,["breakpoint","breakpoints",e.breakpoint.activeBreakpoint],e)}const ca={breakpoints:{},activeBreakpoint:NaN,progressionIndex:NaN,positionIndex:NaN,totalOffers:NaN,totalGroups:NaN,creativeCopy:{},customStates:{},domainStates:{}};function da(e,t,n,a){const o=t.map((e=>"Progression"===e.type?Object.assign(Object.assign({},e),{type:a?"Position":e.type}):e)),{cached:r,uncached:s}=o.reduce(((t,a)=>function(e,t,n,a){const o=function(e,t){switch(e.type){case"Position":case"StaticBoolean":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:static-state`;case"StaticString":return`${e.type}:${e.predicate.input}:${e.predicate.condition}:${e.predicate.value}:static-state`;case"CreativeCopy":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${ia(t,e.predicate.value)}:${t.totalGroups}`;case"CustomState":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${e.predicate.key}:${t.customStates[e.predicate.key]}`;case"DomainState":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${e.predicate.key}:${t.domainStates[e.predicate.key]}`;case"Placeholder":return`${e.type}:${e.predicate.type}:${e.predicate.content.condition}:data:${e.predicate.content.input}:${e.predicate.content.value}`;default:return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${aa(e.type,t)}:${t.totalGroups}`}}(e,t),r=n.current.get(o);return i.evolve(ua(r)?{cached:i.append(r)}:{uncached:i.append({key:o,predicate:e})},a)}(a,n,e,t)),{cached:[],uncached:[]}),l=sa(s.map((({predicate:e})=>e)),n);return i.zip(s,l).forEach((([{key:t},n])=>{e.current.set(t,n)})),r.concat(l)}const ua=i.is(Boolean);const pa=i.curry(((e,t,n)=>{var a,i,o,r,s,l;return{breakpoints:n.breakpoint.breakpoints,activeBreakpoint:la(n),progressionIndex:null!==(i=null===(a=n.progression)||void 0===a?void 0:a.activeGroupIndex)&&void 0!==i?i:0,totalOffers:null!==(r=null===(o=n.progression)||void 0===o?void 0:o.totalOffers)&&void 0!==r?r:0,totalGroups:null!==(l=null===(s=n.progression)||void 0===s?void 0:s.totalGroups)&&void 0!==l?l:0,customStates:n.customStates,domainStates:n.domainStates,positionIndex:e,creativeCopy:t}})),fa=i.lensPath(["predicate","content","input"]),ya=i.lensPath(["predicate","content","value"]);function ha(e,t){const n=i.over(fa,(t=>t?e(t):"")),a=i.over(ya,(t=>"string"==typeof t?e(t):t)),o=i.compose(n,a);return t.map((e=>"Placeholder"===e.type?"TextValue"===e.predicate.type?o(e):n(e):e))}const ma=i.all(i.equals(!0));function va(e){const n=Qt(),a=en(),o=t.useRef(new Map),r=At(),s=gt(ca,pa(a,r)),l=Jt();return t.useMemo((()=>i.mapObjIndexed((e=>{const t=ha(l,e);return ma(da(o,t,s,n))}),e)),[o,e,s,n,l])}function ga(e){e&&(e.style.display="")}function ba(e){e&&(e.style.display="none")}function Ea(e){return e.settings.duration}const Ia=[{opacity:0,display:"none"},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],Sa=[{opacity:1},{opacity:0,offset:.75},{opacity:0}];function xa(e,t,n){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){const a=t?Ia:Sa,i=e.animate(a,{duration:n,iterations:1});return i.onfinish=()=>{t?ga(e):ba(e)},i.oncancel=()=>{t?ga(e):ba(e)},()=>{i.finish()}}return t?ga(e):ba(e),()=>{}}function Ca({inTransitions:e,outTransitions:n,visible:a,children:i,containerClassName:o}){const r=t.useRef(null);return t.useEffect((()=>a&&e?e.forEach((e=>{r.current&&function(e,t,n,a){if("FadeIn"===a)xa(e,t,n)}(r.current,a,Ea(e),e.type)})):!a&&n?n.forEach((e=>{r.current&&function(e,t,n,a){if("FadeOut"===a)xa(e,t,n)}(r.current,a,Ea(e),e.type)})):()=>{}),[a]),t.createElement("div",{ref:r,style:{display:"none"},className:o},i)}function wa(e){const n=It(),a=function(e){const n=Qt(),a=en(),i=t.useRef(new Map),o=At(),r=gt(ca,pa(a,o)),s=ha(Jt(),e);return t.useMemo((()=>ma(da(i,s,r,n))),[i,s,r,n])}(e.schema.predicates),i=t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0))));return e.schema.transition?t.createElement(Ca,{inTransitions:e.schema.transition.inTransition,outTransitions:e.schema.transition.outTransition,visible:a},i):"functionally"===e.schema.hide?t.createElement(Tn.Provider,{value:a?"ENABLED":"DISABLED"},i):a?t.createElement(t.Fragment,null,i):null}const Oa=i.mergeWith(((e,t)=>`${e||""} ${t||""}`.trim())),Ta=e=>{var n;const a=t.useContext(Kt),o=en(),r=Ct()||document.head,s=Bn(),l=dt(s,o,r),c=t.useCallback(pt,[]),d=gt([],(e=>Object.values(e.breakpoint.breakpoints))),u=a||c(d,s,o,r),p=e.styles?u(e.styles):{},f=e.styles&&e.styles.conditionalTransitions?function(e,t){const n=Jn(e);return i.mapObjIndexed((e=>Kn(t)||!e?null:n({predicates:t.predicates,duration:t.duration,styles:e})),t.value)}(l,null===(n=e.styles)||void 0===n?void 0:n.conditionalTransitions):void 0,y=va(f?i.mapObjIndexed(i.propOr([],"predicates"),f):{}),h=i.mapObjIndexed(((e,t)=>e?function(e,t){var n;if(e&&t in e)return null===(n=e[t])||void 0===n?void 0:n.classname}(f,t):void 0),y),m=f?i.mapObjIndexed(i.prop("transitionBaseClassname"),f):{},v=e.styles?(g=m,Oa(Oa(p,h),g)):void 0;var g;return e.children({classnames:v,mapperRef:u})};function Aa(e){const n=It();return t.createElement(Ta,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:a?a.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"column"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,U(a,e.testId))))))}))}function Ra(e){const n=It();return t.createElement(Ta,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:a?a.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"row"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,U(a,e.testId))))))}))}const Na={allowedTags:["em","strong","a","br","u","p","li","ul","ol","s"],allowedAttributes:{a:["href","target",le,ce],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],s:[]},allowedSchemes:["http","https"]},La=new Map([["&","_;^;_"]]),_a=new RegExp(`<a *(?=${Na.allowedAttributes.a.join("|")}|>)`,"g"),ja=new RegExp('<a [^>]*href="([^"]+)"',"g"),Da=new RegExp("(<br *?>)|(<br *?/>)","g"),ka="<br/>";function Pa(e){const n=Jt(),a=An(),i=t.useMemo((()=>{const t=n(e.schema.value);if(!function(e){const t=function(e){return e.replaceAll(ja,((e,t)=>{const n=t.replaceAll("&",La.get("&"));return e.replace(t,n)})).replaceAll(Da,ka)}(e);return t===u(t,Na)}(t))throw new L("FAILED_SANITISING_HTML","Invalid HTML tags");return t.trim()?t:""}),[e.schema.value,n]),{tabIndex:o,styles:r,isDisabled:s}=m(a);return i?t.createElement(Ta,{styles:e.schema.styles},(({classnames:n})=>{const a=[(null==n?void 0:n.link)?`class = "${null==n?void 0:n.link}"`:"",s?'tabindex="-1"':"",s?"style=\"pointer-events: 'none'; user-select: none;\"":"",s?'aria-disabled="true"':""].filter((e=>e.length>0));return l=i,new RegExp("</(p|ul|ol)>").test(l)?t.createElement("div",{tabIndex:o,style:r,"aria-hidden":s,className:null==n?void 0:n.own,"data-testid":e.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:i.replace(_a,`<a ${a.join(" ")}`)}}):t.createElement("p",{tabIndex:o,style:r,"aria-hidden":s,className:null==n?void 0:n.own,"data-testid":e.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:i.replace(_a,`<a ${a.join(" ")}`)}});var l})):null}function $a(e){const n=Jt()(e.schema.value),a=An(),{tabIndex:i,styles:o,isDisabled:r}=m(a);return n?t.createElement(Ta,{styles:e.schema.styles},(({classnames:a})=>{const s={tabIndex:i,"aria-hidden":r,className:null==a?void 0:a.own,"data-testid":e.testId,"data-e2e":"BasicText"};return e.isInline?t.createElement("span",Object.assign({style:o},s),n):t.createElement("p",Object.assign({style:o},s),n)})):null}function Fa(e,n,a){if("BasicText"===e.type)return t.createElement($a,{schema:e.node,testId:n,isInline:null!=a&&a})}function Ga(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,U(t,a)))))}function Ma(e){const n=mt(),a=It(),i=Tt(),o=Jt(),r=en(),s=An(),l=i.creative.responseOptionsMap[e.schema.responseKey],c=x(l);t.useEffect((()=>{c&&n(function(e){if(e.paymentTriggerConfig)return{type:ne,payload:{criteria:{key:"PAYMENT_OFFER_SELECTED"},signal:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:e.instanceGuid,responseActionPayload:{name:e.action,externalKey:"PAYMENT_OFFER_SELECTED"}}}};throw new Error(`Invalid External Response: No 'paymentTriggerConfig' found for external response option with instanceGuid: ${e.instanceGuid}`)}(l))}),[l,n,c]);const d=l?o({data:l},"creativeResponse"):o,{tabIndex:u,styles:p,isDisabled:f}=m(s);return E(l)&&!c&&void 0!==r?t.createElement(Ta,{styles:e.schema.styles},(({classnames:o,mapperRef:r})=>{var s;return t.createElement("button",{type:"button",tabIndex:u,"aria-disabled":f,"aria-label":null!==(s=e.schema.a11yLabel)&&void 0!==s?s:void 0,style:Object.assign({cursor:"pointer"},p),"data-testid":e.testId,"data-e2e":"CreativeResponse","data-e2e-response-type":e.schema.responseKey,onClick:e=>{e.preventDefault();const t=function(e,t){switch(t.action){case"Fulfillment":{const n=e.creative.fulfillment;if(b(n))return{fulfillment:n,responseOption:t,creativeInstanceGuid:e.creative.instanceGuid,accountID:e.accountId,referralCreativeID:e.creative.referralCreativeId};throw new Error(`Invalid Fulfillment: ${n} with referralCreativeID: ${e.creative.referralCreativeId}`)}case"Url":return Object.assign(Object.assign({},t),{accountID:e.accountId,creativeInstanceGuid:e.creative.instanceGuid,referralCreativeID:e.creative.referralCreativeId});default:return Object.assign(Object.assign({},t),{creativeInstanceGuid:e.creative.instanceGuid})}}(i,l);n({type:z,payload:t})},className:null==o?void 0:o.own,disabled:f},t.createElement(Wt,{value:d},(null==o?void 0:o.own)?function(e,n,a,i,o){return t.createElement(Yt,{value:a(n)},Ga(e,i,o))}(e.schema.children,o.own,r,a,e.testId):Ga(e.schema.children,a,e.testId)))})):null}function Ba(e){const n=An(),{styles:a,isDisabled:i}=m(n);return e.schema.url.light?t.createElement(Ta,{styles:h(e.schema.styles)},(({classnames:n})=>t.createElement("img",{"aria-hidden":i,style:Object.assign(Object.assign({},a),{display:"inline-block"}),alt:i?void 0:e.schema.alt||void 0,title:e.schema.title||void 0,className:n?n.own:void 0,"data-testid":e.testId,"data-e2e":"StaticImage",src:e.schema.url.light}))):null}function Ua(e){const n=An(),{styles:a,isDisabled:i}=m(n),o=(e=>{const n=t.useContext(_n),a=e.split("|");for(const e of a){const t=n(e.trim(),"images");if(t)return t}})(e.schema.imageKey);return null!=(r=o)&&"object"==typeof r&&"light"in r&&"string"==typeof r.light?t.createElement(Ta,{styles:h(e.schema.styles)},(({classnames:n})=>t.createElement("img",{"aria-hidden":i,style:Object.assign(Object.assign({},a),{display:"inline-block"}),alt:o.alt,title:o.title,className:n?n.own:void 0,"data-testid":e.testId,"data-e2e":"DataImage",src:o.light}))):null;var r}const Va={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function za(e){const n=e.schema.name,a=e.schema.description,i=e.schema.styles?M(Va,e.schema.styles):Va,o=An(),{styles:r,isDisabled:s}=m(o);return n?t.createElement(Ta,{styles:i},(({classnames:i})=>t.createElement("span",Object.assign({style:Object.assign(Object.assign({},r),{display:"inline-block"}),className:"rokt-icon"+((null==i?void 0:i.own)?" "+i.own:""),"data-testid":e.testId,"data-e2e":`StaticIcon-${n}`},!s&&a?{title:a}:{"aria-hidden":"true"}),n))):null}const qa={backgroundColor:"#FFEEEE",color:"#FF0000",fontSize:"10px",padding:"4px",border:"1px solid #FF0000",margin:0,whiteSpace:"normal"};class Ha extends t.Component{constructor(e){super(e),this.state={errorMessage:""}}static getDerivedStateFromError(e){return{errorMessage:e.message}}componentDidUpdate(e){this.state.errorMessage&&JSON.stringify(e.schema)!==JSON.stringify(this.props.schema)&&this.setState({errorMessage:""})}componentDidCatch(e,t){var n;this.props.reporter&&"true"===fe.REPORT_RENDER_ERRORS&&this.props.reporter({level:R,code:null!==(n=e.code)&&void 0!==n?n:"UNHANDLED_RENDERING_EXCEPTION",message:e.message,additionalInformation:Object.assign({componentStack:t.componentStack,stack:e.stack},this.context||{})})}render(){return this.state.errorMessage?"true"===fe.DISPLAY_ERRORS?t.createElement("pre",{style:qa},t.createElement("strong",null,"Error:")," [",t.createElement("em",null,this.props.schema.type),"]"," ",this.state.errorMessage):void 0:this.props.children}}Ha.contextType=kn;const Wa={internally:"_top",externally:"_blank"};function Ja(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Ka(e){var n;const a=Wa[e.schema.open],i=It(),o=An(),{tabIndex:r,styles:s,isDisabled:l}=m(o);return(null===(n=e.schema.children)||void 0===n?void 0:n.length)>0?t.createElement(Ta,{styles:e.schema.styles},(({classnames:n,mapperRef:o})=>{var c;return t.createElement("a",{href:e.schema.src,"data-testid":e.testId,"data-e2e":"StaticLink",target:null!=a?a:"_blank",tabIndex:r,"aria-disabled":l,"aria-label":null!==(c=e.schema.a11yLabel)&&void 0!==c?c:void 0,style:Object.assign({cursor:"pointer",textDecoration:"none",display:e.isInline?"inline":"block"},s),className:null==n?void 0:n.own},(null==n?void 0:n.own)?function(e,n,a,i,o){return t.createElement(Yt,{value:a(n)},Ja(e,i,o))}(e.schema.children,null==n?void 0:n.own,o,i,e.testId):Ja(e.schema.children,i,e.testId))})):null}function Ya(e,n,a){if("StaticLink"===e.type)return t.createElement(Ka,{schema:e.node,testId:n,isInline:null!=a&&a})}const Za={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function Qa(e){const n=(a=e.schema.iconKey,t.useContext(_n)(a,"icons"));var a;const i=null==n?void 0:n.name,o=e.schema.styles?M(Za,e.schema.styles):Za,r=An(),{styles:s}=m(r);return i?t.createElement(Ta,{styles:o},(({classnames:n})=>t.createElement("span",{style:Object.assign(Object.assign({},s),{display:"inline-block"}),"aria-hidden":"true",className:"rokt-icon"+((null==n?void 0:n.own)?" "+n.own:""),"data-testid":e.testId,"data-e2e":`DataIcon-${i}`},i))):null}const Xa=o.css`
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("react-dom/client"),a=require("react-redux"),i=require("ramda"),o=require("@emotion/css"),r=require("redux-saga/effects"),s=require("@reduxjs/toolkit"),l=require("redux-saga"),c=require("@redux-saga/core/effects"),d=require("embla-carousel-react"),u=require("insane"),p=require("@emotion/css/create-instance");function f(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var y=f(t);function h(e){const t=["elements","own"],n=["default","dimension","width","type"],a=["default","dimension","width","value"],o=["default","dimension","minWidth"],r=i.path(t,e);return r&&Array.isArray(r)&&r.length?i.assocPath(t,r.map(i.when(i.allPass([i.hasPath(n),i.complement(i.hasPath(o)),i.pathEq("fixed",n)]),(e=>i.assocPath(o,i.path(a,e),e)))),e):e}function m(e){const t="DISABLED"===e;return{tabIndex:t?-1:void 0,styles:t?{pointerEvents:"none",userSelect:"none"}:void 0,isDisabled:t}}function v(e,t){if("EscapeHatch"===t.type)try{return JSON.parse(t.node.data).type===e}catch(e){return!1}return!1}function g(){return"ontouchstart"in document.documentElement}function b(e){return null!=e&&"object"==typeof e&&("url"in e||"name"in e)&&"config"in e}function E(e){return null!=e&&"object"==typeof e&&"id"in e&&"action"in e&&"instanceGuid"in e&&"signalType"in e}function I(e){return E(e)&&"Fulfillment"===e.action}function S(e){return E(e)&&"Url"===e.action}function x(e){return E(e)&&"ExternalPaymentTrigger"===e.action}function C(e){return(I(e)||S(e))&&"RealTime"===e.conversionType&&"rclid"in e}function w(e){return(I(e)||S(e))&&"RealTimeReferral"===e.conversionType&&"rclid"in e}const O={pluginId:"shared",pageInstanceGuid:"N/A"};var T;!function(e){e.DCUI="DCUI",e.Partner="partner"}(T||(T={}));const A=["SignalCartItemQuantitySelected"],R="ERROR",N="WARNING";class _ extends Error{constructor(e,t){super(t),this.code=null!=e?e:"UNHANDLED_EXCEPTION"}toString(){return`CodedError (${this.code}): ${this.message}`}}const L=["V2_CART_ITEM_UPDATED","CART_ITEM_INSTANT_PURCHASE","OFFER_ENGAGEMENT","POSITIVE_ENGAGEMENT","UPSELL_CREATIVE_SENT","REALTIME_OFFER_FULFILLMENT_REFERRAL","REALTIME_OFFER_FULFILLMENT_CONVERSION","REALTIME_OFFER_FULFILLMENT_SUCCESS","INITIATE_INSTANT_PURCHASE_EVENT","PLACEMENT_CLOSED","PLACEMENT_COMPLETED","PLACEMENT_INTERACTIVE","PLACEMENT_FAILURE"];const j=(e,t)=>i.concat(e,i.slice(e.length,t.length,t)),D=(e,t)=>{if(Array.isArray(e)&&Array.isArray(t)){const n=e.length>t.length?j(t,e):t,a=t.length>e.length?j(e,t):e;return i.zipWith(G,a,n)}return t},k=e=>null==e,P=e=>!k(e),$=(e,t)=>k(t)?e:t,F=(e,t)=>{throw new _("MERGE_TYPE_INCONSISTENCY",`Unable to merge values for inconsistent types, left = ${e}, right = ${t}`)};function G(e,t){return i.cond([[(e,t)=>i.type(e)!==i.type(t)&&P(e)&&P(t),F],[(e,t)=>k(e)||k(t),$],[(e,t)=>"Object"===i.type(e),i.mergeDeepWith(G)],[(e,t)=>"Array"===i.type(e),D],[i.T,i.flip(i.unary(i.identity))]])(e,t)}function M(e,t){return G(e,t)}function B(e=0){return`breakpoint-${e}px`}function U(e,t){return t?`${t}-child${e}`:void 0}const V="GLOBAL/RAISE_METRIC",z="GLOBAL/OFFER_ENGAGEMENT";function H(e){return null!=e&&"object"==typeof e&&"responseOption"in e&&I(e.responseOption)&&"fulfillment"in e&&b(e.fulfillment)}function q(e){return x(e)}function W(e){return S(e)}function J(e){return function(e){return E(e)&&"CaptureOnly"===e.action}(e)}function Y(e){return!!(C(e)||"responseOption"in e&&C(e.responseOption))&&(!!e.accountID&&!!e.referralCreativeID)}function K(e){return!!(w(e)||"responseOption"in e&&w(e.responseOption))&&(!!e.accountID&&!!e.referralCreativeID)}const Z="GLOBAL/RAISE_SIGNAL",Q="GLOBAL/OFFER_LIFECYCLE",X="GLOBAL/SET_CUSTOM_STATE",ee="GLOBAL/SEND_PARTNER",te="GLOBAL/SET_DOMAIN_STATE",ne="GLOBAL/PREPARE_SIGNAL",ae="GLOBAL/OPEN_LINK",ie="GLOBAL/SET_PARTNER_VALIDATION_STATUS",oe="GLOBAL/SET_GLOBAL_OFFER_DATA_CART",re="GLOBAL/LAUNCH_CHILD_LAYOUT",se={RAISE_METRIC:V,PREPARE_SIGNAL:ne,OFFER_ENGAGEMENT:z,RAISE_SIGNAL:Z,OFFER_LIFECYCLE:Q,SEND_PARTNER:ee,SET_CUSTOM_STATE:X,SET_DOMAIN_STATE:te,OPEN_LINK:ae,SET_PARTNER_VALIDATION_STATUS:ie,SET_GLOBAL_OFFER_DATA_CART:oe,LAUNCH_CHILD_LAYOUT:re},le="data-open-in-app",ce="data-click-signal-context";function de(e,n){function a(e){var t;if(!(e.target&&e.target instanceof HTMLElement))return;const a=null===(t=e.target)||void 0===t?void 0:t.closest("a");if(a){const t=a.getAttribute("href"),i=a.getAttribute(ce);if(i&&n({type:Z,payload:{name:"SignalUserInteraction",action:"Click",context:i}}),t){e.preventDefault();let i="newTab";a.hasAttribute(le)&&(i="inApp"),n({type:ae,payload:{url:t,urlBehaviour:i}})}}}t.useEffect((()=>null!==e?(e.addEventListener("click",a),()=>{e.removeEventListener("click",a)}):()=>{}),[e])}function ue(){const e=t.useRef(null);return t.useEffect((()=>{const t=t=>{"Tab"===t.key&&pe(t,e)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)}),[e]),e}const pe=(e,t)=>{var n;const a=null===(n=t.current)||void 0===n?void 0:n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!a)return;const i=a[0],o=a[a.length-1],{activeElement:r}=window.document;if(1!==a.length)return r===i&&e.shiftKey?(o&&o.focus(),void e.preventDefault()):r!==o||e.shiftKey?void 0:(i&&i.focus(),void e.preventDefault());e.preventDefault()},fe="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DISPLAY_ERRORS:"true",REPORT_RENDER_ERRORS:"true",USE_MEDIA_QUERY_NESTING:"true"};function ye(e,t){return t?"false"!==fe.USE_MEDIA_QUERY_NESTING?`${n=e,`@media (min-width: ${n}px)`} {${t}}`:t.includes(" & ")?`#app-container.${B(e)} ${t.trim()}`:`#app-container.${B(e)} & {${t}}`:"";var n}const he={hovered:":hover",pressed:":active",focussed:":focus",disabled:":disabled"};function me(e){return function(e){return Object.keys(he).indexOf(e)>-1}(e)?he[e]:""}const ve={container:{justifyContent:"justify-content",alignItems:"align-items",shadow:"box-shadow",gap:"gap",overflow:"overflow",blur:"filter",opacity:"opacity"},text:{textColor:"color",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",fontStyle:"font-style",lineHeight:"line-height",lineLimit:"",letterSpacing:"letter-spacing",baselineTextAlign:"vertical-align",horizontalTextAlign:"text-align",textDecoration:"text-decoration",textTransform:"text-transform"},background:{backgroundColor:"background-color",backgroundImage:""},dimension:{width:"width",maxWidth:"max-width",minWidth:"min-width",height:"height",maxHeight:"max-height",minHeight:"min-height",rotateZ:"transform"},flexChild:{alignSelf:"align-self",weight:"flex",order:"order"},spacing:{margin:"margin",padding:"padding",offset:""},border:{borderColor:"border-color",borderRadius:"border-radius",borderWidth:"border-width",borderStyle:"border-style"}};function ge(e,t){if(!ve[e]||!ve[e][t])throw new Error(`No CSS property mapping exists for styling property: ${e}.${t.toString()}`);return ve[e][t]}function be(e,t){return n=>t(...Object.keys(e).map((t=>e[t](n[t]))))}function Ee(...e){let t="";const n=(...e)=>e.reduce(((e,n)=>(e&&n?e=e+t+n:n&&(e=n),e)),"");return 1===e.length?(t=e[0],n):n(...e)}function Ie(e,t){return`${e}:${t};`}function Se(e){return function(e,t){return`@media (${e}) {${t}}\n`}("prefers-color-scheme: dark",e)}class xe extends Error{constructor(e,t){super(`Invalid styling value '${t}': ${e}.`),this.name=this.constructor.name}}function Ce(e,t){if(null===t)return!1;const n=("function"==typeof e?[e]:e).map((e=>e(t))).reduce(((e,t)=>t?e?e+=`, ${t}`:t:e),void 0);if(n)throw new xe(n,JSON.stringify(t));return!0}function we(e){if(isNaN(e)||"number"!=typeof e&&"string"!=typeof e)return"value must be a number"}function Oe(e){return t=>{const n=t&&"symbol"!=typeof t?t.toString():t;if(!(e.indexOf(n)>=0))return`value must be one of [${e.join(",")}]`}}function Te(e){if(null==e||""===e)return"value must not be omitted"}function Ae(e){const t=new RegExp(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{3})$/);if("string"!=typeof e||!t.test(e))return"value must be a valid hex color"}function Re(e){const t=new RegExp(/^(?:(?:data:image\/[^;]+;base64[^"]+)|(?:(?:https?:)?\/\/[a-zA-Z\d-]+(?:\.[a-zA-Z\d-]+)*(?::\d{1,10})?)?(?:\.\.?\/?)*\/(?:[a-zA-Z\d\-_]+\/)*[a-zA-Z\d\-_]+\.[a-zA-Z\d]{2,6}(?:\?(?:.+=.+&?)*)?)(?:#.+)?$/);if("string"!=typeof e||!t.test(e))return"value must be a valid CSS URL string"}function Ne(e){if(null!=e&&""!==e)return"value must not be specified"}function _e(e){return t=>{if(t&&"object"==typeof t&&"value"in t&&"type"in t&&"string"==typeof t.type&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t.type)&&"function"==typeof e[t.type]){const n=e[t.type](t.value);if(!n)return;return`object must have valid "value" for type: ${t.type}: ${n}`}return`value must be an object that has a "type" property that matches one of: [${Object.keys(e).join(", ")}] and a "value" property`}}function Le(...e){return t=>{if("string"==typeof t){const n=t.split(" ");if(n.length>1&&e.indexOf(n.length)>-1){if(!n.reduce(((e,t)=>e||we(t)),void 0))return}}return`value must be a space separated list of numbers, of one of the following lengths: ${e.join(" ,")}`}}function je(e,t){return n=>{const a=e(n),i=t(n);if(a&&i)return`one of these must be true: ${a} -OR- ${i}`}}function De(e){if("string"!=typeof e)return"value must be a string"}const ke=i.is(Object);function Pe(e){const t=Object.entries(e);return n=>ke(n)&&!Array.isArray(n)?t.reduce(((e,[t,a])=>e||a(n[t])),void 0):`Input value (${e}) must be an object`}function $e(e){if("number"!=typeof e&&"string"!=typeof e||isNaN(e)||!(e>=0))return"value must be a positive number"}function Fe(e,t,n){return Ce(we,n)?Ie(ge(e,t),`${n}`):""}function Ge(e){return(t,n,a)=>Ce(Oe(Object.keys(e)),a)?Ie(ge(t,n),`${e[a]}`):""}function Me(e){return Ce(Te,e)?be({light:t(Re,!1),dark:t(je(Ne,Re),!0)},Ee("\n "))(e):"";function t(e,t){return n=>{if(Ce(e,n)&&n){const e=Ie("background-image",`url("${n}")`);return t?Se(e):e}return""}}}function Be(e){const t={crop:"auto",fit:"contain",fill:"cover"};return"string"==typeof e&&(e=e.toLowerCase()),Ce(je(Ne,Oe(Object.keys(t))),e)&&e?Ie("background-size",t[e]):""}const Ue=i.cond([[i.equals("top-left"),i.always("top left")],[i.equals("top-right"),i.always("top right")],[i.equals("bottom-left"),i.always("bottom left")],[i.equals("bottom-right"),i.always("bottom right")],[i.T,i.identity]]);function Ve(e){const t="string"==typeof e?e.toLowerCase():e;return Ce(je(Ne,Oe(["top","right","bottom","left","center","top-left","top-right","bottom-left","bottom-right"])),t)&&t?Ie("background-position",Ue(t)):""}function ze(e,t,n){return Ce(je(we,Le(2,3,4)),n)?Ie(ge(e,t),n.toString().split(" ").map((e=>`${e}px`)).join(" ")):""}function He(e){return(t,n,a)=>Ce(_e({fit:Oe(e),percentage:we,fixed:we}),a)?Ie(ge(t,n),qe(a)):""}function qe(e){const t={"wrap-content":"fit-content","fit-width":"100%","fit-height":"100%"};switch(e.type){case"fixed":return`${e.value}px`;case"percentage":return`${e.value}%`;case"fit":return t[e.value]}}const We=Pe({light:Ae,dark:je(Ne,Ae)});function Je(e,t,n){return a=>{if(a){const i=Ie(ge(e,t),Ke(String(a)));return n?Se(i):i}return""}}function Ye(e,t,n){return Ce(We,n)?be({light:Je(e,t,!1),dark:Je(e,t,!0)},Ee("\n "))(n):""}function Ke(e){const t=e.toUpperCase();switch(t.length){case 5:return`#${t.substring(2,5)}${t[1]}`;case 9:return`#${t.substring(3,9)}${t[1]}${t[2]}`;default:return t.toUpperCase()}}const Ze=Pe({offsetX:je(Ne,we),offsetY:je(Ne,we),blurRadius:je(Ne,we),spreadRadius:je(Ne,we),color:We}),Qe=e=>t=>null!=t?String(t):e,Xe=i.compose(i.concat(i.__,"px"),Qe("0")),et=e=>t=>"string"==typeof t?e(t):t,tt=i.compose(et(i.concat(i.__,"px")),Qe(void 0)),nt=i.compose(et(Ke),i.prop("dark"));function at(e,t,n){return Ie(e,be({offsetX:Xe,offsetY:Xe,blurRadius:t.spreadRadius?Xe:tt,spreadRadius:tt,color:n},Ee(" "))(t))}const it={center:"center","flex-end":"flex-end","flex-start":"flex-start",stretch:"stretch"},ot={container:{justifyContent:Ge(it),alignItems:Ge(it),shadow:function(e,t,n){var a,o,r;if(Ce(Ze,n)){const s=ge(e,t);return Ee("\n")(at(s,n,(o="light",r="#80000000",i.compose(Ke,i.propOr(r,o)))),(null===(a=n.color)||void 0===a?void 0:a.dark)?Se(at(s,n,nt)):"")}return""},gap:ze,overflow:Ge({hidden:"hidden",visible:"visible"}),blur:function(e,t,n){return Ce($e,n)?Ie(ge(e,t),`blur(${n.toString()}px)`):""},opacity:Fe},text:{textColor:Ye,fontSize:ze,fontFamily:function(e,t,n){return Ce(De,n)?Ie(ge(e,t),(a=`${n}`,a.replace(/['();{}@:[\]!/=]/g,"")).split(",").map(((e,t)=>{const n=0===t?e:e.trim();if(n.includes(" ")){const e=n.startsWith('"')?"":'"',t=n.endsWith('"')?"":'"';return`${e}${n}${t}`}return n})).join(",")):"";var a},fontWeight:Ge({100:100,200:200,300:300,400:400,500:500,600:600,700:700,800:800,900:900}),fontStyle:Ge({normal:"normal",italic:"italic"}),lineHeight:ze,lineLimit:function(e,t,n){return Ce(we,n)?`\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: ${n};\n line-clamp: ${n}; \n -webkit-box-orient: vertical;\n `:""},letterSpacing:ze,baselineTextAlign:Ge({super:"super",sub:"sub",baseline:"baseline"}),horizontalTextAlign:Ge({left:"left",right:"right",center:"center",start:"start",end:"end",justify:"justify"}),textDecoration:Ge({underline:"underline","strike-through":"line-through",none:"none"}),textTransform:Ge({capitalize:"capitalize",uppercase:"uppercase",lowercase:"lowercase",none:"none"})},background:{backgroundColor:Ye,backgroundImage:function(e,t,n){return Ce(Te,n)?be({url:Me,position:Ve,scale:Be},Ee)(n):""}},dimension:{width:He(["wrap-content","fit-width"]),maxWidth:ze,minWidth:ze,height:He(["wrap-content","fit-height"]),maxHeight:ze,minHeight:ze,rotateZ:(rt="Z",(e,t,n)=>{const a=`rotate${rt}`;return Ce(we,n)?Ie(ge(e,t),`${a}(${n.toString()}deg)`):""})},flexChild:{alignSelf:Ge(it),weight:Fe,order:Fe},spacing:{margin:ze,padding:ze,offset:function(e,t,n){return Ce(Le(2),n)?`transform:translate(${n.split(" ").join("px, ")}px)`:""}},border:{borderColor:Ye,borderRadius:ze,borderWidth:ze,borderStyle:Ge({solid:"solid",dashed:"dashed"})}};var rt;function st(e){return Object.keys(e).reduce(((t,n)=>(n&&e[n]&&Object.keys(e[n]).forEach((a=>{if(!ot[n])throw new Error(`No styling transformers exist for styling category key: ${n}`);const i=ot[n][a];if(!i)throw new Error(`No styling transformer exists for property: ${n}.${a.toString()}`);try{t+=i(n,a,e[n][a])}catch(e){throw e&&"object"==typeof e&&"message"in e&&(e.message=`Error parsing styling key ${n}.${a.toString()}: ${e.message}`),e}})),t)),"")}const lt="FAILED_TEMPLATING_DATA",ct=new Map;function dt(e){return String.fromCharCode(97+e)}function ut(e,t,n){const a=`${e||O.pluginId}-${void 0!==t?String(t):"outer"}`,i=ct.get(a);if(i&&i.sheet.container.isConnected)return i.css;const o=function(e,t){const n={key:void 0!==e?`inner-css-${dt(e)}`:"outer-css",container:t};return t&&t.parentElement&&(n.container=t.parentElement),p(n)}(t,n);return ct.set(a,o),o.css}const pt="%%%OWN_CLASS_REF%%%",ft=i.memoizeWith(((e,t,n,a)=>`${String(e)}-${t}-${n}`),yt);function yt(e,t,n,a){const i=ut(t,n,a);let o=1;return function t(n,a=!1){var r;if("string"==typeof n){const e={scopeClass:n};return t.bind(e)}const s=n,l=this.scopeClass,c=Object.entries(null!==(r=s.elements)&&void 0!==r?r:{});try{const t=c.reduce(((t,[n,i])=>Object.assign(Object.assign({},t),{[n]:ht(i,l,a,String(n),e)})),{}),n=Object.entries(t),r=a?"parent-"+o++:"",s=function(e){return"own"in e&&"string"==typeof e.own&&e.own.length>0}(t)?i(t.own):"";return n.reduce(((e,[t,n=""])=>{if("own"===t)return e;const a=n.replace(pt,r);return Object.assign(Object.assign({},e),{[t]:a?i(a):""})}),{own:`${s}${s&&r?" ":""}${r}`})}catch(e){const t=e;throw t.code="FAILED_PARSING_STYLES",t}}.bind({})}function ht(e,t,n,a,i){return e.map(function(e,t,n){return a=>Object.entries(a).map((([a,i])=>{const o=i?st(i):"";switch(!0){case"default"===a:return o?`\n${o}\n`:"";case Boolean(e):return`\n .${e}${me(a)} & {\n${o}\n}\n`;case t&&"own"!==n:return`\n .${pt}${me(a)} & {\n${o}\n}\n`;default:return`\n &${me(a)} {\n${o}\n}\n`}})).join("")}(t,n,a)).reduce(((e,t,n)=>{const a=i[n];return void 0!==a?e+(0===n?t:`${ye(a,t)}\n`):e}),"")}const mt=t.createContext(i.always(void 0)),vt=()=>t.useContext(mt),gt=t.createContext(null);function bt(e,n){var a;const i=t.useContext(gt);return i&&null!==(a=n(i))&&void 0!==a?a:e}const Et=t.createContext((()=>{throw Error("Node Mapper Context does not have a mapper. Use the NodeMapperProvider with the default nodeMapper as a value before you consume this mapper")})),It=Et.Consumer,St=()=>t.useContext(Et),xt=e=>t.createElement(Et.Provider,{value:(t,n,a)=>e.value(t,null!=n?n:e.overrides,a)},e.children),Ct=t.createContext(null),wt=()=>t.useContext(Ct),Ot=t.createContext({get(){throw Error("Offer context has not been set")}}),Tt=e=>t.createElement(Ot.Provider,{value:{get:()=>e.context}},e.children),At=()=>t.useContext(Ot).get(),Rt=()=>{try{return t.useContext(Ot).get().creative.copy}catch(e){return}},Nt=new RegExp("<a ([^>]*>((?!</a>).)*</a>)","g"),_t=i.compose(i.not,i.isEmpty),Lt=i.where({url:_t,title:_t});function jt(e,t,n){return t.reduce(((t,n)=>{const[a,i]=n.slice(0,-1).split("["),o=i?i.split(","):[];if(!a)throw new Error(kt(e,"This Meta Attribute could not be parsed."));return function(e,t,n,a){switch(t){case"openLinks":return function(e,t,n){Dt(t,e,"openLinks",1,2);const a=Pt(t,e,0,(e=>"InApp"===e?"InApp":null),"openLinks meta attribute can only open InApp"),i=$t(t,1,(e=>"string"==typeof e&&e.length?e:null));if("InApp"===a)return n.replace(Nt,((e,t)=>`<a ${le} ${i?`${ce}="${i}" `:""}${t}`));return n}(e,n,a);case"sliceText":return function(e,t,n){Dt(t,e,"sliceText",2,2);const a=Pt(t,e,0,(e=>"Chars"===e?"Chars":null),"sliceText meta attribute can only slice by Chars"),i=Pt(t,e,1,(e=>{const t=Number(e);return!Number.isNaN(t)&&t>=0?t:null}),"sliceText meta attribute second argument must be a positive number");if("Chars"===a)return function(e,t){const n=new RegExp("(?<=<a.*>).*(?=</a>)");return e.startsWith("<a")?e.replace(n,(e=>e.slice(0,t))):e.slice(0,t)}(n,i);throw Error(kt(e,`Unknown "SliceBy" value. ${a}`))}(e,n,a);default:throw new Error(kt(e,`Unknown Meta Attribute '${t}'.`))}}(e,a,o,t)}),n)}function Dt(e,t,n,a,i){const o=new Error(kt(t,`${n} meta attribute takes ${a!=i?`between ${a} and ${i}`:a} arguments; received ${e.length}.`));if(e.length<a||e.length>i)throw o}function kt(e,t){return`Malformed Meta Attribute: '${e}' - ${t}`}function Pt(e,t,n,a,i){const o=$t(e,n,a);if(null!==o)return o;throw Error(kt(t,i||`Could not parse meta attribute argument at index ${n} from arguments ${JSON.stringify(e)}`))}function $t(e,t,n){return n(e[t])}const Ft="DATA",Gt="STATE",Mt=new RegExp(`^(${Ft}|${Gt})`),Bt=new RegExp(`^${Gt}`),Ut=new RegExp(`%\\^(?:${Ft}|${Gt})\\.[a-zA-Z0-9]+[a-zA-Z0-9\\.]*(?:\\:[a-zA-Z0-9]+\\[[a-zA-Z0-9\\.,]*\\])*(?:\\|.*?)?\\^%`,"g"),Vt=Symbol("invalid");function zt(e,t="creativeCopy"){const n=Ht({data:e},t);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Ht(t,n,this.dataMap)});let a=!1;const o=t,r=i.pipe(i.slice(2,-2),i.split("|"),(e=>{const t=i.reduce(((e,t)=>{let n;if(Mt.test(t)){if(!this.dataMap.has(t)&&Bt.test(t))throw new _(lt,`Invalid use of STATE template key in a context it does not exist: ${t}`);const a=i.split(":",t);if(a[0]){if(n=this.dataMap.get(a[0]),n&&n===Vt)throw new _(lt,`Invalid template key referenced: "${t}" is an object but expected a string, boolean, number or empty. \nDid you mean to reference a child property of ${t}?`);if(a.length>1&&n)try{n=jt(a[0],a.slice(1),n)}catch(e){throw new _(lt,`Failed to apply meta attributes. ${function(e){return null!=e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message?e.message:String(e)}(e)}`)}}return n?i.reduced({provided:!0,value:n}):e}return i.reduced({provided:!0,value:t})}),{provided:!1,value:""},e);return t.provided||(a=!0),t.value})),s=i.replace(Ut,r,o);return!1===a?s:""}.bind({dataMap:n})}function Ht(e,t,n){const a=new Map(n);return"data"in e&&o(e.data,`${Ft}${t?"."+t:""}`),"state"in e&&o(e.state,`${Gt}${t?"."+t:""}`),a;function o(e,t){"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e?a.set(t,(null==e?void 0:e.toString())||""):a.set(t,Vt),e&&"object"==typeof e&&i.forEachObjIndexed(((e,n)=>o(e,`${t}.${n}`)),e)}}const qt=t.createContext(zt({})),Wt=qt.Consumer,Jt=qt.Provider,Yt=()=>t.useContext(qt),Kt=t.createContext(null),Zt=Kt.Provider,Qt=t.createContext("OUTER"),Xt=()=>"VARIANT"===t.useContext(Qt),en=t.createContext(void 0),tn=()=>t.useContext(en);var nn,an,on,rn,sn,ln,cn=function(e,t,n,a){return new(n||(n=Promise))((function(i,o){function r(e){try{l(a.next(e))}catch(e){o(e)}}function s(e){try{l(a.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,s)}l((a=a.apply(e,t||[])).next())}))},dn=function(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n},un=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)};class pn{constructor(e,t,n,a,o){nn.set(this,void 0),an.set(this,void 0),on.set(this,new Set),rn.set(this,void 0),sn.set(this,void 0),ln.set(this,void 0),dn(this,nn,i.partial(e.subscribe.bind(e),[n]),"f"),dn(this,an,i.partial(e.dispatch.bind(e),[n]),"f"),dn(this,rn,t,"f"),dn(this,sn,a,"f"),dn(this,ln,o,"f"),this.onGlobalStateChange=this.onGlobalStateChange.bind(this),this.onInteractivityChange=this.onInteractivityChange.bind(this),this.onEvent=this.onEvent.bind(this),this.globalDispatch=this.globalDispatch.bind(this),this.createChildPlugin=this.createChildPlugin.bind(this)}onGlobalStateChange(e){const t=un(this,nn,"f").call(this,e),n=()=>{t(),un(this,on,"f").delete(n)};return un(this,on,"f").add(n),n}onInteractivityChange(e){return un(this,sn,"f").subscribe(e)}onEvent(...e){const t=e.reduce(((e,t)=>{if("partner"===t.source||"*"===t.source){const n=un(this,ln,"f").call(this,t.name).subscribe(t.callback);return[...e,()=>n.unsubscribe()]}return e}),[]),n=()=>{t.forEach((e=>{e()})),un(this,on,"f").delete(n)};return un(this,on,"f").add(n),n}globalDispatch(e){un(this,an,"f").call(this,e)}dispose(){un(this,on,"f").forEach((e=>e())),dn(this,on,new Set,"f"),un(this,sn,"f").clear()}createChildPlugin(e){return un(this,rn,"f").call(this,e)}}nn=new WeakMap,an=new WeakMap,on=new WeakMap,rn=new WeakMap,sn=new WeakMap,ln=new WeakMap;class fn{onGlobalStateChange(){return()=>{}}onInteractivityChange(){return()=>{}}onEvent(){return()=>{}}globalDispatch(){}dispose(){}createChildPlugin(){return{close:()=>cn(this,void 0,void 0,(function*(){})),onClose:()=>cn(this,void 0,void 0,(function*(){})),putConfig:()=>cn(this,void 0,void 0,(function*(){})),send:()=>cn(this,void 0,void 0,(function*(){})),onEvent:()=>({subscribe:()=>({unsubscribe:()=>{}})})}}}var yn,hn,mn=function(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n},vn=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)};class gn{constructor(e){yn.set(this,void 0),hn.set(this,new Set),mn(this,yn,e,"f")}subscribe(e){return vn(this,hn,"f").add(e),!0===e(vn(this,yn,"f"))&&vn(this,hn,"f").delete(e),()=>{vn(this,hn,"f").delete(e)}}publish(e){mn(this,yn,e,"f"),vn(this,hn,"f").forEach((e=>{!0===e(vn(this,yn,"f"))&&vn(this,hn,"f").delete(e)}))}clear(){vn(this,hn,"f").clear()}}yn=new WeakMap,hn=new WeakMap;var bn=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)},En=function(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n};const In="breakpoint-0px";class Sn{constructor(){this.logger=()=>{}}withAppFactory(e){return this.appFactory=e,this}withLogger(e){return this.logger=e,this}withGatewayFactory(e){return this.gatewayFactory=e,this}build(){var e,t,n,a,i,o,r,s,l,c,d,u,p,f;const y=this.appFactory,h=this.logger,m=null!==(e=this.gatewayFactory)&&void 0!==e?e:()=>new fn;return f=class extends HTMLElement{static get observedAttributes(){return["visible","interactivity","active-breakpoint"]}constructor(){super(),t.add(this),n.set(this,(()=>null)),a.set(this,(()=>null)),i.set(this,void 0),o.set(this,!1),r.set(this,null),s.set(this,null),l.set(this,null);const e=this.attachShadow({mode:"open"});En(this,i,document.createElement("div"),"f"),bn(this,i,"f").id="app-container",bn(this,i,"f").classList.add("default"),e.appendChild(bn(this,i,"f"))}attributeChangedCallback(e,i,o){if(o!==i)switch(e){case"visible":bn(this,n,"f").call(this,"true"===o);break;case"interactivity":"ENABLED"!==o&&"DISABLED"!==o||bn(this,a,"f").call(this,o);break;case"active-breakpoint":bn(this,t,"m",c).call(this,o,i)}}makeInteractivityUpdateHandler(e){En(this,a,(t=>{e.publish(t)}),"f")}makeVisbilityUpdateHandler(e,a,i){const o="true"===this.getAttribute("visible"),r=this.getAttribute("slotInstanceGuid");En(this,n,(o=>{o?(En(this,n,(()=>null),"f"),0===e&&i.globalDispatch({type:Q,payload:{event:"Interactive"}}),a&&(i.globalDispatch({type:Z,payload:{name:"SignalImpression",parentGuid:a}}),this.trackViewability(a,i)),r&&i.globalDispatch({type:Z,payload:{name:"SignalImpression",parentGuid:r}})):bn(this,t,"m",p).call(this)}),"f"),bn(this,n,"f").call(this,o)}trackViewability(e,n){if(!bn(this,o,"f"))if("IntersectionObserver"in window&&!bn(this,r,"f")){const a=()=>{bn(this,o,"f")||(n.globalDispatch({type:Z,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!0}}),En(this,o,!0,"f"),bn(this,t,"m",p).call(this),bn(this,i,"f").removeEventListener("click",a))};bn(this,i,"f").addEventListener("click",a),En(this,r,new IntersectionObserver((r=>{r.forEach((r=>{r.isIntersecting&&r.intersectionRatio>=.5?bn(this,t,"m",u).call(this,(()=>{bn(this,o,"f")||(n.globalDispatch({type:Z,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!0,inferred:!1}}),En(this,o,!0,"f"),bn(this,t,"m",p).call(this),bn(this,i,"f").removeEventListener("click",a))})):bn(this,t,"m",d).call(this)}))}),{threshold:.5}),"f"),En(this,l,(()=>{var e,n;"visible"===document.visibilityState?null===(e=bn(this,r,"f"))||void 0===e||e.observe(bn(this,i,"f")):(bn(this,t,"m",d).call(this),null===(n=bn(this,r,"f"))||void 0===n||n.disconnect())}),"f"),document.addEventListener("visibilitychange",bn(this,l,"f")),bn(this,l,"f").call(this)}else n.globalDispatch({type:Z,payload:{name:"SignalViewed",parentGuid:e,supportedByBrowser:!1,inferred:!1}}),En(this,o,!0,"f")}getOfferPositionAttr(){const e=this.getAttribute("offerPositionIndex"),t=Number(e);return(null==e||isNaN(t)||t<0)&&v(`Offer position attribute (${e}) is invalid`),t}getJSONAttr(e,t="{}"){const n=this.getAttribute(e);try{return JSON.parse(null!=n?n:t)}catch(t){v(`Invalid JSON attribute ${e}: ${n}`)}}disconnectedCallback(){bn(this,t,"m",p).call(this)}connectedCallback(){var e,t,n;const a=this.getAttribute("container"),o=this.getAttribute("plugin-id");bn(this,i,"f").setAttribute("style","width:100%;display:flex;flex-direction:"+("column"===a?"column":"row"));const r=this.getOfferPositionAttr(),s=this.getJSONAttr("layoutSchema"),l=this.getJSONAttr("childLayouts","[]"),c=this.getJSONAttr("offerData"),d=new gn("DISABLED"===this.getAttribute("interactivity")?"DISABLED":"ENABLED"),u=null!==(e=this.getAttribute("schemaVersion"))&&void 0!==e?e:"",p=this.getJSONAttr("offerState","{}");y||v("Cannot create app without factory. Please build the connector withAppFactory.");const f=m({offerPositionIndex:r,creativeInstanceGuid:null===(t=null==c?void 0:c.creative)||void 0===t?void 0:t.instanceGuid},d);this.makeInteractivityUpdateHandler(d),y({rootElement:bn(this,i,"f"),gateway:f,logger:h,offerPositionIndex:r,offerData:c,layoutSchema:s,childLayouts:l,schemaVersion:u,pluginId:o||O.pluginId,offerState:p}),this.makeVisbilityUpdateHandler(r,null===(n=null==c?void 0:c.creative)||void 0===n?void 0:n.instanceGuid,f)}},n=new WeakMap,a=new WeakMap,i=new WeakMap,o=new WeakMap,r=new WeakMap,s=new WeakMap,l=new WeakMap,t=new WeakSet,c=function(e,t){bn(this,i,"f").classList.remove(t||In),bn(this,i,"f").classList.add(e||In)},d=function(){bn(this,s,"f")&&(clearTimeout(bn(this,s,"f")),En(this,s,null,"f"))},u=function(e){bn(this,t,"m",d).call(this),En(this,s,window.setTimeout(e,1e3),"f")},p=function(){bn(this,t,"m",d).call(this),bn(this,r,"f")&&(bn(this,r,"f").disconnect(),En(this,r,null,"f")),bn(this,l,"f")&&(document.removeEventListener("visibilitychange",bn(this,l,"f")),En(this,l,null,"f"))},f;function v(e){throw h({level:R,code:"MODULE_BUILDER/FAILED_TO_BUILD_MODULE",message:e}),Error(e)}}}const xn=t.createContext({get:()=>new fn}),Cn=e=>t.createElement(xn.Provider,{value:{get:()=>e.context}},e.children);const wn=t.createContext({get(){throw Error("Layout Schema context has not been set")}}),On=e=>t.createElement(wn.Provider,{value:{get:()=>e.context}},e.children),Tn=()=>t.useContext(wn).get(),An=t.createContext("ENABLED"),Rn=()=>t.useContext(An);function Nn(e){const t=Ln(e);return function e(t,n){if("string"!=typeof t)return e.bind({dataMap:Ln(t,this.dataMap)});if(!n)throw new _("FAILED_TO_MAP_STATIC_DATA","No namespace submitted to StaticData Mapper");const a=t;return i.path([n,a],this.dataMap)}.bind({dataMap:t})}const _n={images:{},links:{},icons:{},copy:{},responseOptionsMap:{}};function Ln(e,t=_n){return["images","links","icons","copy","responseOptionsMap"].reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Object.assign(Object.assign({},t[n]),e[n])})),t)}const jn=t.createContext(Nn({}));jn.Consumer;const Dn=jn.Provider,kn=()=>t.useContext(jn),Pn=t.createContext({});function $n({info:e,children:n}){const a=t.useContext(Pn);return t.createElement(Pn.Provider,{value:Object.assign(Object.assign({},a),e)},n)}const Fn=t.createContext({get(){throw Error("Catalog Item context has not been set")}}),Gn=e=>t.createElement(Fn.Provider,{value:{get:()=>e.context}},e.children),Mn=()=>t.useContext(Fn).get(),Bn=t.createContext(""),Un=()=>t.useContext(Bn),Vn=t.createContext(""),zn=t.createContext(void 0);function Hn({children:e}){const n=t.useMemo((()=>{const e=document.createElement("div");return e.inert=!0,{inert:!0===e.inert}}),[]);return t.createElement(zn.Provider,{value:n},e)}const qn=i.compose(i.anyPass([i.isEmpty,i.all(i.isEmpty)]),i.flatten,i.map(i.values),i.map(i.ifElse(i.isNil,i.always({}),i.identity)),i.values,i.propOr({},"value")),Wn=i.compose(i.isEmpty,i.prop("predicates"));function Jn(e,t){return`transition: ${t.map((t=>`${t} ${e}ms`)).join(", ")};`}const Yn=i.curry(((e,{duration:t,predicates:n,styles:a})=>{return{predicates:n,classname:e(st(a)),transitionBaseClassname:e(Jn(t,(o=a,i.toPairs(o).flatMap((e=>{const[t,n]=null!=e?e:[];return n&&t?i.keys(n).map((e=>ge(t,e))):[]})))))};var o})),Kn=i.anyPass([qn,Wn]);const Zn={is:i.equals,"is-not":i.compose(i.not,i.equals),"is-below":i.lt,"is-above":i.gt};function Qn(e,t){return e.includes(t)}const Xn={is:i.equals,"is-not":i.compose(i.not,i.equals),exists:Qn,"not-exists":i.compose(i.not,Qn)},ea={exists:i.compose(i.not,i.either(i.isNil,i.isEmpty)),"not-exists":i.either(i.isNil,i.isEmpty)},ta={"is-true":i.equals(!0),"is-false":i.equals(!1)},na={is:i.equals,"is-not":i.compose(i.not,i.equals)};function aa(e){return(t,n)=>n[e]}const ia=i.cond([[(e,t)=>i.equals("Breakpoint",e),aa("activeBreakpoint")],[(e,t)=>i.equals("Progression",e),aa("progressionIndex")],[(e,t)=>i.equals("Position",e),aa("positionIndex")]]);function oa(e,t){return e.creativeCopy&&"string"==typeof e.creativeCopy[t]?e.creativeCopy[t]:void 0}const ra=i.cond([[i.equals("Breakpoint"),(e,t,n)=>{const a=i.lensPath(["breakpoints",t]);return i.pipe(i.over(a,Number),i.view(a))(n)}],[i.equals("Progression"),(e,t,n)=>i.cond([[i.gt(0),i.add(n.totalGroups)],[i.lte(0),i.identity]])(Number(t))],[i.equals("Position"),(e,t,n)=>i.cond([[i.gt(0),i.add(n.totalOffers)],[i.lte(0),i.identity]])(Number(t))]]),sa=i.compose(i.not,isNaN);function la(e,t){return e.map((e=>{var n,a,i;switch(e.type){case"StaticString":return(0,na[e.predicate.condition])(e.predicate.input,e.predicate.value);case"CreativeCopy":return(0,ea[e.predicate.condition])(oa(t,e.predicate.value));case"StaticBoolean":return(0,ta[e.predicate.condition])(e.predicate.value);case"CustomState":return(0,Zn[e.predicate.condition])(null!==(n=t.customStates[e.predicate.key])&&void 0!==n?n:0,e.predicate.value);case"DomainState":return(0,Zn[e.predicate.condition])(null!==(a=t.domainStates[e.predicate.key])&&void 0!==a?a:0,e.predicate.value);case"DarkMode":throw new Error("DarkMode has not yet been implemented.");case"Placeholder":return function(e){switch(e.predicate.type){case"TextValue":return(0,Xn[e.predicate.content.condition])(e.predicate.content.input,e.predicate.content.value);case"TextLength":return(0,Zn[e.predicate.content.condition])(e.predicate.content.input.length,e.predicate.content.value);case"Numeric":return(0,Zn[e.predicate.content.condition])(Number(e.predicate.content.input),e.predicate.content.value);default:return!1}}(e);default:{const n=Zn[e.predicate.condition],a=null!==(i=ia(e.type,t))&&void 0!==i?i:NaN,o=ra(e.type,e.predicate.value,t);return!!sa(a)&&n(a,o)}}}))}function ca(e){return i.pathOr(0,["breakpoint","breakpoints",e.breakpoint.activeBreakpoint],e)}const da={breakpoints:{},activeBreakpoint:NaN,progressionIndex:NaN,positionIndex:NaN,totalOffers:NaN,totalGroups:NaN,creativeCopy:{},customStates:{},domainStates:{}};function ua(e,t,n,a){const o=t.map((e=>"Progression"===e.type?Object.assign(Object.assign({},e),{type:a?"Position":e.type}):e)),{cached:r,uncached:s}=o.reduce(((t,a)=>function(e,t,n,a){const o=function(e,t){switch(e.type){case"Position":case"StaticBoolean":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:static-state`;case"StaticString":return`${e.type}:${e.predicate.input}:${e.predicate.condition}:${e.predicate.value}:static-state`;case"CreativeCopy":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${oa(t,e.predicate.value)}:${t.totalGroups}`;case"CustomState":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${e.predicate.key}:${t.customStates[e.predicate.key]}`;case"DomainState":return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${e.predicate.key}:${t.domainStates[e.predicate.key]}`;case"Placeholder":return`${e.type}:${e.predicate.type}:${e.predicate.content.condition}:data:${e.predicate.content.input}:${e.predicate.content.value}`;default:return`${e.type}:${e.predicate.condition}:${e.predicate.value}:state:${ia(e.type,t)}:${t.totalGroups}`}}(e,t),r=n.current.get(o);return i.evolve(pa(r)?{cached:i.append(r)}:{uncached:i.append({key:o,predicate:e})},a)}(a,n,e,t)),{cached:[],uncached:[]}),l=la(s.map((({predicate:e})=>e)),n);return i.zip(s,l).forEach((([{key:t},n])=>{e.current.set(t,n)})),r.concat(l)}const pa=i.is(Boolean);const fa=i.curry(((e,t,n)=>{var a,i,o,r,s,l;return{breakpoints:n.breakpoint.breakpoints,activeBreakpoint:ca(n),progressionIndex:null!==(i=null===(a=n.progression)||void 0===a?void 0:a.activeGroupIndex)&&void 0!==i?i:0,totalOffers:null!==(r=null===(o=n.progression)||void 0===o?void 0:o.totalOffers)&&void 0!==r?r:0,totalGroups:null!==(l=null===(s=n.progression)||void 0===s?void 0:s.totalGroups)&&void 0!==l?l:0,customStates:n.customStates,domainStates:n.domainStates,positionIndex:e,creativeCopy:t}})),ya=i.lensPath(["predicate","content","input"]),ha=i.lensPath(["predicate","content","value"]);function ma(e,t){const n=i.over(ya,(t=>t?e(t):"")),a=i.over(ha,(t=>"string"==typeof t?e(t):t)),o=i.compose(n,a);return t.map((e=>"Placeholder"===e.type?"TextValue"===e.predicate.type?o(e):n(e):e))}const va=i.all(i.equals(!0));function ga(e){const n=Xt(),a=tn(),o=t.useRef(new Map),r=Rt(),s=bt(da,fa(a,r)),l=Yt();return t.useMemo((()=>i.mapObjIndexed((e=>{const t=ma(l,e);return va(ua(o,t,s,n))}),e)),[o,e,s,n,l])}function ba(e){e&&(e.style.display="")}function Ea(e){e&&(e.style.display="none")}function Ia(e){return e.settings.duration}const Sa=[{opacity:0,display:"none"},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],xa=[{opacity:1},{opacity:0,offset:.75},{opacity:0}];function Ca(e,t,n){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){const a=t?Sa:xa,i=e.animate(a,{duration:n,iterations:1});return i.onfinish=()=>{t?ba(e):Ea(e)},i.oncancel=()=>{t?ba(e):Ea(e)},()=>{i.finish()}}return t?ba(e):Ea(e),()=>{}}function wa({inTransitions:e,outTransitions:n,visible:a,children:i,containerClassName:o}){const r=t.useRef(null);return t.useEffect((()=>a&&e?e.forEach((e=>{r.current&&function(e,t,n,a){if("FadeIn"===a)Ca(e,t,n)}(r.current,a,Ia(e),e.type)})):!a&&n?n.forEach((e=>{r.current&&function(e,t,n,a){if("FadeOut"===a)Ca(e,t,n)}(r.current,a,Ia(e),e.type)})):()=>{}),[a]),t.createElement("div",{ref:r,style:{display:"none"},className:o},i)}function Oa(e){const n=St(),a=function(e){const n=Xt(),a=tn(),i=t.useRef(new Map),o=Rt(),r=bt(da,fa(a,o)),s=ma(Yt(),e);return t.useMemo((()=>va(ua(i,s,r,n))),[i,s,r,n])}(e.schema.predicates),i=t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0))));return e.schema.transition?t.createElement(wa,{inTransitions:e.schema.transition.inTransition,outTransitions:e.schema.transition.outTransition,visible:a},i):"functionally"===e.schema.hide?t.createElement(An.Provider,{value:a?"ENABLED":"DISABLED"},i):a?t.createElement(t.Fragment,null,i):null}const Ta=i.mergeWith(((e,t)=>`${e||""} ${t||""}`.trim())),Aa=e=>{var n;const a=t.useContext(Kt),o=tn(),r=wt()||document.head,s=Un(),l=ut(s,o,r),c=t.useCallback(ft,[]),d=bt([],(e=>Object.values(e.breakpoint.breakpoints))),u=a||c(d,s,o,r),p=e.styles?u(e.styles):{},f=e.styles&&e.styles.conditionalTransitions?function(e,t){const n=Yn(e);return i.mapObjIndexed((e=>Kn(t)||!e?null:n({predicates:t.predicates,duration:t.duration,styles:e})),t.value)}(l,null===(n=e.styles)||void 0===n?void 0:n.conditionalTransitions):void 0,y=ga(f?i.mapObjIndexed(i.propOr([],"predicates"),f):{}),h=i.mapObjIndexed(((e,t)=>e?function(e,t){var n;if(e&&t in e)return null===(n=e[t])||void 0===n?void 0:n.classname}(f,t):void 0),y),m=f?i.mapObjIndexed(i.prop("transitionBaseClassname"),f):{},v=e.styles?(g=m,Ta(Ta(p,h),g)):void 0;var g;return e.children({classnames:v,mapperRef:u})};function Ra(e){const n=St();return t.createElement(Aa,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:a?a.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"column"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,U(a,e.testId))))))}))}function Na(e){const n=St();return t.createElement(Aa,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:a?a.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"row"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,U(a,e.testId))))))}))}const _a={allowedTags:["em","strong","a","br","u","p","li","ul","ol","s"],allowedAttributes:{a:["href","target",le,ce],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],s:[]},allowedSchemes:["http","https"]},La=new Map([["&","_;^;_"]]),ja=new RegExp(`<a *(?=${_a.allowedAttributes.a.join("|")}|>)`,"g"),Da=new RegExp('<a [^>]*href="([^"]+)"',"g"),ka=new RegExp("(<br *?>)|(<br *?/>)","g"),Pa="<br/>";function $a(e){const n=Yt(),a=Rn(),i=t.useMemo((()=>{const t=n(e.schema.value);if(!function(e){const t=function(e){return e.replaceAll(Da,((e,t)=>{const n=t.replaceAll("&",La.get("&"));return e.replace(t,n)})).replaceAll(ka,Pa)}(e);return t===u(t,_a)}(t))throw new _("FAILED_SANITISING_HTML","Invalid HTML tags");return t.trim()?t:""}),[e.schema.value,n]),{tabIndex:o,styles:r,isDisabled:s}=m(a);return i?t.createElement(Aa,{styles:e.schema.styles},(({classnames:n})=>{const a=[(null==n?void 0:n.link)?`class = "${null==n?void 0:n.link}"`:"",s?'tabindex="-1"':"",s?"style=\"pointer-events: 'none'; user-select: none;\"":"",s?'aria-disabled="true"':""].filter((e=>e.length>0));return l=i,new RegExp("</(p|ul|ol)>").test(l)?t.createElement("div",{tabIndex:o,style:r,"aria-hidden":s,className:null==n?void 0:n.own,"data-testid":e.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:i.replace(ja,`<a ${a.join(" ")}`)}}):t.createElement("p",{tabIndex:o,style:r,"aria-hidden":s,className:null==n?void 0:n.own,"data-testid":e.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:i.replace(ja,`<a ${a.join(" ")}`)}});var l})):null}function Fa(e){const n=Yt()(e.schema.value),a=Rn(),{tabIndex:i,styles:o,isDisabled:r}=m(a);return n?t.createElement(Aa,{styles:e.schema.styles},(({classnames:a})=>{const s={tabIndex:i,"aria-hidden":r,className:null==a?void 0:a.own,"data-testid":e.testId,"data-e2e":"BasicText"};return e.isInline?t.createElement("span",Object.assign({style:o},s),n):t.createElement("p",Object.assign({style:o},s),n)})):null}function Ga(e,n,a){if("BasicText"===e.type)return t.createElement(Fa,{schema:e.node,testId:n,isInline:null!=a&&a})}function Ma(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,U(t,a)))))}function Ba(e){const n=vt(),a=St(),i=At(),o=Yt(),r=tn(),s=Rn(),l=i.creative.responseOptionsMap[e.schema.responseKey],c=x(l);t.useEffect((()=>{c&&n(function(e){if(e.paymentTriggerConfig)return{type:ne,payload:{criteria:{key:"PAYMENT_OFFER_SELECTED"},signal:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:e.instanceGuid,responseActionPayload:{name:e.action,externalKey:"PAYMENT_OFFER_SELECTED"}}}};throw new Error(`Invalid External Response: No 'paymentTriggerConfig' found for external response option with instanceGuid: ${e.instanceGuid}`)}(l))}),[l,n,c]);const d=l?o({data:l},"creativeResponse"):o,{tabIndex:u,styles:p,isDisabled:f}=m(s);return E(l)&&!c&&void 0!==r?t.createElement(Aa,{styles:e.schema.styles},(({classnames:o,mapperRef:r})=>{var s;return t.createElement("button",{type:"button",tabIndex:u,"aria-disabled":f,"aria-label":null!==(s=e.schema.a11yLabel)&&void 0!==s?s:void 0,style:Object.assign({cursor:"pointer"},p),"data-testid":e.testId,"data-e2e":"CreativeResponse","data-e2e-response-type":e.schema.responseKey,onClick:e=>{e.preventDefault();const t=function(e,t){switch(t.action){case"Fulfillment":{const n=e.creative.fulfillment;if(b(n))return{fulfillment:n,responseOption:t,creativeInstanceGuid:e.creative.instanceGuid,accountID:e.accountId,referralCreativeID:e.creative.referralCreativeId};throw new Error(`Invalid Fulfillment: ${n} with referralCreativeID: ${e.creative.referralCreativeId}`)}case"Url":return Object.assign(Object.assign({},t),{accountID:e.accountId,creativeInstanceGuid:e.creative.instanceGuid,referralCreativeID:e.creative.referralCreativeId});default:return Object.assign(Object.assign({},t),{creativeInstanceGuid:e.creative.instanceGuid})}}(i,l);n({type:z,payload:t})},className:null==o?void 0:o.own,disabled:f},t.createElement(Jt,{value:d},(null==o?void 0:o.own)?function(e,n,a,i,o){return t.createElement(Zt,{value:a(n)},Ma(e,i,o))}(e.schema.children,o.own,r,a,e.testId):Ma(e.schema.children,a,e.testId)))})):null}function Ua(e){const n=Rn(),{styles:a,isDisabled:i}=m(n);return e.schema.url.light?t.createElement(Aa,{styles:h(e.schema.styles)},(({classnames:n})=>t.createElement("img",{"aria-hidden":i,style:Object.assign(Object.assign({},a),{display:"inline-block"}),alt:i?void 0:e.schema.alt||void 0,title:e.schema.title||void 0,className:n?n.own:void 0,"data-testid":e.testId,"data-e2e":"StaticImage",src:e.schema.url.light}))):null}function Va(e){const n=Rn(),{styles:a,isDisabled:i}=m(n),o=(e=>{const n=t.useContext(jn),a=e.split("|");for(const e of a){const t=n(e.trim(),"images");if(t)return t}})(e.schema.imageKey);return null!=(r=o)&&"object"==typeof r&&"light"in r&&"string"==typeof r.light?t.createElement(Aa,{styles:h(e.schema.styles)},(({classnames:n})=>t.createElement("img",{"aria-hidden":i,style:Object.assign(Object.assign({},a),{display:"inline-block"}),alt:o.alt,title:o.title,className:n?n.own:void 0,"data-testid":e.testId,"data-e2e":"DataImage",src:o.light}))):null;var r}const za={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function Ha(e){const n=e.schema.name,a=e.schema.description,i=e.schema.styles?M(za,e.schema.styles):za,o=Rn(),{styles:r,isDisabled:s}=m(o);return n?t.createElement(Aa,{styles:i},(({classnames:i})=>t.createElement("span",Object.assign({style:Object.assign(Object.assign({},r),{display:"inline-block"}),className:"rokt-icon"+((null==i?void 0:i.own)?" "+i.own:""),"data-testid":e.testId,"data-e2e":`StaticIcon-${n}`},!s&&a?{title:a}:{"aria-hidden":"true"}),n))):null}const qa={backgroundColor:"#FFEEEE",color:"#FF0000",fontSize:"10px",padding:"4px",border:"1px solid #FF0000",margin:0,whiteSpace:"normal"};class Wa extends t.Component{constructor(e){super(e),this.state={errorMessage:""}}static getDerivedStateFromError(e){return{errorMessage:e.message}}componentDidUpdate(e){this.state.errorMessage&&JSON.stringify(e.schema)!==JSON.stringify(this.props.schema)&&this.setState({errorMessage:""})}componentDidCatch(e,t){var n;this.props.reporter&&"true"===fe.REPORT_RENDER_ERRORS&&this.props.reporter({level:R,code:null!==(n=e.code)&&void 0!==n?n:"UNHANDLED_RENDERING_EXCEPTION",message:e.message,additionalInformation:Object.assign({componentStack:t.componentStack,stack:e.stack},this.context||{})})}render(){return this.state.errorMessage?"true"===fe.DISPLAY_ERRORS?t.createElement("pre",{style:qa},t.createElement("strong",null,"Error:")," [",t.createElement("em",null,this.props.schema.type),"]"," ",this.state.errorMessage):void 0:this.props.children}}Wa.contextType=Pn;const Ja={internally:"_top",externally:"_blank"};function Ya(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Ka(e){var n;const a=Ja[e.schema.open],i=St(),o=Rn(),{tabIndex:r,styles:s,isDisabled:l}=m(o);return(null===(n=e.schema.children)||void 0===n?void 0:n.length)>0?t.createElement(Aa,{styles:e.schema.styles},(({classnames:n,mapperRef:o})=>{var c;return t.createElement("a",{href:e.schema.src,"data-testid":e.testId,"data-e2e":"StaticLink",target:null!=a?a:"_blank",tabIndex:r,"aria-disabled":l,"aria-label":null!==(c=e.schema.a11yLabel)&&void 0!==c?c:void 0,style:Object.assign({cursor:"pointer",textDecoration:"none",display:e.isInline?"inline":"block"},s),className:null==n?void 0:n.own},(null==n?void 0:n.own)?function(e,n,a,i,o){return t.createElement(Zt,{value:a(n)},Ya(e,i,o))}(e.schema.children,null==n?void 0:n.own,o,i,e.testId):Ya(e.schema.children,i,e.testId))})):null}function Za(e,n,a){if("StaticLink"===e.type)return t.createElement(Ka,{schema:e.node,testId:n,isInline:null!=a&&a})}const Qa={elements:{own:[{default:{text:{fontFamily:"rokt-icons"}}}]}};function Xa(e){const n=(a=e.schema.iconKey,t.useContext(jn)(a,"icons"));var a;const i=null==n?void 0:n.name,o=e.schema.styles?M(Qa,e.schema.styles):Qa,r=Rn(),{styles:s}=m(r);return i?t.createElement(Aa,{styles:o},(({classnames:n})=>t.createElement("span",{style:Object.assign(Object.assign({},s),{display:"inline-block"}),"aria-hidden":"true",className:"rokt-icon"+((null==n?void 0:n.own)?" "+n.own:""),"data-testid":e.testId,"data-e2e":`DataIcon-${i}`},i))):null}const ei=o.css`
2
2
  display: flex;
3
3
  position: relative;
4
4
  overflow: hidden;
@@ -6,7 +6,7 @@
6
6
  > * {
7
7
  position: absolute !important;
8
8
  }
9
- `;function ei(e){const n=It(),a=t.useRef(null);return t.useEffect((()=>{const e=new ResizeObserver((()=>{requestAnimationFrame((()=>{if(a.current){const e=Array.from(a.current.children).reduce(((e,t)=>Math.max(e,t.clientHeight)),0);a.current.style.height=`${e}px`}}))}));return a.current&&Array.from(a.current.children).forEach((t=>{e.observe(t)})),()=>{e.disconnect()}}),[]),t.createElement(Ta,{styles:e.schema.styles},(({classnames:i})=>{var o;return t.createElement("div",{ref:a,className:[Xa,null==i?void 0:i.own].filter(Boolean).join(" ")||void 0,"aria-label":null!==(o=e.schema.a11yLabel)&&void 0!==o?o:void 0,"data-testid":e.testId,"data-e2e":"ZStack"},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,U(a,e.testId))))))}))}const ti={elements:{own:[{default:{dimension:{width:{type:"percentage",value:100},height:{type:"fixed",value:50}},background:{backgroundColor:{light:"#000"}},border:{borderRadius:25}}}],thumb:[{default:{dimension:{width:{type:"fixed",value:50},height:{type:"fixed",value:50}},background:{backgroundColor:{light:"#FFF"}},text:{fontSize:22,fontFamily:"rokt-icons",horizontalTextAlign:"center"},border:{borderRadius:25}}}],fill:[{default:{background:{backgroundColor:{light:"#000"}}}}],label:[{default:{text:{fontSize:18,textColor:{light:"#FFF"},horizontalTextAlign:"center"}}}]}};function ni(e){const[n,a]=t.useState(!1),[i,o]=t.useState(!1),r=Bn(),s=An(),l=en(),c=mt(),{customStateKey:d,customStateValue:u,label:p,a11yLabel:f,thumb:y}=e.schema,{containerClass:h,trackClass:v,fillClass:b,thumbClass:E,labelClass:I,buttonClass:S}=function(e,t){const n=dt(e,t);return{containerClass:n`
9
+ `;function ti(e){const n=St(),a=t.useRef(null);return t.useEffect((()=>{const e=new ResizeObserver((()=>{requestAnimationFrame((()=>{if(a.current){const e=Array.from(a.current.children).reduce(((e,t)=>Math.max(e,t.clientHeight)),0);a.current.style.height=`${e}px`}}))}));return a.current&&Array.from(a.current.children).forEach((t=>{e.observe(t)})),()=>{e.disconnect()}}),[]),t.createElement(Aa,{styles:e.schema.styles},(({classnames:i})=>{var o;return t.createElement("div",{ref:a,className:[ei,null==i?void 0:i.own].filter(Boolean).join(" ")||void 0,"aria-label":null!==(o=e.schema.a11yLabel)&&void 0!==o?o:void 0,"data-testid":e.testId,"data-e2e":"ZStack"},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,U(a,e.testId))))))}))}const ni={elements:{own:[{default:{dimension:{width:{type:"percentage",value:100},height:{type:"fixed",value:50}},background:{backgroundColor:{light:"#000"}},border:{borderRadius:25}}}],thumb:[{default:{dimension:{width:{type:"fixed",value:50},height:{type:"fixed",value:50}},background:{backgroundColor:{light:"#FFF"}},text:{fontSize:22,fontFamily:"rokt-icons",horizontalTextAlign:"center"},border:{borderRadius:25}}}],fill:[{default:{background:{backgroundColor:{light:"#000"}}}}],label:[{default:{text:{fontSize:18,textColor:{light:"#FFF"},horizontalTextAlign:"center"}}}]}};function ai(e){const[n,a]=t.useState(!1),[i,o]=t.useState(!1),r=Un(),s=Rn(),l=tn(),c=vt(),{customStateKey:d,customStateValue:u,label:p,a11yLabel:f,thumb:y}=e.schema,{containerClass:h,trackClass:v,fillClass:b,thumbClass:E,labelClass:I,buttonClass:S}=function(e,t){const n=ut(e,t);return{containerClass:n`
10
10
  position: relative;
11
11
  z-index: 1;
12
12
  flex: 1;
@@ -54,7 +54,7 @@
54
54
  z-index: 0;
55
55
  background-color: #00000000;
56
56
  color: #00000000;
57
- `}}(r,l);if(!d)throw new Error("No custom state key provided for state trigger node.");const x={type:X,payload:{key:d,value:null!=u?u:1}},C={type:Z,payload:{name:"SignalUserInteraction",action:"Swipe",context:"SlideStateTrigger"}},w=e.schema.styles?M(ti,e.schema.styles):ti,O=t.useRef(null),T=t.useRef(null),A=t.useRef(null),R=t.useRef(!1),N=t.useRef(void 0),{isDisabled:L}=m(s);t.useEffect((()=>{if(n)return g()?(document.addEventListener("touchmove",D),document.addEventListener("touchend",_)):(document.addEventListener("mousemove",D),document.addEventListener("mouseup",_)),G}),[n]);const _=()=>{G(),N.current=void 0,a(!1),i||(F(!0),R.current?($(P()),k()):$(0))},j=e=>{n||i||L||(N.current=ii(e),F(!1),a(!0))},D=e=>{var t,n;if(ai(A)){const a=Math.min(Math.max(0,(null!==(t=ii(e))&&void 0!==t?t:0)-(null!==(n=N.current)&&void 0!==n?n:0)),P());$(a),a/P()*100>=75?R.current=!0:R.current=!1}},k=()=>{var e,t;o(!0),c(x),c(C),null===(t=null===(e=ai(O).parentElement)||void 0===e?void 0:e.parentElement)||void 0===t||t.focus()},P=()=>ai(O).getBoundingClientRect().width-ai(A).getBoundingClientRect().width,$=e=>{var t;ai(A).style.transform=`translateX(${e}px)`,ai(T).style.transform=`translateX(${e+(null===(t=ai(A))||void 0===t?void 0:t.getBoundingClientRect().width)/2}px)`},F=e=>{e?(ai(A).style.transition="transform .2s",ai(T).style.transition="transform .2s"):(ai(A).style.transition="",ai(T).style.transition="")},G=()=>{document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",_),document.removeEventListener("touchmove",D),document.removeEventListener("touchend",_)};return t.createElement(Ta,{styles:w},(({classnames:n})=>{var a,o,r,s,l,c;return t.createElement("div",{className:`${h}`,"data-testid":e.testId,"data-e2e":"SlideStateTrigger"},t.createElement("div",{className:`${v} ${null!==(a=null==n?void 0:n.own)&&void 0!==a?a:""}`,ref:O,"aria-hidden":!0,"data-testid":e.testId&&`${e.testId}-track`},(null==p?void 0:p.value)?t.createElement("div",{className:`${I} ${null!==(o=null==n?void 0:n.label)&&void 0!==o?o:""}`,"data-testid":e.testId&&`${e.testId}-label`},p.value):null,t.createElement("div",{className:`${b} ${null!==(r=null==n?void 0:n.fill)&&void 0!==r?r:""}`,ref:T,"data-testid":e.testId&&`${e.testId}-fill`}),t.createElement("div",{className:`${E} ${null!==(s=null==n?void 0:n.thumb)&&void 0!==s?s:""}`,ref:A,"data-testid":e.testId&&`${e.testId}-thumb`,"data-e2e":"SlideStateTrigger-thumb",onMouseDown:j,onTouchStart:j},null!==(l=null==y?void 0:y.icon)&&void 0!==l?l:"ArrowForward")),t.createElement("button",{className:S,"aria-label":null!=f?f:void 0,onClick:k,disabled:i||L,"data-testid":e.testId&&`${e.testId}-button`},null!==(c=null==p?void 0:p.value)&&void 0!==c?c:"Unlock Offers"))}))}function ai(e){if(!e.current)throw new Error("Unexpected missing reference to required SlideStateTrigger Element");return e.current}function ii(e){var t;return"touches"in e?null===(t=e.touches[0])||void 0===t?void 0:t.clientX:e.clientX}function oi(e){const n=It();return t.createElement(Ta,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:a?a.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"row",flexWrap:"wrap"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,U(a,e.testId))))))}))}function ri(e){const n=An(),a=mt(),i=e.schema.customStateKey,o=gt(0,(e=>e.customStates[i])),{tabIndex:r,styles:s,isDisabled:l}=m(n),c=()=>{a({type:X,payload:{key:i,value:o?0:1}})};return t.createElement(Ta,{styles:e.schema.styles},(({classnames:n})=>{var a;return t.createElement("button",{className:null==n?void 0:n.own,onClick:c,"data-testid":e.testId,"data-e2e":"ToggleButtonStateTrigger",disabled:l,"aria-disabled":l,"aria-label":null!==(a=e.schema.a11yLabel)&&void 0!==a?a:void 0,tabIndex:r,style:Object.assign({cursor:"pointer"},s)},t.createElement(Et,null,(n=>t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0)))))))}))}function si(e){const n=It();return t.createElement(Ta,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:a?a.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"row",overflowX:"auto"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,U(a,e.testId))))))}))}function li(e){const n=It();return t.createElement(Ta,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:a?a.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"column",overflowY:"auto"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,U(a,e.testId))))))}))}const ci=t.createContext({extensions:{ctx:new Map,cache:[]}}),di=()=>t.useContext(ci).extensions;function ui({extensions:e,extendStore:n,children:a}){const i=di(),o=new Map([...i.ctx,...e.ctx]),r=i.cache.concat(e.cache);return t.createElement(ci.Provider,{value:{extensions:{ctx:o,cache:r},extendStore:n}},a)}function pi(e,t){const n=function(e){try{const t=JSON.parse(e);if(null!=t&&"object"==typeof t&&"type"in t&&"Extension"===t.type&&"name"in t&&"string"==typeof t.name&&t.name.trim().length>0&&"body"in t&&"object"==typeof t.body)return{type:"Extension",name:t.name,body:t.body}}catch(e){}return null}(t),a=n?e.ctx.get(n.name):null;return n&&a?[n,a]:null}function fi({data:e}){const n=pi(di(),e);var a;if((e=>{const{extendStore:n,extensions:a}=t.useContext(ci);t.useEffect((()=>{e&&n&&!a.cache.includes(e.name)&&(n(e),a.cache.push(e.name))}),[e,a.cache,n])})((a=null==n?void 0:n[1])?{sagas:a.sagas,reducer:a.reducer,name:a.name,interceptors:a.interceptors}:void 0),n){const[e,t]=n;return t.componentFactory(e.body)}return null}function yi(e,n){if(v("Extension",e))return t.createElement(fi,{data:e.node.data})}function hi(e){const n=Dn(),a=Tt(),i=Jt(),o=It(),r=mt(),s=t.useMemo((()=>a.catalogItems||[]),[a]),l=e=>i({data:e},"catalogItem");return t.useEffect((()=>{for(const e of s)r({type:Z,payload:{name:"SignalImpression",parentGuid:e.instanceGuid}})}),[s,r]),s.length>0?t.createElement(Ta,{styles:e.schema.styles},(({classnames:a})=>t.createElement("div",{"data-testid":e.testId,"data-e2e":"CatalogStackedCollection",className:null==a?void 0:a.own,style:{display:"flex",flexDirection:"column"}},t.Children.toArray(s.map(((a,i)=>t.createElement(Fn,{context:a},t.createElement(jn,{value:n(a)},t.createElement(Wt,{value:l(a)},o(e.schema.template,void 0,U(i,e.testId))))))))))):null}const mi={BasicText:(e,t)=>Fa(e,t,!0),StaticLink:(e,t)=>Ya(e,t,!0)};function vi(e){const n=It();return t.createElement(St,{value:n,overrides:mi},t.createElement(Et,null,(n=>t.createElement(Ta,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:null==a?void 0:a.own,"data-testid":e.testId,"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,U(a,e.testId))))))})))))}function gi(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,U(t,a)))))}function bi(e){const n=An(),a=mt(),o=It(),r=Jt(),{event:s}=e.schema,{tabIndex:l,styles:c,isDisabled:d}=m(n),u=i.mapObjIndexed((e=>r(e)),s.data||{}),p=()=>{a({type:ee,payload:{name:s.type,body:{offerId:u.providerOfferId,title:u.title,description:u.description}}})};return t.createElement(Ta,{styles:e.schema.styles},(({classnames:n,mapperRef:a})=>{var i;return t.createElement("button",{"aria-disabled":d,"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0,className:null==n?void 0:n.own,"data-e2e":"PartnerEventButtonTrigger","data-testid":e.testId,disabled:d,onClick:p,tabIndex:l,type:"button",style:Object.assign({cursor:"pointer"},c)},t.createElement(Wt,{value:r},(null==n?void 0:n.own)?function(e,n,a,i,o){return t.createElement(Yt,{value:a(n)},gi(e,i,o))}(e.schema.children,n.own,a,o,e.testId):gi(e.schema.children,o,e.testId)))}))}function Ei(e){const n=mt(),a=e.schema.delay?e.schema.delay:1,i=e.schema.customStateKey,o=gt(0,(e=>e.customStates[i]));return function({delay:e,callback:n}){const a=t.useRef(null);t.useEffect((()=>{a.current=setTimeout(n,e)}),[])}({delay:a,callback:()=>{n({type:X,payload:{key:i,value:o?0:1}})}}),null}function Ii(e){const n=An(),a=Jt()(e.schema.value),i=mt(),o=e.schema.customStateKey,r=gt(0,(e=>e.customStates[o])),{tabIndex:s,styles:l,isDisabled:c}=m(n),d=()=>{navigator.clipboard.writeText(a),r||i({type:X,payload:{key:o,value:1}})};return t.createElement(Ta,{styles:e.schema.styles},(({classnames:n})=>{var a;return t.createElement("button",{className:null==n?void 0:n.own,onClick:d,"data-testid":e.testId,"data-e2e":"CopyToClipboardButton",disabled:c,"aria-disabled":c,"aria-label":null!==(a=e.schema.a11yLabel)&&void 0!==a?a:void 0,tabIndex:s,style:Object.assign({cursor:"pointer"},l)},t.createElement(Et,null,(n=>t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0)))))))}))}function Si(e){const n=An(),a=mt(),{customStateKey:i,value:o}=e.schema,{tabIndex:r,styles:s,isDisabled:l}=m(n),c=()=>{a({type:X,payload:{key:i,value:o}})};return t.createElement(Ta,{styles:e.schema.styles},(({classnames:n})=>{var a;return t.createElement("button",{className:null==n?void 0:n.own,onClick:c,"data-testid":e.testId,"data-e2e":"ButtonStateTrigger",disabled:l,"aria-disabled":l,"aria-label":null!==(a=e.schema.a11yLabel)&&void 0!==a?a:void 0,tabIndex:r,style:Object.assign({backgroundColor:"transparent",cursor:"pointer",margin:0,padding:0},s)},t.createElement(Et,null,(n=>t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0)))))))}))}function xi(e){return()=>{throw new L("FAILED_CREATING_UNHANDLED_NODE",`The default mapper does not handle the ${e} node. Make sure when you use the NodeMapperProvider, you pass an override for ${e} node.`)}}const Ci={Column:function(e,n){if("Column"===e.type)return t.createElement(Aa,{schema:e.node,testId:n})},Row:function(e,n){if("Row"===e.type)return t.createElement(Ra,{schema:e.node,testId:n})},StaticImage:function(e,n){if("StaticImage"===e.type)return t.createElement(Ba,{schema:e.node,testId:n})},DataImage:function(e,n){if("DataImage"===e.type)return t.createElement(Ua,{schema:e.node,testId:n})},CreativeResponse:function(e,n){if("CreativeResponse"===e.type)return t.createElement(Ma,{schema:e.node,testId:n})},OneByOneDistribution:xi("OneByOneDistribution"),StackedDistribution:xi("StackedDistribution"),CarouselDistribution:xi("CarouselDistribution"),GroupedDistribution:xi("GroupedDistribution"),ProgressIndicator:xi("ProgressIndicator"),ProgressControl:xi("ProgressControl"),When:function(e,n){if("When"===e.type)return t.createElement(wa,{schema:e.node,testId:n})},Overlay:xi("Overlay"),CloseButton:xi("CloseButton"),RichText:function(e,n){if("RichText"===e.type)return t.createElement(Pa,{schema:e.node,testId:n})},BasicText:Fa,StaticLink:Ya,DataIcon:function(e,n){if("DataIcon"===e.type)return t.createElement(Qa,{schema:e.node,testId:n})},StaticIcon:function(e,n){if("StaticIcon"===e.type)return t.createElement(za,{schema:e.node,testId:n})},ZStack:function(e,n){if("ZStack"===e.type)return t.createElement(ei,{schema:e.node,testId:n})},FlowRow:function(e,n){if("FlowRow"===e.type)return t.createElement(oi,{schema:e.node,testId:n})},SlideStateTrigger:function(e,n){if("SlideStateTrigger"===e.type)return t.createElement(ni,{schema:e.node,testId:n})},ToggleButtonStateTrigger:function(e,n){if("ToggleButtonStateTrigger"===e.type)return t.createElement(ri,{schema:e.node,testId:n})},PartnerEventButtonTrigger:function(e,n){if("PartnerEventButtonTrigger"===e.type)return t.createElement(bi,{schema:e.node,testId:n})},TimerStateTrigger:function(e,n){if("TimerStateTrigger"===e.type)return t.createElement(Ei,{schema:e.node})},CatalogStackedCollection:function(e,n){if("CatalogStackedCollection"===e.type)return t.createElement(hi,{schema:e.node,testId:n})},CatalogResponseButton:xi("CatalogResponseButton"),ScrollableRow:function(e,n){if("ScrollableRow"===e.type)return t.createElement(si,{schema:e.node,testId:n})},ScrollableColumn:function(e,n){if("ScrollableColumn"===e.type)return t.createElement(li,{schema:e.node,testId:n})},EscapeHatch:yi,BottomSheet:xi("BottomSheet"),CatalogQuantityOption:xi("CatalogQuantityOption"),CatalogRadioGroup:xi("CatalogRadioGroup"),CatalogQuantityCounter:xi("CatalogQuantityCounter"),InlineContainer:function(e,n){if("InlineContainer"===e.type)return t.createElement(vi,{schema:e.node,testId:n})},CopyToClipboardButton:function(e,n){if("CopyToClipboardButton"===e.type)return t.createElement(Ii,{schema:e.node,testId:n})},ButtonStateTrigger:function(e,n){if("ButtonStateTrigger"===e.type)return t.createElement(Si,{schema:e.node,testId:n})},CatalogCombinedCollection:xi("CatalogCombinedCollection")};function wi(e){return function(n,a,i){const o=a&&a[n.type],r=null!=o?o:Ci[n.type];return t.createElement(Ha,{schema:n,reporter:e},r&&r(n,i)||function(e){throw new L("FAILED_CREATING_LAYOUT_NODE",`Failed to create layout node ${JSON.stringify(e)}`)}(n))}}const Oi={transformLinksToAnchorText:function(e={}){return{data:i.mapObjIndexed((e=>Lt(e)?`<a target="_blank" href="${e.url}">${e.title}</a>`:""),e)}}};function Ti(e){const{childLayouts:n}=e,a=mt(),[o,r]=t.useMemo((()=>{const e=i.indexBy(i.prop("childLayoutId"),n);return[e,i.mapObjIndexed((e=>e.childLayoutSchema.predicates),e)]}),[n]),s=va(r);t.useEffect((()=>{Object.entries(s).forEach((([e,t])=>{const n=o[e];t&&n&&a({type:re,payload:n})}))}),[s,o,a])}function Ai(e){const{settings:n,dispatch:a,children:i}=e,o=Vt(n.offerData.creative.copy||{})(Oi.transformLinksToAnchorText(n.offerData.creative.links),"creativeLink"),r=wi(n.logger),[s,l]=t.useState("ENABLED");return t.useEffect((()=>n.gateway.onInteractivityChange(l)),[n]),de(n.rootElement,a),t.createElement(Zt.Provider,{value:"VARIANT"},t.createElement(xt.Provider,{value:n.rootElement},t.createElement(Mn.Provider,{value:n.pluginId},t.createElement(xn,{context:n.gateway},t.createElement(wn,{context:n.layoutSchema},t.createElement(Un.Provider,{value:n.schemaVersion},t.createElement(Ot,{context:n.offerData},t.createElement(jn,{value:Rn(n.offerData.creative)},t.createElement(Tn.Provider,{value:s},t.createElement(St,{value:r},t.createElement(Xt.Provider,{value:n.offerPositionIndex},t.createElement(ht.Provider,{value:a},t.createElement(Wt,{value:o},t.createElement(Ri,null,t.createElement(Ti,{childLayouts:n.childLayouts}),i))))))))))))))}function Ri(e){var n;const{children:a}=e,o=Bn(),r=function(){const[e,n]=t.useState(null),a=t.useContext(Sn).get();return t.useEffect((()=>a.onGlobalStateChange((t=>{i.equals(t,e)||n(t)}))),[a]),e}(),s=t.useContext(xt)||void 0,l=en(),c=t.useCallback((e=>ft(e,o,l,s)),[s]);return r?t.createElement(Yt,{value:c(Object.values(null!==(n=null==r?void 0:r.breakpoint.breakpoints)&&void 0!==n?n:{}))},t.createElement(vt.Provider,{value:r},a)):null}function Ni(e){return t.createElement("style",{"data-testid":e.testId},"\n* {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n}\nbody {\n margin: 0;\n font-family: sans-serif;\n}\np {\n margin: 0;\n}\nimg {\n max-width: 100%;\n}\n")}function Li(e,t,n,a,i,o){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){o.current.isRunning=!0,i&&"in"===t&&function(e,t){e.style.height=`${t.clientHeight}px`}(i,e);const r=e.animate(n,{duration:a,iterations:1});return r.onfinish=()=>{"in"===t?ga(e):ba(e),o.current.isRunning=!1},r.oncancel=()=>{"in"===t?ga(e):ba(e),o.current.isRunning=!1},()=>{r.finish()}}return"in"===t?ga(e):ba(e),()=>{}}const _i={FadeInOut:{in:[{opacity:0,display:"none"},{opacity:0,display:"none",offset:.5},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],out:[{opacity:1},{opacity:0,offset:.75},{opacity:0}]}};function ji({visible:e,effect:n,children:a,parentElement:i,containerClassName:o}){const[r,s]=t.useState(e),l=t.useRef(null),c=t.useRef({isRunning:!1}),d=Ea(n);return t.useEffect((()=>{const t=new ResizeObserver((function(t){i&&e&&!c.current.isRunning&&t.forEach((e=>{e.contentBoxSize?function(e,t){var n;Array.isArray(e.contentBoxSize)&&e.contentBoxSize[0]?t.style.height=e.contentBoxSize[0].blockSize+"px":"object"==typeof(n=e.contentBoxSize)&&null!=n&&"blockSize"in n&&"number"==typeof n.blockSize&&"inlineSize"in n&&"number"==typeof n.inlineSize?t.style.height=e.contentBoxSize.blockSize+"px":t.style.height="auto"}(e,i):e.contentRect&&function(e,t){t.style.height=`${e.contentRect.height}px`}(e,i)}))}));return e&&l.current&&(ga(l.current),t.observe(l.current)),()=>{t.disconnect()}}),[e,i]),t.useEffect((()=>e&&!r&&l.current&&i?(s(!0),Li(l.current,"in",_i[n.type].in,d,i,c)):!e&&r&&l.current&&i?(s(!1),Li(l.current,"out",_i[n.type].out,d/2,i,c)):()=>{}),[e,i,d]),t.createElement("div",{ref:l,style:{display:"none"},className:o},a)}function Di(e){const n=It();return t.createElement(Ta,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:null==a?void 0:a.own,"data-testid":e.testId,style:{display:"flex",flexDirection:"column"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},n(e.schema.template))}))}const ki="ACTIVE/ADD",Pi="ACTIVE/DELETE",$i="BREAKPOINT/UPDATE_ACTIVE",Fi="BREAKPOINT/INITIALISE",Gi="BREAKPOINT/SET_BREAKPOINTS",Mi="FONTS/SET",Bi="LAYOUT/UPDATE",Ui="CONFIG/HANDLE",Vi="PLUGIN/CLOSE_PLUGIN",zi="SETTINGS/SET",qi="CACHE/ADD_SERIALIZED_VALUE",Hi="CACHE/UPDATE_SERIALIZED_VALUE",Wi="CACHE/CLEAR_SERIALIZED_VALUE",Ji="SIGNAL/QUEUE",Ki="SIGNAL/PROCESSED",Yi="SIGNAL/PROCESS",Zi="OVERLAY/DISMISS_OVERLAY",Qi="ERROR/REPORT",Xi="LOG",eo="CUSTOM_STATES/SET",to={LAYOUT_UPDATE:Bi,UPDATE_ACTIVE_BREAKPOINT:$i,INITIALISE_BREAKPOINT:Fi,ACTIVE_ADD:ki,ACTIVE_DELETE:Pi,SET_FONTS:Mi,QUEUE_SIGNAL:Ji,SIGNAL_PROCESSED:Ki,CACHE_SERIALIZED_VALUE:qi,UPDATE_CACHED_SERIALIZED_VALUE:Hi,CLEAR_SERIALIZED_VALUE_FROM_CACHE:Wi,SET_SETTINGS:zi,SET_CUSTOM_STATE:eo},no={HANDLE_CONFIG:Ui,SET_BREAKPOINTS:Gi,CLOSE_PLUGIN:Vi,RAISE_METRIC:V,PREPARE_SIGNAL:ne,DISMISS_OVERLAY:Zi,REPORT_ERROR:Qi,LOG:Xi,OPEN_LINK:ae},ao="plugin-overlay",io="plugin";function oo(n){var i;const o=n.schema.styles,r=a.useDispatch(),s={type:(null===(i=n.action)||void 0===i?void 0:i.type)||Zi,payload:{id:ao,dismissalMethod:n.schema.dismissalMethod}},l=()=>{r(s)},c=An(),{tabIndex:d,styles:u,isDisabled:p}=m(c);return e.jsx(Ta,{styles:o,children:({classnames:a})=>{var i;return e.jsx("button",{title:"Close",className:null==a?void 0:a.own,onClick:l,"data-testid":n.testId,"data-e2e":"CloseButton",disabled:p,tabIndex:d,"aria-disabled":p,"aria-label":null!==(i=n.schema.a11yLabel)&&void 0!==i?i:void 0,style:Object.assign({cursor:"pointer"},u),children:e.jsx(Et,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}const ro={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var so;function lo({isOpen:n,schema:o,testId:r,children:s}){const l=ue(),c=a.useSelector((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid})),d=a.useSelector((e=>e.active.has(io))),u=a.useDispatch(),p=()=>{u({type:no.DISMISS_OVERLAY,payload:{id:ao,dismissalMethod:"rokt_backdrop"}})};t.useEffect((()=>{c&&u({type:Z,payload:{name:"SignalActivation",parentGuid:c}})}),[c]),t.useEffect((()=>{d&&requestAnimationFrame((()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.focus()}))}),[d]);const f=An(),{tabIndex:y,isDisabled:h,styles:v}=m(f),g=o.styles?i.mergeRight(ro,o.styles):ro;if(!n)return null;const b=e.jsx(Et,{children:e=>t.Children.toArray(o.children.map(((t,n)=>e(t,void 0,r?`${r}-child${n}`:void 0))))});return e.jsx(Ta,{styles:g,children:({classnames:t})=>{var n;return e.jsxs("div",{className:null==t?void 0:t.wrapper,style:Object.assign({position:"fixed",top:"0",right:"0",bottom:"0",left:"0",zIndex:"9999",display:"flex",overflow:"auto"},v),"aria-label":null!==(n=o.a11yLabel)&&void 0!==n?n:void 0,"aria-hidden":h,role:"dialog","aria-modal":!0,tabIndex:y,"data-testid":r,"data-e2e":"Overlay-Wrapper",children:[e.jsx("div",{style:{position:"fixed",top:"0",right:"0",bottom:"0",left:"0",zIndex:"1"},onClick:o.allowBackdropToClose?p:void 0,"data-testid":r&&`${r}-backdrop`,"data-e2e":"Overlay-Backdrop"}),s(b,l)]})}})}!function(e){e[e.BottomSheet=0]="BottomSheet",e[e.Overlay=1]="Overlay"}(so||(so={}));const co={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const uo=t.forwardRef((function({schema:t,testId:n,children:a},o){const r=t.styles?i.mergeRight(co,t.styles):co;return e.jsx(Ta,{styles:r,children:({classnames:t})=>e.jsx("div",{className:null==t?void 0:t.own,style:{position:"relative",zIndex:"3",outline:"none"},ref:o,tabIndex:-1,"data-e2e":"Overlay-Container","data-testid":n&&`${n}-container`,children:a})})}));const po=a.connect((function(e){return{isOpen:e.active.has(ao)}}))((function(t){return e.jsx(lo,Object.assign({},t,{children:(n,a)=>e.jsx(uo,Object.assign({},t,{ref:a,children:n}))}))}));const fo=a.connect((function(e){return{isOpen:e.active.has(ao)}})),yo={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const ho=t.forwardRef((function({schema:n,testId:a,children:o},r){const s=t.useRef(null),l=n.styles?i.mergeRight(yo,n.styles):yo;return t.useEffect((()=>{if(s.current)return function(e){const t=requestAnimationFrame((()=>{e&&e.style.setProperty("max-height","100%")}));return()=>{cancelAnimationFrame(t)}}(s.current)}),[]),e.jsx(Ta,{styles:l,children:({classnames:t})=>e.jsx("div",{style:{width:"100%",maxHeight:"0%",transition:"max-height 0.8s",transitionTimingFunction:"cubic-bezier(0.05, 0.7, 0.1, 1.0)",alignSelf:"flex-end"},ref:s,children:e.jsx("div",{className:null==t?void 0:t.own,style:{position:"relative",zIndex:"3",outline:"none",borderBottomLeftRadius:"0",borderBottomRightRadius:"0"},ref:r,tabIndex:-1,"data-testid":a&&`${a}-container`,"data-e2e":"BottomSheet-Container",children:o})})})}));const mo=fo((function(t){const n=a.useSelector((e=>e.breakpoint.activeBreakpoint));return e.jsx(lo,Object.assign({},t,{children:(a,i)=>"default"===n?e.jsx(ho,Object.assign({},t,{ref:i,children:a})):e.jsx(uo,Object.assign({},t,{ref:i,children:a}))}))}));const vo="DisplayPreset.FULLSCREEN",go="DisplayPreset.EMBEDDED",bo="DisplayPreset.ATTACHED",Eo="ERROR",Io="INFO",So="WARNING";var xo;!function(e){e.PAYPAL="Paypal"}(xo||(xo={}));const Co="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DCUI_SCHEMA_VERSION:"",ROKT_DOMAIN:""};function*wo(e,t,n){(function(e){return"object"==typeof e&&null!==e&&"type"in e&&Object.values(se).includes(e.type)})(n)&&!e.includes(n.type)&&(yield r.call(t.globalDispatch.bind(t),n))}function Oo(e,t){return!e||t<1?null:{cartItemId:e.cartItemId,catalogItemId:e.catalogItemId,name:e.title,description:e.description,quantity:t,currency:e.currency||"$",unitPrice:e.price||0,totalPrice:(e.price||0)*t,linkedProductId:e.linkedProductId,quantityMustBeSynchronized:e.quantityMustBeSynchronized,providerData:e.providerData||""}}function To(e){switch(typeof e){case"undefined":return"";case"object":return null===e?"":JSON.stringify(e);case"string":return e;default:return String(e)}}function Ao(e){return i.map(To,e)}function*Ro(e,t){const n=yield r.actionChannel(e,l.buffers.expanding(10));for(;n;){const e=yield r.take(n);yield r.call(t,e)}}function*No(e,t){const n=yield r.take(e);yield r.call(t,n)}function*Lo(e){for(;;){const t=yield r.take(e);yield r.put(t)}}function*_o(e,t){const n=i.over(i.lensProp("moduleName"),i.defaultTo("orchestrator"),t.payload.additionalInformation||{}),a=Object.assign(Object.assign({},t.payload),{additionalInformation:n?Ao(n):{}});try{yield r.call(e,a)}catch(e){}t.payload.level===Eo&&(yield r.put({type:ee,payload:{name:"PLACEMENT_FAILURE"}}),yield r.put({type:no.CLOSE_PLUGIN}))}const jo="INVALID_RESPONSE_OBJECT",Do="FAILED_TO_OPEN_LINK",ko="NO_PARENT_GUID",Po="FAILED_TO_NOTIFY_INTERACTIVE",$o="FAILED_TO_ESTABLISH_PARTNER_VALIDATION";var Fo=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)t.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(n[a[i]]=e[a[i]])}return n};function Go(e,t){return n=>n&&n.replace(e,t)}const Mo=Go(/['""();{}@:[\]!/=]/g,""),Bo=/^(normal|italic|oblique( \d+deg)*)$/i,Uo=(e="")=>Bo.test(e)?e:void 0,Vo=Go(/[;{}@[\]!]/g,"");function zo(e){const{fontFamily:t,sources:n}=e,a=Fo(e,["fontFamily","sources"]),i=document.fonts,o=new FontFace(t,n.join(", "),a);return i.add(o),o.load().catch((e=>(i.delete(o),Promise.reject(e))))}function qo(e=[]){const t=Array.from(document.fonts.values());return Promise.all(e.map((e=>{const n=function(e){return{fontFamily:Mo(e.fontFamily)||"",style:Uo(e.style),weight:Mo(e.weight),sources:e.sources.map((e=>Vo(e)||"")),display:e.display}}(e);return t.find((e=>e.family===n.fontFamily&&e.weight===n.weight&&(e.style===n.style||!n.style)))?Promise.resolve():zo(n).then((()=>{})).catch((e=>`${e}`.includes("SyntaxError")?(n.fontFamily='"'+n.fontFamily+'"',zo(n).then((()=>{}))):Promise.reject(e))).catch((e=>Promise.resolve(`Error loading font: [Font (${JSON.stringify(n)})] [Message - ${e}]`)))}))).then((e=>{const t=e.filter(Boolean);return t.length>0?Promise.reject(t):Promise.resolve()}))}function Ho(e){const n=a.useDispatch(),i=a.useSelector((e=>{const t=e.fonts.map((e=>({fontFamily:e.fontFamily,style:e.fontStyle||"normal",weight:e.fontWeight,sources:e.src}))),n=t.find((e=>"rokt-icons"===e.fontFamily));if(n)n.display="block";else{const e=null!==(a=Co.ROKT_DOMAIN)&&void 0!==a?a:"";t.push(function(e=""){return{fontFamily:"rokt-icons",weight:"400",sources:[`url("${e}/icons/rokt-icons.woff") format("woff")`],display:"block"}}(e))}var a;return JSON.stringify(t)}));return t.useEffect((()=>{qo(JSON.parse(i)).catch((e=>{const t={type:Qi,payload:{level:Io,code:"FAILED_TO_LOAD_FONT",message:`Error loading fonts:\n\t${e.join("\n\t")}`}};n(t)}))}),[i]),t.useEffect((()=>{const e=()=>{var e,t;null===(t=null===(e=window.frameElement)||void 0===e?void 0:e.iFrameResizer)||void 0===t||t.resize()};return document.fonts.addEventListener("loadingdone",e),()=>{document.fonts.removeEventListener("loadingdone",e)}}),[]),null}function Wo(e){return null!=e?e:null}function Jo(){return new Set([ao])}function Ko(e){return e.breakpoint.breakpoints[e.breakpoint.activeBreakpoint]||0}const Yo=i.sortBy(i.prop(1)),Zo=i.map(i.prop(0)),Qo=e=>i.compose(i.findIndex(i.equals(e)),Zo,Yo,i.toPairs,i.pathOr({},["breakpoint","breakpoints"]));function Xo(e){return Qo(e.breakpoint.activeBreakpoint)(e)}function er(e,t){return e.customStates[`module${t}`]||{}}function tr(e){return`${e.name}:${e.parentGuid}`}function nr(e,t){return!e.processed.includes(tr(t))||(n=t.name,void 0!==A.find((e=>e===n)));var n}function ar(){return new Map}const ir={layout:function(e=Wo(),t){return t.type===Bi?t.payload:e},breakpoint:function(e={breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},t){var n;switch(t.type){case $i:return Object.prototype.hasOwnProperty.call(e.breakpoints,t.payload.activeBreakpoint)?Object.assign(Object.assign({},e),{activeBreakpoint:t.payload.activeBreakpoint}):e;case Fi:return{activeBreakpoint:null!==(n=t.payload.activeBreakpoint)&&void 0!==n?n:"default",breakpoints:Object.assign({default:0},t.payload.breakpoints),initialised:!0};default:return e}},active:function(e=Jo(),t){var n,a;switch(t.type){case ki:{const a=new Set(e);return a.add(null===(n=t.payload)||void 0===n?void 0:n.id),a}case Pi:{const n=new Set(e);return n.delete(null===(a=t.payload)||void 0===a?void 0:a.id),n}default:return e}},fonts:function(e=[],t){return t.type===Mi?t.payload:e},signal:function(e={queue:[],processed:[]},t){switch(t.type){case Ji:return i.evolve({queue:n=>nr(e,t.payload.signal)?i.uniqBy(i.pipe(i.prop("signal"),tr),n.concat(t.payload)):n},e);case Ki:return i.evolve({queue:e=>i.reject(i.pipe(i.prop("signal"),i.whereEq({name:t.payload.name,parentGuid:t.payload.parentGuid})))(e),processed:i.append(tr(t.payload))},e);default:return e}},serializableCache:function(e=ar(),t){switch(t.type){case qi:case Hi:if(t.payload.key&&t.payload.value){return new Map([...e]).set(t.payload.key,t.payload.value)}return e;case Wi:{const n=new Map([...e]);return t.payload&&n.delete(t.payload),n}default:return e}},settings:function(e={closeOnComplete:!0},t){return t.type===zi?i.mergeDeepWith(((e,t)=>i.isNil(t)?e:t),e,t.payload):e},customStates:function(e={root:{}},t){if(t.type===eo){if(t.payload.key&&!isNaN(t.payload.value)){const n=void 0!==t.payload.offerPositionIndex?`module${t.payload.offerPositionIndex}`:"root";return i.assocPath([n,t.payload.key],Number(t.payload.value),e)}return e}return e}};function*or(e,t){var n,a;try{const i=(null===(n=e.activeBreakpointEventChannel)||void 0===n?void 0:n.call(e,t.payload))||(a=t.payload,l.eventChannel((e=>{const t=Object.entries(a).reduce(((e,t)=>{const a=window.matchMedia(`(min-width: ${t[1]}px)`);return"addEventListener"in a&&"function"==typeof a.addEventListener?(a.addEventListener("change",n),e[t[0]]=a):"addListener"in a&&"function"==typeof a.addListener&&(a.addListener(n),e[t[0]]=a),e}),{});return setTimeout((()=>n()),0),()=>{Object.entries(t).forEach((e=>{const t=e[1];"removeEventListener"in t&&"function"==typeof t.removeEventListener?t.removeEventListener("change",n):"removeListener"in t&&"function"==typeof t.removeListener&&t.removeListener(n)}))};function n(){try{e(function(e,t){return Object.entries(e).reduce(((e,n)=>n[1].matches&&(t[n[0]]||0)>(t[e]||0)?n[0]:e),"default")}(t,a))}catch(t){e(t)}}})));try{let e=yield r.take(i);for(yield r.put({type:to.INITIALISE_BREAKPOINT,payload:{activeBreakpoint:e,breakpoints:t.payload}});;)e=yield r.take(i),yield r.put({type:to.UPDATE_ACTIVE_BREAKPOINT,payload:{activeBreakpoint:e}})}catch(e){const n=e;yield r.put({type:Qi,payload:{level:So,code:"FAILED_TO_DETERMINE_BREAKPOINT",message:null==n?void 0:n.message,additionalInformation:{stack:null==n?void 0:n.stack,breakpoints:t.payload}}})}finally{(yield r.cancelled())&&i.close()}}catch(e){const n=e;yield r.put({type:Qi,payload:{level:Eo,code:"FAILED_TO_ESTABLISH_BREAKPOINT_CHANNEL",message:null==n?void 0:n.message,additionalInformation:{stack:null==n?void 0:n.stack,breakpoints:t.payload}}})}}function rr(e,t,n){return l.eventChannel((a=>{const i=e.subscribe((e=>{const t=n(e);t&&a({type:Ui,payload:t})}),(e=>{a(e)})),o=t.fonts.subscribe((e=>{a({type:Mi,payload:e})}),(e=>{a(e)}));return()=>{i.unsubscribe(),o.unsubscribe()}}),l.buffers.sliding(2))}var sr=Object.freeze({__proto__:null,CartEvent:{UPDATE_CART_ITEM_MESSAGE:"UPDATE_CART_ITEM_MESSAGE",UPSERT_ALERT:"UPSERT_ALERT",DELETE_ALERT:"DELETE_ALERT",UPSERT_DELIVERY_DETAILS:"UPSERT_DELIVERY_DETAILS"}}),lr=Object.freeze({__proto__:null,PartnerMessage:{UpdateCartItem:"V2_UPDATE_CART_ITEM"},PlacementMessage:{CartItemUpdated:"V2_CART_ITEM_UPDATED"}}),cr=Object.freeze({__proto__:null,V1:sr,V2:lr}),dr=Object.freeze({__proto__:null,PartnerMessage:{CartItemInstantPurchaseResponse:"CART_ITEM_INSTANT_PURCHASE_RESPONSE"},PlacementMessage:{CartItemInstantPurchase:"CART_ITEM_INSTANT_PURCHASE"}}),ur=Object.freeze({__proto__:null,PartnerValidationEvent:{SET_PARTNER_VALIDATION_STATUS:"SET_PARTNER_VALIDATION_STATUS",OPT_IN_TO_PARTNER_VALIDATION:"OPT_IN_TO_PARTNER_VALIDATION",SHOW_PARTNER_VALIDATION_STATUS:"SHOW_PARTNER_VALIDATION_STATUS"}});const pr="LINK_NAVIGATION_REQUEST",fr="REALTIME_OFFER_FULFILLMENT_SUCCESS",yr="REALTIME_OFFER_FULFILLMENT_FAILURE";var hr=function(e,t,n,a){return new(n||(n=Promise))((function(i,o){function r(e){try{l(a.next(e))}catch(e){o(e)}}function s(e){try{l(a.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,s)}l((a=a.apply(e,t||[])).next())}))};const mr={newTab:"_blank",self:"_top",roktWebViewSDK:"roktWebViewSDK",inApp:"inApp",overrideLinkNavigation:"overrideLinkNavigation"};function vr({url:e,urlBehavior:t,external:n},a=window){return hr(this,void 0,void 0,(function*(){if(!e)return null;if("overrideLinkNavigation"===t)return n.partner.send(pr,{url:e}).then((()=>null));const i=mr[t];if(a.RoktWebViewSDK){const t=a.RoktWebViewSDK.open(e);return t?{ref:t}:null}if("_top"===i&&a.top)return a.top.location.href=e,null;const o=a.open(e,i);if(o)try{o.opener=null}catch(e){}return o?{ref:o}:null}))}var gr=Object.freeze({__proto__:null,openLink:vr});function br(e,t,n,a){const i=function(e){return"object"==typeof e&&null!=e&&"message"in e&&"string"==typeof e.message&&e.message.includes("timed out")}(e),o=i?{originErrorCode:n}:void 0;return{type:Qi,payload:{level:So,code:i?"COMMUNICATION_FAILURE_WITH_WSDK":n,message:t,additionalInformation:Object.assign(Object.assign({},o),a)}}}var Er=Object.freeze({__proto__:null,makePluginWarningAction:br});function Ir(e){return null!=e&&"object"==typeof e&&"ref"in e&&"object"==typeof e.ref&&!Array.isArray(e.ref)&&null!=e.ref}var Sr=Object.freeze({__proto__:null,isWindow:Ir}),xr=Object.assign(Object.assign(Object.assign({},gr),Er),Sr);function*Cr(e=10){(yield r.select((e=>e.signal.queue.length>0)))&&(yield c.delay(30),e>=1&&(yield*Cr(e-1)))}function*wr(e){try{yield*Cr(10),yield c.call(e.close)}catch(e){const t=xr.makePluginWarningAction(e,"Failed to close the plugin","FAILED_TO_CLOSE_PLUGIN");yield c.put(t)}}function*Or(e,{payload:t}){var n;if("string"==typeof(n=t.name)&&_.includes(n))switch(t.name){case"V2_CART_ITEM_UPDATED":case"CART_ITEM_INSTANT_PURCHASE":case"UPSELL_CREATIVE_SENT":case"INITIATE_INSTANT_PURCHASE_EVENT":case"REALTIME_OFFER_FULFILLMENT_REFERRAL":case"REALTIME_OFFER_FULFILLMENT_CONVERSION":case"REALTIME_OFFER_FULFILLMENT_SUCCESS":yield e.send(t.name,t.body);break;case"OFFER_ENGAGEMENT":case"PLACEMENT_CLOSED":case"PLACEMENT_COMPLETED":case"PLACEMENT_FAILURE":case"PLACEMENT_INTERACTIVE":case"POSITIVE_ENGAGEMENT":yield e.send(t.name);break;default:return}}const Tr=i.propOr("FAILED_TO_PARSE_CONFIG","code");function*Ar(e,t){var n;const a=yield c.call(rr,e.configService,e.themeService,t);for(;;)try{const e=yield c.take(a);yield c.put(e)}catch(e){const t=e;yield c.put({type:Qi,payload:{level:Eo,code:Tr(t),message:null!==(n=null==t?void 0:t.message)&&void 0!==n?n:"An error occured parsing or receiving Plugin config, fonts or configurables.",additionalInformation:{stack:null==t?void 0:t.stack}}})}}function*Rr(e,t){yield c.all([c.spawn(Ar,e,t),c.takeEvery(ee,Or,e.partnerInteractionService)])}function Nr(e){switch(e){case"ATTACHED":return bo;case"EMBEDDED":return go;default:return vo}}function*Lr(e,t){const n={preset:Nr(t)};yield c.call(e.setDisplaySettings,n),yield c.put({type:to.ACTIVE_ADD,payload:{id:io}})}function*_r(e,t){var n;const a=null!==(n=t.payload.data)&&void 0!==n?n:{};try{yield r.call(e,{code:t.payload.code,level:Io,message:t.payload.message||"Plugin Generic Log",additionalInformation:Ao(a)})}catch(e){}}function*jr(e){yield r.put({type:to.QUEUE_SIGNAL,payload:{signal:e.payload}}),yield r.put({type:Yi})}function*Dr(e){yield r.put({type:to.QUEUE_SIGNAL,payload:e.payload}),yield r.put({type:Yi})}function*kr(e,t){const n=yield r.select((e=>e.signal.queue.filter((t=>nr(e.signal,t.signal)))));if(Array.isArray(n)&&n.length)for(const e of n){const t="criteria"in e?e.criteria:void 0;switch(e.signal.name){case"SignalActivation":case"SignalLoadComplete":case"SignalImpression":yield*Pr(e.signal,a(t));break;case"SignalViewed":yield*$r(e.signal,a(t));break;case"SignalDismissal":yield*Fr(e.signal,a(t));break;case"SignalInstantPurchaseDismissal":yield*Gr(e.signal,a(t));break;case"SignalLoadStart":yield*Mr(e.signal,a(t));break;case"SignalGatedResponse":case"SignalResponse":yield*Br(e.signal,a(t,!0));break;case"SignalUserInteraction":yield*Ur(e.signal,a(t));break;case"SignalCartItemQuantitySelected":yield*Vr(e.signal,a(t));break;case"SignalCartItemInstantPurchaseInitiated":yield*zr(e.signal,a(t));break;case"SignalCartItemInstantPurchase":yield*qr(e.signal,a(t));break;case"SignalCartItemInstantPurchaseFailure":yield*Hr(e.signal,a(t))}yield r.put({type:to.SIGNAL_PROCESSED,payload:e.signal})}function a(t,n=!1){return function(a,i,o){return t?r.call(e.prepareExternalSignal,t.key,a,i,o):n?r.call(e.issueSignalSync,a,i,o):r.call(e.issueSignal,a,i,o)}}}function*Pr(e,t){let n;e.creativeInstanceGuid&&(n={},n.creativeInstanceGuid=e.creativeInstanceGuid);try{yield t(e.name,e.parentGuid,n)}catch(t){yield Wr(e,t)}}function*$r(e,t){try{yield t(e.name,e.parentGuid,{objectData:{supportedByBrowser:e.supportedByBrowser.toString()},metadata:[{name:"inferred",value:e.inferred.toString()}]})}catch(t){yield Wr(e,t)}}function*Fr(e,t){try{yield t(e.name,e.parentGuid,e.dismissalMethod?{objectData:{dismissalMethod:e.dismissalMethod}}:void 0)}catch(t){yield Wr(e,t)}}function*Gr(e,t){try{yield t(e.name,e.parentGuid,void 0)}catch(t){yield Wr(e,t)}}function*Mr(e,t){var n;const a={overrideTimestamp:null!==(n=e.overrideTimestamp)&&void 0!==n?n:new Date};try{yield t(e.name,e.parentGuid,a)}catch(t){yield Wr(e,t)}}function*Br(e,t){try{yield t(e.name,e.parentGuid,function(e){const t={creativeInstanceGuid:e.responseActionPayload.creativeInstanceGuid};"Url"===e.responseActionPayload.name&&(t.transformedTrafficURL=e.responseActionPayload.transformedTrafficURL);return t}(e))}catch(t){yield Wr(e,t)}}function*Ur(e,t){const n=e.parentGuid?e.parentGuid:yield r.select((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid}));try{if(!n||"string"!=typeof n)throw new Error(`Cannot raise SignalUserInteraction, missing or invalid parent GUID: ${JSON.stringify(e)}`);yield t(e.name,n,{objectData:{action:e.action,context:e.context}})}catch(t){yield Wr(e,t)}}function*Vr(e,t){const n={objectData:{preselected:e.objectData.preselected.toString(),quantity:e.objectData.quantity.toString()}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield Wr(e,t)}}function*zr(e,t){const n={objectData:{catalogItemId:e.objectData.catalogItemId,quantity:e.objectData.quantity.toString()}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield Wr(e,t)}}function*qr(e,t){const n={objectData:{catalogItemId:e.objectData.catalogItemId,quantity:e.objectData.quantity.toString(),initiatedBy:e.objectData.initiatedBy}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield Wr(e,t)}}function*Hr(e,t){const n={objectData:{catalogItemId:e.objectData.catalogItemId,quantity:e.objectData.quantity.toString(),failureReason:e.objectData.failureReason,providerId:e.objectData.providerId}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield Wr(e,t)}}function Wr(e,t){const n=xr.makePluginWarningAction(t,(null==t?void 0:t.message)||"Failed to issue signal","FAILED_TO_ISSUE_SIGNAL",{signalName:null==e?void 0:e.name,parentGuid:null==e?void 0:e.parentGuid,stack:null==t?void 0:t.stack});return r.put(n)}function*Jr(e){yield r.put({type:eo,payload:e.payload})}function*Kr(e,t){if("Interactive"===t.payload.name)try{yield*function*(e){const t="METRIC";(yield r.select((e=>e.serializableCache.has(t))))||(yield r.call(e.notifyInteractive),yield r.put({type:qi,payload:{key:t,value:"Interactive"}}))}(e)}catch(e){const t=e;yield*function*(e){var t;yield r.put({type:Qi,payload:{level:Io,code:Po,message:null!==(t=null==e?void 0:e.message)&&void 0!==t?t:"Failed to notify interactive",additionalInformation:{stack:null==e?void 0:e.stack}}})}(t)}}function*Yr(e,t){const n=e.context.getOverrideLinkNavigation()?"overrideLinkNavigation":t.payload.urlBehaviour;try{"inApp"===n?yield r.call(e.createChildPlugin,{name:"url-modal",config:{url:t.payload.url,method:"GET"}}):yield r.call(vr,{url:t.payload.url,urlBehavior:n,external:e})}catch(e){yield r.put(br(e,"Failed to open link",Do,{url:t.payload.url,urlBehaviour:n}))}}function*Zr(e){const t=yield r.select((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid}));yield r.put({type:to.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:Vi}),t?yield r.put({type:Z,payload:{name:"SignalDismissal",parentGuid:t,dismissalMethod:e.payload.dismissalMethod}}):yield r.put({type:Qi,payload:{level:Io,code:ko,message:"ParentGuid does not exist"}})}const Qr=a.connect((function(e){return{isOpen:e.active.has(ao)}})),Xr="undefined"!=typeof window;function es(e,n){t.useEffect((()=>{if(!Xr||n)return;const t=e.current;if(!t)return;const a=e=>{e.preventDefault()},i=["wheel","touchmove"];i.forEach((e=>{t.addEventListener(e,a,{passive:!1})}));const o=e=>{["ArrowUp","ArrowDown","PageUp","PageDown","Space"].includes(e.code)&&e.preventDefault()};return window.addEventListener("keydown",o),()=>{i.forEach((e=>{t.removeEventListener(e,a)})),window.removeEventListener("keydown",o)}}),[e,n])}const ts="Minimized",ns=()=>{const e=t.useRef(null),n=t.useRef(null),a=t.useRef(null),i=t.useRef(null),o=t.useRef(null),r=gt(0,(e=>e.customStates[ts])),s=mt(),l=An(),c=t.useRef(0),d=t.useRef(!1),u=t.useRef(0),p=t.useRef([]),f=t.useRef(void 0),{isDisabled:y}=m(l);es(e,!!r);const h=t.useCallback((()=>{D(),f.current=void 0,d.current=!1,L(!0);v()?S():N(0)}),[]),v=()=>{const e=R();return r?e<=-.2:e>=.2};t.useEffect((()=>{r?(C(),s(is(!0))):(w(),s(is(!1)))}),[r,s]),t.useEffect((()=>{requestAnimationFrame((()=>{j(!r,a),j(!!r,i),_()}))}),[]);const b=t.useCallback((e=>{if(n.current){e.preventDefault();const t=I(e);N(t)}}),[n]),E=t.useCallback((e=>{Date.now()-u.current<200||(u.current=Date.now(),r?x(!1):d.current||y||(d.current=!0,A(),f.current=as(e),L(!1),k()))}),[r,y]);t.useEffect((()=>{const e=n.current;return e&&(e.addEventListener("mousedown",E),e.addEventListener("touchstart",E)),()=>{null==e||e.removeEventListener("mousedown",E),null==e||e.removeEventListener("touchstart",E)}}),[n,E]);const I=e=>{var t,n;return(null!==(t=as(e))&&void 0!==t?t:0)-(null!==(n=f.current)&&void 0!==n?n:0)},S=()=>{x(!r)},x=e=>{const t=(e=>({type:X,payload:{key:ts,value:e?1:0}}))(e);t&&s(t)},C=()=>{var e,t,n,o;const r=null!==(t=null===(e=a.current)||void 0===e?void 0:e.clientHeight)&&void 0!==t?t:0,s=(null!==(o=null===(n=i.current)||void 0===n?void 0:n.clientHeight)&&void 0!==o?o:0)-r;L(!0),_(!0,!0),N(s),j(!1,a),j(!0,i),P()},w=()=>{L(!0),_(!0,!1),N(0),f.current=void 0,j(!0,a),j(!1,i),$()},O=t.useCallback((()=>{d.current&&(T(),requestAnimationFrame(O))}),[]),T=()=>{p.current.push({yPosition:c.current,timestamp:Date.now()}),p.current.length>20&&p.current.shift()},A=t.useCallback((()=>{p.current=[],O()}),[O]),R=()=>{const e=p.current;if(!e)return 0;const t=e[0],n=e[e.length-1];if(!t||!n)return 0;const a=n.timestamp-t.timestamp;return(n.yPosition-t.yPosition)/a},N=e=>{const t=Math.round(e);c.current=t,n.current&&(n.current.style.transform=`translateY(${t}px)`)},L=e=>{e?n.current&&(n.current.style.transition="transform .2s"):n.current&&(n.current.style.transition="")},_=(e,t=!1)=>{const n=t?i:a,o=t?a:i;o.current&&(o.current.style.transition="opacity .5s"),n.current&&(n.current.style.transition="opacity .2s")},j=(e,t)=>{const n=t.current;if(!n)return;const a=e?0:1;n.style.opacity=`${a}`,e?n.style.pointerEvents="none":setTimeout((()=>{n.style.pointerEvents="auto"}),400)},D=t.useCallback((()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",h),document.removeEventListener("touchmove",b),document.removeEventListener("touchend",h)}),[b,h]),k=t.useCallback((()=>{g()?(document.addEventListener("touchmove",b,{passive:!1}),document.addEventListener("touchend",h)):(document.addEventListener("mousemove",b,{passive:!1}),document.addEventListener("mouseup",h))}),[b,h]),P=()=>{const t=e.current;t&&(o.current=setTimeout((()=>{var e;const n=((null===(e=a.current)||void 0===e?void 0:e.clientHeight)||0)+1;t.style.height=n+"px"}),200))},$=()=>{o.current&&clearTimeout(o.current),e.current&&(e.current.style.height="100000px")};return{wrapperRef:e,containerRef:n,minimizedChildRef:a,maximizedChildRef:i}};function as(e){var t;return"touches"in e?null===(t=e.touches[0])||void 0===t?void 0:t.clientY:e.clientY}const is=e=>({type:Z,payload:{action:e?"BottomSheetMinimized":"BottomSheetMaximized",name:"SignalUserInteraction",context:"BottomSheetMinimized"}}),os={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var rs;function ss({schema:n,testId:o}){const r=ue(),s=a.useSelector((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid})),l=a.useSelector((e=>e.active.has(io))),c=t.useRef(null),d=a.useDispatch(),u=()=>{d({type:no.DISMISS_OVERLAY,payload:{id:ao,dismissalMethod:"rokt_backdrop"}})},p=gt(0,(e=>e.customStates[ts]));t.useEffect((()=>{f(!!p)}),[p]),es(c,!!p);const f=e=>{const t=c.current;t&&(e?t.style.opacity="0":(t.style.display="flex",t.style.opacity="1"))};t.useEffect((()=>{s&&d({type:Z,payload:{name:"SignalActivation",parentGuid:s}})}),[s]),t.useEffect((()=>{l&&requestAnimationFrame((()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.focus()}))}),[l]);const y=An(),{tabIndex:h,isDisabled:v,styles:g}=m(y),b=n.styles?i.mergeRight(os,n.styles):os;return e.jsx(Ta,{styles:b,children:({classnames:t})=>{var a;return e.jsx("div",{className:null==t?void 0:t.wrapper,style:Object.assign({height:"100%",top:"0",right:"0",bottom:"0",left:"0",zIndex:"9998",overflow:"hidden",display:"flex",opacity:"1",transition:"opacity 0.2s ease-in-out"},g),"aria-label":null!==(a=n.a11yLabel)&&void 0!==a?a:void 0,"aria-hidden":v,role:"dialog","aria-modal":!0,tabIndex:h,"data-testid":o,"data-e2e":"Overlay-Wrapper",ref:c,children:e.jsx("div",{style:{position:"fixed",top:"0",right:"0",bottom:"0",left:"0",zIndex:"1"},onClick:n.allowBackdropToClose?u:void 0,"data-testid":o&&`${o}-backdrop`,"data-e2e":"Overlay-Backdrop"})})}})}function ls(){return e.jsx("div",{style:{width:"48px",height:"4px",backgroundColor:"#C6C6C8",borderRadius:"2px",margin:"0 auto -4px",position:"relative",top:"6px"}})}!function(e){e[e.BottomSheet=0]="BottomSheet",e[e.Overlay=1]="Overlay"}(rs||(rs={}));const cs={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};function ds(t){const n=a.useSelector((e=>e.slots)),i=a.useSelector((e=>{var t,n;return null!==(n=null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex)&&void 0!==n?n:0}));return e.jsx(us,Object.assign({},t,{slots:n,currentIndex:i}))}function us(t){const{wrapperRef:n,containerRef:a,minimizedChildRef:i,maximizedChildRef:o}=ns();return t.isOpen?e.jsxs("div",{ref:n,style:{height:"100000px"},children:[e.jsx(ss,Object.assign({},t)),e.jsx(fs,Object.assign({},t,{containerRef:a,minimizedChildRef:i,maximizedChildRef:o}))]}):null}const ps=o.css`
57
+ `}}(r,l);if(!d)throw new Error("No custom state key provided for state trigger node.");const x={type:X,payload:{key:d,value:null!=u?u:1}},C={type:Z,payload:{name:"SignalUserInteraction",action:"Swipe",context:"SlideStateTrigger"}},w=e.schema.styles?M(ni,e.schema.styles):ni,O=t.useRef(null),T=t.useRef(null),A=t.useRef(null),R=t.useRef(!1),N=t.useRef(void 0),{isDisabled:_}=m(s);t.useEffect((()=>{if(n)return g()?(document.addEventListener("touchmove",D),document.addEventListener("touchend",L)):(document.addEventListener("mousemove",D),document.addEventListener("mouseup",L)),G}),[n]);const L=()=>{G(),N.current=void 0,a(!1),i||(F(!0),R.current?($(P()),k()):$(0))},j=e=>{n||i||_||(N.current=oi(e),F(!1),a(!0))},D=e=>{var t,n;if(ii(A)){const a=Math.min(Math.max(0,(null!==(t=oi(e))&&void 0!==t?t:0)-(null!==(n=N.current)&&void 0!==n?n:0)),P());$(a),a/P()*100>=75?R.current=!0:R.current=!1}},k=()=>{var e,t;o(!0),c(x),c(C),null===(t=null===(e=ii(O).parentElement)||void 0===e?void 0:e.parentElement)||void 0===t||t.focus()},P=()=>ii(O).getBoundingClientRect().width-ii(A).getBoundingClientRect().width,$=e=>{var t;ii(A).style.transform=`translateX(${e}px)`,ii(T).style.transform=`translateX(${e+(null===(t=ii(A))||void 0===t?void 0:t.getBoundingClientRect().width)/2}px)`},F=e=>{e?(ii(A).style.transition="transform .2s",ii(T).style.transition="transform .2s"):(ii(A).style.transition="",ii(T).style.transition="")},G=()=>{document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",L),document.removeEventListener("touchmove",D),document.removeEventListener("touchend",L)};return t.createElement(Aa,{styles:w},(({classnames:n})=>{var a,o,r,s,l,c;return t.createElement("div",{className:`${h}`,"data-testid":e.testId,"data-e2e":"SlideStateTrigger"},t.createElement("div",{className:`${v} ${null!==(a=null==n?void 0:n.own)&&void 0!==a?a:""}`,ref:O,"aria-hidden":!0,"data-testid":e.testId&&`${e.testId}-track`},(null==p?void 0:p.value)?t.createElement("div",{className:`${I} ${null!==(o=null==n?void 0:n.label)&&void 0!==o?o:""}`,"data-testid":e.testId&&`${e.testId}-label`},p.value):null,t.createElement("div",{className:`${b} ${null!==(r=null==n?void 0:n.fill)&&void 0!==r?r:""}`,ref:T,"data-testid":e.testId&&`${e.testId}-fill`}),t.createElement("div",{className:`${E} ${null!==(s=null==n?void 0:n.thumb)&&void 0!==s?s:""}`,ref:A,"data-testid":e.testId&&`${e.testId}-thumb`,"data-e2e":"SlideStateTrigger-thumb",onMouseDown:j,onTouchStart:j},null!==(l=null==y?void 0:y.icon)&&void 0!==l?l:"ArrowForward")),t.createElement("button",{className:S,"aria-label":null!=f?f:void 0,onClick:k,disabled:i||_,"data-testid":e.testId&&`${e.testId}-button`},null!==(c=null==p?void 0:p.value)&&void 0!==c?c:"Unlock Offers"))}))}function ii(e){if(!e.current)throw new Error("Unexpected missing reference to required SlideStateTrigger Element");return e.current}function oi(e){var t;return"touches"in e?null===(t=e.touches[0])||void 0===t?void 0:t.clientX:e.clientX}function ri(e){const n=St();return t.createElement(Aa,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:a?a.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"row",flexWrap:"wrap"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,U(a,e.testId))))))}))}function si(e){const n=Rn(),a=vt(),i=e.schema.customStateKey,o=bt(0,(e=>e.customStates[i])),{tabIndex:r,styles:s,isDisabled:l}=m(n),c=()=>{a({type:X,payload:{key:i,value:o?0:1}})};return t.createElement(Aa,{styles:e.schema.styles},(({classnames:n})=>{var a;return t.createElement("button",{className:null==n?void 0:n.own,onClick:c,"data-testid":e.testId,"data-e2e":"ToggleButtonStateTrigger",disabled:l,"aria-disabled":l,"aria-label":null!==(a=e.schema.a11yLabel)&&void 0!==a?a:void 0,tabIndex:r,style:Object.assign({cursor:"pointer"},s)},t.createElement(It,null,(n=>t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0)))))))}))}function li(e){const n=St();return t.createElement(Aa,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:a?a.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"row",overflowX:"auto"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,U(a,e.testId))))))}))}function ci(e){const n=St();return t.createElement(Aa,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:a?a.own:void 0,"data-testid":e.testId,style:{display:"flex",flexDirection:"column",overflowY:"auto"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,U(a,e.testId))))))}))}const di=t.createContext({extensions:{ctx:new Map,cache:[]}}),ui=()=>t.useContext(di).extensions;function pi({extensions:e,extendStore:n,children:a}){const i=ui(),o=new Map([...i.ctx,...e.ctx]),r=i.cache.concat(e.cache);return t.createElement(di.Provider,{value:{extensions:{ctx:o,cache:r},extendStore:n}},a)}function fi(e,t){const n=function(e){try{const t=JSON.parse(e);if(null!=t&&"object"==typeof t&&"type"in t&&"Extension"===t.type&&"name"in t&&"string"==typeof t.name&&t.name.trim().length>0&&"body"in t&&"object"==typeof t.body)return{type:"Extension",name:t.name,body:t.body}}catch(e){}return null}(t),a=n?e.ctx.get(n.name):null;return n&&a?[n,a]:null}function yi({data:e}){const n=fi(ui(),e);var a;if((e=>{const{extendStore:n,extensions:a}=t.useContext(di);t.useEffect((()=>{e&&n&&!a.cache.includes(e.name)&&(n(e),a.cache.push(e.name))}),[e,a.cache,n])})((a=null==n?void 0:n[1])?{sagas:a.sagas,reducer:a.reducer,name:a.name,interceptors:a.interceptors}:void 0),n){const[e,t]=n;return t.componentFactory(e.body)}return null}function hi(e,n){if(v("Extension",e))return t.createElement(yi,{data:e.node.data})}function mi(e){const n=kn(),a=At(),i=Yt(),o=St(),r=vt(),s=t.useMemo((()=>a.catalogItems||[]),[a]),l=e=>i({data:e},"catalogItem");return t.useEffect((()=>{for(const e of s)r({type:Z,payload:{name:"SignalImpression",parentGuid:e.instanceGuid}})}),[s,r]),s.length>0?t.createElement(Aa,{styles:e.schema.styles},(({classnames:a})=>t.createElement("div",{"data-testid":e.testId,"data-e2e":"CatalogStackedCollection",className:null==a?void 0:a.own,style:{display:"flex",flexDirection:"column"}},t.Children.toArray(s.map(((a,i)=>t.createElement(Gn,{context:a},t.createElement(Dn,{value:n(a)},t.createElement(Jt,{value:l(a)},o(e.schema.template,void 0,U(i,e.testId))))))))))):null}const vi={BasicText:(e,t)=>Ga(e,t,!0),StaticLink:(e,t)=>Za(e,t,!0)};function gi(e){const n=St();return t.createElement(xt,{value:n,overrides:vi},t.createElement(It,null,(n=>t.createElement(Aa,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:null==a?void 0:a.own,"data-testid":e.testId,"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,U(a,e.testId))))))})))))}function bi(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,U(t,a)))))}function Ei(e){const n=Rn(),a=vt(),o=St(),r=Yt(),{event:s}=e.schema,{tabIndex:l,styles:c,isDisabled:d}=m(n),u=i.mapObjIndexed((e=>r(e)),s.data||{}),p=()=>{a({type:ee,payload:{name:s.type,body:{offerId:u.providerOfferId,title:u.title,description:u.description}}})};return t.createElement(Aa,{styles:e.schema.styles},(({classnames:n,mapperRef:a})=>{var i;return t.createElement("button",{"aria-disabled":d,"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0,className:null==n?void 0:n.own,"data-e2e":"PartnerEventButtonTrigger","data-testid":e.testId,disabled:d,onClick:p,tabIndex:l,type:"button",style:Object.assign({cursor:"pointer"},c)},t.createElement(Jt,{value:r},(null==n?void 0:n.own)?function(e,n,a,i,o){return t.createElement(Zt,{value:a(n)},bi(e,i,o))}(e.schema.children,n.own,a,o,e.testId):bi(e.schema.children,o,e.testId)))}))}function Ii(e){const n=vt(),a=e.schema.delay?e.schema.delay:1,i=e.schema.customStateKey,o=bt(0,(e=>e.customStates[i]));return function({delay:e,callback:n}){const a=t.useRef(null);t.useEffect((()=>{a.current=setTimeout(n,e)}),[])}({delay:a,callback:()=>{n({type:X,payload:{key:i,value:o?0:1}})}}),null}function Si(e){const n=Rn(),a=Yt()(e.schema.value),i=vt(),o=e.schema.customStateKey,r=bt(0,(e=>e.customStates[o])),{tabIndex:s,styles:l,isDisabled:c}=m(n),d=()=>{navigator.clipboard.writeText(a),r||i({type:X,payload:{key:o,value:1}})};return t.createElement(Aa,{styles:e.schema.styles},(({classnames:n})=>{var a;return t.createElement("button",{className:null==n?void 0:n.own,onClick:d,"data-testid":e.testId,"data-e2e":"CopyToClipboardButton",disabled:c,"aria-disabled":c,"aria-label":null!==(a=e.schema.a11yLabel)&&void 0!==a?a:void 0,tabIndex:s,style:Object.assign({cursor:"pointer"},l)},t.createElement(It,null,(n=>t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0)))))))}))}function xi(e){const n=Rn(),a=vt(),{customStateKey:i,value:o}=e.schema,{tabIndex:r,styles:s,isDisabled:l}=m(n),c=()=>{a({type:X,payload:{key:i,value:o}})};return t.createElement(Aa,{styles:e.schema.styles},(({classnames:n})=>{var a;return t.createElement("button",{className:null==n?void 0:n.own,onClick:c,"data-testid":e.testId,"data-e2e":"ButtonStateTrigger",disabled:l,"aria-disabled":l,"aria-label":null!==(a=e.schema.a11yLabel)&&void 0!==a?a:void 0,tabIndex:r,style:Object.assign({backgroundColor:"transparent",cursor:"pointer",margin:0,padding:0},s)},t.createElement(It,null,(n=>t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0)))))))}))}function Ci(e){return()=>{throw new _("FAILED_CREATING_UNHANDLED_NODE",`The default mapper does not handle the ${e} node. Make sure when you use the NodeMapperProvider, you pass an override for ${e} node.`)}}const wi={Column:function(e,n){if("Column"===e.type)return t.createElement(Ra,{schema:e.node,testId:n})},Row:function(e,n){if("Row"===e.type)return t.createElement(Na,{schema:e.node,testId:n})},StaticImage:function(e,n){if("StaticImage"===e.type)return t.createElement(Ua,{schema:e.node,testId:n})},DataImage:function(e,n){if("DataImage"===e.type)return t.createElement(Va,{schema:e.node,testId:n})},CreativeResponse:function(e,n){if("CreativeResponse"===e.type)return t.createElement(Ba,{schema:e.node,testId:n})},OneByOneDistribution:Ci("OneByOneDistribution"),StackedDistribution:Ci("StackedDistribution"),CarouselDistribution:Ci("CarouselDistribution"),GroupedDistribution:Ci("GroupedDistribution"),ProgressIndicator:Ci("ProgressIndicator"),ProgressControl:Ci("ProgressControl"),When:function(e,n){if("When"===e.type)return t.createElement(Oa,{schema:e.node,testId:n})},Overlay:Ci("Overlay"),CloseButton:Ci("CloseButton"),RichText:function(e,n){if("RichText"===e.type)return t.createElement($a,{schema:e.node,testId:n})},BasicText:Ga,StaticLink:Za,DataIcon:function(e,n){if("DataIcon"===e.type)return t.createElement(Xa,{schema:e.node,testId:n})},StaticIcon:function(e,n){if("StaticIcon"===e.type)return t.createElement(Ha,{schema:e.node,testId:n})},ZStack:function(e,n){if("ZStack"===e.type)return t.createElement(ti,{schema:e.node,testId:n})},FlowRow:function(e,n){if("FlowRow"===e.type)return t.createElement(ri,{schema:e.node,testId:n})},SlideStateTrigger:function(e,n){if("SlideStateTrigger"===e.type)return t.createElement(ai,{schema:e.node,testId:n})},ToggleButtonStateTrigger:function(e,n){if("ToggleButtonStateTrigger"===e.type)return t.createElement(si,{schema:e.node,testId:n})},PartnerEventButtonTrigger:function(e,n){if("PartnerEventButtonTrigger"===e.type)return t.createElement(Ei,{schema:e.node,testId:n})},TimerStateTrigger:function(e,n){if("TimerStateTrigger"===e.type)return t.createElement(Ii,{schema:e.node})},CatalogStackedCollection:function(e,n){if("CatalogStackedCollection"===e.type)return t.createElement(mi,{schema:e.node,testId:n})},CatalogResponseButton:Ci("CatalogResponseButton"),ScrollableRow:function(e,n){if("ScrollableRow"===e.type)return t.createElement(li,{schema:e.node,testId:n})},ScrollableColumn:function(e,n){if("ScrollableColumn"===e.type)return t.createElement(ci,{schema:e.node,testId:n})},EscapeHatch:hi,BottomSheet:Ci("BottomSheet"),CatalogQuantityOption:Ci("CatalogQuantityOption"),CatalogRadioGroup:Ci("CatalogRadioGroup"),CatalogQuantityCounter:Ci("CatalogQuantityCounter"),InlineContainer:function(e,n){if("InlineContainer"===e.type)return t.createElement(gi,{schema:e.node,testId:n})},CopyToClipboardButton:function(e,n){if("CopyToClipboardButton"===e.type)return t.createElement(Si,{schema:e.node,testId:n})},ButtonStateTrigger:function(e,n){if("ButtonStateTrigger"===e.type)return t.createElement(xi,{schema:e.node,testId:n})},CatalogCombinedCollection:Ci("CatalogCombinedCollection")};function Oi(e){return function(n,a,i){const o=a&&a[n.type],r=null!=o?o:wi[n.type];return t.createElement(Wa,{schema:n,reporter:e},r&&r(n,i)||function(e){throw new _("FAILED_CREATING_LAYOUT_NODE",`Failed to create layout node ${JSON.stringify(e)}`)}(n))}}const Ti={transformLinksToAnchorText:function(e={}){return{data:i.mapObjIndexed((e=>Lt(e)?`<a target="_blank" href="${e.url}">${e.title}</a>`:""),e)}}};function Ai(e){const{childLayouts:n}=e,a=vt(),[o,r]=t.useMemo((()=>{const e=i.indexBy(i.prop("childLayoutId"),n);return[e,i.mapObjIndexed((e=>e.childLayoutSchema.predicates),e)]}),[n]),s=ga(r);t.useEffect((()=>{Object.entries(s).forEach((([e,t])=>{const n=o[e];t&&n&&a({type:re,payload:n})}))}),[s,o,a])}function Ri(e){const{settings:n,dispatch:a,children:i}=e,o=zt(n.offerData.creative.copy||{})(Ti.transformLinksToAnchorText(n.offerData.creative.links),"creativeLink"),r=Oi(n.logger),[s,l]=t.useState("ENABLED");return t.useEffect((()=>n.gateway.onInteractivityChange(l)),[n]),de(n.rootElement,a),t.createElement(Qt.Provider,{value:"VARIANT"},t.createElement(Ct.Provider,{value:n.rootElement},t.createElement(Bn.Provider,{value:n.pluginId},t.createElement(Cn,{context:n.gateway},t.createElement(On,{context:n.layoutSchema},t.createElement(Vn.Provider,{value:n.schemaVersion},t.createElement(Tt,{context:n.offerData},t.createElement(Dn,{value:Nn(n.offerData.creative)},t.createElement(An.Provider,{value:s},t.createElement(xt,{value:r},t.createElement(en.Provider,{value:n.offerPositionIndex},t.createElement(mt.Provider,{value:a},t.createElement(Jt,{value:o},t.createElement(Ni,null,t.createElement(Ai,{childLayouts:n.childLayouts}),i))))))))))))))}function Ni(e){var n;const{children:a}=e,o=Un(),r=function(){const[e,n]=t.useState(null),a=t.useContext(xn).get();return t.useEffect((()=>a.onGlobalStateChange((t=>{i.equals(t,e)||n(t)}))),[a]),e}(),s=t.useContext(Ct)||void 0,l=tn(),c=t.useCallback((e=>yt(e,o,l,s)),[s]);return r?t.createElement(Zt,{value:c(Object.values(null!==(n=null==r?void 0:r.breakpoint.breakpoints)&&void 0!==n?n:{}))},t.createElement(gt.Provider,{value:r},a)):null}function _i(e){return t.createElement("style",{"data-testid":e.testId},"\n* {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n}\nbody {\n margin: 0;\n font-family: sans-serif;\n}\np {\n margin: 0;\n}\nimg {\n max-width: 100%;\n}\n")}function Li(e,t,n,a,i,o){if("animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype){o.current.isRunning=!0,i&&"in"===t&&function(e,t){e.style.height=`${t.clientHeight}px`}(i,e);const r=e.animate(n,{duration:a,iterations:1});return r.onfinish=()=>{"in"===t?ba(e):Ea(e),o.current.isRunning=!1},r.oncancel=()=>{"in"===t?ba(e):Ea(e),o.current.isRunning=!1},()=>{r.finish()}}return"in"===t?ba(e):Ea(e),()=>{}}const ji={FadeInOut:{in:[{opacity:0,display:"none"},{opacity:0,display:"none",offset:.5},{opacity:0,display:"block",offset:.5},{opacity:0,display:"block",offset:.625},{opacity:1,display:"block"}],out:[{opacity:1},{opacity:0,offset:.75},{opacity:0}]}};function Di({visible:e,effect:n,children:a,parentElement:i,containerClassName:o}){const[r,s]=t.useState(e),l=t.useRef(null),c=t.useRef({isRunning:!1}),d=Ia(n);return t.useEffect((()=>{const t=new ResizeObserver((function(t){i&&e&&!c.current.isRunning&&t.forEach((e=>{e.contentBoxSize?function(e,t){var n;Array.isArray(e.contentBoxSize)&&e.contentBoxSize[0]?t.style.height=e.contentBoxSize[0].blockSize+"px":"object"==typeof(n=e.contentBoxSize)&&null!=n&&"blockSize"in n&&"number"==typeof n.blockSize&&"inlineSize"in n&&"number"==typeof n.inlineSize?t.style.height=e.contentBoxSize.blockSize+"px":t.style.height="auto"}(e,i):e.contentRect&&function(e,t){t.style.height=`${e.contentRect.height}px`}(e,i)}))}));return e&&l.current&&(ba(l.current),t.observe(l.current)),()=>{t.disconnect()}}),[e,i]),t.useEffect((()=>e&&!r&&l.current&&i?(s(!0),Li(l.current,"in",ji[n.type].in,d,i,c)):!e&&r&&l.current&&i?(s(!1),Li(l.current,"out",ji[n.type].out,d/2,i,c)):()=>{}),[e,i,d]),t.createElement("div",{ref:l,style:{display:"none"},className:o},a)}function ki(e){const n=St();return t.createElement(Aa,{styles:e.schema.styles},(({classnames:a})=>{var i;return t.createElement("div",{className:null==a?void 0:a.own,"data-testid":e.testId,style:{display:"flex",flexDirection:"column"},"aria-label":null!==(i=e.schema.a11yLabel)&&void 0!==i?i:void 0},n(e.schema.template))}))}const Pi="ACTIVE/ADD",$i="ACTIVE/DELETE",Fi="BREAKPOINT/UPDATE_ACTIVE",Gi="BREAKPOINT/INITIALISE",Mi="BREAKPOINT/SET_BREAKPOINTS",Bi="FONTS/SET",Ui="LAYOUT/UPDATE",Vi="CONFIG/HANDLE",zi="PLUGIN/CLOSE_PLUGIN",Hi="SETTINGS/SET",qi="CACHE/ADD_SERIALIZED_VALUE",Wi="CACHE/UPDATE_SERIALIZED_VALUE",Ji="CACHE/CLEAR_SERIALIZED_VALUE",Yi="SIGNAL/QUEUE",Ki="SIGNAL/PROCESSED",Zi="SIGNAL/PROCESS",Qi="OVERLAY/DISMISS_OVERLAY",Xi="ERROR/REPORT",eo="LOG",to="CUSTOM_STATES/SET",no={LAYOUT_UPDATE:Ui,UPDATE_ACTIVE_BREAKPOINT:Fi,INITIALISE_BREAKPOINT:Gi,ACTIVE_ADD:Pi,ACTIVE_DELETE:$i,SET_FONTS:Bi,QUEUE_SIGNAL:Yi,SIGNAL_PROCESSED:Ki,CACHE_SERIALIZED_VALUE:qi,UPDATE_CACHED_SERIALIZED_VALUE:Wi,CLEAR_SERIALIZED_VALUE_FROM_CACHE:Ji,SET_SETTINGS:Hi,SET_CUSTOM_STATE:to},ao={HANDLE_CONFIG:Vi,SET_BREAKPOINTS:Mi,CLOSE_PLUGIN:zi,RAISE_METRIC:V,PREPARE_SIGNAL:ne,DISMISS_OVERLAY:Qi,REPORT_ERROR:Xi,LOG:eo,OPEN_LINK:ae},io="plugin-overlay",oo="plugin";function ro(n){var i;const o=n.schema.styles,r=a.useDispatch(),s={type:(null===(i=n.action)||void 0===i?void 0:i.type)||Qi,payload:{id:io,dismissalMethod:n.schema.dismissalMethod}},l=()=>{r(s)},c=Rn(),{tabIndex:d,styles:u,isDisabled:p}=m(c);return e.jsx(Aa,{styles:o,children:({classnames:a})=>{var i;return e.jsx("button",{title:"Close",className:null==a?void 0:a.own,onClick:l,"data-testid":n.testId,"data-e2e":"CloseButton",disabled:p,tabIndex:d,"aria-disabled":p,"aria-label":null!==(i=n.schema.a11yLabel)&&void 0!==i?i:void 0,style:Object.assign({cursor:"pointer"},u),children:e.jsx(It,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}const so={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var lo;function co({isOpen:n,schema:o,testId:r,children:s}){const l=ue(),c=a.useSelector((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid})),d=a.useSelector((e=>e.active.has(oo))),u=a.useDispatch(),p=()=>{u({type:ao.DISMISS_OVERLAY,payload:{id:io,dismissalMethod:"rokt_backdrop"}})};t.useEffect((()=>{c&&u({type:Z,payload:{name:"SignalActivation",parentGuid:c}})}),[c]),t.useEffect((()=>{d&&requestAnimationFrame((()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.focus()}))}),[d]);const f=Rn(),{tabIndex:y,isDisabled:h,styles:v}=m(f),g=o.styles?i.mergeRight(so,o.styles):so;if(!n)return null;const b=e.jsx(It,{children:e=>t.Children.toArray(o.children.map(((t,n)=>e(t,void 0,r?`${r}-child${n}`:void 0))))});return e.jsx(Aa,{styles:g,children:({classnames:t})=>{var n;return e.jsxs("div",{className:null==t?void 0:t.wrapper,style:Object.assign({position:"fixed",top:"0",right:"0",bottom:"0",left:"0",zIndex:"9999",display:"flex",overflow:"auto"},v),"aria-label":null!==(n=o.a11yLabel)&&void 0!==n?n:void 0,"aria-hidden":h,role:"dialog","aria-modal":!0,tabIndex:y,"data-testid":r,"data-e2e":"Overlay-Wrapper",children:[e.jsx("div",{style:{position:"fixed",top:"0",right:"0",bottom:"0",left:"0",zIndex:"1"},onClick:o.allowBackdropToClose?p:void 0,"data-testid":r&&`${r}-backdrop`,"data-e2e":"Overlay-Backdrop"}),s(b,l)]})}})}!function(e){e[e.BottomSheet=0]="BottomSheet",e[e.Overlay=1]="Overlay"}(lo||(lo={}));const uo={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const po=t.forwardRef((function({schema:t,testId:n,children:a},o){const r=t.styles?i.mergeRight(uo,t.styles):uo;return e.jsx(Aa,{styles:r,children:({classnames:t})=>e.jsx("div",{className:null==t?void 0:t.own,style:{position:"relative",zIndex:"3",outline:"none"},ref:o,tabIndex:-1,"data-e2e":"Overlay-Container","data-testid":n&&`${n}-container`,children:a})})}));const fo=a.connect((function(e){return{isOpen:e.active.has(io)}}))((function(t){return e.jsx(co,Object.assign({},t,{children:(n,a)=>e.jsx(po,Object.assign({},t,{ref:a,children:n}))}))}));const yo=a.connect((function(e){return{isOpen:e.active.has(io)}})),ho={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const mo=t.forwardRef((function({schema:n,testId:a,children:o},r){const s=t.useRef(null),l=n.styles?i.mergeRight(ho,n.styles):ho;return t.useEffect((()=>{if(s.current)return function(e){const t=requestAnimationFrame((()=>{e&&e.style.setProperty("max-height","100%")}));return()=>{cancelAnimationFrame(t)}}(s.current)}),[]),e.jsx(Aa,{styles:l,children:({classnames:t})=>e.jsx("div",{style:{width:"100%",maxHeight:"0%",transition:"max-height 0.8s",transitionTimingFunction:"cubic-bezier(0.05, 0.7, 0.1, 1.0)",alignSelf:"flex-end"},ref:s,children:e.jsx("div",{className:null==t?void 0:t.own,style:{position:"relative",zIndex:"3",outline:"none",borderBottomLeftRadius:"0",borderBottomRightRadius:"0"},ref:r,tabIndex:-1,"data-testid":a&&`${a}-container`,"data-e2e":"BottomSheet-Container",children:o})})})}));const vo=yo((function(t){const n=a.useSelector((e=>e.breakpoint.activeBreakpoint));return e.jsx(co,Object.assign({},t,{children:(a,i)=>"default"===n?e.jsx(mo,Object.assign({},t,{ref:i,children:a})):e.jsx(po,Object.assign({},t,{ref:i,children:a}))}))}));const go="DisplayPreset.FULLSCREEN",bo="DisplayPreset.EMBEDDED",Eo="DisplayPreset.ATTACHED",Io="ERROR",So="INFO",xo="WARNING";var Co;!function(e){e.PAYPAL="Paypal"}(Co||(Co={}));const wo="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DCUI_SCHEMA_VERSION:"",ROKT_DOMAIN:""};function*Oo(e,t,n){(function(e){return"object"==typeof e&&null!==e&&"type"in e&&Object.values(se).includes(e.type)})(n)&&!e.includes(n.type)&&(yield r.call(t.globalDispatch.bind(t),n))}function To(e,t){return!e||t<1?null:{cartItemId:e.cartItemId,catalogItemId:e.catalogItemId,name:e.title,description:e.description,quantity:t,currency:e.currency||"$",unitPrice:e.price||0,totalPrice:(e.price||0)*t,linkedProductId:e.linkedProductId,quantityMustBeSynchronized:e.quantityMustBeSynchronized,providerData:e.providerData||""}}function Ao(e){switch(typeof e){case"undefined":return"";case"object":return null===e?"":JSON.stringify(e);case"string":return e;default:return String(e)}}function Ro(e){return i.map(Ao,e)}function*No(e,t){const n=yield r.actionChannel(e,l.buffers.expanding(10));for(;n;){const e=yield r.take(n);yield r.call(t,e)}}function*_o(e,t){const n=yield r.take(e);yield r.call(t,n)}function*Lo(e){for(;;){const t=yield r.take(e);yield r.put(t)}}function*jo(e,t){const n=i.over(i.lensProp("moduleName"),i.defaultTo("orchestrator"),t.payload.additionalInformation||{}),a=Object.assign(Object.assign({},t.payload),{additionalInformation:n?Ro(n):{}});try{yield r.call(e,a)}catch(e){}t.payload.level===Io&&(yield r.put({type:ee,payload:{name:"PLACEMENT_FAILURE"}}),yield r.put({type:ao.CLOSE_PLUGIN}))}const Do="INVALID_RESPONSE_OBJECT",ko="FAILED_TO_OPEN_LINK",Po="NO_PARENT_GUID",$o="FAILED_TO_NOTIFY_INTERACTIVE",Fo="FAILED_TO_ESTABLISH_PARTNER_VALIDATION";var Go=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)t.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(n[a[i]]=e[a[i]])}return n};function Mo(e,t){return n=>n&&n.replace(e,t)}const Bo=Mo(/['""();{}@:[\]!/=]/g,""),Uo=/^(normal|italic|oblique( \d+deg)*)$/i,Vo=(e="")=>Uo.test(e)?e:void 0,zo=Mo(/[;{}@[\]!]/g,"");function Ho(e){const{fontFamily:t,sources:n}=e,a=Go(e,["fontFamily","sources"]),i=document.fonts,o=new FontFace(t,n.join(", "),a);return i.add(o),o.load().catch((e=>(i.delete(o),Promise.reject(e))))}function qo(e=[]){const t=Array.from(document.fonts.values());return Promise.all(e.map((e=>{const n=function(e){return{fontFamily:Bo(e.fontFamily)||"",style:Vo(e.style),weight:Bo(e.weight),sources:e.sources.map((e=>zo(e)||"")),display:e.display}}(e);return t.find((e=>e.family===n.fontFamily&&e.weight===n.weight&&(e.style===n.style||!n.style)))?Promise.resolve():Ho(n).then((()=>{})).catch((e=>`${e}`.includes("SyntaxError")?(n.fontFamily='"'+n.fontFamily+'"',Ho(n).then((()=>{}))):Promise.reject(e))).catch((e=>Promise.resolve(`Error loading font: [Font (${JSON.stringify(n)})] [Message - ${e}]`)))}))).then((e=>{const t=e.filter(Boolean);return t.length>0?Promise.reject(t):Promise.resolve()}))}function Wo(e){const n=a.useDispatch(),i=a.useSelector((e=>{const t=e.fonts.map((e=>({fontFamily:e.fontFamily,style:e.fontStyle||"normal",weight:e.fontWeight,sources:e.src}))),n=t.find((e=>"rokt-icons"===e.fontFamily));if(n)n.display="block";else{const e=null!==(a=wo.ROKT_DOMAIN)&&void 0!==a?a:"";t.push(function(e=""){return{fontFamily:"rokt-icons",weight:"400",sources:[`url("${e}/icons/rokt-icons.woff") format("woff")`],display:"block"}}(e))}var a;return JSON.stringify(t)}));return t.useEffect((()=>{qo(JSON.parse(i)).catch((e=>{const t={type:Xi,payload:{level:So,code:"FAILED_TO_LOAD_FONT",message:`Error loading fonts:\n\t${e.join("\n\t")}`}};n(t)}))}),[i]),t.useEffect((()=>{const e=()=>{var e,t;null===(t=null===(e=window.frameElement)||void 0===e?void 0:e.iFrameResizer)||void 0===t||t.resize()};return document.fonts.addEventListener("loadingdone",e),()=>{document.fonts.removeEventListener("loadingdone",e)}}),[]),null}function Jo(e){return null!=e?e:null}function Yo(){return new Set([io])}function Ko(e){return e.breakpoint.breakpoints[e.breakpoint.activeBreakpoint]||0}const Zo=i.sortBy(i.prop(1)),Qo=i.map(i.prop(0)),Xo=e=>i.compose(i.findIndex(i.equals(e)),Qo,Zo,i.toPairs,i.pathOr({},["breakpoint","breakpoints"]));function er(e){return Xo(e.breakpoint.activeBreakpoint)(e)}function tr(e,t){return e.customStates[`module${t}`]||{}}function nr(e){return`${e.name}:${e.parentGuid}`}function ar(e,t){return!e.processed.includes(nr(t))||(n=t.name,void 0!==A.find((e=>e===n)));var n}function ir(){return new Map}const or={layout:function(e=Jo(),t){return t.type===Ui?t.payload:e},breakpoint:function(e={breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},t){var n;switch(t.type){case Fi:return Object.prototype.hasOwnProperty.call(e.breakpoints,t.payload.activeBreakpoint)?Object.assign(Object.assign({},e),{activeBreakpoint:t.payload.activeBreakpoint}):e;case Gi:return{activeBreakpoint:null!==(n=t.payload.activeBreakpoint)&&void 0!==n?n:"default",breakpoints:Object.assign({default:0},t.payload.breakpoints),initialised:!0};default:return e}},active:function(e=Yo(),t){var n,a;switch(t.type){case Pi:{const a=new Set(e);return a.add(null===(n=t.payload)||void 0===n?void 0:n.id),a}case $i:{const n=new Set(e);return n.delete(null===(a=t.payload)||void 0===a?void 0:a.id),n}default:return e}},fonts:function(e=[],t){return t.type===Bi?t.payload:e},signal:function(e={queue:[],processed:[]},t){switch(t.type){case Yi:return i.evolve({queue:n=>ar(e,t.payload.signal)?i.uniqBy(i.pipe(i.prop("signal"),nr),n.concat(t.payload)):n},e);case Ki:return i.evolve({queue:e=>i.reject(i.pipe(i.prop("signal"),i.whereEq({name:t.payload.name,parentGuid:t.payload.parentGuid})))(e),processed:i.append(nr(t.payload))},e);default:return e}},serializableCache:function(e=ir(),t){switch(t.type){case qi:case Wi:if(t.payload.key&&t.payload.value){return new Map([...e]).set(t.payload.key,t.payload.value)}return e;case Ji:{const n=new Map([...e]);return t.payload&&n.delete(t.payload),n}default:return e}},settings:function(e={closeOnComplete:!0},t){return t.type===Hi?i.mergeDeepWith(((e,t)=>i.isNil(t)?e:t),e,t.payload):e},customStates:function(e={root:{}},t){if(t.type===to){if(t.payload.key&&!isNaN(t.payload.value)){const n=void 0!==t.payload.offerPositionIndex?`module${t.payload.offerPositionIndex}`:"root";return i.assocPath([n,t.payload.key],Number(t.payload.value),e)}return e}return e}};function*rr(e,t){var n,a;try{const i=(null===(n=e.activeBreakpointEventChannel)||void 0===n?void 0:n.call(e,t.payload))||(a=t.payload,l.eventChannel((e=>{const t=Object.entries(a).reduce(((e,t)=>{const a=window.matchMedia(`(min-width: ${t[1]}px)`);return"addEventListener"in a&&"function"==typeof a.addEventListener?(a.addEventListener("change",n),e[t[0]]=a):"addListener"in a&&"function"==typeof a.addListener&&(a.addListener(n),e[t[0]]=a),e}),{});return setTimeout((()=>n()),0),()=>{Object.entries(t).forEach((e=>{const t=e[1];"removeEventListener"in t&&"function"==typeof t.removeEventListener?t.removeEventListener("change",n):"removeListener"in t&&"function"==typeof t.removeListener&&t.removeListener(n)}))};function n(){try{e(function(e,t){return Object.entries(e).reduce(((e,n)=>n[1].matches&&(t[n[0]]||0)>(t[e]||0)?n[0]:e),"default")}(t,a))}catch(t){e(t)}}})));try{let e=yield r.take(i);for(yield r.put({type:no.INITIALISE_BREAKPOINT,payload:{activeBreakpoint:e,breakpoints:t.payload}});;)e=yield r.take(i),yield r.put({type:no.UPDATE_ACTIVE_BREAKPOINT,payload:{activeBreakpoint:e}})}catch(e){const n=e;yield r.put({type:Xi,payload:{level:xo,code:"FAILED_TO_DETERMINE_BREAKPOINT",message:null==n?void 0:n.message,additionalInformation:{stack:null==n?void 0:n.stack,breakpoints:t.payload}}})}finally{(yield r.cancelled())&&i.close()}}catch(e){const n=e;yield r.put({type:Xi,payload:{level:Io,code:"FAILED_TO_ESTABLISH_BREAKPOINT_CHANNEL",message:null==n?void 0:n.message,additionalInformation:{stack:null==n?void 0:n.stack,breakpoints:t.payload}}})}}function sr(e,t,n){return l.eventChannel((a=>{const i=e.subscribe((e=>{const t=n(e);t&&a({type:Vi,payload:t})}),(e=>{a(e)})),o=t.fonts.subscribe((e=>{a({type:Bi,payload:e})}),(e=>{a(e)}));return()=>{i.unsubscribe(),o.unsubscribe()}}),l.buffers.sliding(2))}var lr=Object.freeze({__proto__:null,CartEvent:{UPDATE_CART_ITEM_MESSAGE:"UPDATE_CART_ITEM_MESSAGE",UPSERT_ALERT:"UPSERT_ALERT",DELETE_ALERT:"DELETE_ALERT",UPSERT_DELIVERY_DETAILS:"UPSERT_DELIVERY_DETAILS"}}),cr=Object.freeze({__proto__:null,PartnerMessage:{UpdateCartItem:"V2_UPDATE_CART_ITEM"},PlacementMessage:{CartItemUpdated:"V2_CART_ITEM_UPDATED"}}),dr=Object.freeze({__proto__:null,V1:lr,V2:cr}),ur=Object.freeze({__proto__:null,PartnerMessage:{CartItemInstantPurchaseResponse:"CART_ITEM_INSTANT_PURCHASE_RESPONSE"},PlacementMessage:{CartItemInstantPurchase:"CART_ITEM_INSTANT_PURCHASE"}}),pr=Object.freeze({__proto__:null,PartnerValidationEvent:{SET_PARTNER_VALIDATION_STATUS:"SET_PARTNER_VALIDATION_STATUS",OPT_IN_TO_PARTNER_VALIDATION:"OPT_IN_TO_PARTNER_VALIDATION",SHOW_PARTNER_VALIDATION_STATUS:"SHOW_PARTNER_VALIDATION_STATUS"}});const fr="LINK_NAVIGATION_REQUEST",yr="REALTIME_OFFER_FULFILLMENT_SUCCESS",hr="REALTIME_OFFER_FULFILLMENT_FAILURE";var mr=function(e,t,n,a){return new(n||(n=Promise))((function(i,o){function r(e){try{l(a.next(e))}catch(e){o(e)}}function s(e){try{l(a.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,s)}l((a=a.apply(e,t||[])).next())}))};const vr={newTab:"_blank",self:"_top",roktWebViewSDK:"roktWebViewSDK",inApp:"inApp",overrideLinkNavigation:"overrideLinkNavigation"};function gr({url:e,urlBehavior:t,external:n},a=window){return mr(this,void 0,void 0,(function*(){if(!e)return null;if("overrideLinkNavigation"===t)return n.partner.send(fr,{url:e}).then((()=>null));const i=vr[t];if(a.RoktWebViewSDK){const t=a.RoktWebViewSDK.open(e);return t?{ref:t}:null}if("_top"===i&&a.top)return a.top.location.href=e,null;const o=a.open(e,i);if(o)try{o.opener=null}catch(e){}return o?{ref:o}:null}))}var br=Object.freeze({__proto__:null,openLink:gr});function Er(e,t,n,a){const i=function(e){return"object"==typeof e&&null!=e&&"message"in e&&"string"==typeof e.message&&e.message.includes("timed out")}(e),o=i?{originErrorCode:n}:void 0;return{type:Xi,payload:{level:xo,code:i?"COMMUNICATION_FAILURE_WITH_WSDK":n,message:t,additionalInformation:Object.assign(Object.assign({},o),a)}}}var Ir=Object.freeze({__proto__:null,makePluginWarningAction:Er});function Sr(e){return null!=e&&"object"==typeof e&&"ref"in e&&"object"==typeof e.ref&&!Array.isArray(e.ref)&&null!=e.ref}var xr=Object.freeze({__proto__:null,isWindow:Sr}),Cr=Object.assign(Object.assign(Object.assign({},br),Ir),xr);function wr(e){switch(e){case"ATTACHED":return Eo;case"EMBEDDED":return bo;default:return go}}function Or(e,t){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e.offsetBottom&&{bottom:qe(e.offsetBottom)}),e.offsetLeft&&{left:qe(e.offsetLeft)}),e.offsetRight&&{right:qe(e.offsetRight)}),e.offsetTop&&{top:qe(e.offsetTop)}),(e.offsetAnchorX||e.offsetAnchorY)&&{transform:`translate(${"center"===e.offsetAnchorX?e.offsetLeft?"-50%":"50%":"0"}, ${"center"===e.offsetAnchorY?e.offsetTop?"-50%":"50%":"0"})`}),e.maxWidth?{maxWidth:qe(e.maxWidth)}:void 0),t)}function*Tr(e=10){(yield r.select((e=>e.signal.queue.length>0)))&&(yield c.delay(30),e>=1&&(yield*Tr(e-1)))}function*Ar(e){try{yield*Tr(10),yield c.call(e.close)}catch(e){const t=Cr.makePluginWarningAction(e,"Failed to close the plugin","FAILED_TO_CLOSE_PLUGIN");yield c.put(t)}}function*Rr(e,{payload:t}){var n;if("string"==typeof(n=t.name)&&L.includes(n))switch(t.name){case"V2_CART_ITEM_UPDATED":case"CART_ITEM_INSTANT_PURCHASE":case"UPSELL_CREATIVE_SENT":case"INITIATE_INSTANT_PURCHASE_EVENT":case"REALTIME_OFFER_FULFILLMENT_REFERRAL":case"REALTIME_OFFER_FULFILLMENT_CONVERSION":case"REALTIME_OFFER_FULFILLMENT_SUCCESS":yield e.send(t.name,t.body);break;case"OFFER_ENGAGEMENT":case"PLACEMENT_CLOSED":case"PLACEMENT_COMPLETED":case"PLACEMENT_FAILURE":case"PLACEMENT_INTERACTIVE":case"POSITIVE_ENGAGEMENT":yield e.send(t.name);break;default:return}}const Nr=i.propOr("FAILED_TO_PARSE_CONFIG","code");function*_r(e,t){var n;const a=yield c.call(sr,e.configService,e.themeService,t);for(;;)try{const e=yield c.take(a);yield c.put(e)}catch(e){const t=e;yield c.put({type:Xi,payload:{level:Io,code:Nr(t),message:null!==(n=null==t?void 0:t.message)&&void 0!==n?n:"An error occured parsing or receiving Plugin config, fonts or configurables.",additionalInformation:{stack:null==t?void 0:t.stack}}})}}function*Lr(e,t){yield c.all([c.spawn(_r,e,t),c.takeEvery(ee,Rr,e.partnerInteractionService)])}function*jr(e,t,n){const a=function(e,t){if(!t)return{preset:wr(e)};switch(e){case"ATTACHED":return{autoresize:!0,applyHighestZIndex:!0,replaceTargetElement:"body",outerCss:Or(t,{position:"fixed",width:"100%",minWidth:"1px"}),innerCss:{width:"100%"}};case"EMBEDDED":return{autoresize:!0,css:Or(t,{width:"1px",minWidth:"100%"})};default:return{autoresize:!1,applyHighestZIndex:!0,replaceTargetElement:"body",css:Or(t,{position:"fixed",height:"100%",width:"100%"})}}}(t,n);yield c.call(e.setDisplaySettings,a),yield c.put({type:no.ACTIVE_ADD,payload:{id:oo}})}function*Dr(e,t){var n;const a=null!==(n=t.payload.data)&&void 0!==n?n:{};try{yield r.call(e,{code:t.payload.code,level:So,message:t.payload.message||"Plugin Generic Log",additionalInformation:Ro(a)})}catch(e){}}function*kr(e){yield r.put({type:no.QUEUE_SIGNAL,payload:{signal:e.payload}}),yield r.put({type:Zi})}function*Pr(e){yield r.put({type:no.QUEUE_SIGNAL,payload:e.payload}),yield r.put({type:Zi})}function*$r(e,t){const n=yield r.select((e=>e.signal.queue.filter((t=>ar(e.signal,t.signal)))));if(Array.isArray(n)&&n.length)for(const e of n){const t="criteria"in e?e.criteria:void 0;switch(e.signal.name){case"SignalActivation":case"SignalLoadComplete":case"SignalImpression":yield*Fr(e.signal,a(t));break;case"SignalViewed":yield*Gr(e.signal,a(t));break;case"SignalDismissal":yield*Mr(e.signal,a(t));break;case"SignalInstantPurchaseDismissal":yield*Br(e.signal,a(t));break;case"SignalLoadStart":yield*Ur(e.signal,a(t));break;case"SignalGatedResponse":case"SignalResponse":yield*Vr(e.signal,a(t,!0));break;case"SignalUserInteraction":yield*zr(e.signal,a(t));break;case"SignalCartItemQuantitySelected":yield*Hr(e.signal,a(t));break;case"SignalCartItemInstantPurchaseInitiated":yield*qr(e.signal,a(t));break;case"SignalCartItemInstantPurchase":yield*Wr(e.signal,a(t));break;case"SignalCartItemInstantPurchaseFailure":yield*Jr(e.signal,a(t))}yield r.put({type:no.SIGNAL_PROCESSED,payload:e.signal})}function a(t,n=!1){return function(a,i,o){return t?r.call(e.prepareExternalSignal,t.key,a,i,o):n?r.call(e.issueSignalSync,a,i,o):r.call(e.issueSignal,a,i,o)}}}function*Fr(e,t){let n;e.creativeInstanceGuid&&(n={},n.creativeInstanceGuid=e.creativeInstanceGuid);try{yield t(e.name,e.parentGuid,n)}catch(t){yield Yr(e,t)}}function*Gr(e,t){try{yield t(e.name,e.parentGuid,{objectData:{supportedByBrowser:e.supportedByBrowser.toString()},metadata:[{name:"inferred",value:e.inferred.toString()}]})}catch(t){yield Yr(e,t)}}function*Mr(e,t){try{yield t(e.name,e.parentGuid,e.dismissalMethod?{objectData:{dismissalMethod:e.dismissalMethod}}:void 0)}catch(t){yield Yr(e,t)}}function*Br(e,t){try{yield t(e.name,e.parentGuid,void 0)}catch(t){yield Yr(e,t)}}function*Ur(e,t){var n;const a={overrideTimestamp:null!==(n=e.overrideTimestamp)&&void 0!==n?n:new Date};try{yield t(e.name,e.parentGuid,a)}catch(t){yield Yr(e,t)}}function*Vr(e,t){try{yield t(e.name,e.parentGuid,function(e){const t={creativeInstanceGuid:e.responseActionPayload.creativeInstanceGuid};"Url"===e.responseActionPayload.name&&(t.transformedTrafficURL=e.responseActionPayload.transformedTrafficURL);return t}(e))}catch(t){yield Yr(e,t)}}function*zr(e,t){const n=e.parentGuid?e.parentGuid:yield r.select((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid}));try{if(!n||"string"!=typeof n)throw new Error(`Cannot raise SignalUserInteraction, missing or invalid parent GUID: ${JSON.stringify(e)}`);yield t(e.name,n,{objectData:{action:e.action,context:e.context}})}catch(t){yield Yr(e,t)}}function*Hr(e,t){const n={objectData:{preselected:e.objectData.preselected.toString(),quantity:e.objectData.quantity.toString()}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield Yr(e,t)}}function*qr(e,t){const n={objectData:{catalogItemId:e.objectData.catalogItemId,quantity:e.objectData.quantity.toString()}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield Yr(e,t)}}function*Wr(e,t){const n={objectData:{catalogItemId:e.objectData.catalogItemId,quantity:e.objectData.quantity.toString(),initiatedBy:e.objectData.initiatedBy}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield Yr(e,t)}}function*Jr(e,t){const n={objectData:{catalogItemId:e.objectData.catalogItemId,quantity:e.objectData.quantity.toString(),failureReason:e.objectData.failureReason,providerId:e.objectData.providerId}};try{yield t(e.name,e.parentGuid,n)}catch(t){yield Yr(e,t)}}function Yr(e,t){const n=Cr.makePluginWarningAction(t,(null==t?void 0:t.message)||"Failed to issue signal","FAILED_TO_ISSUE_SIGNAL",{signalName:null==e?void 0:e.name,parentGuid:null==e?void 0:e.parentGuid,stack:null==t?void 0:t.stack});return r.put(n)}function*Kr(e){yield r.put({type:to,payload:e.payload})}function*Zr(e,t){if("Interactive"===t.payload.name)try{yield*function*(e){const t="METRIC";(yield r.select((e=>e.serializableCache.has(t))))||(yield r.call(e.notifyInteractive),yield r.put({type:qi,payload:{key:t,value:"Interactive"}}))}(e)}catch(e){const t=e;yield*function*(e){var t;yield r.put({type:Xi,payload:{level:So,code:$o,message:null!==(t=null==e?void 0:e.message)&&void 0!==t?t:"Failed to notify interactive",additionalInformation:{stack:null==e?void 0:e.stack}}})}(t)}}function*Qr(e,t){const n=e.context.getOverrideLinkNavigation()?"overrideLinkNavigation":t.payload.urlBehaviour;try{"inApp"===n?yield r.call(e.createChildPlugin,{name:"url-modal",config:{url:t.payload.url,method:"GET"}}):yield r.call(gr,{url:t.payload.url,urlBehavior:n,external:e})}catch(e){yield r.put(Er(e,"Failed to open link",ko,{url:t.payload.url,urlBehaviour:n}))}}function*Xr(e){const t=yield r.select((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid}));yield r.put({type:no.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:zi}),t?yield r.put({type:Z,payload:{name:"SignalDismissal",parentGuid:t,dismissalMethod:e.payload.dismissalMethod}}):yield r.put({type:Xi,payload:{level:So,code:Po,message:"ParentGuid does not exist"}})}const es=a.connect((function(e){return{isOpen:e.active.has(io)}})),ts="undefined"!=typeof window;function ns(e,n){t.useEffect((()=>{if(!ts||n)return;const t=e.current;if(!t)return;const a=e=>{e.preventDefault()},i=["wheel","touchmove"];i.forEach((e=>{t.addEventListener(e,a,{passive:!1})}));const o=e=>{["ArrowUp","ArrowDown","PageUp","PageDown","Space"].includes(e.code)&&e.preventDefault()};return window.addEventListener("keydown",o),()=>{i.forEach((e=>{t.removeEventListener(e,a)})),window.removeEventListener("keydown",o)}}),[e,n])}const as="Minimized",is=()=>{const e=t.useRef(null),n=t.useRef(null),a=t.useRef(null),i=t.useRef(null),o=t.useRef(null),r=bt(0,(e=>e.customStates[as])),s=vt(),l=Rn(),c=t.useRef(0),d=t.useRef(!1),u=t.useRef(0),p=t.useRef([]),f=t.useRef(void 0),{isDisabled:y}=m(l);ns(e,!!r);const h=t.useCallback((()=>{D(),f.current=void 0,d.current=!1,_(!0);v()?S():N(0)}),[]),v=()=>{const e=R();return r?e<=-.2:e>=.2};t.useEffect((()=>{r?(C(),s(rs(!0))):(w(),s(rs(!1)))}),[r,s]),t.useEffect((()=>{requestAnimationFrame((()=>{j(!r,a),j(!!r,i),L()}))}),[]);const b=t.useCallback((e=>{if(n.current){e.preventDefault();const t=I(e);N(t)}}),[n]),E=t.useCallback((e=>{Date.now()-u.current<200||(u.current=Date.now(),r?x(!1):d.current||y||(d.current=!0,A(),f.current=os(e),_(!1),k()))}),[r,y]);t.useEffect((()=>{const e=n.current;return e&&(e.addEventListener("mousedown",E),e.addEventListener("touchstart",E)),()=>{null==e||e.removeEventListener("mousedown",E),null==e||e.removeEventListener("touchstart",E)}}),[n,E]);const I=e=>{var t,n;return(null!==(t=os(e))&&void 0!==t?t:0)-(null!==(n=f.current)&&void 0!==n?n:0)},S=()=>{x(!r)},x=e=>{const t=(e=>({type:X,payload:{key:as,value:e?1:0}}))(e);t&&s(t)},C=()=>{var e,t,n,o;const r=null!==(t=null===(e=a.current)||void 0===e?void 0:e.clientHeight)&&void 0!==t?t:0,s=(null!==(o=null===(n=i.current)||void 0===n?void 0:n.clientHeight)&&void 0!==o?o:0)-r;_(!0),L(!0,!0),N(s),j(!1,a),j(!0,i),P()},w=()=>{_(!0),L(!0,!1),N(0),f.current=void 0,j(!0,a),j(!1,i),$()},O=t.useCallback((()=>{d.current&&(T(),requestAnimationFrame(O))}),[]),T=()=>{p.current.push({yPosition:c.current,timestamp:Date.now()}),p.current.length>20&&p.current.shift()},A=t.useCallback((()=>{p.current=[],O()}),[O]),R=()=>{const e=p.current;if(!e)return 0;const t=e[0],n=e[e.length-1];if(!t||!n)return 0;const a=n.timestamp-t.timestamp;return(n.yPosition-t.yPosition)/a},N=e=>{const t=Math.round(e);c.current=t,n.current&&(n.current.style.transform=`translateY(${t}px)`)},_=e=>{e?n.current&&(n.current.style.transition="transform .2s"):n.current&&(n.current.style.transition="")},L=(e,t=!1)=>{const n=t?i:a,o=t?a:i;o.current&&(o.current.style.transition="opacity .5s"),n.current&&(n.current.style.transition="opacity .2s")},j=(e,t)=>{const n=t.current;if(!n)return;const a=e?0:1;n.style.opacity=`${a}`,e?n.style.pointerEvents="none":setTimeout((()=>{n.style.pointerEvents="auto"}),400)},D=t.useCallback((()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",h),document.removeEventListener("touchmove",b),document.removeEventListener("touchend",h)}),[b,h]),k=t.useCallback((()=>{g()?(document.addEventListener("touchmove",b,{passive:!1}),document.addEventListener("touchend",h)):(document.addEventListener("mousemove",b,{passive:!1}),document.addEventListener("mouseup",h))}),[b,h]),P=()=>{const t=e.current;t&&(o.current=setTimeout((()=>{var e;const n=((null===(e=a.current)||void 0===e?void 0:e.clientHeight)||0)+1;t.style.height=n+"px"}),200))},$=()=>{o.current&&clearTimeout(o.current),e.current&&(e.current.style.height="100000px")};return{wrapperRef:e,containerRef:n,minimizedChildRef:a,maximizedChildRef:i}};function os(e){var t;return"touches"in e?null===(t=e.touches[0])||void 0===t?void 0:t.clientY:e.clientY}const rs=e=>({type:Z,payload:{action:e?"BottomSheetMinimized":"BottomSheetMaximized",name:"SignalUserInteraction",context:"BottomSheetMinimized"}}),ss={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var ls;function cs({schema:n,testId:o}){const r=ue(),s=a.useSelector((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid})),l=a.useSelector((e=>e.active.has(oo))),c=t.useRef(null),d=a.useDispatch(),u=()=>{d({type:ao.DISMISS_OVERLAY,payload:{id:io,dismissalMethod:"rokt_backdrop"}})},p=bt(0,(e=>e.customStates[as]));t.useEffect((()=>{f(!!p)}),[p]),ns(c,!!p);const f=e=>{const t=c.current;t&&(e?t.style.opacity="0":(t.style.display="flex",t.style.opacity="1"))};t.useEffect((()=>{s&&d({type:Z,payload:{name:"SignalActivation",parentGuid:s}})}),[s]),t.useEffect((()=>{l&&requestAnimationFrame((()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.focus()}))}),[l]);const y=Rn(),{tabIndex:h,isDisabled:v,styles:g}=m(y),b=n.styles?i.mergeRight(ss,n.styles):ss;return e.jsx(Aa,{styles:b,children:({classnames:t})=>{var a;return e.jsx("div",{className:null==t?void 0:t.wrapper,style:Object.assign({height:"100%",top:"0",right:"0",bottom:"0",left:"0",zIndex:"9998",overflow:"hidden",display:"flex",opacity:"1",transition:"opacity 0.2s ease-in-out"},g),"aria-label":null!==(a=n.a11yLabel)&&void 0!==a?a:void 0,"aria-hidden":v,role:"dialog","aria-modal":!0,tabIndex:h,"data-testid":o,"data-e2e":"Overlay-Wrapper",ref:c,children:e.jsx("div",{style:{position:"fixed",top:"0",right:"0",bottom:"0",left:"0",zIndex:"1"},onClick:n.allowBackdropToClose?u:void 0,"data-testid":o&&`${o}-backdrop`,"data-e2e":"Overlay-Backdrop"})})}})}function ds(){return e.jsx("div",{style:{width:"48px",height:"4px",backgroundColor:"#C6C6C8",borderRadius:"2px",margin:"0 auto -4px",position:"relative",top:"6px"}})}!function(e){e[e.BottomSheet=0]="BottomSheet",e[e.Overlay=1]="Overlay"}(ls||(ls={}));const us={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};function ps(t){const n=a.useSelector((e=>e.slots)),i=a.useSelector((e=>{var t,n;return null!==(n=null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex)&&void 0!==n?n:0}));return e.jsx(fs,Object.assign({},t,{slots:n,currentIndex:i}))}function fs(t){const{wrapperRef:n,containerRef:a,minimizedChildRef:i,maximizedChildRef:o}=is();return t.isOpen?e.jsxs("div",{ref:n,style:{height:"100000px"},children:[e.jsx(cs,Object.assign({},t)),e.jsx(hs,Object.assign({},t,{containerRef:a,minimizedChildRef:i,maximizedChildRef:o}))]}):null}const ys=o.css`
58
58
  display: flex;
59
59
  position: relative;
60
60
  overflow: hidden;
@@ -62,7 +62,7 @@
62
62
  > * {
63
63
  position: absolute !important;
64
64
  }
65
- `,fs=t.forwardRef((function({schema:n,testId:a,slots:o,currentIndex:r,minimizedChildRef:s,containerRef:l,maximizedChildRef:c},d){var u,p;const f=t.useRef(null),y=t.useRef(null),h=t.useRef(!0),m=n.styles?i.mergeRight(cs,n.styles):cs,v=It(),g=()=>{const e=y.current;if(!e)return 0;return Array.from(e.children).reduce(((e,t)=>Math.max(e,t.clientHeight)),0)};t.useEffect((()=>{const e=new ResizeObserver((()=>{(()=>{const e=y.current;if(!e)return;const t=g();e.style.height=`${t}px`})(),h.current&&(()=>{const e=g(),t=f.current;t&&(h.current=!1,t.style.setProperty("transform",`translateY(${e}px)`),requestAnimationFrame((()=>{t.style.transition="transform 0.8s",t.style.setProperty("transform","translateY(0px)")})))})()}));return y.current&&Array.from(y.current.children).forEach((t=>{e.observe(t)})),()=>{e.disconnect()}}),[]);const b=null===(p=null===(u=o[r])||void 0===u?void 0:u.offer)||void 0===p?void 0:p.creative,E=null==b?void 0:b.copy,I=Vt(E||{})(Oi.transformLinksToAnchorText(null==b?void 0:b.links),"creativeLink");return e.jsx(Ta,{styles:m,children:({classnames:i})=>{var o;return e.jsxs("div",{style:{width:"100%",position:"absolute",bottom:"-1000px",zIndex:"9999"},ref:l,children:[e.jsx("div",{style:{zIndex:"3",width:"100%",maxHeight:"0%",transitionTimingFunction:"cubic-bezier(0.05, 0.7, 0.1, 1.0)"},ref:f,children:e.jsxs("div",{className:null==i?void 0:i.own,style:{height:"100%",position:"relative",outline:"none",borderBottomLeftRadius:"0",borderBottomRightRadius:"0",border:"1px solid #D5D7DA",borderBottom:"none",margin:"0px -1px"},ref:l,tabIndex:-1,"data-testid":a&&`${a}-container`,"data-e2e":"BottomSheet-Container",children:[e.jsx(ls,{}),e.jsx("div",{ref:y,className:ps,"aria-label":null!==(o=n.a11yLabel)&&void 0!==o?o:void 0,children:t.Children.toArray([e.jsx("div",{ref:c,style:{width:"100%"},children:v(n.children[0],void 0,U(0,a))},"0"),e.jsx(Wt,{value:I,children:e.jsx(jn,{value:Rn(b),children:e.jsx("div",{ref:s,style:{width:"100%"},children:E&&e.jsx("div",{children:v(n.children[1],void 0,U(1,a))})},"1")})})])})]})}),e.jsx("div",{style:{width:"100%",height:"1000px",backgroundColor:"white"}})]})}})}));function*ys(){(yield r.select((e=>{var t;return null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex})))===(yield r.select((e=>{var t;return(null===(t=e.slots)||void 0===t?void 0:t.length)||1})))-1&&(yield r.put({type:X,payload:{key:"Minimized",value:1}}))}Qr(ds);const hs={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var ms;function vs({isOpen:n,schema:o,testId:r,children:s}){const l=ue(),c=a.useSelector((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid})),d=a.useSelector((e=>e.active.has(io))),u=a.useDispatch();t.useEffect((()=>{c&&u({type:Z,payload:{name:"SignalActivation",parentGuid:c}})}),[c]),t.useEffect((()=>{d&&requestAnimationFrame((()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.focus()}))}),[d]);const p=An(),{tabIndex:f,isDisabled:y,styles:h}=m(p),v=o.styles?i.mergeRight(hs,o.styles):hs;if(!n)return null;const g=e.jsx(Et,{children:e=>t.Children.toArray(o.children.map(((t,n)=>e(t,void 0,r?`${r}-child${n}`:void 0))))});return e.jsx(Ta,{styles:v,children:({classnames:t})=>{var n;return e.jsx("div",{className:null==t?void 0:t.wrapper,style:Object.assign({height:"10000px",top:"0",right:"0",bottom:"0",left:"0",zIndex:"9999",display:"flex",overflow:"auto",flexDirection:"column",justifyContent:"flex-end"},h),"aria-label":null!==(n=o.a11yLabel)&&void 0!==n?n:void 0,"aria-hidden":y,role:"dialog","aria-modal":!0,tabIndex:f,"data-testid":r,"data-e2e":"Overlay-Wrapper",children:s(g,l)})}})}!function(e){e[e.BottomSheet=0]="BottomSheet",e[e.Overlay=1]="Overlay"}(ms||(ms={}));const gs={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const bs=t.forwardRef((function({schema:t,testId:n,children:a},o){const r=t.styles?i.mergeRight(gs,t.styles):gs;return e.jsx(Ta,{styles:r,children:({classnames:i})=>{var r;return e.jsx("div",{className:null==i?void 0:i.own,style:{position:"relative",zIndex:"3",outline:"none",alignSelf:"center"},ref:o,tabIndex:-1,"data-e2e":"Overlay-Container","aria-label":null!==(r=t.a11yLabel)&&void 0!==r?r:void 0,role:"dialog","aria-modal":!0,"data-testid":n&&`${n}-container`,children:a})}})}));const Es=a.connect((function(e){return{isOpen:e.active.has(ao)}}))((function(t){return e.jsx(vs,Object.assign({},t,{children:(n,a)=>e.jsx(bs,Object.assign({},t,{ref:a,children:n}))}))})),Is=Qr(ds),Ss={name:"minimized-bottomsheet-extension",sagas:function*(){yield r.all([r.takeEvery("OFFER_LIFECYCLE",ys)])},componentFactory:t=>"Overlay"===t.type?e.jsx(Es,{schema:t}):function(e){const t=e.children instanceof Array;return t}(t)?e.jsx(Is,{schema:t}):e.jsx("div",{children:"Could not Render Bottom Sheet"})};const xs=a.connect((function(e,{schema:t}){var n,a,i;const o=t.startPosition||1;if((null===(n=e.progression)||void 0===n?void 0:n.totalCount)&&(null===(a=e.progression)||void 0===a?void 0:a.groupSize)){const t=(r=e.progression.totalCount,(s=e.progression.groupSize)<=0||r<=0||s>r?0:Math.ceil(r/s));let n;n=o>0?o-1:t+o>-1?t+o:0;return{numOfIndicators:t-n>-1?t-n:0,activeIndex:null!==(i=e.progression.currentGroupIndex)&&void 0!==i?i:0,startIndex:n}}var r,s;return{numOfIndicators:0,activeIndex:0,startIndex:0}})),Cs=t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"37",height:"29",viewBox:"0 0 37 29",fill:"inherit",style:{maxWidth:"44px",maxHeight:"32px",width:"100%",height:"100%"}},t.createElement("path",{d:"M5.62263 14.7123L5.48251 5.86667L11.3433 4.79804L11.3655 6.53531L7.57989 7.22555L7.61586 9.03828L11.0283 8.41606L11.0513 10.1575L7.63884 10.7797L7.69779 14.3339L5.62263 14.7123ZM17.5824 3.66043L19.6534 3.28282L19.745 8.98818C19.7555 9.64756 19.6126 10.2497 19.3164 10.7947C19.0224 11.3363 18.6042 11.7908 18.0619 12.1583C17.5191 12.5229 16.8858 12.7712 16.1619 12.9032C15.4352 13.0357 14.7983 13.019 14.2512 12.8531C13.7035 12.6844 13.2748 12.3843 12.9651 11.9527C12.6549 11.5184 12.4931 10.9717 12.4799 10.3129L12.3882 4.60752L14.4634 4.22914L14.5473 9.74965C14.5538 10.0546 14.6243 10.3146 14.7588 10.5298C14.8957 10.7416 15.0825 10.8952 15.3194 10.9907C15.5557 11.0833 15.8276 11.1016 16.135 11.0455C16.4453 10.989 16.717 10.8716 16.9501 10.6933C17.1828 10.5123 17.3621 10.2919 17.488 10.0321C17.6134 9.76959 17.6728 9.48585 17.6663 9.18094L17.5824 3.66043ZM28.2611 1.71333L28.4012 10.5589L26.6405 10.88L23.1503 6.39639L23.0916 6.40709L23.1693 11.5129L21.0941 11.8913L20.954 3.04567L22.7399 2.72004L26.2075 7.19908L26.2788 7.18608L26.1901 2.09094L28.2611 1.71333ZM4.24231 28.1783L4.10219 19.3327L9.96295 18.2641L9.98516 20.0013L6.19957 20.6916L6.23554 22.5043L9.64803 21.8821L9.67101 23.6235L6.25852 24.2457L6.31747 27.7999L4.24231 28.1783ZM11.933 26.776L9.70271 27.1827L12.4594 17.8089L15.2221 17.3051L18.2591 25.6225L16.0288 26.0292L13.9145 19.7787L13.8474 19.7909L11.933 26.776ZM11.5852 23.3481L16.247 22.4981L16.2661 24.1233L11.6043 24.9733L11.5852 23.3481ZM26.4764 18.4671L24.4054 18.8447C24.3768 18.6247 24.3205 18.4343 24.2363 18.2735C24.1516 18.1099 24.0407 17.9771 23.9037 17.875C23.7662 17.7701 23.6063 17.7011 23.4241 17.6679C23.2419 17.6347 23.0376 17.6387 22.8113 17.68C22.3781 17.759 22.005 17.9382 21.6921 18.2176C21.3792 18.497 21.1409 18.861 20.9772 19.3096C20.8136 19.7581 20.7359 20.2747 20.7444 20.8594C20.7576 21.423 20.8423 21.8797 20.9985 22.2295C21.1575 22.5788 21.3782 22.823 21.6605 22.9621C21.9424 23.0985 22.2748 23.1317 22.6577 23.0619C22.9064 23.0165 23.1316 22.9451 23.3333 22.8477C23.5373 22.747 23.7155 22.6235 23.8679 22.4774C24.0203 22.3312 24.1446 22.1656 24.2408 21.9805C24.3393 21.7922 24.4051 21.591 24.4383 21.3771L26.5261 20.9964C26.4914 21.3926 26.3895 21.7996 26.2202 22.2174C26.0532 22.6319 25.8184 23.0227 25.5157 23.3898C25.213 23.7568 24.842 24.0743 24.4028 24.342C23.9636 24.6098 23.4548 24.7965 22.8762 24.902C22.0853 25.0462 21.371 24.993 20.7333 24.7426C20.0985 24.4916 19.5925 24.0525 19.2153 23.4253C18.8405 22.7948 18.6436 21.9846 18.6249 20.9947C18.6089 20.0359 18.7692 19.1967 19.1057 18.4769C19.4451 17.7566 19.9106 17.1736 20.5022 16.7279C21.0965 16.2817 21.764 15.991 22.5047 15.856C23.0413 15.7581 23.5366 15.7429 23.9907 15.8103C24.4471 15.8743 24.8501 16.0174 25.1996 16.2396C25.5486 16.459 25.8322 16.7552 26.0504 17.1284C26.2714 17.501 26.4134 17.9473 26.4764 18.4671ZM27.362 16.8329L27.3398 15.0956L34.5966 13.7725L34.6188 15.5097L32.0154 15.9844L32.1333 23.0928L30.0875 23.4658L29.9696 16.3575L27.362 16.8329Z",fill:"inherit"})),ws="FunFactMode";function Os({activeIndex:e,startIndex:n,numOfIndicators:i,schema:o,slots:r}){var s,l,c;const d=An(),u=a.useDispatch(),{tabIndex:p,styles:f,isDisabled:y}=m(d),h=Array(i+1).fill(o.indicator),[v,g]=t.useState(new Set([n])),[b,E]=t.useState(!1),I=gt(0,(e=>e.customStates[ws])),S=t.useCallback((e=>v.has(e)||v.has(e-1)),[v]);t.useEffect((()=>{g((t=>new Set([...t,e])))}),[e,I]),t.useEffect((()=>{I&&E(!0)}),[I]);const x=()=>{u({type:X,payload:{key:ws,value:1}})},C=null===(l=null===(s=r[e])||void 0===s?void 0:s.offer)||void 0===l?void 0:l.creative,w=null===(c=null==C?void 0:C.images.creativeImage)||void 0===c?void 0:c.light;return i>0&&(T=i+n+1,(O=e)>=n&&O<=T)?t.createElement(Ht,null,(a=>t.createElement(Ta,{styles:o.styles},(o=>{var r;const s=o.classnames,l=t=>{var n,a,o,r;return t===i&&I?`${null==s?void 0:s.indicator} ${null!==(n=null==s?void 0:s.activeIndicator)&&void 0!==n?n:""}`:t!==e||I?v.has(t)||t===i&&b?`${null==s?void 0:s.indicator} ${null!==(o=null==s?void 0:s.seenIndicator)&&void 0!==o?o:""}`:t==e+1?`${null==s?void 0:s.indicator} ${null!==(r=null==s?void 0:s.clickableIndicator)&&void 0!==r?r:""}`:`${null==s?void 0:s.indicator}`:`${null==s?void 0:s.indicator} ${null!==(a=null==s?void 0:s.activeIndicator)&&void 0!==a?a:""}`};return t.createElement("div",{className:null!==(r=null==s?void 0:s.own)&&void 0!==r?r:"",style:Object.assign({display:"flex",flexDirection:"row",gap:"8px"},f),"data-e2e":"ProgressIndicator",tabIndex:p,"aria-hidden":y},t.Children.toArray(h.map(((o,r)=>{return r===i?t.createElement("button",{onClick:b||e==i-1?x:void 0,className:l(r+n),style:{display:"inline-block",borderRadius:"50%",aspectRatio:"1/1",overflow:"hidden",fill:I?"#101828":"#A3A3A3",cursor:b||e==i-1?"pointer":"default"}},a({state:{indicatorPosition:String(r+1+n)}})(o),t.createElement("div",{style:{marginTop:"3px",marginLeft:"2px"},"data-testid":"fun-fact-icon"},Cs)):r!==e||I?t.createElement("button",{onClick:(s=r,()=>{S(s)&&(u({type:"PROGRESSION/INITIALISE",payload:{totalCount:i,currentGroupIndex:s,groupSize:1}}),I&&u({type:X,payload:{key:ws,value:0}}))}),className:l(r+n),style:{display:"inline-block",borderRadius:"50%",aspectRatio:"1/1",overflow:"hidden",cursor:S(r)?"pointer":"default"}},a({state:{indicatorPosition:String(r+1+n)}})(""),t.createElement("div",{style:{fontSize:"30px",fontWeight:"700",lineHeight:"38px",display:"inline-block"}},`${r+1}`)):t.createElement("button",{className:l(r+n),style:{display:"inline-block",borderRadius:"50%",aspectRatio:"1/1",overflow:"hidden",cursor:S(r)?"pointer":"default"}},a({state:{indicatorPosition:String(r+1+n)}})(""),w?t.createElement("img",{src:w,style:{marginTop:"3px"}}):t.createElement("div",{style:{fontSize:"30px",fontWeight:"700",lineHeight:"38px",display:"inline-block"}},`${r+1}`));var s}))))})))):null;var O,T}const Ts=xs(((e,n)=>{const i=a.useSelector((e=>e.slots)),o=a.useSelector((e=>{var t,n;return null!==(n=null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex)&&void 0!==n?n:0}));return t.createElement(Os,Object.assign({},e,{slots:i,currentIndex:o,partnerColor:n}))})),As=({children:e,partnerColor:n,schema:a})=>{var i;const r=It(),s=t.useMemo((()=>Math.random()),[]),l=Vt((null!==(i=Rs[Math.floor(s*Rs.length)])&&void 0!==i?i:{text:"",header:""})||{},"funfact"),c=o.css`
65
+ `,hs=t.forwardRef((function({schema:n,testId:a,slots:o,currentIndex:r,minimizedChildRef:s,containerRef:l,maximizedChildRef:c},d){var u,p;const f=t.useRef(null),y=t.useRef(null),h=t.useRef(!0),m=n.styles?i.mergeRight(us,n.styles):us,v=St(),g=()=>{const e=y.current;if(!e)return 0;return Array.from(e.children).reduce(((e,t)=>Math.max(e,t.clientHeight)),0)};t.useEffect((()=>{const e=new ResizeObserver((()=>{(()=>{const e=y.current;if(!e)return;const t=g();e.style.height=`${t}px`})(),h.current&&(()=>{const e=g(),t=f.current;t&&(h.current=!1,t.style.setProperty("transform",`translateY(${e}px)`),requestAnimationFrame((()=>{t.style.transition="transform 0.8s",t.style.setProperty("transform","translateY(0px)")})))})()}));return y.current&&Array.from(y.current.children).forEach((t=>{e.observe(t)})),()=>{e.disconnect()}}),[]);const b=null===(p=null===(u=o[r])||void 0===u?void 0:u.offer)||void 0===p?void 0:p.creative,E=null==b?void 0:b.copy,I=zt(E||{})(Ti.transformLinksToAnchorText(null==b?void 0:b.links),"creativeLink");return e.jsx(Aa,{styles:m,children:({classnames:i})=>{var o;return e.jsxs("div",{style:{width:"100%",position:"absolute",bottom:"-1000px",zIndex:"9999"},ref:l,children:[e.jsx("div",{style:{zIndex:"3",width:"100%",maxHeight:"0%",transitionTimingFunction:"cubic-bezier(0.05, 0.7, 0.1, 1.0)"},ref:f,children:e.jsxs("div",{className:null==i?void 0:i.own,style:{height:"100%",position:"relative",outline:"none",borderBottomLeftRadius:"0",borderBottomRightRadius:"0",border:"1px solid #D5D7DA",borderBottom:"none",margin:"0px -1px"},ref:l,tabIndex:-1,"data-testid":a&&`${a}-container`,"data-e2e":"BottomSheet-Container",children:[e.jsx(ds,{}),e.jsx("div",{ref:y,className:ys,"aria-label":null!==(o=n.a11yLabel)&&void 0!==o?o:void 0,children:t.Children.toArray([e.jsx("div",{ref:c,style:{width:"100%"},children:v(n.children[0],void 0,U(0,a))},"0"),e.jsx(Jt,{value:I,children:e.jsx(Dn,{value:Nn(b),children:e.jsx("div",{ref:s,style:{width:"100%"},children:E&&e.jsx("div",{children:v(n.children[1],void 0,U(1,a))})},"1")})})])})]})}),e.jsx("div",{style:{width:"100%",height:"1000px",backgroundColor:"white"}})]})}})}));function*ms(){(yield r.select((e=>{var t;return null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex})))===(yield r.select((e=>{var t;return(null===(t=e.slots)||void 0===t?void 0:t.length)||1})))-1&&(yield r.put({type:X,payload:{key:"Minimized",value:1}}))}es(ps);const vs={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var gs;function bs({isOpen:n,schema:o,testId:r,children:s}){const l=ue(),c=a.useSelector((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid})),d=a.useSelector((e=>e.active.has(oo))),u=a.useDispatch();t.useEffect((()=>{c&&u({type:Z,payload:{name:"SignalActivation",parentGuid:c}})}),[c]),t.useEffect((()=>{d&&requestAnimationFrame((()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.focus()}))}),[d]);const p=Rn(),{tabIndex:f,isDisabled:y,styles:h}=m(p),v=o.styles?i.mergeRight(vs,o.styles):vs;if(!n)return null;const g=e.jsx(It,{children:e=>t.Children.toArray(o.children.map(((t,n)=>e(t,void 0,r?`${r}-child${n}`:void 0))))});return e.jsx(Aa,{styles:v,children:({classnames:t})=>{var n;return e.jsx("div",{className:null==t?void 0:t.wrapper,style:Object.assign({height:"10000px",top:"0",right:"0",bottom:"0",left:"0",zIndex:"9999",display:"flex",overflow:"auto",flexDirection:"column",justifyContent:"flex-end"},h),"aria-label":null!==(n=o.a11yLabel)&&void 0!==n?n:void 0,"aria-hidden":y,role:"dialog","aria-modal":!0,tabIndex:f,"data-testid":r,"data-e2e":"Overlay-Wrapper",children:s(g,l)})}})}!function(e){e[e.BottomSheet=0]="BottomSheet",e[e.Overlay=1]="Overlay"}(gs||(gs={}));const Es={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const Is=t.forwardRef((function({schema:t,testId:n,children:a},o){const r=t.styles?i.mergeRight(Es,t.styles):Es;return e.jsx(Aa,{styles:r,children:({classnames:i})=>{var r;return e.jsx("div",{className:null==i?void 0:i.own,style:{position:"relative",zIndex:"3",outline:"none",alignSelf:"center"},ref:o,tabIndex:-1,"data-e2e":"Overlay-Container","aria-label":null!==(r=t.a11yLabel)&&void 0!==r?r:void 0,role:"dialog","aria-modal":!0,"data-testid":n&&`${n}-container`,children:a})}})}));const Ss=a.connect((function(e){return{isOpen:e.active.has(io)}}))((function(t){return e.jsx(bs,Object.assign({},t,{children:(n,a)=>e.jsx(Is,Object.assign({},t,{ref:a,children:n}))}))})),xs=es(ps),Cs={name:"minimized-bottomsheet-extension",sagas:function*(){yield r.all([r.takeEvery("OFFER_LIFECYCLE",ms)])},componentFactory:t=>"Overlay"===t.type?e.jsx(Ss,{schema:t}):function(e){const t=e.children instanceof Array;return t}(t)?e.jsx(xs,{schema:t}):e.jsx("div",{children:"Could not Render Bottom Sheet"})};const ws=a.connect((function(e,{schema:t}){var n,a,i;const o=t.startPosition||1;if((null===(n=e.progression)||void 0===n?void 0:n.totalCount)&&(null===(a=e.progression)||void 0===a?void 0:a.groupSize)){const t=(r=e.progression.totalCount,(s=e.progression.groupSize)<=0||r<=0||s>r?0:Math.ceil(r/s));let n;n=o>0?o-1:t+o>-1?t+o:0;return{numOfIndicators:t-n>-1?t-n:0,activeIndex:null!==(i=e.progression.currentGroupIndex)&&void 0!==i?i:0,startIndex:n}}var r,s;return{numOfIndicators:0,activeIndex:0,startIndex:0}})),Os=t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"37",height:"29",viewBox:"0 0 37 29",fill:"inherit",style:{maxWidth:"44px",maxHeight:"32px",width:"100%",height:"100%"}},t.createElement("path",{d:"M5.62263 14.7123L5.48251 5.86667L11.3433 4.79804L11.3655 6.53531L7.57989 7.22555L7.61586 9.03828L11.0283 8.41606L11.0513 10.1575L7.63884 10.7797L7.69779 14.3339L5.62263 14.7123ZM17.5824 3.66043L19.6534 3.28282L19.745 8.98818C19.7555 9.64756 19.6126 10.2497 19.3164 10.7947C19.0224 11.3363 18.6042 11.7908 18.0619 12.1583C17.5191 12.5229 16.8858 12.7712 16.1619 12.9032C15.4352 13.0357 14.7983 13.019 14.2512 12.8531C13.7035 12.6844 13.2748 12.3843 12.9651 11.9527C12.6549 11.5184 12.4931 10.9717 12.4799 10.3129L12.3882 4.60752L14.4634 4.22914L14.5473 9.74965C14.5538 10.0546 14.6243 10.3146 14.7588 10.5298C14.8957 10.7416 15.0825 10.8952 15.3194 10.9907C15.5557 11.0833 15.8276 11.1016 16.135 11.0455C16.4453 10.989 16.717 10.8716 16.9501 10.6933C17.1828 10.5123 17.3621 10.2919 17.488 10.0321C17.6134 9.76959 17.6728 9.48585 17.6663 9.18094L17.5824 3.66043ZM28.2611 1.71333L28.4012 10.5589L26.6405 10.88L23.1503 6.39639L23.0916 6.40709L23.1693 11.5129L21.0941 11.8913L20.954 3.04567L22.7399 2.72004L26.2075 7.19908L26.2788 7.18608L26.1901 2.09094L28.2611 1.71333ZM4.24231 28.1783L4.10219 19.3327L9.96295 18.2641L9.98516 20.0013L6.19957 20.6916L6.23554 22.5043L9.64803 21.8821L9.67101 23.6235L6.25852 24.2457L6.31747 27.7999L4.24231 28.1783ZM11.933 26.776L9.70271 27.1827L12.4594 17.8089L15.2221 17.3051L18.2591 25.6225L16.0288 26.0292L13.9145 19.7787L13.8474 19.7909L11.933 26.776ZM11.5852 23.3481L16.247 22.4981L16.2661 24.1233L11.6043 24.9733L11.5852 23.3481ZM26.4764 18.4671L24.4054 18.8447C24.3768 18.6247 24.3205 18.4343 24.2363 18.2735C24.1516 18.1099 24.0407 17.9771 23.9037 17.875C23.7662 17.7701 23.6063 17.7011 23.4241 17.6679C23.2419 17.6347 23.0376 17.6387 22.8113 17.68C22.3781 17.759 22.005 17.9382 21.6921 18.2176C21.3792 18.497 21.1409 18.861 20.9772 19.3096C20.8136 19.7581 20.7359 20.2747 20.7444 20.8594C20.7576 21.423 20.8423 21.8797 20.9985 22.2295C21.1575 22.5788 21.3782 22.823 21.6605 22.9621C21.9424 23.0985 22.2748 23.1317 22.6577 23.0619C22.9064 23.0165 23.1316 22.9451 23.3333 22.8477C23.5373 22.747 23.7155 22.6235 23.8679 22.4774C24.0203 22.3312 24.1446 22.1656 24.2408 21.9805C24.3393 21.7922 24.4051 21.591 24.4383 21.3771L26.5261 20.9964C26.4914 21.3926 26.3895 21.7996 26.2202 22.2174C26.0532 22.6319 25.8184 23.0227 25.5157 23.3898C25.213 23.7568 24.842 24.0743 24.4028 24.342C23.9636 24.6098 23.4548 24.7965 22.8762 24.902C22.0853 25.0462 21.371 24.993 20.7333 24.7426C20.0985 24.4916 19.5925 24.0525 19.2153 23.4253C18.8405 22.7948 18.6436 21.9846 18.6249 20.9947C18.6089 20.0359 18.7692 19.1967 19.1057 18.4769C19.4451 17.7566 19.9106 17.1736 20.5022 16.7279C21.0965 16.2817 21.764 15.991 22.5047 15.856C23.0413 15.7581 23.5366 15.7429 23.9907 15.8103C24.4471 15.8743 24.8501 16.0174 25.1996 16.2396C25.5486 16.459 25.8322 16.7552 26.0504 17.1284C26.2714 17.501 26.4134 17.9473 26.4764 18.4671ZM27.362 16.8329L27.3398 15.0956L34.5966 13.7725L34.6188 15.5097L32.0154 15.9844L32.1333 23.0928L30.0875 23.4658L29.9696 16.3575L27.362 16.8329Z",fill:"inherit"})),Ts="FunFactMode";function As({activeIndex:e,startIndex:n,numOfIndicators:i,schema:o,slots:r}){var s,l,c;const d=Rn(),u=a.useDispatch(),{tabIndex:p,styles:f,isDisabled:y}=m(d),h=Array(i+1).fill(o.indicator),[v,g]=t.useState(new Set([n])),[b,E]=t.useState(!1),I=bt(0,(e=>e.customStates[Ts])),S=t.useCallback((e=>v.has(e)||v.has(e-1)),[v]);t.useEffect((()=>{g((t=>new Set([...t,e])))}),[e,I]),t.useEffect((()=>{I&&E(!0)}),[I]);const x=()=>{u({type:X,payload:{key:Ts,value:1}})},C=null===(l=null===(s=r[e])||void 0===s?void 0:s.offer)||void 0===l?void 0:l.creative,w=null===(c=null==C?void 0:C.images.creativeImage)||void 0===c?void 0:c.light;return i>0&&(T=i+n+1,(O=e)>=n&&O<=T)?t.createElement(Wt,null,(a=>t.createElement(Aa,{styles:o.styles},(o=>{var r;const s=o.classnames,l=t=>{var n,a,o,r;return t===i&&I?`${null==s?void 0:s.indicator} ${null!==(n=null==s?void 0:s.activeIndicator)&&void 0!==n?n:""}`:t!==e||I?v.has(t)||t===i&&b?`${null==s?void 0:s.indicator} ${null!==(o=null==s?void 0:s.seenIndicator)&&void 0!==o?o:""}`:t==e+1?`${null==s?void 0:s.indicator} ${null!==(r=null==s?void 0:s.clickableIndicator)&&void 0!==r?r:""}`:`${null==s?void 0:s.indicator}`:`${null==s?void 0:s.indicator} ${null!==(a=null==s?void 0:s.activeIndicator)&&void 0!==a?a:""}`};return t.createElement("div",{className:null!==(r=null==s?void 0:s.own)&&void 0!==r?r:"",style:Object.assign({display:"flex",flexDirection:"row",gap:"8px"},f),"data-e2e":"ProgressIndicator",tabIndex:p,"aria-hidden":y},t.Children.toArray(h.map(((o,r)=>{return r===i?t.createElement("button",{onClick:b||e==i-1?x:void 0,className:l(r+n),style:{display:"inline-block",borderRadius:"50%",aspectRatio:"1/1",overflow:"hidden",fill:I?"#101828":"#A3A3A3",cursor:b||e==i-1?"pointer":"default"}},a({state:{indicatorPosition:String(r+1+n)}})(o),t.createElement("div",{style:{marginTop:"3px",marginLeft:"2px"},"data-testid":"fun-fact-icon"},Os)):r!==e||I?t.createElement("button",{onClick:(s=r,()=>{S(s)&&(u({type:"PROGRESSION/INITIALISE",payload:{totalCount:i,currentGroupIndex:s,groupSize:1}}),I&&u({type:X,payload:{key:Ts,value:0}}))}),className:l(r+n),style:{display:"inline-block",borderRadius:"50%",aspectRatio:"1/1",overflow:"hidden",cursor:S(r)?"pointer":"default"}},a({state:{indicatorPosition:String(r+1+n)}})(""),t.createElement("div",{style:{fontSize:"30px",fontWeight:"700",lineHeight:"38px",display:"inline-block"}},`${r+1}`)):t.createElement("button",{className:l(r+n),style:{display:"inline-block",borderRadius:"50%",aspectRatio:"1/1",overflow:"hidden",cursor:S(r)?"pointer":"default"}},a({state:{indicatorPosition:String(r+1+n)}})(""),w?t.createElement("img",{src:w,style:{marginTop:"3px"}}):t.createElement("div",{style:{fontSize:"30px",fontWeight:"700",lineHeight:"38px",display:"inline-block"}},`${r+1}`));var s}))))})))):null;var O,T}const Rs=ws(((e,n)=>{const i=a.useSelector((e=>e.slots)),o=a.useSelector((e=>{var t,n;return null!==(n=null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex)&&void 0!==n?n:0}));return t.createElement(As,Object.assign({},e,{slots:i,currentIndex:o,partnerColor:n}))})),Ns=({children:e,partnerColor:n,schema:a})=>{var i;const r=St(),s=t.useMemo((()=>Math.random()),[]),l=zt((null!==(i=_s[Math.floor(s*_s.length)])&&void 0!==i?i:{text:"",header:""})||{},"funfact"),c=o.css`
66
66
  display: inline;
67
67
  margin: 8px 16px;
68
68
  p {
@@ -72,7 +72,7 @@
72
72
  font-size: 24px;
73
73
  font-weight: 600;
74
74
  color: ${n};
75
- `;return t.createElement(Wt,{value:l},t.createElement(Ta,{styles:a.styles},(n=>{const a=n.classnames;return t.createElement(t.Fragment,null,t.Children.toArray(null==e?void 0:e.map(((e,n)=>t.createElement("div",{className:`${c} ${null==a?void 0:a.own}`},0===n?t.createElement(t.Fragment,null,t.createElement("p",{className:`${d} ${null==a?void 0:a.own}`},"Did you know...")," ",t.createElement("span",{className:`${null==a?void 0:a.own}`},r(e))):t.createElement("span",{className:`${null==a?void 0:a.own}`},r(e)))))))})))},Rs=[{header:"the Eiffel Tower can grow taller in summer?",text:"The heat causes the metal to expand, adding up to six inches to its height."},{header:"flamingos aren't born pink?",text:"Their feathers turn pink from eating shrimp and algae rich in carotenoids."},{header:"bananas are berries, but strawberries aren't?",text:"Botanically, strawberries are aggregate fruits, while bananas meet all the criteria for a true berry."},{header:"a day on Venus is longer than a year on Venus?",text:"It takes Venus 243 Earth days to rotate once but only 225 Earth days to orbit the Sun."},{header:"sea cucumbers can eject their guts when threatened?",text:"This defense mechanism helps them escape predators and they regenerate the lost organs later."},{header:"prunes used to be said instead of cheese for photos?",text:'In the 1840s, people said "prunes" to maintain a tight-lipped expression instead of smiling.'},{header:"some frogs can freeze solid and survive?",text:"Species like wood frogs produce special proteins that prevent ice from damaging their cells."},{header:"Venus is the only planet that spins clockwise?",text:"Its unusual rotation direction makes it stand out among other planets in our solar system."},{header:"cats have 230 bones while humans have only 206?",text:"Their extra bones make them incredibly flexible jumpers and climbers."},{header:"the Statue of Liberty once functioned as a lighthouse?",text:"From 1886 to 1902, its light could be seen up to 24 miles away."},{header:"the first commercial flight lasted just 23 minutes?",text:"It flew between St. Petersburg and Tampa, Florida, in 1914."},{header:"octopuses have blue blood and nine brains?",text:"Their unique blood helps them survive in low-oxygen environments, and each arm has its own mini-brain."},{header:"hummingbirds can fly backward?",text:"They're the only birds capable of this agile movement thanks to their unique wing structure."},{header:"gorillas burp when they're happy?",text:"It's one of their ways of expressing contentment and relaxation."},{header:"Australia is wider than the Moon?",text:"Australia spans about 2,485 miles across, while the Moon's diameter is only about 2,159 miles."},{header:"ants can carry up to 50 times their body weight?",text:"These tiny insects are incredibly strong for their size due to their muscle structure."},{header:"lightning is five times hotter than the surface of the Sun?",text:"A single bolt can reach temperatures of up to 50,000 degrees Fahrenheit."},{header:"sharks are the only fish that can blink with both eyes?",text:"They have an extra eyelid called a nictitating membrane for protection during attacks or feeding."},{header:"octopuses have three hearts?",text:"Two pump blood to the gills, while the third pumps it to the rest of the body—and it stops beating when they swim."},{header:"a group of flamingos is called a flamboyance?",text:"Their bright pink color and synchronized movements make this name quite fitting."},{header:"honey never spoils?",text:"Archaeologists have found pots of honey in ancient Egyptian tombs that are still edible."},{header:"cats can't taste sweetness?",text:"Their taste buds lack the receptors for sugary flavors, which might explain their disinterest in desserts."},{header:"a crocodile can't stick out its tongue?",text:"A special membrane holds their tongue in place, helping them swallow prey underwater."},{header:"sea otters hold hands while they sleep?",text:"This keeps them from drifting apart in the water, especially when they're napping in groups."},{header:"bananas glow blue under black light?",text:"This happens because of the way their peel breaks down as they ripen."},{header:"a watermelon is 92% water?",text:"That's why it's such a refreshing snack on a hot day!"},{header:"butterflies taste with their feet?",text:"Their taste sensors are located on their legs, helping them identify suitable plants for laying eggs."},{header:"an ostrich's eye is bigger than its brain?",text:"This might explain why these birds rely more on instinct than intelligence."},{header:"kangaroos can't walk backward?",text:"Their muscular tails and body structure make this movement impossible."},{header:"avocados are fruits, not vegetables?",text:"They're technically berries because of their fleshy pulp and single seed."},{header:"dolphins have names for each other?",text:"They use unique whistles to identify and call out to specific individuals in their pods."},{header:'the Hollywood sign originally said "Hollywoodland"?',text:"It was installed in 1923 as an advertisement for a real estate development."},{header:"giraffe tongues can be up to 20 inches long?",text:"Their dark color helps protect them from sunburn while reaching for leaves."},{header:"M&M's were the first candy eaten in space?",text:"Astronauts love them because they don't crumble and create messes in zero gravity."},{header:"starfish don't have brains?",text:"They rely on a simple nervous system to sense their surroundings and move around."},{header:"peanuts are legumes, not nuts?",text:"They grow underground like beans and peas, making them part of the legume family."},{header:"the shortest war in history lasted only 38 minutes?",text:"It was between Britain and Zanzibar on August 27, 1896."},{header:"clouds can weigh over a million pounds?",text:"Despite their massive weight, the water droplets are spread out enough to float in the air!"}];function*Ns(){(yield r.select((e=>{var t;return null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex})))===(yield r.select((e=>{var t;return(null===(t=e.slots)||void 0===t?void 0:t.length)||1})))-1&&(yield r.put({type:X,payload:{key:"FunFactMode",value:1}}))}const Ls={name:"logo-clickable-progression-extension",sagas:function*(){yield r.all([r.takeEvery("OFFER_LIFECYCLE",Ns)])},componentFactory:e=>e?"fun-fact"===e.variant?t.createElement(As,{partnerColor:e.partnerColor,schema:e},e.children):t.createElement(Ts,{schema:Object.assign(Object.assign({},e),{indicator:""}),partnerColor:e.partnerColor}):t.createElement("div",null,"Could not render Logo Clickable Progression"),interceptors:{}};const _s=o.css`
75
+ `;return t.createElement(Jt,{value:l},t.createElement(Aa,{styles:a.styles},(n=>{const a=n.classnames;return t.createElement(t.Fragment,null,t.Children.toArray(null==e?void 0:e.map(((e,n)=>t.createElement("div",{className:`${c} ${null==a?void 0:a.own}`},0===n?t.createElement(t.Fragment,null,t.createElement("p",{className:`${d} ${null==a?void 0:a.own}`},"Did you know...")," ",t.createElement("span",{className:`${null==a?void 0:a.own}`},r(e))):t.createElement("span",{className:`${null==a?void 0:a.own}`},r(e)))))))})))},_s=[{header:"the Eiffel Tower can grow taller in summer?",text:"The heat causes the metal to expand, adding up to six inches to its height."},{header:"flamingos aren't born pink?",text:"Their feathers turn pink from eating shrimp and algae rich in carotenoids."},{header:"bananas are berries, but strawberries aren't?",text:"Botanically, strawberries are aggregate fruits, while bananas meet all the criteria for a true berry."},{header:"a day on Venus is longer than a year on Venus?",text:"It takes Venus 243 Earth days to rotate once but only 225 Earth days to orbit the Sun."},{header:"sea cucumbers can eject their guts when threatened?",text:"This defense mechanism helps them escape predators and they regenerate the lost organs later."},{header:"prunes used to be said instead of cheese for photos?",text:'In the 1840s, people said "prunes" to maintain a tight-lipped expression instead of smiling.'},{header:"some frogs can freeze solid and survive?",text:"Species like wood frogs produce special proteins that prevent ice from damaging their cells."},{header:"Venus is the only planet that spins clockwise?",text:"Its unusual rotation direction makes it stand out among other planets in our solar system."},{header:"cats have 230 bones while humans have only 206?",text:"Their extra bones make them incredibly flexible jumpers and climbers."},{header:"the Statue of Liberty once functioned as a lighthouse?",text:"From 1886 to 1902, its light could be seen up to 24 miles away."},{header:"the first commercial flight lasted just 23 minutes?",text:"It flew between St. Petersburg and Tampa, Florida, in 1914."},{header:"octopuses have blue blood and nine brains?",text:"Their unique blood helps them survive in low-oxygen environments, and each arm has its own mini-brain."},{header:"hummingbirds can fly backward?",text:"They're the only birds capable of this agile movement thanks to their unique wing structure."},{header:"gorillas burp when they're happy?",text:"It's one of their ways of expressing contentment and relaxation."},{header:"Australia is wider than the Moon?",text:"Australia spans about 2,485 miles across, while the Moon's diameter is only about 2,159 miles."},{header:"ants can carry up to 50 times their body weight?",text:"These tiny insects are incredibly strong for their size due to their muscle structure."},{header:"lightning is five times hotter than the surface of the Sun?",text:"A single bolt can reach temperatures of up to 50,000 degrees Fahrenheit."},{header:"sharks are the only fish that can blink with both eyes?",text:"They have an extra eyelid called a nictitating membrane for protection during attacks or feeding."},{header:"octopuses have three hearts?",text:"Two pump blood to the gills, while the third pumps it to the rest of the body—and it stops beating when they swim."},{header:"a group of flamingos is called a flamboyance?",text:"Their bright pink color and synchronized movements make this name quite fitting."},{header:"honey never spoils?",text:"Archaeologists have found pots of honey in ancient Egyptian tombs that are still edible."},{header:"cats can't taste sweetness?",text:"Their taste buds lack the receptors for sugary flavors, which might explain their disinterest in desserts."},{header:"a crocodile can't stick out its tongue?",text:"A special membrane holds their tongue in place, helping them swallow prey underwater."},{header:"sea otters hold hands while they sleep?",text:"This keeps them from drifting apart in the water, especially when they're napping in groups."},{header:"bananas glow blue under black light?",text:"This happens because of the way their peel breaks down as they ripen."},{header:"a watermelon is 92% water?",text:"That's why it's such a refreshing snack on a hot day!"},{header:"butterflies taste with their feet?",text:"Their taste sensors are located on their legs, helping them identify suitable plants for laying eggs."},{header:"an ostrich's eye is bigger than its brain?",text:"This might explain why these birds rely more on instinct than intelligence."},{header:"kangaroos can't walk backward?",text:"Their muscular tails and body structure make this movement impossible."},{header:"avocados are fruits, not vegetables?",text:"They're technically berries because of their fleshy pulp and single seed."},{header:"dolphins have names for each other?",text:"They use unique whistles to identify and call out to specific individuals in their pods."},{header:'the Hollywood sign originally said "Hollywoodland"?',text:"It was installed in 1923 as an advertisement for a real estate development."},{header:"giraffe tongues can be up to 20 inches long?",text:"Their dark color helps protect them from sunburn while reaching for leaves."},{header:"M&M's were the first candy eaten in space?",text:"Astronauts love them because they don't crumble and create messes in zero gravity."},{header:"starfish don't have brains?",text:"They rely on a simple nervous system to sense their surroundings and move around."},{header:"peanuts are legumes, not nuts?",text:"They grow underground like beans and peas, making them part of the legume family."},{header:"the shortest war in history lasted only 38 minutes?",text:"It was between Britain and Zanzibar on August 27, 1896."},{header:"clouds can weigh over a million pounds?",text:"Despite their massive weight, the water droplets are spread out enough to float in the air!"}];function*Ls(){(yield r.select((e=>{var t;return null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex})))===(yield r.select((e=>{var t;return(null===(t=e.slots)||void 0===t?void 0:t.length)||1})))-1&&(yield r.put({type:X,payload:{key:"FunFactMode",value:1}}))}const js={name:"logo-clickable-progression-extension",sagas:function*(){yield r.all([r.takeEvery("OFFER_LIFECYCLE",Ls)])},componentFactory:e=>e?"fun-fact"===e.variant?t.createElement(Ns,{partnerColor:e.partnerColor,schema:e},e.children):t.createElement(Rs,{schema:Object.assign(Object.assign({},e),{indicator:""}),partnerColor:e.partnerColor}):t.createElement("div",null,"Could not render Logo Clickable Progression"),interceptors:{}};const Ds=o.css`
76
76
  height: 20px;
77
77
  border-radius: 4px;
78
78
  width: 100%;
@@ -81,40 +81,40 @@
81
81
  background-size: 200% 100%;
82
82
  animation: 1.5s ${o.keyframes`to { background-position-x: -200%; }`} linear
83
83
  infinite;
84
- `,js=o.css`
84
+ `,ks=o.css`
85
85
  width: 75%;
86
- `,Ds=o.css`
86
+ `,Ps=o.css`
87
87
  height: 40px;
88
88
  width: 200px;
89
- `,ks=o.css`
89
+ `,$s=o.css`
90
90
  width: 150px;
91
- `;function Ps({hasLoaded:e,animationSpeedMS:n,styles:a}){const[i,r]=t.useState(!0);return t.useEffect((()=>{if(e){const e=setTimeout((()=>{r(!1)}),n);return()=>clearTimeout(e)}return()=>null}),[e]),i?t.createElement("div",{"data-testid":"skeleton",className:o.css(Object.assign({height:"100%"},null==a?void 0:a.skeleton))},t.createElement("div",{className:o.css`
91
+ `;function Fs({hasLoaded:e,animationSpeedMS:n,styles:a}){const[i,r]=t.useState(!0);return t.useEffect((()=>{if(e){const e=setTimeout((()=>{r(!1)}),n);return()=>clearTimeout(e)}return()=>null}),[e]),i?t.createElement("div",{"data-testid":"skeleton",className:o.css(Object.assign({height:"100%"},null==a?void 0:a.skeleton))},t.createElement("div",{className:o.css`
92
92
  padding: 30px 24px;
93
93
  display: flex;
94
94
  flex-direction: column;
95
95
  gap: 16px;
96
96
  height: inherit;
97
97
  justify-content: center;
98
- `},t.createElement("div",{className:_s}),t.createElement("div",{className:_s}),t.createElement("div",{className:_s}),t.createElement("div",{className:o.cx(_s,js)}),t.createElement("div",{className:o.css`
98
+ `},t.createElement("div",{className:Ds}),t.createElement("div",{className:Ds}),t.createElement("div",{className:Ds}),t.createElement("div",{className:o.cx(Ds,ks)}),t.createElement("div",{className:o.css`
99
99
  display: flex;
100
100
  gap: 16px;
101
101
  align-items: center;
102
- `},t.createElement("div",{className:o.cx(_s,Ds)}),t.createElement("div",{className:o.cx(_s,ks)})))):null}function $s({styles:e,hasLoaded:n,partnerText:a,animationSpeedMS:i}){if(!Array.isArray(a)||!(null==a?void 0:a.length))throw new Error("partnerText must be an string[]");const[r,s]=t.useState(!0);return t.useEffect((()=>{if(n){const e=setTimeout((()=>{s(!1)}),i);return()=>clearTimeout(e)}return()=>null}),[n]),r?t.createElement("div",{"data-testid":"partner-text",className:o.css(Object.assign({height:"100%",width:"100%",display:"flex",alignItems:"center",flexDirection:"column",justifyContent:"center",opacity:n?0:1,transition:`opacity ${i}ms ease-in-out`},null==e?void 0:e.partnerText))},a?t.Children.toArray(a.map((e=>t.createElement("p",{className:o.css`
102
+ `},t.createElement("div",{className:o.cx(Ds,Ps)}),t.createElement("div",{className:o.cx(Ds,$s)})))):null}function Gs({styles:e,hasLoaded:n,partnerText:a,animationSpeedMS:i}){if(!Array.isArray(a)||!(null==a?void 0:a.length))throw new Error("partnerText must be an string[]");const[r,s]=t.useState(!0);return t.useEffect((()=>{if(n){const e=setTimeout((()=>{s(!1)}),i);return()=>clearTimeout(e)}return()=>null}),[n]),r?t.createElement("div",{"data-testid":"partner-text",className:o.css(Object.assign({height:"100%",width:"100%",display:"flex",alignItems:"center",flexDirection:"column",justifyContent:"center",opacity:n?0:1,transition:`opacity ${i}ms ease-in-out`},null==e?void 0:e.partnerText))},a?t.Children.toArray(a.map((e=>t.createElement("p",{className:o.css`
103
103
  font-weight: 600;
104
104
  font-size: 14px;
105
105
  line-height: 21px;
106
106
  padding: 0 16px;
107
- `},e)))):null):null}const Fs=o.keyframes`
107
+ `},e)))):null):null}const Ms=o.keyframes`
108
108
  0% { width: 0; }
109
109
  100% { width: 100%; }
110
- }`;function Gs(e){const[n,i]=t.useState(!1),[r,s]=t.useState(!1),l=a.useDispatch(),c=It(),{type:d,children:u,durationMS:p,styles:f,partnerText:y,animationSpeedMS:h}=e.data;let m=null;switch(d){case"skeleton":m=t.createElement(Ps,{hasLoaded:n,animationSpeedMS:h,styles:f});break;case"partnerText":m=t.createElement($s,{partnerText:y,hasLoaded:n,animationSpeedMS:h,styles:f})}return t.useEffect((()=>{let e=null;const t=setTimeout((()=>{i(!0),e=setTimeout((()=>{s(!0)}),h)}),1.25*p);return()=>{t&&clearTimeout(t),e&&clearTimeout(e)}}),[p,l]),t.createElement("div",{"data-testid":"Loading"},t.createElement("div",{className:o.css`
110
+ }`;function Bs(e){const[n,i]=t.useState(!1),[r,s]=t.useState(!1),l=a.useDispatch(),c=St(),{type:d,children:u,durationMS:p,styles:f,partnerText:y,animationSpeedMS:h}=e.data;let m=null;switch(d){case"skeleton":m=t.createElement(Fs,{hasLoaded:n,animationSpeedMS:h,styles:f});break;case"partnerText":m=t.createElement(Gs,{partnerText:y,hasLoaded:n,animationSpeedMS:h,styles:f})}return t.useEffect((()=>{let e=null;const t=setTimeout((()=>{i(!0),e=setTimeout((()=>{s(!0)}),h)}),1.25*p);return()=>{t&&clearTimeout(t),e&&clearTimeout(e)}}),[p,l]),t.createElement("div",{"data-testid":"Loading"},t.createElement("div",{className:o.css`
111
111
  position: relative;
112
112
  `},t.createElement("div",{className:o.css`
113
113
  height: 4px;
114
114
  background-color: ${(null==f?void 0:f.primaryColor)||"#7F56D9"};
115
115
  position: absolute;
116
116
  top: 0;
117
- animation: ${Fs} ${p}ms linear forwards;
117
+ animation: ${Ms} ${p}ms linear forwards;
118
118
  transition: opacity ${h}ms ease-in-out;
119
119
  opacity: ${n?0:1};
120
120
  `}),t.createElement("div",{className:o.css`
@@ -133,7 +133,7 @@
133
133
  z-index: 10;
134
134
  transition: opacity ${h}ms ease-in-out;
135
135
  ${r?"\n opacity: 1;\n user-select: auto;\n pointer-events: auto;\n ":"\n opacity: 0;\n user-select: none;\n pointer-events: none;\n "}
136
- `},t.Children.toArray(u.map((e=>c(e))))))))}const Ms={name:"loading-extension",componentFactory:e=>t.createElement(Gs,{data:e}),interceptors:{}},Bs={name:"shimmer-background-extension",componentFactory:e=>t.createElement("div",null,"Shimmer Background"),interceptors:{}},Us=1e3;function Vs(e){const n=e.data,{minutes:o,seconds:r,timeRemaining:s,restartTimer:l}=function(e){const[n,a]=t.useState(e),i=(new Date).getTime()/Us,o=t.useRef(null),r=()=>{const t=(new Date).getTime()/Us;a(Math.max(Math.floor(e-(t-i)),0))};return t.useEffect((()=>(o.current=setInterval(r,Us),()=>{o.current&&"number"==typeof o.current&&clearInterval(o.current)})),[]),{minutes:Math.floor(n/60).toString(),seconds:Math.floor(Math.min(n%60,59)).toLocaleString("en-US",{minimumIntegerDigits:2,maximumFractionDigits:0,useGrouping:!1}),timeRemaining:n,restartTimer:function(){o.current&&"number"==typeof o.current&&clearInterval(o.current),a(e),o.current=setInterval(r,Us)}}}((null==n?void 0:n.duration)||300),c=a.useSelector((e=>{const t=i.path(["progression","currentGroupIndex"],e);return"number"==typeof t?t:0})),d=a.useDispatch();t.useEffect((()=>{l()}),[c]),t.useEffect((()=>{0===s&&(d({type:Z,payload:{name:"SignalUserInteraction",action:"TimerExpired",context:"TimerProgression"}}),d({type:"PROGRESSION/PROCESS",payload:{offerProcessStatus:"CONTINUE"}}))}),[o,r]);const u=An(),{tabIndex:p,styles:f,isDisabled:y}=m(u);return t.createElement("p",{tabIndex:p,style:Object.assign(Object.assign({},null==n?void 0:n.styles),f),"aria-hidden":y,"data-e2e":"Timer"},`${o}:${r}`)}const zs={name:"timer-progression-extension",componentFactory:e=>t.createElement(Vs,{data:e}),interceptors:{}},qs="MODULE/ADD_LOADED",Hs="MODULE/LOAD",Ws="PROGRESSION/INITIALISE",Js="PROGRESSION/NEXT",Ks="PROGRESSION/PREV",Ys="PROGRESSION/UPDATE_GROUP_SIZE",Zs="PROGRESSION/PROCESS",Qs="SLOTS/SET",Xs="INSTANT_PURCHASE/DISMISS",el="OFFER_LIFECYCLE",tl="DOMAIN_STATES/SET",nl="OFFER_ENGAGEMENT",al="GLOBAL_OFFER_DATA_STATE/SET_CART",il=Object.assign(Object.assign({},to),{NEXT_IN_PROGRESSION:Js,PREV_IN_PROGRESSION:Ks,INITIALISE_PROGRESSION:Ws,UPDATE_GROUP_SIZE:Ys,SET_SLOTS:Qs,ADD_LOADED_MODULE:qs,SET_DOMAIN_STATE:tl,SET_GLOBAL_OFFER_DATA_CART:al}),ol=Object.assign(Object.assign({},no),{LOAD_MODULES:Hs,DISMISS_INSTANT_PURCHASE:Xs,PROCESS_PROGRESSION:Zs,OFFER_LIFECYCLE:el,OFFER_ENGAGEMENT:nl,SET_PARTNER_VALIDATION_STATUS:ie});function rl(e,t){return t<=0||e<=0||t>e?0:Math.ceil(e/t)}function sl(e,t){const n=[];if(t<=0||e<=0||t>e)throw Error(`Could not generate the progression groups with groupSize: ${t} and totalCount: ${e}`);for(let a=0;a<rl(e,t);a++){const i=[];for(let n=0;n<t;n++)i.push(Math.min(a*t+n,e-1));n.push([...new Set(i)])}return n}const ll=Symbol("root");function cl(){return{[ll]:{}}}const dl=Object.assign({progression:function(e=null,t){switch(t.type){case Ws:if(function(e){const{totalCount:t,currentGroupIndex:n,groupSize:a}=e;return t>=0&&a>=0&&n>=0&&a<=t&&n<rl(t,a)}(t.payload)){const{totalCount:e,_:n,groupSize:a}=t.payload;return Object.assign(Object.assign({},t.payload),{indexGroups:sl(e,a)})}return null;case Ys:{const{groupSize:n}=t.payload,a=null==e?void 0:e.totalCount;return a&&n<=a&&n>0?Object.assign(Object.assign({},e),{groupSize:n,indexGroups:sl(a,n),currentGroupIndex:0}):null}case Js:{if(!e)return null;const{totalCount:t,groupSize:n,currentGroupIndex:a}=e;return t>0&&n>0&&a>=0?Object.assign(Object.assign({},e),{currentGroupIndex:Math.min(a+1,rl(t,n)-1)}):null}case Ks:{if(!e)return null;const{totalCount:t,groupSize:n,currentGroupIndex:a}=e;return t>0&&n>0&&a>=0?Object.assign(Object.assign({},e),{currentGroupIndex:Math.max(a-1,0)}):null}default:return e}},slots:function(e=[],t){return t.type===Qs?t.payload:e},module:function(e={loadedModules:[]},t){return t.type===qs?Object.assign(Object.assign({},e),{loadedModules:[...e.loadedModules,t.payload]}):e},domainStates:function(e=cl(),t){if(t.type===tl){if(t.payload.key&&!isNaN(t.payload.value)){const n=void 0!==t.payload.offerPositionIndex?`module${t.payload.offerPositionIndex}`:ll;return n===ll?e:Object.assign(Object.assign({},i.assocPath([n,t.payload.key],Number(t.payload.value),e)),{[ll]:{}})}return e}return e},globalOfferDataState:function(e={},t){if(t.type===al){if(t.payload.cart){const n=`module${t.payload.offerPositionIndex}`;return Object.assign(Object.assign({},e),{[n]:{cart:t.payload.cart}})}return e}return e}},ir);function ul(e={}){return Object.assign(Object.assign(Object.assign({},function(e={}){return Object.assign({layout:Wo(),breakpoint:{breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},active:Jo(),fonts:[],signal:{queue:[],processed:[]},serializableCache:ar(),settings:{closeOnComplete:!0},customStates:{root:{}}},e)}(e)),{progression:null,slots:[],module:{loadedModules:[]},domainStates:cl(),globalOfferDataState:{}}),e)}function pl(e){var t;return!!e.progression&&(1===e.progression.groupSize&&e.progression.currentGroupIndex===(null===(t=e.progression)||void 0===t?void 0:t.totalCount)-1)}function fl(e){return e.progression?{activeGroupIndex:e.progression.currentGroupIndex,totalOffers:e.progression.totalCount,totalGroups:rl(e.progression.totalCount,e.progression.groupSize),isLast:pl(e)}:null}function yl(e,t){return e.domainStates[`module${t}`]||{offerComplete:0,checkout:0}}function hl(e){return Object.values(e.globalOfferDataState).reduce(((e,t)=>{if(t&&"object"==typeof t&&"cart"in t){const n=t.cart;if(Array.isArray(n))return e+n.reduce(((e,t)=>e+("number"==typeof t.quantity?t.quantity:0)),0)}return e}),0)}function ml(n){var i;const{config:o,position:r,visible:s,container:l,testId:c}=n,d=Bn(),u=An(),p=a.useSelector(Ko),f=a.useSelector((e=>function(e,t){return e.globalOfferDataState[`module${t}`]}(e,r))),y=t.useContext(Un),h=t.useContext(Vn),m=`rokt-${o.layoutVariant.moduleName}-${d}`;return e.jsxs(e.Fragment,{children:[!s&&e.jsx("div",{style:{position:"absolute",top:"0",right:"0",bottom:"0",left:"0",zIndex:"1"},"aria-hidden":"true"}),e.jsx(m,{style:{display:"flex",flexDirection:"column"===l?"column":"row",width:"100%"},slotInstanceGuid:o.instanceGuid,layoutSchema:JSON.stringify(o.layoutVariant.layoutVariantSchema),schemaVersion:y,childLayouts:JSON.stringify(null!==(i=o.layoutVariant.childLayouts)&&void 0!==i?i:[]),offerData:JSON.stringify(o.offer),offerPositionIndex:r,visible:s,container:l,interactivity:u,"data-testid":c,"data-e2e":`OfferSlot-${r}`,inert:(null==h?void 0:h.inert)&&!s?"":void 0,"aria-hidden":(null==h?void 0:h.inert)?void 0:!s,"module-component":!0,"plugin-id":d,"active-breakpoint":B(p),offerState:JSON.stringify(f)})]})}function vl({schema:n,testId:i}){const o=n.styles,r=a.useSelector((e=>e.slots)),s=t.useRef(null),l=a.useSelector((e=>{var t,n;return null!==(n=null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex)&&void 0!==n?n:0})),c=An(),{tabIndex:d,isDisabled:u,styles:p}=m(c);return r.length&&r[l]?e.jsx(Ta,{styles:o,children:({classnames:a})=>e.jsx("div",{ref:s,"data-testid":i,"data-e2e":"OneByOneDistribution",className:null==a?void 0:a.own,tabIndex:d,"aria-hidden":u,style:Object.assign({position:"relative",transition:`height ${n.transition.settings.duration/2}ms ease-in-out`,overflow:"hidden",boxSizing:"content-box"},p),children:t.Children.toArray(r.map(((t,a)=>e.jsx(ji,{effect:n.transition,visible:a===l,parentElement:s.current,children:e.jsx(ml,{config:t,position:a,visible:a===l,container:"column"})}))))})}):null}const gl=a.connect((function(e,{schema:t}){var n,a,i;const o=t.startPosition||1;if((null===(n=e.progression)||void 0===n?void 0:n.totalCount)&&(null===(a=e.progression)||void 0===a?void 0:a.groupSize)){const t=rl(e.progression.totalCount,e.progression.groupSize);let n;n=o>0?o-1:t+o>-1?t+o:0;return{numOfIndicators:t-n>-1?t-n:0,activeIndex:null!==(i=e.progression.currentGroupIndex)&&void 0!==i?i:0,startIndex:n}}return{numOfIndicators:0,activeIndex:0,startIndex:0}}))((function({activeIndex:t,startIndex:n,numOfIndicators:a,schema:i}){const o=An(),{tabIndex:r,styles:s,isDisabled:l}=m(o),c=Array(a).fill(i.indicator);return a>1&&(u=a+n-1,(d=t)>=n&&d<=u)?e.jsx(Ht,{children:a=>e.jsx(Ta,{styles:i.styles,children:i=>{var o;const d=i.classnames,u=e=>{var n,a;return e===t?`${null==d?void 0:d.indicator} ${(null==d?void 0:d.activeIndicator)?d.activeIndicator:null!==(n=null==d?void 0:d.seenIndicator)&&void 0!==n?n:""}`:e<t?`${null==d?void 0:d.indicator} ${null!==(a=null==d?void 0:d.seenIndicator)&&void 0!==a?a:""}`:null==d?void 0:d.indicator};return e.jsx("div",{className:null!==(o=null==d?void 0:d.own)&&void 0!==o?o:"",style:Object.assign({display:"flex",flexDirection:"row"},s),"data-e2e":"ProgressIndicator",tabIndex:r,"aria-hidden":l,children:y.Children.toArray(c.map(((t,i)=>e.jsx("span",{className:u(i+n),style:{display:"flex"},children:a({state:{indicatorPosition:String(i+1+n)}})(t)}))))})}})}):null;var d,u}));const bl="partnerValidationUI",El="stackedViewableItems";function Il(n){var o;const r=a.useDispatch(),s=a.useSelector((e=>e.slots)),l=null!==(o=n.schema.viewableItems)&&void 0!==o?o:[],c=va(l.reduce(((e,t,n)=>Object.assign(Object.assign({},e),{[n]:t.when})),{})),d=i.compose((e=>{var t;return e&&(null===(t=l[e[0]])||void 0===t?void 0:t.value)||s.length}),i.find((([e,t])=>t)),i.toPairs)(c);t.useEffect((()=>{r({type:Hi,payload:{key:El,value:String(d)}})}),[d]);const u=s.slice(0,d),p=An(),{tabIndex:f,isDisabled:y,styles:h}=m(p);return(null==u?void 0:u.length)>0?e.jsx(Ta,{styles:n.schema.styles,children:({classnames:a})=>e.jsx("div",{"data-testid":n.testId,"data-e2e":"StackedDistribution",className:null==a?void 0:a.own,"aria-hidden":y,tabIndex:f,style:Object.assign({display:"flex",flexDirection:"column"},h),children:t.Children.toArray(u.map(((t,n)=>e.jsx(ml,{config:t,position:n,visible:!0,container:"column"}))))})}):null}function Sl(n){const i=n.schema.styles,o=a.useDispatch(),r=An(),s="Backward"===n.schema.direction?"Previous":"Next",{tabIndex:l,styles:c,isDisabled:d}=m(r),u=()=>{o({type:"Backward"===n.schema.direction?il.PREV_IN_PROGRESSION:il.NEXT_IN_PROGRESSION})};return e.jsx(Ta,{styles:i,children:({classnames:a})=>{var i;return e.jsx("button",{title:s,className:null==a?void 0:a.own,onClick:u,"data-testid":n.testId,"data-e2e":"ProgressControl","data-e2e-direction":`${n.schema.direction}`,disabled:d,"aria-disabled":d,"aria-label":null!==(i=n.schema.a11yLabel)&&void 0!==i?i:s,tabIndex:l,style:Object.assign({cursor:"pointer"},c),children:e.jsx(Et,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}function xl({schema:n,testId:i}){var o,r,s,l,c,u,p,f,y;const h=a.useSelector((e=>e.progression)),v=null==h?void 0:h.indexGroups[null==h?void 0:h.currentGroupIndex],g=null!==(o=null==h?void 0:h.currentGroupIndex)&&void 0!==o?o:0,b=a.useSelector((e=>e.slots)),E=a.useSelector(Xo),I=n.viewableItems.length-1,[S,x]=d({slidesToScroll:null!==(r=n.viewableItems[Math.min(E,I)])&&void 0!==r?r:"auto",containScroll:"trimSnaps"}),C=a.useDispatch(),w=An(),{tabIndex:O,isDisabled:T,styles:A}=m(w),R=`${null!==(f=null===(p=null===(u=null===(c=null===(l=null===(s=n.styles)||void 0===s?void 0:s.elements)||void 0===l?void 0:l.own[E])||void 0===c?void 0:c.default)||void 0===u?void 0:u.container)||void 0===p?void 0:p.gap)&&void 0!==f?f:"0"}px`;t.useEffect((()=>{function e(e){var t,n;const a=null!==(t=null==e?void 0:e.selectedScrollSnap())&&void 0!==t?t:0,i=null!==(n=null==e?void 0:e.previousScrollSnap())&&void 0!==n?n:0;a!==g&&(a>i?C({type:il.NEXT_IN_PROGRESSION}):a<i&&C({type:il.PREV_IN_PROGRESSION}))}return null!=g&&(null==x||x.on("select",e),null==x||x.scrollTo(g)),()=>{null==x||x.off("select",e)}}),[x,g,C]);const N={overflow:"hidden"},L={backfaceVisibility:"hidden",display:"flex",touchAction:"pan-y",gap:R,alignItems:"stretch"},_=e=>{var t;return null!==(t=null==v?void 0:v.includes(e))&&void 0!==t&&t},j=n.peekThroughSize[Math.min(E,n.peekThroughSize.length-1)],D=j?"Fixed"===(k=j).type?`${k.value}px`:`${k.value}%`:"0px";var k;const P=null!==(y=n.viewableItems[Math.min(I,E)])&&void 0!==y?y:1,$={flex:`0 0 calc(${(e=>"0px"!==e&&"0%"!==e)(D)?`(100% - 2 * ${D} - (${P} + 1) * ${R})/${P}`:`(100% - (${P} - 1) * ${R})/${P}`})`,position:"relative",display:"flex",overflow:"auto"};return(null==b?void 0:b.length)>0?e.jsx(Ta,{styles:n.styles,children:({classnames:n})=>e.jsx("div",{ref:S,style:Object.assign(Object.assign({},N),A),"aria-disabled":T,tabIndex:O,className:null==n?void 0:n.own,"data-e2e":"CarouselDistribution","data-testid":i&&`${i}`,children:e.jsx("div",{style:L,"data-testid":i&&`${i}-container`,"data-e2e":"CarouselDistribution-Container",children:t.Children.toArray(b.map(((t,n)=>e.jsx("div",{style:$,"data-testid":i&&`${i}-slide-${n}`,"data-e2e":`CarouselDistribution-Slide-${n}`,children:e.jsx(ml,{config:t,position:n,container:"row",visible:_(n)})}))))})})}):null}const Cl=Object.freeze([]);function wl({schema:n,testId:i}){const o=Bn(),r=t.useMemo((()=>dt(o)([{display:"flex",flexDirection:"column"}])),[o]),s=a.useSelector((e=>{var t;return(null===(t=e.progression)||void 0===t?void 0:t.groupSize)||0})),l=a.useSelector((e=>{var t;return(null===(t=e.progression)||void 0===t?void 0:t.indexGroups)||Cl})),c=a.useSelector((e=>e.slots||Cl)),d=t.useMemo((()=>l.map((e=>e.map((e=>c[e])).filter((e=>null!=e))))),[l,c]),u=t.useRef(null),p=a.useSelector((e=>{var t,n;return null!==(n=null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex)&&void 0!==n?n:0})),f=An(),{tabIndex:y,isDisabled:h,styles:v}=m(f);return d.length?e.jsx(Ta,{styles:n.styles,children:({classnames:a})=>e.jsx("div",{ref:u,"data-testid":i,"data-e2e":"GroupedDistribution","aria-disabled":h,tabIndex:y,style:Object.assign({position:"relative",transition:`height ${n.transition.settings.duration/2}ms ease-in-out`,overflow:"hidden",boxSizing:"content-box"},v),children:t.Children.toArray(d.map(((o,l)=>e.jsx(ji,{effect:n.transition,visible:l===p,parentElement:u.current,containerClassName:[r,null==a?void 0:a.own].filter(Boolean).join(" ")||void 0,children:t.Children.toArray(o.map(((t,n)=>{const a=s*l+n;return e.jsx(ml,{config:t,position:a,visible:l===p,container:"column",testId:i?`${i}-child${a}`:void 0})})))}))))})}):null}const Ol={action:{CaptureOnly:"CaptureOnly",Url:"Url",Fulfillment:"Fulfillment",ExternalPaymentTrigger:"ExternalPaymentTrigger"},urlBehavior:{newTab:"newTab",roktWebViewSDK:"roktWebViewSDK",self:"self"},signalType:{SignalResponse:"SignalResponse",SignalGatedResponse:"SignalGatedResponse",SignalSecondaryResponse:"SignalSecondaryResponse"},conversionType:{Default:"Default",RealTime:"RealTime",RealTimeReferral:"RealTimeReferral"}};function Tl(e,t,n=!1){return Error(`Could not translate ${e} with guid: ${t}${n?" for child layout":""}`)}function Al(e,t=!1){var n;try{if(e.responseOptionsMap||t)return Object.assign(Object.assign({},e),{responseOptionsMap:i.mapObjIndexed(Rl,null!==(n=e.responseOptionsMap)&&void 0!==n?n:{})});{const t=`Creative: ${e.instanceGuid}, did not receive a valid response options map.`;throw new L("NO_CREATIVE_RESPONSE_OPTIONS_MAP",t)}}catch(n){throw n.message?n:Tl("Creative",e.instanceGuid,t)}}function Rl(e){try{let t,n;if(e.urlBehavior&&(t=Ol.urlBehavior[e.urlBehavior]),e.conversionType&&(n=Ol.conversionType[e.conversionType]),"External"===e.action){const t=`Creative response with instanceGuid '${e.instanceGuid}' uses legacy action type 'External'. This should be 'ExternalPaymentTrigger'.`;throw new L("LEGACY_EXTERNAL_ACTION_TYPE",t)}return Object.assign(Object.assign({},e),{urlBehavior:t,action:Ol.action[e.action],signalType:Ol.signalType[e.signalType],conversionType:n})}catch(t){throw t.message?t:Tl("CreativeResponse",e.instanceGuid)}}function Nl(e,t,n){try{return JSON.parse(e)}catch(e){throw Error(`Parse JSON failed, invalid JSON file for ${t} with guid ${n}.`)}}function Ll(){t.useEffect((()=>{const e=new ResizeObserver(function(e=100){let t;return()=>{t&&clearTimeout(t),t=setTimeout((()=>{var e,n;null===(n=null===(e=window.frameElement)||void 0===e?void 0:e.iFrameResizer)||void 0===n||n.resize(),t=void 0}),e)}}());return e.observe(document.body),()=>{e.disconnect()}}),[])}const _l={OneByOneDistribution:function(t){if("OneByOneDistribution"===t.type)return e.jsx(vl,{schema:t.node})},StackedDistribution:function(t){if("StackedDistribution"===t.type)return e.jsx(Il,{schema:t.node})},ProgressIndicator:function(t){if("ProgressIndicator"===t.type)return e.jsx(gl,{schema:t.node})},ProgressControl:function(t){if("ProgressControl"===t.type)return e.jsx(Sl,{schema:t.node})},Overlay:function(t){if("Overlay"===t.type)return e.jsx(po,{schema:t.node})},CloseButton:function(t){if("CloseButton"===t.type)return e.jsx(oo,{schema:t.node})},EscapeHatch:(jl=[function(t,n){if(v("CloseButton",t)){const n=JSON.parse(t.node.data);return e.jsx(oo,{schema:n.node,action:n.action})}},yi],e=>jl.reduce(((t,n)=>void 0===t?n(e):t),void 0)),CarouselDistribution:function(t){if("CarouselDistribution"===t.type)return e.jsx(xl,{schema:t.node})},GroupedDistribution:function(t){if("GroupedDistribution"===t.type)return e.jsx(wl,{schema:t.node})},BottomSheet:function(t){if("BottomSheet"===t.type)return e.jsx(mo,{schema:t.node})}};var jl;function Dl(e,t){e({type:Z,payload:{name:"SignalActivation",parentGuid:t}})}function kl({pageInstanceGuid:n}){var o,r,s,l,c,d;const u=a.useSelector((e=>e.layout),i.equals),p=a.useDispatch(),f=a.useSelector((e=>({breakpoint:e.breakpoint,progression:fl(e),customStates:e.customStates.root,domainStates:e.domainStates[ll]})),i.equals),y=a.useSelector((e=>e.slots.length)),h=a.useSelector((e=>{var t;const n=Number(null!==(t=e.serializableCache.get(El))&&void 0!==t?t:"");return y-n})),m=a.useSelector(hl);de(Ct(),p),t.useEffect((()=>(u&&document.body.addEventListener("click",Dl.bind(null,p,u.instanceGuid),{once:!0}),()=>{u&&document.body.removeEventListener("click",Dl.bind(null,p,u.instanceGuid))})),[null==u?void 0:u.instanceGuid]),Ll(),t.useEffect((()=>{if(u){const e={type:Z,payload:{name:"SignalImpression",parentGuid:u.instanceGuid}},t={type:Xi,payload:{code:"LAYOUT_IMPRESSED"}};p(e),p(t)}}),[u]);const v=e=>{p({type:ol.REPORT_ERROR,payload:e})},g=a.useSelector((e=>e.breakpoint.initialised));if(u&&g){const t=Vt({})({state:{progression:(null!==(r=null===(o=f.progression)||void 0===o?void 0:o.activeGroupIndex)&&void 0!==r?r:0)+1,maxProgression:null!==(l=null===(s=f.progression)||void 0===s?void 0:s.totalGroups)&&void 0!==l?l:1,availableOffersCount:null!==(d=null===(c=f.progression)||void 0===c?void 0:c.totalGroups)&&void 0!==d?d:y,selectedCatalogItemQuantity:m,hiddenItemCount:h}}),a=wi(v);return e.jsx(Pn,{info:{layoutType:"OuterLayout",pageInstanceGuid:n},children:e.jsx(Wt,{value:t,children:e.jsx(St,{value:a,overrides:_l,children:e.jsx(vt.Provider,{value:f,children:e.jsx(ht.Provider,{value:p,children:e.jsx(Zt.Provider,{value:"OUTER",children:e.jsx(Un.Provider,{value:u.layoutSchemaVersion,children:e.jsx(Et,{children:e=>e(u.layoutSchema)})})})})})})})})}return null}var Pl=Object.freeze({__proto__:null,getDistribution:function e(t){var n;switch(t.type){case"OneByOneDistribution":case"StackedDistribution":case"CarouselDistribution":case"GroupedDistribution":return t;case"Row":case"Column":case"When":case"ZStack":case"FlowRow":case"InlineContainer":case"ScrollableRow":case"ScrollableColumn":case"BottomSheet":case"Overlay":for(const n of t.node.children){const t=e(n);if(t)return t}break;case"EscapeHatch":try{const{name:a,body:i}=JSON.parse(t.node.data);if(("loading-extension"===a||"minimized-bottomsheet-extension"===a)&&(null===(n=null==i?void 0:i.children)||void 0===n?void 0:n.length))for(const t of i.children){const n=e(t);if(n)return n}break}catch(e){break}case"StaticImage":case"DataImage":case"RichText":case"BasicText":case"ProgressIndicator":case"CreativeResponse":case"StaticLink":case"CloseButton":case"ProgressControl":case"StaticIcon":case"DataIcon":case"SlideStateTrigger":case"ToggleButtonStateTrigger":case"TimerStateTrigger":case"CatalogStackedCollection":case"CatalogResponseButton":case"CatalogQuantityOption":case"CatalogRadioGroup":case"CatalogQuantityCounter":case"PartnerEventButtonTrigger":case"CopyToClipboardButton":case"ButtonStateTrigger":case"CatalogCombinedCollection":break;default:!function(e){throw Error(`Could not handle layout: ${JSON.stringify(e)}`)}(t)}},getDistributionViewableItems:function(e){switch(null==e?void 0:e.type){case"CarouselDistribution":case"GroupedDistribution":return e.node.viewableItems;default:return}}}),$l=Object.assign({},Pl);function*Fl(e,t){const n=$l.getDistribution(t),a=null==n?void 0:n.type,i=yield r.select(Xo),o=function(e=0,t){var n;switch(null==t?void 0:t.type){case"CarouselDistribution":case"GroupedDistribution":{const a=Math.min(t.node.viewableItems.length,e);return null!==(n=t.node.viewableItems[a])&&void 0!==n?n:1}default:return 1}}("number"==typeof i?i:0,n);"OneByOneDistribution"!==a&&"CarouselDistribution"!==a&&"GroupedDistribution"!==a||(yield c.put({type:il.INITIALISE_PROGRESSION,payload:{currentGroupIndex:0,totalCount:e,groupSize:o}}))}function*Gl(e,t){const{instanceGuid:n,layoutSchemaVersion:a,outerLayoutSchema:o,slots:r}=t.payload;n?yield c.put({type:Z,payload:{name:"SignalLoadComplete",parentGuid:n}}):yield c.put({type:Qi,payload:{level:Io,code:ko,message:"Layout instance guid does not exist"}}),yield c.put({type:Hs,payload:{modules:r.map((e=>e.layoutVariant.moduleName))}}),yield c.put({type:Gi,payload:o.breakpoints}),yield c.put({type:il.LAYOUT_UPDATE,payload:{instanceGuid:n,layoutSchemaVersion:a,layoutSchema:o.layout,settings:o.settings}}),yield c.put({type:il.SET_SLOTS,payload:r}),i.isNil(o.settings)||(yield c.put({type:il.SET_SETTINGS,payload:o.settings})),yield*Fl(r.length,o.layout);const s=yield*function*(e,t,n){const a=null==t?void 0:t.enablePartnerValidation,i=["add-to-cart"],o=n.some((e=>i.some((t=>t===e.layoutVariant.moduleName))));if(a&&o)try{yield c.call(e.send,ur.PartnerValidationEvent.OPT_IN_TO_PARTNER_VALIDATION),yield c.spawn(Ml,e,ur.PartnerValidationEvent.SHOW_PARTNER_VALIDATION_STATUS,(()=>({type:"ACTIVE/ADD",payload:{id:bl}})))}catch(e){return yield c.put({type:Qi,payload:{level:Eo,code:$o,message:"Failed to establish partner validation."}}),"FAILURE"}return"OK"}(e.partner,o.settings,r);"OK"===s&&(yield c.call(Lr,e.display,o.display))}function*Ml(e,t,n){const a=l.eventChannel((a=>{const i=e.onEvent(t).subscribe((e=>{a(n(e))}));return()=>{i.unsubscribe()}}));for(;;){const e=yield c.take(a);yield c.put(e)}}function Bl(e){return Tc(e)}function Ul(e,t){return Error(`Migration process from v0_0 to v0_1 failed: could not transform ${e} node. For more details: ${t}`)}const Vl=i.all(i.anyPass([function(e){return"Row"===e.type&&Wl(e.node.children)},function(e){return"Column"===e.type&&Wl(e.node.children)},Zl,Ql])),zl=i.all(i.anyPass([function(e){return"Row"===e.type&&Jl(e.node.children)},function(e){return"Column"===e.type&&Jl(e.node.children)},Ql,Zl,function(e){return"DataImage"===e.type},function(e){return"When"===e.type&&Jl(e.node.children)}])),ql=i.all(i.anyPass([function(e){return"Row"===e.type&&Kl(e.node.children)},function(e){return"Column"===e.type&&Kl(e.node.children)},Ql,Zl])),Hl=i.all(i.anyPass([function(e){return"Row"===e.type&&Yl(e.node.children)},function(e){return"Column"===e.type&&Yl(e.node.children)},Zl,function(e){return"RichText"===e.type},Ql,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&Yl(e.node.children)},function(e){return"StaticLink"===e.type&&Yl(e.node.children)},function(e){return"StackedDistribution"===e.type},function(e){return"CloseButton"===e.type&&Yl(e.node.children)}]));function Wl(e){return Vl(e)}function Jl(e){return zl(e)}function Kl(e){return ql(e)}function Yl(e){return Hl(e)}function Zl(e){return"StaticImage"===e.type}function Ql(e){return"BasicText"===e.type}const Xl=i.lensPath(["styles","elements","link"]),ec=i.lensPath(["styles","elements","activeIndicator"]),tc=i.lensPath(["styles","elements","indicator"]),nc=i.lensPath(["styles","elements","seenIndicator"]),ac=i.lensPath(["focussed"]),ic=i.lensPath(["hovered"]),oc=i.lensPath(["default"]),rc=i.lensPath(["pressed"]),sc=e=>{var t;return{text:null!==(t=null==e?void 0:e.text)&&void 0!==t?t:{}}},lc=i.when(i.hasPath(["styles","elements","link"]),i.pipe(i.over(Xl,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default})))),i.over(Xl,i.map(i.when(i.has("focussed"),i.over(ac,sc)))),i.over(Xl,i.map(i.when(i.has("hovered"),i.over(ic,sc)))),i.over(Xl,i.map(i.when(i.has("default"),i.over(oc,sc)))),i.over(Xl,i.map(i.when(i.has("pressed"),i.over(rc,sc)))))),cc=i.pipe(i.when(i.hasPath(["styles","elements","activeIndicator"]),i.over(ec,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","indicator"]),i.over(tc,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","seenIndicator"]),i.over(nc,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))));function dc(e,t){return e?{elements:{own:e.elements.own.map(t)}}:void 0}const uc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),pc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),fc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),yc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),hc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),mc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),vc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),gc=e=>{switch(e){case"is":return"is";case"is not":return"is-not";case"is below":return"is-below";case"is above":return"is-above";default:throw Ul("When",`Invalid condition: ${e}`)}},bc=e=>{switch(e){case"breakpoint":return"Breakpoint";case"progression":return"Progression";case"position":return"Position";default:throw Ul("When",`Invalid target: ${e}`)}},Ec=e=>{const{target:t,condition:n,value:a}=e;return{type:bc(t),predicate:{condition:gc(n),value:a}}};function Ic(e){const t={type:"FadeInOut",settings:{duration:e.transition.settings.duration}};return{styles:e.style,transition:t}}function Sc(e){const t=e.children.map((e=>Tc(e)));if(Wl(t))return Object.assign(Object.assign({},e),{children:t,styles:dc(e.styles,hc)});throw Ul("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function xc(e){const t=e.children.map((e=>Tc(e)));if(Jl(t))return Object.assign(Object.assign({},e),{children:t,styles:dc(e.styles,mc)});throw Ul("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function Cc(e){const t=e.children.map((e=>Tc(e)));if(Kl(t))return Object.assign(Object.assign({},e),{children:t,styles:dc(e.styles,vc)});throw Ul("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}const wc=e=>({own:e.overlayContainer,wrapper:e.overlayWrapper});function Oc(e){var t,n;const a=(null===(t=e.styles)||void 0===t?void 0:t.elements)?{elements:wc(null===(n=e.styles)||void 0===n?void 0:n.elements)}:void 0,i=e.children.map((e=>Tc(e)));if(Yl(i))return Object.assign(Object.assign({},e),{styles:a,children:i});throw Ul("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function Tc(e){switch(e.type){case"When":return{type:"When",node:(s=e.node,{predicates:s.predicates.map(Ec),children:s.children.map((e=>Tc(e)))})};case"OneByOneDistribution":return{type:e.type,node:Ic(e.node)};case"Overlay":return{type:e.type,node:Oc(e.node)};case"Column":return{type:e.type,node:(r=e.node,{styles:dc(r.styles,uc),children:r.children.map((e=>Tc(e)))})};case"Row":return{type:e.type,node:(o=e.node,{styles:dc(o.styles,pc),children:o.children.map((e=>Tc(e)))})};case"RichText":return{type:e.type,node:(i=e.node,lc(i))};case"CloseButton":return{type:e.type,node:Sc(e.node)};case"CreativeResponse":return{type:e.type,node:xc(e.node)};case"StaticLink":return{type:e.type,node:Cc(e.node)};case"StaticImage":return{type:e.type,node:(a=e.node,Object.assign(Object.assign({},a),{styles:dc(a.styles,fc)}))};case"DataImage":return{type:e.type,node:(n=e.node,Object.assign(Object.assign({},n),{styles:dc(n.styles,yc)}))};case"ProgressIndicator":return{type:e.type,node:(t=e.node,cc(t))};default:return e}var t,n,a,i,o,r,s}function Ac(e){return Dd(e)}function Rc(e,t){return Error(`Migration process from v0_23 to v1_0 failed: could not transform ${e} node. For more details: ${t}`)}const Nc=e=>"scroll"===e||"auto"===e?"visible":e,Lc=i.lensPath(["elements","own"]),_c=i.lensPath(["transitions","transition","value","own"]),jc=i.lensPath(["elements","wrapper"]),Dc=i.lensPath(["transitions","transition","value","wrapper"]),kc=i.lensPath(["elements","indicator"]),Pc=i.lensPath(["transitions","transition","value","indicator"]),$c=i.lensPath(["elements","activeIndicator"]),Fc=i.lensPath(["transitions","transition","value","activeIndicator"]),Gc=i.lensPath(["elements","seenIndicator"]),Mc=i.lensPath(["transitions","transition","value","seenIndicator"]),Bc=i.lensPath(["default","container","overflow"]),Uc=i.lensPath(["pressed","container","overflow"]),Vc=i.lensPath(["hovered","container","overflow"]),zc=i.lensPath(["focussed","container","overflow"]),qc=i.lensPath(["disabled","container","overflow"]),Hc=i.lensPath(["container","overflow"]),Wc=i.pipe(i.when(i.hasPath(["default","container","overflow"]),i.over(Bc,Nc)),i.when(i.hasPath(["pressed","container","overflow"]),i.over(Uc,Nc)),i.when(i.hasPath(["hovered","container","overflow"]),i.over(Vc,Nc)),i.when(i.hasPath(["focussed","container","overflow"]),i.over(zc,Nc)),i.when(i.hasPath(["disabled","container","overflow"]),i.over(qc,Nc))),Jc=i.when(i.hasPath(["container","overflow"]),i.over(Hc,Nc)),Kc=i.pipe(i.when(i.hasPath(["elements","own"]),i.over(Lc,i.map(Wc))),i.when(i.hasPath(["transitions","transition","value","own"]),i.over(_c,Jc))),Yc=i.when(i.has("transitions"),(e=>{var t;return i.compose(i.omit(["transitions"]),i.assoc("conditionalTransitions",null===(t=e.transitions)||void 0===t?void 0:t.transition))(e)})),Zc=i.pipe(Kc,Yc),Qc=i.pipe(i.when(i.hasPath(["elements","wrapper"]),i.over(jc,i.map(Wc))),i.when(i.hasPath(["transitions","transition","value","wrapper"]),i.over(Dc,Jc))),Xc=i.pipe(i.when(i.hasPath(["elements","indicator"]),i.over(kc,i.map(Wc))),i.when(i.hasPath(["transitions","transition","value","indicator"]),i.over(Pc,Jc))),ed=i.pipe(i.when(i.hasPath(["elements","activeIndicator"]),i.over($c,i.map(Wc))),i.when(i.hasPath(["transitions","transition","value","activeIndicator"]),i.over(Fc,Jc))),td=i.pipe(i.when(i.hasPath(["elements","seenIndicator"]),i.over(Gc,i.map(Wc))),i.when(i.hasPath(["transitions","transition","value","seenIndicator"]),i.over(Mc,Jc)));function nd(e){return"StaticImage"===e.type}function ad(e){return"StaticIcon"===e.type}function id(e){return"BasicText"===e.type}function od(e){return"DataImage"===e.type}function rd(e){return"DataIcon"===e.type}function sd(e){return"RichText"===e.type}function ld(e){return"SlideStateTrigger"===e.type}function cd(e){return"ToggleButtonStateTrigger"===e.type}const dd=i.all(i.anyPass([function(e){return"Row"===e.type&&ud(e.node.children)},function(e){return"Column"===e.type&&ud(e.node.children)},nd,ad,sd,id,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&ud(e.node.children)},function(e){return"StaticLink"===e.type&&ud(e.node.children)},function(e){return"StackedDistribution"===e.type},function(e){return"CarouselDistribution"===e.type},function(e){return"GroupedDistribution"===e.type},function(e){return"CloseButton"===e.type&&ud(e.node.children)},function(e){return"ProgressControl"===e.type&&Id(e.node.children)},function(e){return"ZStack"===e.type&&ud(e.node.children)},function(e){return"FlowRow"===e.type&&ud(e.node.children)},ld,cd]));function ud(e){return dd(e)}const pd=i.pipe(Kc,Qc,Yc);function fd(e){const t=e.children.map((e=>Dd(e)));if(ud(t))return Object.assign(Object.assign({},i.omit(["settings"],e)),{children:t,allowBackdropToClose:e.settings.allowBackdropToClose,styles:e.styles?pd(e.styles):void 0});throw Rc("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function yd(e){const t=e.children.map((e=>Dd(e)));if(Id(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Zc(e.styles):void 0});throw Rc("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function hd(e){const t=e.children.map((e=>Dd(e)));if(xd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Zc(e.styles):void 0});throw Rc("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function md(e){const t=e.children.map((e=>Dd(e)));if(Id(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Zc(e.styles):void 0});throw Rc("ProgressControl",`Invalid schema: ${JSON.stringify(e)}`)}const vd=i.pipe(Kc,Xc,ed,td,Yc);const gd=i.all(i.anyPass([id,nd,ad,od,rd,function(e){return"Row"===e.type&&bd(e.node.children)},function(e){return"FlowRow"===e.type&&bd(e.node.children)},function(e){return"Column"===e.type&&bd(e.node.children)},function(e){return"ZStack"===e.type&&bd(e.node.children)},function(e){return"When"===e.type&&bd(e.node.children)}]));function bd(e){return gd(e)}const Ed=i.all(i.anyPass([id,nd,ad,function(e){return"Row"===e.type&&Id(e.node.children)},function(e){return"FlowRow"===e.type&&Id(e.node.children)},function(e){return"Column"===e.type&&Id(e.node.children)},function(e){return"ZStack"===e.type&&Id(e.node.children)},function(e){return"When"===e.type&&Id(e.node.children)}]));function Id(e){return Ed(e)}const Sd=i.all(i.anyPass([id,nd,ad,od,rd,function(e){return"Row"===e.type&&xd(e.node.children)},function(e){return"FlowRow"===e.type&&xd(e.node.children)},function(e){return"Column"===e.type&&xd(e.node.children)},function(e){return"ZStack"===e.type&&xd(e.node.children)},function(e){return"When"===e.type&&xd(e.node.children)}]));function xd(e){return Sd(e)}function Cd(e){const t=e.children.map((e=>Dd(e)));if(bd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Zc(e.styles):void 0});throw Rc("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}function wd(e){const t=e.children.map((e=>Dd(e)));if(xd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Zc(e.styles):void 0});throw Rc("CatalogResponseButton",`Invalid schema: ${JSON.stringify(e)}`)}function Od(e){return"Row"===e.type&&Rd(e.node.children)}function Td(e){return"Column"===e.type&&Rd(e.node.children)}const Ad=i.all(i.anyPass([id,nd,ad,od,rd,sd,function(e){return"StaticLink"===e.type},ld,cd,function(e){return"CatalogResponseButton"===e.type},Od,function(e){return"FlowRow"===e.type&&Rd(e.node.children)},Td,function(e){return"ZStack"===e.type&&Rd(e.node.children)},function(e){return"When"===e.type&&Rd(e.node.children)}]));function Rd(e){return Ad(e)}const Nd=i.anyPass([Od,Td]);function Ld(e){const t=Dd(e.template);if(function(e){return Nd(e)}(t))return Object.assign(Object.assign({},e),{template:t,styles:e.styles?Zc(e.styles):void 0});throw Rc("CatalogStackedCollection",`Invalid schema: ${JSON.stringify(e)}`)}function _d(e){const t=e.children.map((e=>Dd(e)));if(bd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Zc(e.styles):void 0});throw Rc("ToggleButtonStateTrigger",`Invalid schema: ${JSON.stringify(e)}`)}function jd(e){const t=e.transition?{inTransition:e.transition.in,outTransition:e.transition.out}:void 0;return Object.assign(Object.assign({},e),{children:e.children.map((e=>Dd(e))),transition:t})}function Dd(e){switch(e.type){case"Row":return{type:e.type,node:(g=e.node,Object.assign(Object.assign({},g),{children:g.children.map((e=>Dd(e))),styles:g.styles?Zc(g.styles):void 0}))};case"When":return{type:e.type,node:jd(e.node)};case"FlowRow":return{type:e.type,node:(v=e.node,Object.assign(Object.assign({},v),{styles:v.styles?Zc(v.styles):void 0,children:v.children.map((e=>Dd(e)))}))};case"Column":return{type:e.type,node:(m=e.node,Object.assign(Object.assign({},m),{children:m.children.map((e=>Dd(e))),styles:m.styles?Zc(m.styles):void 0}))};case"ZStack":return{type:e.type,node:(h=e.node,Object.assign(Object.assign({},h),{styles:h.styles?Zc(h.styles):void 0,children:h.children.map((e=>Dd(e)))}))};case"Overlay":return{type:e.type,node:fd(e.node)};case"ProgressControl":return{type:e.type,node:md(e.node)};case"CarouselDistribution":return{type:"CarouselDistribution",node:(y=e.node,Object.assign(Object.assign({},i.omit(["settings"],y)),{viewableItems:y.settings.viewableItems,peekThroughSize:y.settings.peekThroughSize,styles:y.styles?Zc(y.styles):void 0}))};case"CloseButton":return{type:"CloseButton",node:yd(e.node)};case"CreativeResponse":return{type:"CreativeResponse",node:hd(e.node)};case"GroupedDistribution":return{type:"GroupedDistribution",node:(f=e.node,Object.assign(Object.assign({},i.omit(["settings"],f)),{viewableItems:f.settings.viewableItems,transition:f.settings.transition,styles:f.styles?Zc(f.styles):void 0}))};case"OneByOneDistribution":return{type:"OneByOneDistribution",node:(p=e.node,Object.assign(Object.assign({},p),{styles:p.styles?Zc(p.styles):void 0}))};case"ProgressIndicator":return{type:"ProgressIndicator",node:(d=e.node,Object.assign(Object.assign({},i.omit(["settings"],d)),{startPosition:null===(u=d.settings)||void 0===u?void 0:u.startPosition,styles:d.styles?vd(d.styles):void 0}))};case"SlideStateTrigger":return{type:"SlideStateTrigger",node:(c=e.node,Object.assign(Object.assign({},c),{styles:c.styles?Zc(c.styles):void 0}))};case"StackedDistribution":return{type:"StackedDistribution",node:(l=e.node,Object.assign(Object.assign({viewableItems:[]},l),{styles:l.styles?Zc(l.styles):void 0}))};case"StaticLink":return{type:"StaticLink",node:Cd(e.node)};case"ToggleButtonStateTrigger":return{type:"ToggleButtonStateTrigger",node:_d(e.node)};case"CatalogResponseButton":return{type:"CatalogResponseButton",node:wd(e.node)};case"CatalogStackedCollection":return{type:"CatalogStackedCollection",node:Ld(e.node)};case"RichText":return{type:"RichText",node:(s=e.node,Object.assign(Object.assign({},s),{styles:s.styles?Yc(s.styles):void 0}))};case"DataImage":return{type:"DataImage",node:(r=e.node,Object.assign(Object.assign({},r),{styles:r.styles?Yc(r.styles):void 0}))};case"StaticImage":return{type:"StaticImage",node:(o=e.node,Object.assign(Object.assign({},o),{styles:o.styles?Yc(o.styles):void 0}))};case"DataIcon":return{type:"DataIcon",node:(a=e.node,Object.assign(Object.assign({},a),{styles:a.styles?Yc(a.styles):void 0}))};case"StaticIcon":return{type:"StaticIcon",node:(n=e.node,Object.assign(Object.assign({},n),{styles:n.styles?Yc(n.styles):void 0}))};case"BasicText":return{type:"BasicText",node:(t=e.node,Object.assign(Object.assign({},t),{styles:t.styles?Yc(t.styles):void 0}))};default:return e}var t,n,a,o,r,s,l,c,d,u,p,f,y,h,m,v,g}function kd(e){const t=e.split("."),n=Number(t[0]),a=Number(t[1]);if(t.length<2||Number.isNaN(n)||Number.isNaN(a))throw Error(`Fail to convert version ${e} to a valid version.`);return{major:n,minor:a}}function Pd(e,t){return e.major===t.major&&e.minor===t.minor}const $d=(e,t,n)=>i.allPass([i.lte(e),i.gte(t)])(n);function Fd(e,t){return Pd(t,{major:0,minor:0})?Fd(Bl(e),{major:0,minor:1}):function(e,t){return 0===t.major&&$d(1,23,t.minor)}(0,t)?Fd(Ac(e),{major:1,minor:0}):e}function Gd(e,t){return Pd(t,{major:0,minor:0})?Gd(function(e){return Object.assign(Object.assign({},e),{layout:Bl(e.layout)})}(e),{major:0,minor:1}):function(e,t){return 0===t.major&&$d(1,23,t.minor)}(0,t)?Gd(function(e){return Object.assign(Object.assign({},e),{layout:Ac(e.layout)})}(e),{major:1,minor:0}):e}function Md(e,t,n,a){const i=kd(n);if(a){const s=kd(a);if(r=i,(o=s).major<r.major||o.major===r.major&&o.minor<r.minor||Pd(s,i))return t(e,s);throw Error(`Could not migrate received layout config, config schema version ${a} is higher than the supported version ${n}.`)}return t(e,kd("0.0"));var o,r}function Bd(e){var t;try{return Object.assign(Object.assign({},i.clone(e)),{offer:Object.assign(Object.assign({},i.clone(e.offer)),{creative:Al(e.offer.creative)}),layoutVariant:Object.assign(Object.assign({},i.clone(e.layoutVariant)),{layoutVariantSchema:"string"==typeof e.layoutVariant.layoutVariantSchema?Nl(e.layoutVariant.layoutVariantSchema,"LayoutSlotLayoutVariant",e.instanceGuid):e.layoutVariant.layoutVariantSchema,childLayouts:i.map(Ud,null!==(t=e.layoutVariant.childLayouts)&&void 0!==t?t:[])})})}catch(t){throw t.message?t:Tl("Slot",e.instanceGuid)}}function Ud(e){return Object.assign(Object.assign({},i.clone(e)),{childLayoutSchema:"string"==typeof e.childLayoutSchema?Nl(e.childLayoutSchema,"ChildLayoutRootSchema",e.childLayoutId):e.childLayoutSchema})}function Vd(e){if(e){const t=function(e){try{return Object.assign(Object.assign({},i.clone(e)),{outerLayoutSchema:"string"==typeof e.outerLayoutSchema?Nl(e.outerLayoutSchema,"LayoutRootLayoutSchema",e.instanceGuid):e.outerLayoutSchema,slots:i.map(Bd,e.slots)})}catch(t){throw t.message?t:Tl("LayoutConfig",e.instanceGuid)}}(e);return function(e,t){const{layoutSchemaVersion:n}=e,a=i.lensPath(["outerLayoutSchema"]),o=i.lensPath(["slots"]),r=i.lensPath(["layoutVariant","layoutVariantSchema"]);return i.pipe(i.over(o,i.map(i.over(r,(e=>Md(e,Fd,t,n))))),i.over(a,(e=>Md(e,Gd,t,n))))(e)}(t,Co.DCUI_SCHEMA_VERSION)}}const zd=i.cond([[i.where({signalType:i.equals("SignalSecondaryResponse")}),function*(e,t){return yield r.put({type:Qi,payload:{level:So,code:jo,message:"DCUI does not support SignalSecondaryResponse creative response signal type.",additionalInformation:{instanceGuid:e.instanceGuid}}}),e.isPositive?"ERROR":"EXPLICIT_DISMISSAL"}],[i.where({isPositive:i.equals(!0)}),function*(e,t,n){var a;if("url"in e&&e.url){const i=e.instanceGuid;yield r.put({type:Z,payload:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:i,responseActionPayload:{name:"Url",transformedTrafficURL:e.url,creativeInstanceGuid:e.creativeInstanceGuid}}});const o=t.getOverrideLinkNavigation()?"overrideLinkNavigation":null!==(a=e.urlBehavior)&&void 0!==a?a:"newTab",s=yield*function*(e,t,n){try{const a=yield r.call(vr,t),i=Ir(a)?a.ref:void 0;return yield r.call(e.addAdvertiserWindowRef,i,n),Ir(a)||"newTab"!==t.urlBehavior?"SUCCESS":(yield r.put({type:Qi,payload:{level:So,code:Do,message:`Did not receive a window reference opening link ${t.url}`}}),"UNSPECIFIED")}catch(e){return yield r.put({type:Qi,payload:{level:So,code:Do,message:`Errored attempting to open link ${t.url}: ${e.message}`,stack:e.stack}}),"ERROR"}}(t,{url:e.url,urlBehavior:o,external:{partner:n}},i);return"self"===o?"END":s}return yield r.put({type:Qi,payload:{level:So,code:jo,message:"URL response doesn't have a valid url",additionalInformation:{instanceGuid:e.instanceGuid}}}),"ERROR"}],[i.T,function*(){return"EXPLICIT_DISMISSAL"}]]);function*qd(e){return yield r.put({type:Qi,payload:{level:So,code:jo,message:"DCUI does not support SignalSecondaryResponse creative response signal type.",additionalInformation:{instanceGuid:e.instanceGuid}}}),e.isPositive?"ERROR":"EXPLICIT_DISMISSAL"}function*Hd(e,t){let n="IMPLICIT_DISMISSAL";const a=t.payload.offerPositionIndex,i=W(t.payload)||J(t.payload)||H(t.payload)?t.payload:t.payload.responseOption;switch(i.action){case"Url":yield r.put({type:ee,payload:{name:"OFFER_ENGAGEMENT"}}),i.isPositive&&(yield r.put({type:Xi,payload:{code:"CREATIVE_RESPONSE",message:"creative positive response",data:{type:i.action,isPositive:i.isPositive,responseInstanceGuid:i.instanceGuid}}}),yield r.put({type:ee,payload:{name:"POSITIVE_ENGAGEMENT"}})),n="SignalSecondaryResponse"===i.signalType?yield*qd(i):yield*zd(i,e.context,e.partner);break;case"CaptureOnly":yield r.put({type:ee,payload:{name:"OFFER_ENGAGEMENT"}}),i.isPositive&&(yield r.put({type:ee,payload:{name:"POSITIVE_ENGAGEMENT"}})),n="SignalSecondaryResponse"===i.signalType?yield*qd(i):yield*function*(e){return yield r.put({type:Z,payload:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:e.instanceGuid,responseActionPayload:{name:"CaptureOnly",creativeInstanceGuid:e.creativeInstanceGuid}}}),e.isPositive?"SUCCESS":"EXPLICIT_DISMISSAL"}(i);break;case"Fulfillment":yield r.put({type:Qi,payload:{level:So,code:"INCORRECTLY_HANDLE_FULFILLMENT_ACTION",message:`Fulfillment action is incorrectly handled by the orchestrator instead of a module with the option ID: ${i.instanceGuid}`}}),n="ERROR";break;case"ExternalPaymentTrigger":yield r.put({type:Qi,payload:{level:So,code:"INCORRECTLY_HANDLE_EXTERNAL_ACTION",message:`External action was dispatched as an engagement erroneously. Instance GUID: ${i.instanceGuid}`}}),n="ERROR"}K(t.payload)||(yield r.put(function(e,t){switch(e){case"SUCCESS":return{type:el,payload:{event:"Completed",completionReason:"Success",offerPositionIndex:t}};case"UNSPECIFIED":return{type:el,payload:{event:"Completed",completionReason:"Unspecified",offerPositionIndex:t}};case"ERROR":return{type:el,payload:{event:"Completed",completionReason:"Error",offerPositionIndex:t}};case"EXPLICIT_DISMISSAL":return{type:el,payload:{event:"Dismissed",dismissalReason:"Explicit",offerPositionIndex:t}};case"IMPLICIT_DISMISSAL":return{type:el,payload:{event:"Dismissed",dismissalReason:"Implicit",offerPositionIndex:t}};default:return{type:Zs,payload:{offerProcessStatus:"END"}}}}(n,a)))}function Wd(e,t,n,a){return l.eventChannel((i=>(a().then((e=>Promise.all([t.getRoktPageInstanceGuid(),(t.getUId||t.getPluginInstanceId)()]).then((([t,n])=>Object.assign(Object.assign({},e),{pageInstanceGuid:t,pluginInstanceId:n}))).catch((()=>e)))).then((({moduleConnectorBuilder:t,pageInstanceGuid:a,pluginInstanceId:o})=>{const r=`rokt-${n}-${o}`.toLowerCase();if(!customElements.get(r)){const o=t.withGatewayFactory(e).withLogger((e=>{i({type:Qi,payload:{level:e.level,code:e.code,message:e.message,additionalInformation:Object.assign(Object.assign({},e.additionalInformation),{moduleName:n,layoutType:"LayoutVariant",pageInstanceGuid:null!=a?a:"N/A"})}})})).build();customElements.define(r,o)}})).catch((e=>{const t=e&&"object"==typeof e&&"message"in e?e.message:void 0,a=e&&"object"==typeof e&&"stack"in e?e.stack:void 0;i({type:Qi,payload:{level:R,code:"FAILED_TO_LOAD_MODULE",message:t,additionalInformation:{stack:a,reason:t?void 0:e,moduleName:n}}}),i(l.END)})),()=>{})))}const Jd={"standard-marketing":()=>Promise.resolve().then((function(){return Qu})),"add-to-cart":()=>Promise.resolve().then((function(){return tf})),"instant-purchase":()=>Promise.resolve().then((function(){return ty})),"layouts-xp-sandbox":()=>Promise.resolve().then((function(){return jy}))};function*Kd(e,t,n){let a=yield r.select((e=>e.module.loadedModules));for(const i of n.payload.modules)a&&!(null==a?void 0:a.includes(i))&&(a=[...a,i],yield r.fork(Yd,e,t,i))}function*Yd(e,t,n){if(n in Jd){yield r.put({type:qs,payload:n});const a=yield r.call(Wd,e,t,n,Jd[n]);yield r.call(Lo,a)}else yield r.put({type:Qi,payload:{level:Eo,code:"INVALID_MODULE_NAME",message:`Could not load unknown module ${n}`}})}function*Zd(e){const t=yield r.select((e=>$l.getDistributionViewableItems(e.layout?$l.getDistribution(e.layout.layoutSchema):void 0))),n=yield r.select((n=>{var a;const i=Qo(e.payload.activeBreakpoint)(n);return i>=0&&t?null!==(a=t[Math.min(t.length-1,i)])&&void 0!==a?a:1:void 0}));if("number"==typeof n){const e={type:Ys,payload:{groupSize:n}};yield r.put(e)}}const Qd=i.cond([[(e,t,n,a)=>"END"===e.offerProcessStatus,i.always({type:Vi})],[(e,t,n,a)=>t.isLastOffer&&n,i.always({type:Vi})],[(e,t,n,a)=>1===a&&!t.isLastOffer,i.always({type:Js})],[i.T,i.always(void 0)]]);function*Xd(e){const t=yield r.select((e=>({exists:null!==e.progression,isLastOffer:pl(e)}))),n=yield r.select((e=>{var t;return null===(t=e.progression)||void 0===t?void 0:t.groupSize}));var a;null!=(a=t)&&a instanceof Object&&"exists"in a&&"isLastOffer"in a&&t.exists&&(yield*function*(e,t,n){const a=yield r.select((e=>e.settings.closeOnComplete)),i=Qd(e,t,"boolean"==typeof a&&a,n);i&&(i.type===Vi&&(yield r.put({type:ee,payload:{name:"PLACEMENT_COMPLETED"}})),yield r.put(i))}(e.payload,t,n))}function eu(e){return e.type===el&&"Interactive"===e.payload.event}function tu(e){return e.type===el&&"Interactive"!==e.payload.event}function*nu(e){switch(e.payload.event){case"Dismissed":yield r.put({type:Zs,payload:{offerProcessStatus:"CONTINUE"}});break;case"Completed":yield r.put({type:tl,payload:{key:"offerComplete",value:i.cond([[i.equals("Error"),i.always(-1)],[i.equals("Success"),i.always(1)],[i.T,i.always(2)]])(e.payload.completionReason),offerPositionIndex:e.payload.offerPositionIndex}}),yield r.put({type:Zs,payload:{offerProcessStatus:"CONTINUE"}});break;case"Interactive":yield r.put({type:V,payload:{name:"Interactive",offerPositionIndex:e.payload.offerPositionIndex}}),yield r.put({type:ee,payload:{name:"PLACEMENT_INTERACTIVE"}})}}function*au(e,t){var n;try{const n=yield r.select((e=>{var t,n,a;return null!==(a=null===(n=null===(t=e.layout)||void 0===t?void 0:t.settings)||void 0===n?void 0:n.enablePartnerValidation)&&void 0!==a&&a}));n&&(yield r.call(e.partner.send,ur.PartnerValidationEvent.SET_PARTNER_VALIDATION_STATUS,{errors:t.payload.errors}))}catch(a){const i=yield r.select((({slots:e})=>{var n,a;return"number"==typeof t.payload.offerPositionIndex?null!==(a=null===(n=e.at(t.payload.offerPositionIndex))||void 0===n?void 0:n.layoutVariant.moduleName)&&void 0!==a?a:"Unknown":"orchestrator"})),o=null!==(n=yield r.call(e.context.getRoktPageInstanceGuid))&&void 0!==n?n:"N/A",s={type:Qi,payload:{level:N,code:"PARTNER_VALIDATION_UPDATE_FAILED",message:"Failed to update the partner with error status",additionalInformation:{moduleName:i,layoutType:"number"==typeof t.payload.offerPositionIndex?"LayoutVariant":"OuterLayout",pageInstanceGuid:o}}};yield r.put(s)}}function*iu(e){const t=yield r.select((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid}));yield r.put({type:il.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:Vi}),t?(yield r.put({type:Z,payload:{name:"SignalInstantPurchaseDismissal",parentGuid:t}}),yield r.put({type:Z,payload:{name:"SignalDismissal",parentGuid:t}})):yield r.put({type:Qi,payload:{level:Io,code:ko,message:"ParentGuid does not exist"}})}function*ou(e,t){yield r.all([r.takeEvery(Qi,_o.bind(null,e.errorService.raise)),r.takeLatest(Ui,Gl.bind(null,{display:e.displayService,partner:e.partnerInteractionService})),r.takeEvery(Hs,Kd.bind(null,t,e.contextService)),r.takeLatest(nl,Hd.bind(null,{partner:e.partnerInteractionService,context:e.contextService})),r.takeEvery(Zs,Xd),r.takeEvery(tu,nu),No(eu,nu),r.takeLatest(Gi,or.bind(null,e.displayService)),r.takeLatest(Vi,wr.bind(null,e.contextService)),r.takeLatest(Xs,iu),r.takeLatest(Zi,Zr),r.takeEvery(Z,jr),r.takeEvery(ne,Dr),Ro(V,Kr.bind(null,e.metricsService)),Ro(Yi,kr.bind(null,e.rdnService)),r.takeEvery(Xi,_r.bind(null,e.errorService.raise)),r.takeLatest($i,Zd),r.takeEvery(X,Jr),r.takeEvery(ae,Yr.bind(null,{createChildPlugin:e.childPlugin.create,partner:e.partnerInteractionService,context:e.contextService})),r.takeLatest(ie,au.bind(null,{partner:e.partnerInteractionService,context:e.contextService}))])}var ru,su,lu,cu,du,uu=function(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n},pu=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)};const fu={[se.SET_CUSTOM_STATE]:il.SET_CUSTOM_STATE,[se.SET_DOMAIN_STATE]:il.SET_DOMAIN_STATE,[se.SET_GLOBAL_OFFER_DATA_CART]:il.SET_GLOBAL_OFFER_DATA_CART,[se.OFFER_LIFECYCLE]:ol.OFFER_LIFECYCLE,[se.OFFER_ENGAGEMENT]:ol.OFFER_ENGAGEMENT,[se.SET_PARTNER_VALIDATION_STATUS]:ol.SET_PARTNER_VALIDATION_STATUS};class yu{constructor(e){ru.add(this),su.set(this,void 0),uu(this,su,e,"f")}getState(e){const t=pu(this,su,"f").getState();return{breakpoint:t.breakpoint,progression:fl(t),customStates:er(t,e.offerPositionIndex),domainStates:yl(t,e.offerPositionIndex)}}dispatch(e,t){pu(this,su,"f").dispatch(pu(this,ru,"m",du).call(this,e,t))}subscribe(e,t){return t(this.getState(e)),pu(this,su,"f").subscribe((()=>{t(this.getState(e))}))}}function hu(e,t){const n=l(),a={},i=s.configureStore({reducer:dl,devTools:{name:"Orchestrator"},preloadedState:Object.assign(Object.assign({},ul()),t),middleware:e=>{return e({thunk:!1,serializableCheck:!1}).concat((t=a,e=>e=>n=>{if("object"==typeof n&&null!==n&&"type"in n){const a=n.type,i=t[`${a}`];return e(i?i(n):n)}return e(n)}),n);var t}}),o=(r=function(e){return new yu(e)}(i),c=e.childPlugin.create,d=e.partnerInteractionService.onEvent,(e,t)=>new un(r,c,e,t,d));var r,c,d;n.run(ou,e,o),n.run(Rr,e,Vd);const u={};return Object.assign(Object.assign({},i),{extend:({reducer:e,interceptors:t,sagas:o})=>{e&&(Object.assign(u,e),i.replaceReducer(s.combineReducers(Object.assign(Object.assign({},dl),u)))),t&&Object.assign(a,t),o&&n.run(o)}})}su=new WeakMap,ru=new WeakSet,lu=function(e,t,n){return{type:e,payload:Object.assign(Object.assign({},t),{offerPositionIndex:n.offerPositionIndex,creativeInstanceGuid:n.creativeInstanceGuid})}},cu=function(e,t){return t.type===ne?t.payload.signal.parentGuid||(t.payload.signal.parentGuid=e.creativeInstanceGuid):(t.payload.creativeInstanceGuid=e.creativeInstanceGuid,t.payload.parentGuid||(t.payload.parentGuid=e.creativeInstanceGuid)),t},du=function(e,t){return function(e){return e.type in fu}(t)?pu(this,ru,"m",lu).call(this,fu[t.type],t.payload,e):t.type===Z||t.type===ne?pu(this,ru,"m",cu).call(this,e,t):t};var mu=function(e,t,n,a){return new(n||(n=Promise))((function(i,o){function r(e){try{l(a.next(e))}catch(e){o(e)}}function s(e){try{l(a.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,s)}l((a=a.apply(e,t||[])).next())}))};const vu={ctx:new Map([[zs.name,zs],[Ms.name,Ms],[Ss.name,Ss],[Ls.name,Ls],[Bs.name,Bs]]),cache:[]};class gu{constructor(){this._subscribers=[]}add(e){this._subscribers.push(e)}unsubscribe(){this._subscribers.forEach((e=>e.unsubscribe()))}}const bu=()=>{},Eu=(e=bu,t=bu,n=bu)=>"function"!=typeof e?e:{next:e,error:t,complete:n};class Iu{constructor(e){this._setupFn=e}subscribe(e,t,n){const a=Eu(e,t,n);let i,o=!0;const r={next:e=>{o&&a.next(e)},complete:()=>{o&&(i&&i(),a.complete(),o=!1)},error:e=>{o&&(a.error(e),o=!1)}};i=this._setupFn(r),o||i&&i();const s=new gu;return s.add({unsubscribe:()=>{i&&i(),o=!1}}),s}}class Su extends Iu{constructor(){super((e=>(this._isComplete&&e.complete(),this._observers.push(e),()=>this._observers=this._observers.filter((t=>t!==e))))),this._observers=[],this._isComplete=!1}next(e){for(const t of this._observers)t.next(e)}error(e){for(const t of this._observers)t.error(e)}complete(){this._isComplete=!0;for(const e of this._observers)e.complete()}asObservable(){return new Iu((e=>{const t=this.subscribe(e);return()=>t.unsubscribe()}))}}const xu={CompletedBeforeEmit:"CompletedBeforeEmit"};var Cu=function(e,t,n,a){return new(n||(n=Promise))((function(i,o){function r(e){try{l(a.next(e))}catch(e){o(e)}}function s(e){try{l(a.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,s)}l((a=a.apply(e,t||[])).next())}))};class wu{constructor(e,t){this._target=e,this._handler=t}subscribe(e,t,n){const a=e.next?e.next.bind(e):e,i={next:(...e)=>Cu(this,void 0,void 0,(function*(){try{yield a(...e)}catch(e){this._handler(e)}})),error:e.error?e.error.bind(e):t,complete:e.complete?e.complete.bind(e):n};return this._target.subscribe(i)}}class Ou{constructor(e){this.value=e,this.complete=!1,this.skip=!1}}var Tu=function(e,t,n,a){return new(n||(n=Promise))((function(i,o){function r(e){try{l(a.next(e))}catch(e){o(e)}}function s(e){try{l(a.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,s)}l((a=a.apply(e,t||[])).next())}))};const Au={getBreakpointCSSClass:B},Ru="CHILD_LAYOUTS/ADD_LAUNCHED",Nu="DYNAMIC_DATA/ADD";function Lu(e={launched:{}},t){if(t.type===Ru){const n=t.payload;return n.childLayoutId?i.assocPath(["launched",n.childLayoutId],n.shouldRelaunch,e):e}return e}function _u(e=null,t){return e}function ju(e=null,t){if(t.type===Nu){const n=t.payload;return e?n?i.mergeDeepRight(e,n):e:n}return e}function Du(e,t){var n;return null===(n=e.childLayouts.launched[t])||void 0===n||n}function ku(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer}function Pu(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.schemaVersion}const $u=Object.freeze({});function Fu(e){var t;return(null===(t=e.dynamicData)||void 0===t?void 0:t.text)?e.dynamicData.text:$u}const Gu="FAILED_TO_LAUNCH_CHILD_LAYOUT";function*Mu(e,t,n){var a;if(yield null===(a=r.select(Du,n.payload.childLayoutId))||void 0===a||a){const a=yield r.select(Pu),o=yield r.select(ku),s=yield r.select(Fu);try{const l=(i=function(e,t,n,a){return{instanceGuid:e.instanceGuid,childLayoutId:e.childLayoutId,childLayoutSchema:e.childLayoutSchema,offer:t,layoutSchemaVersion:n,content:{text:a}}}(n.payload,o,a,s),JSON.parse(JSON.stringify(i)));try{yield r.call(e.createChildPlugin,{name:"dcui-child",config:l,targetElementSelector:n.payload.targetElementSelector})}catch(e){yield r.call(t,{level:N,code:Gu,message:"Could not launch child layout, failed creating plugin."})}}catch(e){yield r.call(t,{level:N,code:Gu,message:"Could not launch child layout, failed to make the child layout config serializable."})}yield r.put({type:Ru,payload:{childLayoutId:n.payload.childLayoutId,shouldRelaunch:!1}})}var i}function Bu(){const t=On(),n=a.useSelector(Fu),i=Jt()({state:n},"textContent");return e.jsx(Wt,{value:i,children:e.jsx(Et,{children:e=>e(t)})})}const Uu={staticData:_u,dynamicData:ju,childLayouts:Lu};function Vu(e={}){return Object.assign({staticData:null,dynamicData:null,childLayouts:{launched:{}}},e)}function zu(e){let t,n,a;return l.eventChannel((i=>(Promise.race([e.onClose().then((()=>"CLOSED")),new Promise((n=>{t=e.onEvent("PLUGIN_TRANSITION_OFFER_SUCCESS").subscribe((()=>{n("SUCCESS")}))})),new Promise((t=>{n=e.onEvent("PLUGIN_TRANSITION_OFFER_CLOSE").subscribe((()=>{t("UNSPECIFIED")}))})),new Promise((e=>{a=e}))]).then((e=>{"END"!==e&&(i(e),i(l.END))})),()=>{null==t||t.unsubscribe(),null==n||n.unsubscribe(),a("END")})))}function qu(e){return"object"==typeof e&&null!==e&&Object.entries(e).every((([e,t])=>"string"==typeof e&&"string"==typeof t))}function*Hu(e,t,n,a,i){for(;;){switch(yield r.take(e)){case"CLOSED":t({type:Q,payload:{event:"Dismissed",dismissalReason:"Implicit"}});break;case"SUCCESS":if((n||a)&&i){yield r.call(i);break}t({type:Q,payload:{event:"Completed",completionReason:"Success"}});break;case"UNSPECIFIED":t({type:Q,payload:{event:"Completed",completionReason:"Unspecified"}})}}}function*Wu(e,t,n){if(q(n)){const{responseOption:a,fulfillment:i}=n,o=K(n),s=Y(n);yield r.put({type:Z,payload:{name:"SignalResponse",parentGuid:a.instanceGuid,responseActionPayload:{name:"Fulfillment"}}});const l=yield r.call(e.createChildPlugin.bind(e),i);if("object"==typeof l&&"onClose"in l&&"close"in l){const a=yield r.call(zu,l);if("object"==typeof a&&"take"in a){const i=function(e,t,n,a){if(n.responseOption.rclid)return function*(){yield r.put({type:ee,payload:{name:"REALTIME_OFFER_FULFILLMENT_CONVERSION",body:{rclid:n.responseOption.rclid,accountID:n.accountID,referralCreativeID:n.referralCreativeID}}}),yield r.call(Ju,e,t,a)}}(e,t,n,l);return void(yield r.call(Hu,a,e.globalDispatch.bind(e),o,s,i))}}yield r.call(t,{level:R,code:"UNEXPECTED_NEXT_VALUE_IN_SAGA",message:'Received an unexpected input at a step in the saga "handleFullfillmentResponse" and could not continue.'})}else yield r.call(t,{level:R,code:"INVALID_FULFILLMENT_PAYLOAD",message:`Fulfillment payload is invalid, fulfillment: ${n}`})}function*Ju(e,t,n){const a=function(e){return l.eventChannel((t=>{const n=e.onEvent({name:fr,source:"partner",callback:e=>{qu(e)&&t({eventName:fr,data:e})}},{name:yr,source:"partner",callback:e=>{qu(e)&&t({eventName:yr,data:e})}});return()=>{n()}}))}(e);try{for(;;){const i=yield r.take(a);switch(i.eventName){case fr:yield r.put({type:ee,payload:{name:fr,body:i.data}}),yield r.put({type:Nu,payload:{text:i.data}}),e.globalDispatch({type:Q,payload:{event:"Completed",completionReason:"Success"}}),n&&(yield r.call(n.close.bind(n)));break;case yr:e.globalDispatch({type:Q,payload:{event:"Completed",completionReason:"Error"}}),n&&(yield r.call(n.close.bind(n)));break;default:t({level:R,code:"UNKNOWN_REALTIME_OFFER_FULFILLMENT_EVENT",message:`Unknown event: ${i.eventName}`})}}}catch(e){const n=e;t({level:N,code:"FAILED_TO_PROCESS_REALTIME_OFFER_FULFILLMENT_EVENT",message:null==n?void 0:n.message})}finally{(yield r.cancelled())&&a.close()}}function*Ku(e,t,n){const a=W(n.payload)||J(n.payload)||H(n.payload)?n.payload:n.payload.responseOption;switch(a.action){case"Url":yield r.call(e.globalDispatch.bind(e),n),(K(n.payload)||Y(n.payload))&&(yield r.put({type:ee,payload:{name:"REALTIME_OFFER_FULFILLMENT_REFERRAL",body:{rclid:a.rclid,accountID:a.accountID,referralCreativeID:a.referralCreativeID,referralOnly:Y(n.payload)}}}),K(n.payload)&&(yield r.call(Ju,e,t)));break;case"CaptureOnly":yield r.call(e.globalDispatch.bind(e),n);break;case"Fulfillment":yield r.put({type:ee,payload:{name:"OFFER_ENGAGEMENT"}}),a.isPositive&&(yield r.put({type:ee,payload:{name:"POSITIVE_ENGAGEMENT"}})),Y(n.payload)&&(yield r.put({type:ee,payload:{name:"REALTIME_OFFER_FULFILLMENT_REFERRAL",body:{rclid:a.rclid,accountID:n.payload.accountID,referralCreativeID:n.payload.referralCreativeID,referralOnly:!0}}})),yield*Wu(e,t,n.payload)}}function*Yu(e,t){yield r.all([r.takeLatest(z,Ku.bind(null,e,t)),r.takeEvery(re,Mu.bind(null,e,t)),r.takeEvery("*",wo.bind(null,[z,re],e))])}Object.assign({},se);const Zu=(new In).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=Vu({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n=Vu()){const a=l(),i=s.configureStore({reducer:Uu,devTools:{name:"Standard Marketing"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(Yu,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(Pn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Ni,{}),e.jsx(a.Provider,{store:d,children:e.jsx(Ai,{settings:i,dispatch:d.dispatch,children:e.jsx(Bu,{})})})]})}))}}));var Qu=Object.freeze({__proto__:null,moduleConnectorBuilder:Zu});const Xu="CART/UPDATE",ep="CATALOG_ITEM/RESPONSE",tp="USER_CREATIVE_RESPONSE_HISTORY/ADD",np=i.cond([[(e,t)=>0!==t,i.equals],[(e,t)=>!Number.isNaN(e)&&0===t,i.equals],[(e,t)=>Number.isNaN(e)&&0===t,i.F]]);function ap({isChecked:t,isDisabled:n,outerClassname:a,outerCheckedClassname:i,innerClassname:o,innerCheckedClassname:r}){return e.jsx("span",{style:{display:"flex"},children:e.jsx("span",{className:`${a} ${t?i:""}`,tabIndex:n?-1:1,style:{display:"flex",boxSizing:"border-box"},children:e.jsx("span",{className:`${o} ${t?r:""}`,style:{flex:1}})})})}const ip="catalogRadioGroup__label",op=["Enter","Space"],rp={elements:{own:[],optionContainer:[],radioButtonInner:[{default:{border:{borderRadius:11},background:{backgroundColor:{light:"#FFF"}}}}],radioButtonInnerChecked:[{default:{background:{backgroundColor:{light:"#529ff4"}}}}],radioButtonOuter:[{default:{border:{borderRadius:16,borderColor:{light:"#999"},borderStyle:"solid",borderWidth:"1"},dimension:{width:{type:"fixed",value:16},height:{type:"fixed",value:16}},spacing:{padding:"4"}}}],radioButtonOuterChecked:[]}};function sp(e,t,n){return e.map(i.cond([[i.compose(i.equals("Required"),i.propOr("","type")),({value:e})=>Number.isNaN(n)&&t>0?e.message:""],[i.T,i.always("")]])).filter(i.isNotEmpty)}function lp({schema:n,testId:i}){var o;const r=a.useDispatch(),s=Gn(),l=null!==(o=a.useSelector((e=>{var t,n;return s.cartItemId in e.cart?null!==(n=null===(t=e.cart[s.cartItemId])||void 0===t?void 0:t.quantity)&&void 0!==n?n:0:void 0})))&&void 0!==o?o:NaN,c=t.useMemo((()=>sp(n.validations,n.options.length,l)),[n.validations,n.options.length,l]),d=An(),{tabIndex:u,styles:p,isDisabled:f}=m(d);t.useEffect((()=>{f||r(cp(c))}),[]);const y=n.options.filter((({quantity:e})=>{var t,n;return e>=(null!==(t=s.minItemCount)&&void 0!==t?t:-1/0)&&e<=(null!==(n=s.maxItemCount)&&void 0!==n?n:1/0)}));function h(e){r({type:ep,payload:{catalogItem:s,quantity:e}});const t=sp(n.validations,n.options.length,e);r(cp(t))}return y.length>0?e.jsx(Ta,{styles:n.styles?M(rp,n.styles):rp,children:({classnames:n,mapperRef:a})=>e.jsx("div",{className:null==n?void 0:n.own,style:Object.assign({display:"flex",flexDirection:"column"},p),children:e.jsx(Yt,{value:a(ip),children:t.Children.toArray(y.map(((t,a)=>{var o;const r=np(l,t.quantity),c=e=>i?`${i}-option${a}${e}`:void 0;return e.jsxs("label",{tabIndex:u,"aria-disabled":f,style:{display:"flex"},className:`${ip} ${null!==(o=null==n?void 0:n.optionContainer)&&void 0!==o?o:""}`,onKeyDown:e=>{r||!op.includes(e.code)||f||h(t.quantity)},"data-e2e":"CatalogRadioGroup-Option","data-e2e-quantity":`${t.quantity}`,"data-testid":c("Label"),children:[e.jsx("input",{type:"radio",style:{display:"none"},tabIndex:-1,name:s.instanceGuid,value:t.quantity,checked:r,onChange:()=>h(t.quantity),"aria-disabled":f,disabled:f}),e.jsx(ap,{isChecked:r,isDisabled:f,innerClassname:null==n?void 0:n.radioButtonInner,innerCheckedClassname:null==n?void 0:n.radioButtonInnerChecked,outerClassname:null==n?void 0:n.radioButtonOuter,outerCheckedClassname:null==n?void 0:n.radioButtonOuterChecked}),e.jsx(Di,{schema:t,testId:c("Content")})]})})))})})}):null}function cp(e){return{type:ie,payload:{errors:e}}}function dp(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function up(t){const n=a.useDispatch(),i=It(),o=Gn(),r=An(),{tabIndex:s,styles:l,isDisabled:c}=m(r);return e.jsx(Ta,{styles:t.schema.styles,children:({classnames:a})=>e.jsx("button",{type:"button",tabIndex:s,"aria-disabled":c,disabled:c,style:Object.assign({cursor:"pointer"},l),"data-testid":t.testId,"data-e2e":"CatalogItemResponse",onClick:e=>{e.preventDefault();n({type:ep,payload:{catalogItem:o,quantity:1}})},className:null==a?void 0:a.own,children:dp(t.schema.children,i,t.testId)})})}const pp={allowedTags:["em","strong","a","br","u","p","li","ul","ol","span"],allowedAttributes:{a:["href","target"],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],span:[]},allowedSchemes:["http","https"]},fp=new Map([["&","_;^;_"]]),yp=new RegExp(`<a *(?=${pp.allowedAttributes.a.join("|")}|>)`,"g"),hp=new RegExp(`<a *(?:(?:${pp.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),mp=new RegExp("(<br *?>)|(<br *?/>)","g"),vp=new RegExp(`<ul *(?=${pp.allowedAttributes.ul.join("|")}|>)`,"g"),gp=new RegExp(`<ol *(?=${pp.allowedAttributes.ol.join("|")}|>)`,"g"),bp=new RegExp("<li *(?=>|\\s[^>]*>)","g"),Ep="<br/>";function Ip(n){const a=Jt(),i=An(),o=t.useMemo((()=>{const e=a(n.schema.value);if(!function(e){const t=function(e){return e.replaceAll(hp,((e,t)=>{const n=t.replaceAll("&",fp.get("&"));return e.replace(t,n)})).replaceAll(mp,Ep)}(e);return t===u(t,pp)}(e))throw new L("FAILED_SANITISING_HTML","Invalid HTML tags");return e}),[n.schema.value,a]),{tabIndex:r,styles:s,isDisabled:l}=m(i);return o?e.jsx(Ta,{styles:n.schema.styles,children:({classnames:t})=>{const a=[(null==t?void 0:t.link)?`class="${null==t?void 0:t.link}"`:"",l?'tabindex="-1"':"",l?"style=\"pointer-events: 'none'; user-select: none;\"":"",l?'aria-disabled="true"':""].filter((e=>e.length>0)),i=((null==t?void 0:t.list)?`class="${t.list}"`:"")+' style="list-style-type: none; padding-inline-start: 0px; display: flex; flex-direction: column;"',c=((null==t?void 0:t.listItem)?`class="${t.listItem}"`:"")+' style="display: flex; align-items: flex-start; flex-shrink: 0; flex-grow: 1;"',d=`class="rokt-icon${(null==t?void 0:t.span)?" "+t.span:""}" style="display: inline-block; pointer-events: none; user-select: none;" aria-disabled="true"`,u=o.replace(yp,`<a ${a.join(" ")}`).replace(vp,`<ul ${i}`).replace(gp,`<ol ${i}`).replace(bp,`<li ${c}><span ${d}>Check</span`);return p=o,new RegExp("</(p|ul|ol)>").test(p)?e.jsx("div",{tabIndex:r,style:s,"aria-hidden":l,className:null==t?void 0:t.own,"data-testid":n.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:u}}):e.jsx("p",{tabIndex:r,style:s,"aria-hidden":l,className:null==t?void 0:t.own,"data-testid":n.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:u}});var p}}):null}const Sp={internally:"_top",externally:"_blank"};function xp(t,n,a,i,o){return e.jsx(Yt,{value:a(n),children:Cp(t,i,o)})}function Cp(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function wp(t){var n,i;const o=Sp[t.schema.open],r=It(),s=Gn(),l=An(),c=a.useDispatch(),d=null!==(n=s.url)&&void 0!==n?n:"",{tabIndex:u,styles:p,isDisabled:f}=m(l);return Boolean(d)&&(null===(i=t.schema.children)||void 0===i?void 0:i.length)>0?e.jsx(Ta,{styles:t.schema.styles,children:({classnames:n,mapperRef:a})=>{var i;return e.jsx("a",{href:d,onClick:()=>{var e;c({type:Z,payload:{name:"SignalResponse",parentGuid:null!==(e=s.instanceGuid)&&void 0!==e?e:"",responseActionPayload:{name:"Url",transformedTrafficURL:d}}})},"data-testid":t.testId,"data-e2e":"CatalogUrlLink",target:null!=o?o:"_blank",tabIndex:u,"aria-disabled":f,"aria-label":null!==(i=t.schema.a11yLabel)&&void 0!==i?i:void 0,style:Object.assign({cursor:"pointer",textDecoration:"none",display:"block"},p),className:null==n?void 0:n.own,children:(null==n?void 0:n.own)?xp(t.schema.children,null==n?void 0:n.own,a,r,t.testId):Cp(t.schema.children,r,t.testId)})}}):null}function Op(e,t){const n=e.cart[t];return n||null}function Tp(e){var t,n;const a=null!==(n=null===(t=e.staticData)||void 0===t?void 0:t.offer.catalogItems)&&void 0!==n?n:[],i=function(e){return Object.values(e.cart).filter((e=>null!==e))}(e);return i.filter((e=>a.find((t=>t.catalogItemId===e.catalogItemId))))}function Ap(e,t){var n,a,i,o;const r=null===(n=e.staticData)||void 0===n?void 0:n.offer;if(r){const n=function(e){return Tp(e).reduce(((e,t)=>e+t.quantity),0)}(e),s=Op(e,t.cartItemId),l=(null!==(a=null==r?void 0:r.maxTotalItemsQtyInOffer)&&void 0!==a?a:1/0)-n,c=(null!==(i=t.maxItemCount)&&void 0!==i?i:1/0)-(null!==(o=null==s?void 0:s.quantity)&&void 0!==o?o:0);return Math.min(l,c)}return 0}function Rp(e){var t,n;const a=null!==(n=null===(t=e.staticData)||void 0===t?void 0:t.offer.catalogItems)&&void 0!==n?n:[];return a.length>0?a:null}function Np(e,t){var n,a;return null!==(a=null===(n=Rp(e))||void 0===n?void 0:n.find((e=>e.catalogItemId===t)))&&void 0!==a?a:null}function Lp(e){var t;const n=null===(t=Rp(e))||void 0===t?void 0:t.filter((e=>e.preSelectedQuantity&&e.preSelectedQuantity>0));return n&&n.length>0?n:null}function _p(e){var t,n;return null!==(n=null===(t=Lp(e))||void 0===t?void 0:t.reduce(((e,t)=>{var n;return e+(null!==(n=t.preSelectedQuantity)&&void 0!==n?n:0)}),0))&&void 0!==n?n:0}const jp=i.compose((e=>e.filter((e=>!i.isNil(e[1]))).map((([e,t])=>({cartItemId:t.cartItemId,quantity:t.quantity})))),i.toPairs,i.prop("cart"));function Dp(t,n,a,i,o){return e.jsx(Yt,{value:a(n),children:i(t,void 0,o)})}function kp(e,t,n){return t(e,void 0,n)}function Pp(t){var n;const{schema:i,testId:o}=t,{a11yInputLabel:r,styles:s,showInputField:l,buttons:c,forcedUpsellText:d}=i,{increment:u,decrement:p,a11yIncrementLabel:f,a11yDecrementLabel:y}=c||{},h=a.useDispatch(),v=Gn(),g=It(),b=Jt(),E=An(),{tabIndex:I,styles:S,isDisabled:x}=m(E),C=a.useSelector((e=>function(e,t){var n,a,i;const o=Np(e,t);return Boolean(o&&(null!==(n=o.preSelectedQuantity)&&void 0!==n?n:0)>0&&o.preSelectedQuantity===(null!==(a=o.minItemCount)&&void 0!==a?a:0)&&o.preSelectedQuantity===(null!==(i=o.maxItemCount)&&void 0!==i?i:0))}(e,v.catalogItemId))),w=a.useSelector((e=>Op(e,v.cartItemId))),O=a.useSelector((e=>Ap(e,v))),T=(null==w?void 0:w.quantity)||0,A=m(x||T<=(null!==(n=v.minItemCount)&&void 0!==n?n:0)?"DISABLED":E),R=m(x||O<=0?"DISABLED":E),N=m(x||C?"DISABLED":E),L=e=>{var t;const n=e.target.value;if(0===n.length)_(null!==(t=v.minItemCount)&&void 0!==t?t:0);else{const e=Number(n);!Number.isNaN(e)&&e>=0&&_(e)}},_=e=>{x||h({type:ep,payload:{catalogItem:v,quantity:e}})};return e.jsx(Ta,{styles:s,children:({classnames:t,mapperRef:n})=>e.jsx("div",{className:null==t?void 0:t.own,style:Object.assign({display:"flex",flexDirection:"row"},S),children:C&&d?e.jsx($a,{schema:d,isInline:!1,testId:o?`${o}-forced-upsell-text`:void 0}):e.jsxs(e.Fragment,{children:[p?e.jsx("button",{className:null==t?void 0:t.decrementButton,style:Object.assign(Object.assign({},A.styles),{cursor:A.isDisabled?"not-allowed":"pointer",pointerEvents:"auto"}),onClick:e=>{e.preventDefault(),_(T-1)},tabIndex:A.tabIndex,"aria-label":y||void 0,disabled:A.isDisabled,"data-testid":o?`${o}-decrement-button`:void 0,children:e.jsx(Wt,{value:b,children:(null==t?void 0:t.decrementButton)?Dp(p,t.decrementButton,n,g,o):kp(p,g,o)})}):null,l?e.jsx("input",{type:"text",className:null==t?void 0:t.input,style:Object.assign(Object.assign({},N),{cursor:N.isDisabled?"not-allowed":"auto",caretColor:N.isDisabled?"transparent":"auto",pointerEvents:"auto",outline:"none"}),value:T,onChange:L,"aria-label":r||void 0,tabIndex:I,disabled:x,"data-testid":o?`${o}-input`:void 0}):e.jsx("p",{className:null==t?void 0:t.input,style:S,"data-testid":o?`${o}-quantity-text`:void 0,children:T}),u?e.jsx("button",{className:null==t?void 0:t.incrementButton,style:Object.assign(Object.assign({},R.styles),{cursor:R.isDisabled?"not-allowed":"pointer",pointerEvents:"auto"}),onClick:e=>{e.preventDefault(),_(T+1)},tabIndex:R.tabIndex,"aria-label":f||void 0,disabled:R.isDisabled,"data-testid":o?`${o}-increment-button`:void 0,children:e.jsx(Wt,{value:b,children:(null==t?void 0:t.incrementButton)?Dp(u,t.incrementButton,n,g,o):kp(u,g,o)})}):null]})})})}const $p={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(up,{schema:t.node,testId:n})},EscapeHatch:function(t){if("EscapeHatch"===t.type&&t.node.data){const n=JSON.parse(t.node.data);switch(null==n?void 0:n.type){case"InsuranceRichText":return e.jsx(Ip,{schema:n.node});case"CatalogUrlLink":return e.jsx(wp,{schema:n.node});default:return}}},CatalogRadioGroup:function(t){if("CatalogRadioGroup"===t.type)return e.jsx(lp,{schema:t.node})},CatalogQuantityCounter:function(t){if("CatalogQuantityCounter"===t.type)return e.jsx(Pp,{schema:t.node})}};function Fp(){const t=On(),n=It();return e.jsx(St,{value:n,overrides:$p,children:e.jsx(Et,{children:e=>e(t)})})}function Gp(e){return e.reduce(((e,t)=>(e[t.cartItemId]=function(e={}){return Object.assign({cartItemId:"cartItemId",catalogItemId:"catalogItemId",name:"Catalog Title",description:"This is a catalog item",unitPrice:10,totalPrice:10,quantity:1,currency:"USD",linkedProductId:void 0,quantityMustBeSynchronized:void 0,providerData:""},e)}({cartItemId:t.cartItemId,quantity:t.quantity}),e)),{})}const Mp={cart:function(e=Gp([]),t){if(t.type===Xu){const{catalogItem:n,quantity:a}=t.payload,i=n.cartItemId,o=Oo(n,a);return Object.assign(Object.assign({},e),{[i]:o})}return e},userCreativeResponseHistory:function(e=[],t){return t.type===tp?e.concat(t.payload.responseId):e},staticData:_u,childLayouts:Lu};const Bp="INVALID_PARTNER_MESSAGE",Up="MISCONFIGURED_CATALOG_ITEM",Vp="FAILED_TO_PROCESS_PARTNER_UPDATE_CART_ITEM";function*zp(e){var t,n;const a=yield r.select(Lp),i=yield r.select(_p),o=yield r.select((e=>{var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer.maxTotalItemsQtyInOffer}));if(Kp(i)&&Kp(o)&&i>o)yield r.call(e,{level:N,code:Up,message:`Catalog items preselected quantities (${i}) exceeds the maximum allowed quantity (${o}) for this offer`});else if(a&&Array.isArray(a))for(const i of a){const a=null!==(t=i.preSelectedQuantity)&&void 0!==t?t:0,o=null!==(n=i.maxItemCount)&&void 0!==n?n:1/0;a>o?yield r.call(e,{level:N,code:Up,message:`Preselected quantity (${a}) is greater than maxItemCount (${o}) for catalog item (${i.instanceGuid})`}):yield*Jp(i,a,!0)}}function*qp(e,t,n){const{catalogItem:a,quantity:i}=n.payload;if(yield*Jp(a,i,!1)){const n=yield r.select((e=>{var t,n,a;const i=null===(t=e.staticData)||void 0===t?void 0:t.offer.creative.responseOptionsMap.positive,o=e.userCreativeResponseHistory.at(-1),r=null===(n=e.staticData)||void 0===n?void 0:n.offer.creative.responseOptionsMap.negative;if(i&&o&&i.id===o&&"SignalGatedResponse"===(null==r?void 0:r.signalType))return function(e,t){var n;switch(e.action){case"Fulfillment":{const a=null==t?void 0:t.creative.fulfillment;return b(a)?{type:z,payload:{fulfillment:a,responseOption:e,accountID:null!==(n=null==t?void 0:t.accountId)&&void 0!==n?n:""}}:`Could not get fulfillment for response (instanceGuid: ${e.instanceGuid})`}case"Url":return(null==t?void 0:t.accountId)?{type:z,payload:Object.assign(Object.assign({},e),{accountID:t.accountId})}:`Could not get accountId for response (instanceGuid: ${e.instanceGuid})`;default:return{type:z,payload:e}}}(r,null===(a=e.staticData)||void 0===a?void 0:a.offer)}));null!=(o=n)&&"object"==typeof o&&"type"in o&&"payload"in o&&"object"==typeof o.payload?yield r.call(e.globalDispatch,n):function(e){return"string"==typeof e}(n)&&(yield r.call(t,{level:N,code:"INVALID_RESPONSE_OBJECT",message:n}))}var o}function*Hp(e,t){const n=function(e,t){return l.eventChannel((n=>{const a=e.onEvent({name:cr.V2.PartnerMessage.UpdateCartItem,source:"partner",callback:e=>{!function(e){return null!==e&&"object"==typeof e&&"cartItemId"in e&&"quantity"in e&&!("unitPrice"in e)}(e)?t({level:N,code:Bp,message:`Invalid UpdateCartItemPartnerMessageBody: ${JSON.stringify(e)}`}):n(e)}});return()=>{a()}}))}(e,t);try{for(;;){const e=yield r.take(n);yield r.call(Wp,e,t)}}catch(e){const n=e;t({level:N,code:Vp,message:null==n?void 0:n.message})}finally{(yield r.cancelled())&&n.close()}}function*Wp(e,t){const{cartItemId:n,quantity:a}=e,i=yield r.select(Op,n);if(Yp(i)){const e=yield r.select(Np,i.catalogItemId);null!==(o=e)&&"object"==typeof o&&"catalogItemId"in o&&"price"in o?yield*Jp(e,a,!1):yield r.call(t,{level:N,code:Vp,message:`Catalog item not found for cart item id (${n})`})}else yield r.call(t,{level:N,code:Vp,message:`Cart item not found for cart item id (${n})`});var o}function*Jp(e,t,n){var a;const i=yield r.select(Op,e.cartItemId),o=yield r.select(Ap,e),s=Kp(o)?o:0,l=Yp(i)?i.quantity:0;if(t!==l&&t>=(null!==(a=e.minItemCount)&&void 0!==a?a:0)&&t-l<=s){yield r.put({type:Xu,payload:{catalogItem:e,quantity:t}});const a=yield r.select(Op,e.cartItemId),o=yield r.select(jp);return yield r.put({type:oe,payload:{cart:o}}),yield r.put({type:Z,payload:{name:"SignalCartItemQuantitySelected",parentGuid:e.instanceGuid,objectData:{quantity:t,preselected:n}}}),yield r.put({type:ee,payload:{name:"V2_CART_ITEM_UPDATED",body:{oldCartItem:i,cartItem:a}}}),!0}return!1}function Kp(e){return"number"==typeof e}function Yp(e){return null!=e&&"object"==typeof e&&"cartItemId"in e&&"quantity"in e&&"unitPrice"in e}function*Zp(e,t){var n;yield r.put({type:tp,payload:{responseId:(n=t.payload,q(n)?n.responseOption.id:n.id)}}),yield r.call(e.globalDispatch.bind(e),t)}function*Qp(e,t){yield r.all([r.spawn(zp.bind(null,t)),r.spawn(Hp.bind(null,e,t)),r.takeLatest(ep,qp.bind(null,e,t)),r.takeLatest(z,Zp.bind(null,e)),r.takeEvery(re,Mu.bind(null,e,t)),r.takeEvery("*",wo.bind(null,[z,re],e))])}function Xp(e){return"object"==typeof e&&null!==e&&"cartItemId"in e&&"quantity"in e}Object.assign(Object.assign({},se),{CATALOG_ITEM_RESPONSE:ep});const ef=(new In).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=function(e){return"object"==typeof e&&null!==e&&"cart"in e&&Array.isArray(e.cart)&&e.cart.every(Xp)}(i.offerState)?i.offerState:{cart:[]},d=function(e={}){return Object.assign({cart:Gp([]),userCreativeResponseHistory:[],staticData:null,childLayouts:{launched:{}}},e)}({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion},cart:Gp(c.cart)}),u=function(e,t,n){const a=l(),i=s.configureStore({reducer:Mp,devTools:{name:"Add To Cart"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(Qp,e,t),i}(i.gateway,i.logger,d);r.render(e.jsx(t.StrictMode,{children:e.jsxs(Pn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Ni,{}),e.jsx(a.Provider,{store:u,children:e.jsx(Ai,{settings:i,dispatch:u.dispatch,children:e.jsx(Fp,{})})})]})}))}}));var tf=Object.freeze({__proto__:null,moduleConnectorBuilder:ef});const nf="CATALOG/TRIGGER_SELECT_ITEM",af="CATALOG/SET_SELECTED_ITEM",of="CHECKOUT_LIFECYCLE",rf="INSTANT_PURCHASE/INITIATE",sf="INSTANT_PURCHASE/PARTNER_RESPONSE",lf="INSTANT_PURCAHSE/WSDK_RESPONSE";function cf(t,n,a,i,o){return e.jsx(Yt,{value:a(n),children:df(t,i,o)})}function df(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function uf(t){const n=a.useDispatch(),i=It(),o=An(),{tabIndex:r,styles:s,isDisabled:l}=m(o),c=Gn(),d=Vt(c,"catalogItem");return e.jsx(Ta,{styles:t.schema.styles,children:({classnames:a,mapperRef:o})=>e.jsx("button",{type:"button",tabIndex:r,"aria-disabled":l,disabled:l,style:Object.assign({cursor:"pointer"},s),"data-testid":t.testId,"data-e2e":"CatalogItemResponse",onClick:e=>{e.preventDefault();n({type:rf,payload:{catalogItem:c,quantity:1,useInstantPurchaseExtension:!0}})},className:null==a?void 0:a.own,children:e.jsx(Wt,{value:d,children:(null==a?void 0:a.own)?cf(t.schema.children,a.own,o,i,t.testId):df(t.schema.children,i,t.testId)})})})}function pf(t,n,a,i,o){return e.jsx(Yt,{value:a(n),children:i(t,void 0,o)})}function ff(e,t,n){return t(e,void 0,n)}const yf=["ArrowDown","ArrowUp","Enter","Escape","Tab"];function hf(n){const i=Tt(),o=It(),r=Gn(),s=Jt(),l=e=>s({data:e},"catalogItem"),c=t.useMemo((()=>i.catalogItems||[]),[i]),d=An(),{styles:u,isDisabled:p}=m(d),f=t.useRef(null),y=t.useRef([]),[h,v]=t.useState(!1),[g,b]=t.useState(0),E=a.useDispatch();function I(){p||(h?x():S())}function S(){p||v(!0)}function x(){p||v(!1)}function C(e){b(c.indexOf(e)),x(),E({type:nf,payload:{catalogItem:e}})}t.useEffect((()=>{if(h){const e=y.current[g];e&&e.focus()}}),[h,g]);const w={elements:{own:[{default:{background:{backgroundColor:{light:"#ffffff"}},dimension:{width:{type:"percentage",value:100}}}}]}};function O(e){if(!p&&yf.includes(e.key))switch(e.key){case"ArrowDown":{e.preventDefault();const t=g+1;t<c.length&&b(t);break}case"ArrowUp":{e.preventDefault();const t=g-1;t>=0&&b(t);break}case"Enter":if(e.preventDefault(),h){const e=c[g];e&&C(e)}else S();break;case"Tab":if(h){x();const e=c.indexOf(r);-1!==e&&b(e)}break;case"Escape":if(e.preventDefault(),h){x();const e=c.indexOf(r);-1!==e&&b(e)}}}return c.length>1?e.jsx(Ta,{styles:n.schema.styles?M(w,n.schema.styles):w,children:({classnames:t,mapperRef:a})=>e.jsxs("div",{ref:f,className:null==t?void 0:t.own,onKeyDown:O,onClick:I,onBlur:e=>{var t;(null===(t=f.current)||void 0===t?void 0:t.contains(e.relatedTarget))||h&&x()},"data-e2e":"DropDown","data-testid":n.testId?`${n.testId}-drop-down-container`:void 0,"aria-disabled":p,style:Object.assign({position:"relative"},u),tabIndex:0,children:[e.jsx("div",{className:null==t?void 0:t.dropDownSelectedElement,"aria-disabled":p,"data-testid":n.testId?`${n.testId}-drop-down-selected-element`:void 0,style:Object.assign({cursor:"pointer"},u),children:e.jsx(Wt,{value:l(r),children:(null==t?void 0:t.dropDownSelectedElement)?pf(n.schema.closedTemplate,t.dropDownSelectedElement,a,o,n.testId):ff(n.schema.closedTemplate,o,n.testId)})}),h&&e.jsx("ul",{className:null==t?void 0:t.dropDownListContainer,onClick:e=>e.stopPropagation(),"data-testid":n.testId?`${n.testId}-drop-down-list-container`:void 0,tabIndex:-1,style:Object.assign({listStyle:"none",padding:0,zIndex:9999,position:"absolute",top:"100%",left:0,right:0,backgroundColor:"#FFF",overflow:"hidden"},u),children:c.map(((i,r)=>e.jsx("li",{ref:e=>function(e,t){y.current[t]=e}(e,r),className:null==t?void 0:t.dropDownListElement,onClick:e=>{e.stopPropagation(),p||C(i)},tabIndex:-1,"data-e2e":"DropDownItem","data-testid":n.testId?`${n.testId}-drop-down-item-${r}`:void 0,style:Object.assign({cursor:"pointer",display:"flex"},u),children:e.jsx(Wt,{value:l(i),children:(null==t?void 0:t.dropDownListElement)?pf(n.schema.openTemplate,t.dropDownListElement,a,o,n.testId):ff(n.schema.openTemplate,o,n.testId)})},i.catalogItemId)))})]})}):null}function mf(n){const i=n.schema.styles,o=a.useDispatch(),r=a.useSelector((e=>e.staticData)),s=An(),{tabIndex:l,styles:c,isDisabled:d}=m(s),u=()=>{var e;o({type:of,payload:{event:"Checkout",targetStep:n.schema.targetStep,offerPositionIndex:null!==(e=null==r?void 0:r.position)&&void 0!==e?e:0,data:n.schema.data}})};return e.jsx(Ta,{styles:i,children:({classnames:a})=>{var i;return e.jsx("button",{title:n.schema.targetStep,className:null==a?void 0:a.own,onClick:u,"data-testid":n.testId,"data-e2e":"CheckoutStateButtonTrigger",disabled:d,"aria-disabled":d,"aria-label":null!==(i=n.schema.a11yLabel)&&void 0!==i?i:n.schema.targetStep,tabIndex:l,style:Object.assign({cursor:"pointer"},c),children:e.jsx(Et,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,U(a,n.testId)))))})})}})}const vf=/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{3})$/;function gf(t){const n=Jt(),a=An(),{schema:i,testId:o}=t,r=n(i.value),{tabIndex:s,styles:l,isDisabled:c}=m(a);return"string"==typeof(d=r)&&vf.test(d)?e.jsx(Ta,{styles:i.styles,children:({classnames:t})=>e.jsx("div",{"aria-hidden":c,className:null==t?void 0:t.own,"data-e2e":"ColorSwatch","data-testid":o,style:Object.assign({backgroundColor:r},l),tabIndex:s})}):null;var d}function bf(n){const{schema:{styles:a},testId:i}=n,[o,r]=t.useState(0),s=Gn(),l=An(),{styles:c,isDisabled:d,tabIndex:u}=m(l);t.useEffect((()=>{r(0)}),[s.catalogItemId]);const p=Object.values(s.images||{}),f=p[o]||p[0];return p.length>0&&f?e.jsx(Ta,{styles:a,children:({classnames:n})=>e.jsxs("div",{className:null==n?void 0:n.own,children:[e.jsx("img",{"aria-hidden":d,src:f.light,alt:f.alt,title:f.title,className:null==n?void 0:n.mainImage,style:c,"data-testid":`${i}-main-image`,"data-e2e":"CatalogImageGallery-mainImage"}),e.jsx("div",{className:null==n?void 0:n.thumbnailList,style:Object.assign(Object.assign({},c),{display:"flex"}),children:t.Children.toArray(p.map(((t,a)=>e.jsx("img",{src:t.light,alt:t.alt,title:t.title,className:null==n?void 0:n.thumbnailImage,style:Object.assign(Object.assign({},c),{cursor:d?"not-allowed":"pointer",pointerEvents:"auto"}),"data-testid":`${i}-thumbnail-${a}`,"data-e2e":"CatalogImageGallery-thumbnail",tabIndex:u,onClick:()=>r(a)}))))})]})}):null}const Ef={size:80,radius:30,stroke:7,duration:2,primaryColor:"#222",secondaryColor:"#d6d6d6",primaryRotation:-50,secondaryRotation:45,arcFraction:1/3.5},If={elements:{own:[{default:{container:{justifyContent:"center",alignItems:"center"},dimension:{width:{type:"percentage",value:100}}}}],spinner:[{default:{container:{justifyContent:"center",alignItems:"center"}}}]}};function Sf(t){var n;const{config:a}=t.schema,i=Object.assign(Object.assign({},Ef),a),o=i.radius,r=2*Math.PI*o,s=r*(null!==(n=i.arcFraction)&&void 0!==n?n:1/3.5),l=r-s,c=i.size/2,d={container:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"100%"},spinner:{display:"block",animation:`spin ${i.duration}s ease-in-out infinite`,transformOrigin:"center center"}};return e.jsx(Ta,{styles:t.schema.styles?M(If,t.schema.styles):If,children:({classnames:n})=>e.jsxs("div",{className:null==n?void 0:n.own,"data-testid":t.testId,"data-e2e":"LoadingSpinner",style:d.container,children:[e.jsxs("svg",{width:i.size,height:i.size,viewBox:`0 0 ${i.size} ${i.size}`,className:null==n?void 0:n.spinner,style:d.spinner,children:[e.jsx("circle",{cx:c,cy:c,r:o,fill:"none",stroke:i.primaryColor,strokeWidth:i.stroke,strokeDasharray:`${s} ${l}`,strokeDashoffset:"0",strokeLinecap:"butt",transform:`rotate(${i.primaryRotation} ${c} ${c})`}),i.secondaryColor&&e.jsx("circle",{cx:c,cy:c,r:o,fill:"none",stroke:i.secondaryColor,strokeWidth:i.stroke,strokeDasharray:`${s} ${l}`,strokeDashoffset:"0",strokeLinecap:"butt",transform:`rotate(${i.secondaryRotation} ${c} ${c})`})]}),e.jsx("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]})})}function xf(n){const i=1e3*n.schema.durationInSeconds,o=n.schema.format||"M:SS",r=n.testId,s=a.useDispatch(),[l,c]=t.useState(i),d=t.useRef(null),u=t.useRef(null);function p(){const e=Math.ceil(l/1e3);if("S"===o)return e;{const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,"0")}`}}return t.useEffect((()=>(u.current=requestAnimationFrame((function e(t){d.current||(d.current=t);const n=t-d.current,a=Math.max(i-n,0);c(a),a>0?u.current=requestAnimationFrame(e):s({type:Q,payload:{event:"Dismissed",dismissalReason:"Implicit"}})})),()=>{u.current&&cancelAnimationFrame(u.current)})),[i,s]),e.jsx(Ta,{styles:n.schema.styles,children:({classnames:t})=>e.jsx("span",{className:null==t?void 0:t.own,"data-testid":r||"","data-e2e":"OfferLifecycleTimer",children:p()})})}function Cf(n){const i=It(),o=Dn(),r=Jt(),s=mt(),l=Tt().catalogItems||[],c=a.useSelector((e=>e.selectedItem))||l[0];return t.useEffect((()=>{c&&s({type:Z,payload:{name:"SignalImpression",parentGuid:null==c?void 0:c.instanceGuid}})}),[c,s]),c?e.jsx(Ta,{styles:n.schema.styles,children:({classnames:a})=>{return e.jsx("div",{"data-testid":n.testId,"data-e2e":"CatalogCombinedCollection",className:null==a?void 0:a.own,style:{display:"flex",flexDirection:"column"},children:t.Children.toArray(e.jsx(Fn,{context:c,children:e.jsx(jn,{value:o(c),children:e.jsx(Wt,{value:(s=c,r({data:s},"catalogItem")),children:i(n.schema.template,void 0,n.testId?`${n.testId}-child`:"")})})}))});var s}}):null}const wf={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(uf,{schema:t.node,testId:n})},CatalogCombinedCollection:function(t,n){if("CatalogCombinedCollection"===t.type)return e.jsx(Cf,{schema:t.node,testId:n})},EscapeHatch:function(t){if("EscapeHatch"===t.type&&t.node.data){const n=JSON.parse(t.node.data);switch(null==n?void 0:n.type){case"CatalogDropDown":return e.jsx(hf,{schema:n.node});case"CheckoutStateButtonTrigger":return e.jsx(mf,{schema:n.node});case"ColorSwatch":return e.jsx(gf,{schema:n.node});case"CatalogImageGallery":return e.jsx(bf,{schema:n.node});case"LoadingSpinner":return e.jsx(Sf,{schema:n.node});case"OfferLifecycleTimer":return e.jsx(xf,{schema:n.node});default:return}}}};function Of(){const t=On(),n=It(),i=a.useSelector(Fu),o=Jt()({state:i},"textContent");return e.jsx(St,{value:n,overrides:wf,children:e.jsx(Wt,{value:o,children:e.jsx(Et,{children:e=>e(t)})})})}const Tf={staticData:_u,selectedItem:(e=null,t)=>t.type===af?t.payload:e,dynamicData:ju,childLayouts:Lu};function Af(e={}){return Object.assign({staticData:null,selectedItem:null,dynamicData:null,childLayouts:{launched:{}}},e)}const Rf="INVALID_RESPONSE_OBJECT";function Nf(e,t){return l.eventChannel((n=>e.onEvent({name:dr.PartnerMessage.CartItemInstantPurchaseResponse,source:"partner",callback:e=>{var a;"object"==typeof(a=e)&&null!==a&&"upsellItems"in a&&Array.isArray(a.upsellItems)&&a.upsellItems.every((e=>"object"==typeof e))&&"totalUpsellPrice"in a&&"number"==typeof a.totalUpsellPrice&&"currency"in a&&"string"==typeof a.currency&&"paid"in a&&"boolean"==typeof a.paid&&"success"in a&&"boolean"==typeof a.success?n(e):t({level:N,code:"MALFORMED_INSTANT_PURCHASE_PARTNER_DATA",message:`Malformed data received from partner\n ${e}`})}})))}function*Lf(e,t){var n;try{for(;;){const t=yield r.take(e);t&&(yield r.put({type:sf,payload:t}))}}catch(e){yield r.call(t,{level:N,code:"INSTANT_PURCHASE_PARTNER_CHANNEL_ERROR",message:null!==(n=e.message)&&void 0!==n?n:"Unknown error in instant-purchase partner channel"})}finally{e.close()}}function*_f(e,t){var n;try{for(;;){const t=yield r.take(e);if(t){yield r.put({type:lf,payload:t});break}}}catch(e){yield r.call(t,{level:N,code:"INSTANT_PURCHASE_WSDK_CHANNEL_ERROR",message:null!==(n=e.message)&&void 0!==n?n:"Unknown error in instant-purchase WSDK channel"})}finally{e.close()}}function jf(e){const t=function(e){var t,n;return null!==(n=null===(t=e.staticData)||void 0===t?void 0:t.offer.catalogItems)&&void 0!==n?n:[]}(e);return t[0]}const Df="Unknown failure reason",kf=6e4;function*Pf(){const e=yield r.select(jf);e&&(yield*Vf(e))}function*$f(e){const{catalogItem:t}=e.payload;yield*Vf(t)}function*Ff(e,t,n){const{catalogItem:a,quantity:i}=n.payload,o=Oo(a,i);o?(yield r.put({type:Z,payload:{name:"SignalCartItemInstantPurchaseInitiated",parentGuid:a.instanceGuid,objectData:{catalogItemId:a.catalogItemId,quantity:i}}}),yield*Wf("ProcessingState",1),n.payload.useInstantPurchaseExtension?yield*function*(e,t,n){const a={upsellItems:[{cartItemId:e.cartItemId,catalogItemId:e.catalogItemId,quantity:e.quantity,unitPrice:e.unitPrice,totalPrice:e.totalPrice,currency:e.currency}],totalUpsellPrice:e.totalPrice,currency:e.currency};yield r.fork(Uf,t,n),yield r.put({type:ee,payload:{name:"INITIATE_INSTANT_PURCHASE_EVENT",body:a}})}(o,e,t):yield*function*(e,t,n){yield r.fork(Bf,t,n),yield r.put({type:ee,payload:{name:"CART_ITEM_INSTANT_PURCHASE",body:{upsellItems:[e],totalUpsellPrice:e.totalPrice||0,currency:e.currency}}})}(o,e,t)):(yield r.call(t,{level:N,code:Rf,message:`Unable to translate catalog item with ID ${a.catalogItemId} to cart item for instant purchase transaction.`}),yield*Jf("offerComplete",2))}function*Gf(e,t){const n=yield r.select((e=>e.staticData));if(!n)return yield r.call(e,{level:N,code:"MISSING_STATIC_DATA_IN_INSTANT_PURCHASE_MODULE",message:"App state is not configured with static data."}),void(yield*Hf("Error"));if(!n.offer.catalogItems)return yield r.call(e,{level:N,code:"MISSING_CATALOG_ITEMS",message:"No catalog items found within offer data."}),void(yield*Hf("Error"));const a={accountId:n.offer.accountId,catalogItems:n.offer.catalogItems};let i,o;t.payload.success?(i=zf,o="Success"):(i=(e,n)=>function(e,t,n,a){return{name:"SignalCartItemInstantPurchaseFailure",parentGuid:e.instanceGuid,objectData:{catalogItemId:e.catalogItemId,quantity:t,failureReason:a.reason||Df,providerId:n.accountId.toString()}}}(e,n,a,t.payload),o="Unspecified"),yield*function*(e,t,n,a){const i=[];for(const a of e.upsellItems){const e=qf(a,t.catalogItems);void 0===e?i.push(a):yield r.put({type:Z,payload:n(e,a.quantity)})}i.length>0&&(yield*function*(e,t){const n=JSON.stringify(e,null,"\t").replaceAll('"',"");yield r.call(t,{level:N,code:Rf,message:`Unable to map cart items to catalog items in the instant purchase partner response: ${n}.`})}(i,a))}(t.payload,a,i,e),yield*Hf(o)}function*Mf(e){e.payload.response&&e.payload.response.success?yield*Jf("offerComplete",1):yield*Jf("offerComplete",2)}function*Bf(e,t){const n=Nf(e,t),{timeout:a}=yield r.race({channel:r.call(Lf,n,t),timeout:r.delay(kf)});a&&(yield r.call(t,{level:N,code:"INSTANT_PURCHASE_PARTNER_RESPONSE_TIMEOUT",message:"Instant-purchase partner response timed out after 60000ms"}),n.close(),yield*function*(e){yield*Wf("ProcessingState",0),yield r.put({type:Q,payload:{event:"Dismissed",dismissalReason:e}})}("Implicit"))}function*Uf(e,t){const n=function(e,t){return l.eventChannel((n=>e.onEvent(...["INSTANT_PURCHASE_SUCCESS","INSTANT_PURCHASE_FAILURE"].map((e=>({name:e,source:"partner",callback:e=>{var a;"object"==typeof(a=e)&&null!==a&&"timestamp"in a&&"string"==typeof a.timestamp&&"sessionId"in a&&"string"==typeof a.sessionId?n(e):t({level:N,code:"MALFORMED_INSTANT_PURCHASE_WSDK_DATA",message:`Malformed data received from wsdk\n ${e}`})}}))))))}(e,t),{timeout:a}=yield r.race({channel:r.call(_f,n,t),timeout:r.delay(kf)});a&&(yield r.call(t,{level:N,code:"INSTANT_PURCHASE_WSDK_RESPONSE_TIMEOUT",message:"Instant-purchase wsdk response timed out after 60000ms"}),n.close(),yield*Jf("offerComplete",2))}function*Vf(e){var t,n,a;yield r.put({type:af,payload:e});const i={title:null!==(t=e.title)&&void 0!==t?t:"",description:null!==(n=e.description)&&void 0!==n?n:"",price:null!==(a=e.priceFormatted)&&void 0!==a?a:""};e.copy&&Object.entries(e.copy).forEach((([e,t])=>{i[`copy.${e}`]=t})),yield r.put({type:Nu,payload:{text:i}})}function zf(e,t){return{name:"SignalCartItemInstantPurchase",parentGuid:e.instanceGuid,objectData:{catalogItemId:e.catalogItemId,quantity:t,initiatedBy:T.DCUI}}}function qf(e,t){return t.find((t=>t.catalogItemId===e.catalogItemId))}function*Hf(e){yield*Wf("ProcessingState",0),yield r.put({type:Q,payload:{event:"Completed",completionReason:e}})}function*Wf(e,t){yield r.put({type:X,payload:{key:e,value:t}})}function*Jf(e,t){yield*Wf("ProcessingState",0),yield r.put({type:te,payload:{key:e,value:t}})}const Kf=["Success","Unspecified","Error"],Yf=["Implicit","Explicit"];function*Zf(e,t){if("Checkout"!==t.payload.event)return;yield r.put({type:te,payload:{key:"checkout",value:Qf(t.payload),offerPositionIndex:t.payload.offerPositionIndex}});const n=t.payload.data;if(n){const a="Completed"===n.event;if("Completed"===n.event||"Dismissed"===n.event){(a?Kf.includes(n.reason):Yf.includes(n.reason))?yield r.put({type:Q,payload:Object.assign(Object.assign({event:n.event},a?{completionReason:n.reason}:{dismissalReason:n.reason}),{offerPositionIndex:t.payload.offerPositionIndex})}):yield r.call(e,{level:N,code:"CHECKOUT_BUTTON_INVALID_OFFERLIFECYCLE",message:`Misconfigured offer lifecycle payload in handleCheckoutLifecycle: ${n}.`})}else yield r.call(e,{level:N,code:"CHECKOUT_BUTTON_UNKNOWN_EVENT",message:`Unknown event type in checkout lifecycle: ${JSON.stringify(n)}`})}}function Qf(e){var t;return null!==(t={ViewOffer:0,ViewTransactionDetails:1,EditPayment:2,EditShipping:3,EditPaymentAndShipping:4,CostBreakdown:5,Confirmation:6,CloseOffer:7}[e.targetStep])&&void 0!==t?t:0}function*Xf(e,t){yield r.all([r.spawn(Pf),r.takeEvery(of,Zf.bind(null,t)),r.takeEvery(nf,$f),r.takeLatest(rf,Ff.bind(null,e,t)),r.takeLatest(sf,Gf.bind(null,t)),r.takeLatest(lf,Mf.bind(null)),r.takeEvery(re,Mu.bind(null,e,t)),r.takeEvery("*",wo.bind(null,[z,re],e))])}Object.assign(Object.assign({},se),{INITIATE_INSTANT_PURCHASE:rf,INSTANT_PURCHASE_PARTNER_RESPONSE:sf,INSTANT_PURCHASE_WSDK_RESPONSE:lf});const ey=(new In).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=Af({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n=Af()){const a=l(),i=s.configureStore({reducer:Tf,devTools:{name:"Instant Purchase"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(Xf,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(Pn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Ni,{}),e.jsx(a.Provider,{store:d,children:e.jsx(Ai,{settings:i,dispatch:d.dispatch,children:e.jsx(Of,{})})})]})}))}}));var ty=Object.freeze({__proto__:null,moduleConnectorBuilder:ey});const ny=t.createContext(null),ay=({children:n})=>{var a;const[i,o]=t.useState([]),[r,s]=t.useState(0),[l,c]=t.useState(0),d=Jt();return t.useEffect((()=>{let e=0;const t=i.length,n=setInterval((()=>{e=e+1>=t?0:e+1,s(e)}),l);return()=>clearInterval(n)}),[l,i]),e.jsx(ny.Provider,{value:{images:i,activeIndex:r,duration:l,setImages:o,setActiveIndex:s,setDuration:c},children:e.jsx(Wt,{value:d({data:{"image.title":null===(a=i[r])||void 0===a?void 0:a.title}},"creativeCopy"),children:n})})};function iy({active:n,duration:a,containerStyles:i,indicatorStyles:o}){const r=t.useRef(null);return t.useEffect((()=>{n&&r.current&&function(e,t){const n="animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype,a=[{width:0},{width:"100%"}];if(n){const n=e.animate(a,{duration:t,iterations:1});return()=>{n.finish()}}}(r.current,a)}),[n]),e.jsx("div",{style:Object.assign({position:"relative",height:"2px",width:"100%",backgroundColor:"#FFFFFF66"},i),children:e.jsx("span",{ref:r,style:Object.assign({animationIterationCount:"infinite",animationFillMode:"forwards",animationTimingFunction:"linear",position:"absolute",top:0,left:0,height:"100%",backgroundColor:"#FFF",width:n?"100%":0},o)})})}function oy(e){const n=t.useContext(_n),a=[];return e.forEach((e=>{const t=n(`${e}.src`,"copy"),i=n(`${e}.title`,"copy");if(void 0===t)return;const o=function(e={}){return Object.assign({light:"https://plus.unsplash.com/premium_photo-1675826774817-fe983ceb0475?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=200&q=80",dark:"https://images.unsplash.com/photo-1679941734238-56628f5991f7?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=200&q=80"},e)}({light:t,title:i});a.push(o)})),a}function ry({schema:n,testId:a}){const i=JSON.parse(n.data),{styles:o,duration:r,imageKeys:s}=i,l=t.useContext(ny),c=oy(s);return t.useEffect((()=>{null==l||l.setImages(c),null==l||l.setDuration(r)}),[]),e.jsxs("div",{"data-testid":a,style:Object.assign({position:"relative",flexShrink:1,flexGrow:0,width:"100%"},o.elements.own),children:[t.Children.toArray(c.map(((t,n)=>e.jsx("img",{src:t.light,alt:t.title,style:Object.assign({opacity:n===(null==l?void 0:l.activeIndex)?1:0,position:0===n?"relative":"absolute",display:0===n?"block":"",top:0,width:"100%",height:"100%",maxHeight:"100%",maxWidth:"100%",transition:"opacity 300ms ease-in-out",objectFit:"contain"},o.elements.image)})))),e.jsx("div",{style:Object.assign({display:"flex",gap:"2px",width:"70%",position:"absolute",margin:"0 15%",bottom:"8px",zIndex:20,justifyContent:"center"},o.elements.indicatorWrapper),children:t.Children.toArray(c.map(((t,n)=>e.jsx(iy,{duration:r,active:n===(null==l?void 0:l.activeIndex),containerStyles:o.elements.indicatorContainer,indicatorStyles:o.elements.indicator}))))})]})}const sy={allowedTags:["em","strong","a","br","u","p","li","ul","ol","span"],allowedAttributes:{a:["href","target"],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],span:[]},allowedSchemes:["http","https"]},ly=new Map([["&","_;^;_"]]),cy=new RegExp(`<a *(?=${sy.allowedAttributes.a.join("|")}|>)`,"g"),dy=new RegExp("<span*>","g"),uy=new RegExp(`<a *(?:(?:${sy.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),py=new RegExp("(<br *?>)|(<br *?/>)","g"),fy="<br/>";function yy(n){const a=Jt(),i=An(),o=t.useMemo((()=>{const e=a(n.schema.value);if(!function(e){const t=function(e){return e.replaceAll(uy,((e,t)=>{const n=t.replaceAll("&",ly.get("&"));return e.replace(t,n)})).replaceAll(py,fy)}(e);return t===u(t,sy)}(e))throw new L("FAILED_SANITISING_HTML","Invalid HTML tags");return e}),[n.schema.value,a]),{tabIndex:r,styles:s,isDisabled:l}=m(i);return o?e.jsx(Ta,{styles:n.schema.styles,children:({classnames:t})=>{const a=[(null==t?void 0:t.link)?`class = "${null==t?void 0:t.link}"`:"",l?'tabindex="-1"':"",l?"style=\"pointer-events: 'none'; user-select: none;\"":"",l?'aria-disabled="true"':""].filter((e=>e.length>0));return i=o,new RegExp("</(p|ul|ol)>").test(i)?e.jsx("div",{tabIndex:r,style:s,"aria-hidden":l,className:null==t?void 0:t.own,"data-testid":n.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:o.replace(cy,`<a ${a.join(" ")}`).replace(dy,`<span${(null==t?void 0:t.span)?` class=${t.span}`:""}>`)}}):e.jsx("p",{tabIndex:r,style:s,"aria-hidden":l,className:null==t?void 0:t.own,"data-testid":n.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:o.replace(cy,`<a ${a.join(" ")}`).replace(dy,`<span${(null==t?void 0:t.span)?` class=${t.span}`:""}>`)}});var i}}):null}function hy({schema:n}){const a=It(),i=dt(Bn(),en()),o=JSON.parse(n.data),[r]=d({loop:!1,align:"start",slidesToScroll:2,containScroll:"trimSnaps"}),{styles:s,body:{tierItems:l}}=o;if(!l||!l.length)return;const c=l.length>2;return e.jsx("div",{className:i`
136
+ `},t.Children.toArray(u.map((e=>c(e))))))))}const Us={name:"loading-extension",componentFactory:e=>t.createElement(Bs,{data:e}),interceptors:{}},Vs={name:"shimmer-background-extension",componentFactory:e=>t.createElement("div",null,"Shimmer Background"),interceptors:{}},zs=1e3;function Hs(e){const n=e.data,{minutes:o,seconds:r,timeRemaining:s,restartTimer:l}=function(e){const[n,a]=t.useState(e),i=(new Date).getTime()/zs,o=t.useRef(null),r=()=>{const t=(new Date).getTime()/zs;a(Math.max(Math.floor(e-(t-i)),0))};return t.useEffect((()=>(o.current=setInterval(r,zs),()=>{o.current&&"number"==typeof o.current&&clearInterval(o.current)})),[]),{minutes:Math.floor(n/60).toString(),seconds:Math.floor(Math.min(n%60,59)).toLocaleString("en-US",{minimumIntegerDigits:2,maximumFractionDigits:0,useGrouping:!1}),timeRemaining:n,restartTimer:function(){o.current&&"number"==typeof o.current&&clearInterval(o.current),a(e),o.current=setInterval(r,zs)}}}((null==n?void 0:n.duration)||300),c=a.useSelector((e=>{const t=i.path(["progression","currentGroupIndex"],e);return"number"==typeof t?t:0})),d=a.useDispatch();t.useEffect((()=>{l()}),[c]),t.useEffect((()=>{0===s&&(d({type:Z,payload:{name:"SignalUserInteraction",action:"TimerExpired",context:"TimerProgression"}}),d({type:"PROGRESSION/PROCESS",payload:{offerProcessStatus:"CONTINUE"}}))}),[o,r]);const u=Rn(),{tabIndex:p,styles:f,isDisabled:y}=m(u);return t.createElement("p",{tabIndex:p,style:Object.assign(Object.assign({},null==n?void 0:n.styles),f),"aria-hidden":y,"data-e2e":"Timer"},`${o}:${r}`)}const qs={name:"timer-progression-extension",componentFactory:e=>t.createElement(Hs,{data:e}),interceptors:{}},Ws="MODULE/ADD_LOADED",Js="MODULE/LOAD",Ys="PROGRESSION/INITIALISE",Ks="PROGRESSION/NEXT",Zs="PROGRESSION/PREV",Qs="PROGRESSION/UPDATE_GROUP_SIZE",Xs="PROGRESSION/PROCESS",el="SLOTS/SET",tl="INSTANT_PURCHASE/DISMISS",nl="OFFER_LIFECYCLE",al="DOMAIN_STATES/SET",il="OFFER_ENGAGEMENT",ol="GLOBAL_OFFER_DATA_STATE/SET_CART",rl=Object.assign(Object.assign({},no),{NEXT_IN_PROGRESSION:Ks,PREV_IN_PROGRESSION:Zs,INITIALISE_PROGRESSION:Ys,UPDATE_GROUP_SIZE:Qs,SET_SLOTS:el,ADD_LOADED_MODULE:Ws,SET_DOMAIN_STATE:al,SET_GLOBAL_OFFER_DATA_CART:ol}),sl=Object.assign(Object.assign({},ao),{LOAD_MODULES:Js,DISMISS_INSTANT_PURCHASE:tl,PROCESS_PROGRESSION:Xs,OFFER_LIFECYCLE:nl,OFFER_ENGAGEMENT:il,SET_PARTNER_VALIDATION_STATUS:ie});function ll(e,t){return t<=0||e<=0||t>e?0:Math.ceil(e/t)}function cl(e,t){const n=[];if(t<=0||e<=0||t>e)throw Error(`Could not generate the progression groups with groupSize: ${t} and totalCount: ${e}`);for(let a=0;a<ll(e,t);a++){const i=[];for(let n=0;n<t;n++)i.push(Math.min(a*t+n,e-1));n.push([...new Set(i)])}return n}const dl=Symbol("root");function ul(){return{[dl]:{}}}const pl=Object.assign({progression:function(e=null,t){switch(t.type){case Ys:if(function(e){const{totalCount:t,currentGroupIndex:n,groupSize:a}=e;return t>=0&&a>=0&&n>=0&&a<=t&&n<ll(t,a)}(t.payload)){const{totalCount:e,_:n,groupSize:a}=t.payload;return Object.assign(Object.assign({},t.payload),{indexGroups:cl(e,a)})}return null;case Qs:{const{groupSize:n}=t.payload,a=null==e?void 0:e.totalCount;return a&&n<=a&&n>0?Object.assign(Object.assign({},e),{groupSize:n,indexGroups:cl(a,n),currentGroupIndex:0}):null}case Ks:{if(!e)return null;const{totalCount:t,groupSize:n,currentGroupIndex:a}=e;return t>0&&n>0&&a>=0?Object.assign(Object.assign({},e),{currentGroupIndex:Math.min(a+1,ll(t,n)-1)}):null}case Zs:{if(!e)return null;const{totalCount:t,groupSize:n,currentGroupIndex:a}=e;return t>0&&n>0&&a>=0?Object.assign(Object.assign({},e),{currentGroupIndex:Math.max(a-1,0)}):null}default:return e}},slots:function(e=[],t){return t.type===el?t.payload:e},module:function(e={loadedModules:[]},t){return t.type===Ws?Object.assign(Object.assign({},e),{loadedModules:[...e.loadedModules,t.payload]}):e},domainStates:function(e=ul(),t){if(t.type===al){if(t.payload.key&&!isNaN(t.payload.value)){const n=void 0!==t.payload.offerPositionIndex?`module${t.payload.offerPositionIndex}`:dl;return n===dl?e:Object.assign(Object.assign({},i.assocPath([n,t.payload.key],Number(t.payload.value),e)),{[dl]:{}})}return e}return e},globalOfferDataState:function(e={},t){if(t.type===ol){if(t.payload.cart){const n=`module${t.payload.offerPositionIndex}`;return Object.assign(Object.assign({},e),{[n]:{cart:t.payload.cart}})}return e}return e}},or);function fl(e={}){return Object.assign(Object.assign(Object.assign({},function(e={}){return Object.assign({layout:Jo(),breakpoint:{breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},active:Yo(),fonts:[],signal:{queue:[],processed:[]},serializableCache:ir(),settings:{closeOnComplete:!0},customStates:{root:{}}},e)}(e)),{progression:null,slots:[],module:{loadedModules:[]},domainStates:ul(),globalOfferDataState:{}}),e)}function yl(e){var t;return!!e.progression&&(1===e.progression.groupSize&&e.progression.currentGroupIndex===(null===(t=e.progression)||void 0===t?void 0:t.totalCount)-1)}function hl(e){return e.progression?{activeGroupIndex:e.progression.currentGroupIndex,totalOffers:e.progression.totalCount,totalGroups:ll(e.progression.totalCount,e.progression.groupSize),isLast:yl(e)}:null}function ml(e,t){return e.domainStates[`module${t}`]||{offerComplete:0,checkout:0}}function vl(e){return Object.values(e.globalOfferDataState).reduce(((e,t)=>{if(t&&"object"==typeof t&&"cart"in t){const n=t.cart;if(Array.isArray(n))return e+n.reduce(((e,t)=>e+("number"==typeof t.quantity?t.quantity:0)),0)}return e}),0)}function gl(n){var i;const{config:o,position:r,visible:s,container:l,testId:c}=n,d=Un(),u=Rn(),p=a.useSelector(Ko),f=a.useSelector((e=>function(e,t){return e.globalOfferDataState[`module${t}`]}(e,r))),y=t.useContext(Vn),h=t.useContext(zn),m=`rokt-${o.layoutVariant.moduleName}-${d}`;return e.jsxs(e.Fragment,{children:[!s&&e.jsx("div",{style:{position:"absolute",top:"0",right:"0",bottom:"0",left:"0",zIndex:"1"},"aria-hidden":"true"}),e.jsx(m,{style:{display:"flex",flexDirection:"column"===l?"column":"row",width:"100%"},slotInstanceGuid:o.instanceGuid,layoutSchema:JSON.stringify(o.layoutVariant.layoutVariantSchema),schemaVersion:y,childLayouts:JSON.stringify(null!==(i=o.layoutVariant.childLayouts)&&void 0!==i?i:[]),offerData:JSON.stringify(o.offer),offerPositionIndex:r,visible:s,container:l,interactivity:u,"data-testid":c,"data-e2e":`OfferSlot-${r}`,inert:(null==h?void 0:h.inert)&&!s?"":void 0,"aria-hidden":(null==h?void 0:h.inert)?void 0:!s,"module-component":!0,"plugin-id":d,"active-breakpoint":B(p),offerState:JSON.stringify(f)})]})}function bl({schema:n,testId:i}){const o=n.styles,r=a.useSelector((e=>e.slots)),s=t.useRef(null),l=a.useSelector((e=>{var t,n;return null!==(n=null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex)&&void 0!==n?n:0})),c=Rn(),{tabIndex:d,isDisabled:u,styles:p}=m(c);return r.length&&r[l]?e.jsx(Aa,{styles:o,children:({classnames:a})=>e.jsx("div",{ref:s,"data-testid":i,"data-e2e":"OneByOneDistribution",className:null==a?void 0:a.own,tabIndex:d,"aria-hidden":u,style:Object.assign({position:"relative",transition:`height ${n.transition.settings.duration/2}ms ease-in-out`,overflow:"hidden",boxSizing:"content-box"},p),children:t.Children.toArray(r.map(((t,a)=>e.jsx(Di,{effect:n.transition,visible:a===l,parentElement:s.current,children:e.jsx(gl,{config:t,position:a,visible:a===l,container:"column"})}))))})}):null}const El=a.connect((function(e,{schema:t}){var n,a,i;const o=t.startPosition||1;if((null===(n=e.progression)||void 0===n?void 0:n.totalCount)&&(null===(a=e.progression)||void 0===a?void 0:a.groupSize)){const t=ll(e.progression.totalCount,e.progression.groupSize);let n;n=o>0?o-1:t+o>-1?t+o:0;return{numOfIndicators:t-n>-1?t-n:0,activeIndex:null!==(i=e.progression.currentGroupIndex)&&void 0!==i?i:0,startIndex:n}}return{numOfIndicators:0,activeIndex:0,startIndex:0}}))((function({activeIndex:t,startIndex:n,numOfIndicators:a,schema:i}){const o=Rn(),{tabIndex:r,styles:s,isDisabled:l}=m(o),c=Array(a).fill(i.indicator);return a>1&&(u=a+n-1,(d=t)>=n&&d<=u)?e.jsx(Wt,{children:a=>e.jsx(Aa,{styles:i.styles,children:i=>{var o;const d=i.classnames,u=e=>{var n,a;return e===t?`${null==d?void 0:d.indicator} ${(null==d?void 0:d.activeIndicator)?d.activeIndicator:null!==(n=null==d?void 0:d.seenIndicator)&&void 0!==n?n:""}`:e<t?`${null==d?void 0:d.indicator} ${null!==(a=null==d?void 0:d.seenIndicator)&&void 0!==a?a:""}`:null==d?void 0:d.indicator};return e.jsx("div",{className:null!==(o=null==d?void 0:d.own)&&void 0!==o?o:"",style:Object.assign({display:"flex",flexDirection:"row"},s),"data-e2e":"ProgressIndicator",tabIndex:r,"aria-hidden":l,children:y.Children.toArray(c.map(((t,i)=>e.jsx("span",{className:u(i+n),style:{display:"flex"},children:a({state:{indicatorPosition:String(i+1+n)}})(t)}))))})}})}):null;var d,u}));const Il="partnerValidationUI",Sl="stackedViewableItems";function xl(n){var o;const r=a.useDispatch(),s=a.useSelector((e=>e.slots)),l=null!==(o=n.schema.viewableItems)&&void 0!==o?o:[],c=ga(l.reduce(((e,t,n)=>Object.assign(Object.assign({},e),{[n]:t.when})),{})),d=i.compose((e=>{var t;return e&&(null===(t=l[e[0]])||void 0===t?void 0:t.value)||s.length}),i.find((([e,t])=>t)),i.toPairs)(c);t.useEffect((()=>{r({type:Wi,payload:{key:Sl,value:String(d)}})}),[d]);const u=s.slice(0,d),p=Rn(),{tabIndex:f,isDisabled:y,styles:h}=m(p);return(null==u?void 0:u.length)>0?e.jsx(Aa,{styles:n.schema.styles,children:({classnames:a})=>e.jsx("div",{"data-testid":n.testId,"data-e2e":"StackedDistribution",className:null==a?void 0:a.own,"aria-hidden":y,tabIndex:f,style:Object.assign({display:"flex",flexDirection:"column"},h),children:t.Children.toArray(u.map(((t,n)=>e.jsx(gl,{config:t,position:n,visible:!0,container:"column"}))))})}):null}function Cl(n){const i=n.schema.styles,o=a.useDispatch(),r=Rn(),s="Backward"===n.schema.direction?"Previous":"Next",{tabIndex:l,styles:c,isDisabled:d}=m(r),u=()=>{o({type:"Backward"===n.schema.direction?rl.PREV_IN_PROGRESSION:rl.NEXT_IN_PROGRESSION})};return e.jsx(Aa,{styles:i,children:({classnames:a})=>{var i;return e.jsx("button",{title:s,className:null==a?void 0:a.own,onClick:u,"data-testid":n.testId,"data-e2e":"ProgressControl","data-e2e-direction":`${n.schema.direction}`,disabled:d,"aria-disabled":d,"aria-label":null!==(i=n.schema.a11yLabel)&&void 0!==i?i:s,tabIndex:l,style:Object.assign({cursor:"pointer"},c),children:e.jsx(It,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}function wl({schema:n,testId:i}){var o,r,s,l,c,u,p,f,y;const h=a.useSelector((e=>e.progression)),v=null==h?void 0:h.indexGroups[null==h?void 0:h.currentGroupIndex],g=null!==(o=null==h?void 0:h.currentGroupIndex)&&void 0!==o?o:0,b=a.useSelector((e=>e.slots)),E=a.useSelector(er),I=n.viewableItems.length-1,[S,x]=d({slidesToScroll:null!==(r=n.viewableItems[Math.min(E,I)])&&void 0!==r?r:"auto",containScroll:"trimSnaps"}),C=a.useDispatch(),w=Rn(),{tabIndex:O,isDisabled:T,styles:A}=m(w),R=`${null!==(f=null===(p=null===(u=null===(c=null===(l=null===(s=n.styles)||void 0===s?void 0:s.elements)||void 0===l?void 0:l.own[E])||void 0===c?void 0:c.default)||void 0===u?void 0:u.container)||void 0===p?void 0:p.gap)&&void 0!==f?f:"0"}px`;t.useEffect((()=>{function e(e){var t,n;const a=null!==(t=null==e?void 0:e.selectedScrollSnap())&&void 0!==t?t:0,i=null!==(n=null==e?void 0:e.previousScrollSnap())&&void 0!==n?n:0;a!==g&&(a>i?C({type:rl.NEXT_IN_PROGRESSION}):a<i&&C({type:rl.PREV_IN_PROGRESSION}))}return null!=g&&(null==x||x.on("select",e),null==x||x.scrollTo(g)),()=>{null==x||x.off("select",e)}}),[x,g,C]);const N={overflow:"hidden"},_={backfaceVisibility:"hidden",display:"flex",touchAction:"pan-y",gap:R,alignItems:"stretch"},L=e=>{var t;return null!==(t=null==v?void 0:v.includes(e))&&void 0!==t&&t},j=n.peekThroughSize[Math.min(E,n.peekThroughSize.length-1)],D=j?"Fixed"===(k=j).type?`${k.value}px`:`${k.value}%`:"0px";var k;const P=null!==(y=n.viewableItems[Math.min(I,E)])&&void 0!==y?y:1,$={flex:`0 0 calc(${(e=>"0px"!==e&&"0%"!==e)(D)?`(100% - 2 * ${D} - (${P} + 1) * ${R})/${P}`:`(100% - (${P} - 1) * ${R})/${P}`})`,position:"relative",display:"flex",overflow:"auto"};return(null==b?void 0:b.length)>0?e.jsx(Aa,{styles:n.styles,children:({classnames:n})=>e.jsx("div",{ref:S,style:Object.assign(Object.assign({},N),A),"aria-disabled":T,tabIndex:O,className:null==n?void 0:n.own,"data-e2e":"CarouselDistribution","data-testid":i&&`${i}`,children:e.jsx("div",{style:_,"data-testid":i&&`${i}-container`,"data-e2e":"CarouselDistribution-Container",children:t.Children.toArray(b.map(((t,n)=>e.jsx("div",{style:$,"data-testid":i&&`${i}-slide-${n}`,"data-e2e":`CarouselDistribution-Slide-${n}`,children:e.jsx(gl,{config:t,position:n,container:"row",visible:L(n)})}))))})})}):null}const Ol=Object.freeze([]);function Tl({schema:n,testId:i}){const o=Un(),r=t.useMemo((()=>ut(o)([{display:"flex",flexDirection:"column"}])),[o]),s=a.useSelector((e=>{var t;return(null===(t=e.progression)||void 0===t?void 0:t.groupSize)||0})),l=a.useSelector((e=>{var t;return(null===(t=e.progression)||void 0===t?void 0:t.indexGroups)||Ol})),c=a.useSelector((e=>e.slots||Ol)),d=t.useMemo((()=>l.map((e=>e.map((e=>c[e])).filter((e=>null!=e))))),[l,c]),u=t.useRef(null),p=a.useSelector((e=>{var t,n;return null!==(n=null===(t=e.progression)||void 0===t?void 0:t.currentGroupIndex)&&void 0!==n?n:0})),f=Rn(),{tabIndex:y,isDisabled:h,styles:v}=m(f);return d.length?e.jsx(Aa,{styles:n.styles,children:({classnames:a})=>e.jsx("div",{ref:u,"data-testid":i,"data-e2e":"GroupedDistribution","aria-disabled":h,tabIndex:y,style:Object.assign({position:"relative",transition:`height ${n.transition.settings.duration/2}ms ease-in-out`,overflow:"hidden",boxSizing:"content-box"},v),children:t.Children.toArray(d.map(((o,l)=>e.jsx(Di,{effect:n.transition,visible:l===p,parentElement:u.current,containerClassName:[r,null==a?void 0:a.own].filter(Boolean).join(" ")||void 0,children:t.Children.toArray(o.map(((t,n)=>{const a=s*l+n;return e.jsx(gl,{config:t,position:a,visible:l===p,container:"column",testId:i?`${i}-child${a}`:void 0})})))}))))})}):null}const Al={action:{CaptureOnly:"CaptureOnly",Url:"Url",Fulfillment:"Fulfillment",ExternalPaymentTrigger:"ExternalPaymentTrigger"},urlBehavior:{newTab:"newTab",roktWebViewSDK:"roktWebViewSDK",self:"self"},signalType:{SignalResponse:"SignalResponse",SignalGatedResponse:"SignalGatedResponse",SignalSecondaryResponse:"SignalSecondaryResponse"},conversionType:{Default:"Default",RealTime:"RealTime",RealTimeReferral:"RealTimeReferral"}};function Rl(e,t,n=!1){return Error(`Could not translate ${e} with guid: ${t}${n?" for child layout":""}`)}function Nl(e,t=!1){var n;try{if(e.responseOptionsMap||t)return Object.assign(Object.assign({},e),{responseOptionsMap:i.mapObjIndexed(_l,null!==(n=e.responseOptionsMap)&&void 0!==n?n:{})});{const t=`Creative: ${e.instanceGuid}, did not receive a valid response options map.`;throw new _("NO_CREATIVE_RESPONSE_OPTIONS_MAP",t)}}catch(n){throw n.message?n:Rl("Creative",e.instanceGuid,t)}}function _l(e){try{let t,n;if(e.urlBehavior&&(t=Al.urlBehavior[e.urlBehavior]),e.conversionType&&(n=Al.conversionType[e.conversionType]),"External"===e.action){const t=`Creative response with instanceGuid '${e.instanceGuid}' uses legacy action type 'External'. This should be 'ExternalPaymentTrigger'.`;throw new _("LEGACY_EXTERNAL_ACTION_TYPE",t)}return Object.assign(Object.assign({},e),{urlBehavior:t,action:Al.action[e.action],signalType:Al.signalType[e.signalType],conversionType:n})}catch(t){throw t.message?t:Rl("CreativeResponse",e.instanceGuid)}}function Ll(e,t,n){try{return JSON.parse(e)}catch(e){throw Error(`Parse JSON failed, invalid JSON file for ${t} with guid ${n}.`)}}function jl(){t.useEffect((()=>{const e=new ResizeObserver(function(e=100){let t;return()=>{t&&clearTimeout(t),t=setTimeout((()=>{var e,n;null===(n=null===(e=window.frameElement)||void 0===e?void 0:e.iFrameResizer)||void 0===n||n.resize(),t=void 0}),e)}}());return e.observe(document.body),()=>{e.disconnect()}}),[])}const Dl={OneByOneDistribution:function(t){if("OneByOneDistribution"===t.type)return e.jsx(bl,{schema:t.node})},StackedDistribution:function(t){if("StackedDistribution"===t.type)return e.jsx(xl,{schema:t.node})},ProgressIndicator:function(t){if("ProgressIndicator"===t.type)return e.jsx(El,{schema:t.node})},ProgressControl:function(t){if("ProgressControl"===t.type)return e.jsx(Cl,{schema:t.node})},Overlay:function(t){if("Overlay"===t.type)return e.jsx(fo,{schema:t.node})},CloseButton:function(t){if("CloseButton"===t.type)return e.jsx(ro,{schema:t.node})},EscapeHatch:(kl=[function(t,n){if(v("CloseButton",t)){const n=JSON.parse(t.node.data);return e.jsx(ro,{schema:n.node,action:n.action})}},hi],e=>kl.reduce(((t,n)=>void 0===t?n(e):t),void 0)),CarouselDistribution:function(t){if("CarouselDistribution"===t.type)return e.jsx(wl,{schema:t.node})},GroupedDistribution:function(t){if("GroupedDistribution"===t.type)return e.jsx(Tl,{schema:t.node})},BottomSheet:function(t){if("BottomSheet"===t.type)return e.jsx(vo,{schema:t.node})}};var kl;function Pl(e,t){e({type:Z,payload:{name:"SignalActivation",parentGuid:t}})}function $l({pageInstanceGuid:n}){var o,r,s,l,c,d;const u=a.useSelector((e=>e.layout),i.equals),p=a.useDispatch(),f=a.useSelector((e=>({breakpoint:e.breakpoint,progression:hl(e),customStates:e.customStates.root,domainStates:e.domainStates[dl]})),i.equals),y=a.useSelector((e=>e.slots.length)),h=a.useSelector((e=>{var t;const n=Number(null!==(t=e.serializableCache.get(Sl))&&void 0!==t?t:"");return y-n})),m=a.useSelector(vl);de(wt(),p),t.useEffect((()=>(u&&document.body.addEventListener("click",Pl.bind(null,p,u.instanceGuid),{once:!0}),()=>{u&&document.body.removeEventListener("click",Pl.bind(null,p,u.instanceGuid))})),[null==u?void 0:u.instanceGuid]),jl(),t.useEffect((()=>{if(u){const e={type:Z,payload:{name:"SignalImpression",parentGuid:u.instanceGuid}},t={type:eo,payload:{code:"LAYOUT_IMPRESSED"}};p(e),p(t)}}),[u]);const v=e=>{p({type:sl.REPORT_ERROR,payload:e})},g=a.useSelector((e=>e.breakpoint.initialised));if(u&&g){const t=zt({})({state:{progression:(null!==(r=null===(o=f.progression)||void 0===o?void 0:o.activeGroupIndex)&&void 0!==r?r:0)+1,maxProgression:null!==(l=null===(s=f.progression)||void 0===s?void 0:s.totalGroups)&&void 0!==l?l:1,availableOffersCount:null!==(d=null===(c=f.progression)||void 0===c?void 0:c.totalGroups)&&void 0!==d?d:y,selectedCatalogItemQuantity:m,hiddenItemCount:h}}),a=Oi(v);return e.jsx($n,{info:{layoutType:"OuterLayout",pageInstanceGuid:n},children:e.jsx(Jt,{value:t,children:e.jsx(xt,{value:a,overrides:Dl,children:e.jsx(gt.Provider,{value:f,children:e.jsx(mt.Provider,{value:p,children:e.jsx(Qt.Provider,{value:"OUTER",children:e.jsx(Vn.Provider,{value:u.layoutSchemaVersion,children:e.jsx(It,{children:e=>e(u.layoutSchema)})})})})})})})})}return null}var Fl=Object.freeze({__proto__:null,getDistribution:function e(t){var n;switch(t.type){case"OneByOneDistribution":case"StackedDistribution":case"CarouselDistribution":case"GroupedDistribution":return t;case"Row":case"Column":case"When":case"ZStack":case"FlowRow":case"InlineContainer":case"ScrollableRow":case"ScrollableColumn":case"BottomSheet":case"Overlay":for(const n of t.node.children){const t=e(n);if(t)return t}break;case"EscapeHatch":try{const{name:a,body:i}=JSON.parse(t.node.data);if(("loading-extension"===a||"minimized-bottomsheet-extension"===a)&&(null===(n=null==i?void 0:i.children)||void 0===n?void 0:n.length))for(const t of i.children){const n=e(t);if(n)return n}break}catch(e){break}case"StaticImage":case"DataImage":case"RichText":case"BasicText":case"ProgressIndicator":case"CreativeResponse":case"StaticLink":case"CloseButton":case"ProgressControl":case"StaticIcon":case"DataIcon":case"SlideStateTrigger":case"ToggleButtonStateTrigger":case"TimerStateTrigger":case"CatalogStackedCollection":case"CatalogResponseButton":case"CatalogQuantityOption":case"CatalogRadioGroup":case"CatalogQuantityCounter":case"PartnerEventButtonTrigger":case"CopyToClipboardButton":case"ButtonStateTrigger":case"CatalogCombinedCollection":break;default:!function(e){throw Error(`Could not handle layout: ${JSON.stringify(e)}`)}(t)}},getDistributionViewableItems:function(e){switch(null==e?void 0:e.type){case"CarouselDistribution":case"GroupedDistribution":return e.node.viewableItems;default:return}}}),Gl=Object.assign({},Fl);function*Ml(e,t){const n=Gl.getDistribution(t),a=null==n?void 0:n.type,i=yield r.select(er),o=function(e=0,t){var n;switch(null==t?void 0:t.type){case"CarouselDistribution":case"GroupedDistribution":{const a=Math.min(t.node.viewableItems.length,e);return null!==(n=t.node.viewableItems[a])&&void 0!==n?n:1}default:return 1}}("number"==typeof i?i:0,n);"OneByOneDistribution"!==a&&"CarouselDistribution"!==a&&"GroupedDistribution"!==a||(yield c.put({type:rl.INITIALISE_PROGRESSION,payload:{currentGroupIndex:0,totalCount:e,groupSize:o}}))}function*Bl(e,t){var n;const{instanceGuid:a,layoutSchemaVersion:o,outerLayoutSchema:r,slots:s}=t.payload;a?yield c.put({type:Z,payload:{name:"SignalLoadComplete",parentGuid:a}}):yield c.put({type:Xi,payload:{level:So,code:Po,message:"Layout instance guid does not exist"}}),yield c.put({type:Js,payload:{modules:s.map((e=>e.layoutVariant.moduleName))}}),yield c.put({type:Mi,payload:r.breakpoints}),yield c.put({type:rl.LAYOUT_UPDATE,payload:{instanceGuid:a,layoutSchemaVersion:o,layoutSchema:r.layout,settings:r.settings}}),yield c.put({type:rl.SET_SLOTS,payload:s}),i.isNil(r.settings)||(yield c.put({type:rl.SET_SETTINGS,payload:r.settings})),yield*Ml(s.length,r.layout);const l=yield*function*(e,t,n){const a=null==t?void 0:t.enablePartnerValidation,i=["add-to-cart"],o=n.some((e=>i.some((t=>t===e.layoutVariant.moduleName))));if(a&&o)try{yield c.call(e.send,pr.PartnerValidationEvent.OPT_IN_TO_PARTNER_VALIDATION),yield c.spawn(Ul,e,pr.PartnerValidationEvent.SHOW_PARTNER_VALIDATION_STATUS,(()=>({type:"ACTIVE/ADD",payload:{id:Il}})))}catch(e){return yield c.put({type:Xi,payload:{level:Io,code:Fo,message:"Failed to establish partner validation."}}),"FAILURE"}return"OK"}(e.partner,r.settings,s);"OK"===l&&(yield c.call(jr,e.display,r.display,null===(n=r.settings)||void 0===n?void 0:n.frameControls))}function*Ul(e,t,n){const a=l.eventChannel((a=>{const i=e.onEvent(t).subscribe((e=>{a(n(e))}));return()=>{i.unsubscribe()}}));for(;;){const e=yield c.take(a);yield c.put(e)}}function Vl(e){return Rc(e)}function zl(e,t){return Error(`Migration process from v0_0 to v0_1 failed: could not transform ${e} node. For more details: ${t}`)}const Hl=i.all(i.anyPass([function(e){return"Row"===e.type&&Yl(e.node.children)},function(e){return"Column"===e.type&&Yl(e.node.children)},Xl,ec])),ql=i.all(i.anyPass([function(e){return"Row"===e.type&&Kl(e.node.children)},function(e){return"Column"===e.type&&Kl(e.node.children)},ec,Xl,function(e){return"DataImage"===e.type},function(e){return"When"===e.type&&Kl(e.node.children)}])),Wl=i.all(i.anyPass([function(e){return"Row"===e.type&&Zl(e.node.children)},function(e){return"Column"===e.type&&Zl(e.node.children)},ec,Xl])),Jl=i.all(i.anyPass([function(e){return"Row"===e.type&&Ql(e.node.children)},function(e){return"Column"===e.type&&Ql(e.node.children)},Xl,function(e){return"RichText"===e.type},ec,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&Ql(e.node.children)},function(e){return"StaticLink"===e.type&&Ql(e.node.children)},function(e){return"StackedDistribution"===e.type},function(e){return"CloseButton"===e.type&&Ql(e.node.children)}]));function Yl(e){return Hl(e)}function Kl(e){return ql(e)}function Zl(e){return Wl(e)}function Ql(e){return Jl(e)}function Xl(e){return"StaticImage"===e.type}function ec(e){return"BasicText"===e.type}const tc=i.lensPath(["styles","elements","link"]),nc=i.lensPath(["styles","elements","activeIndicator"]),ac=i.lensPath(["styles","elements","indicator"]),ic=i.lensPath(["styles","elements","seenIndicator"]),oc=i.lensPath(["focussed"]),rc=i.lensPath(["hovered"]),sc=i.lensPath(["default"]),lc=i.lensPath(["pressed"]),cc=e=>{var t;return{text:null!==(t=null==e?void 0:e.text)&&void 0!==t?t:{}}},dc=i.when(i.hasPath(["styles","elements","link"]),i.pipe(i.over(tc,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default})))),i.over(tc,i.map(i.when(i.has("focussed"),i.over(oc,cc)))),i.over(tc,i.map(i.when(i.has("hovered"),i.over(rc,cc)))),i.over(tc,i.map(i.when(i.has("default"),i.over(sc,cc)))),i.over(tc,i.map(i.when(i.has("pressed"),i.over(lc,cc)))))),uc=i.pipe(i.when(i.hasPath(["styles","elements","activeIndicator"]),i.over(nc,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","indicator"]),i.over(ac,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","seenIndicator"]),i.over(ic,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))));function pc(e,t){return e?{elements:{own:e.elements.own.map(t)}}:void 0}const fc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),yc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),hc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),mc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),vc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),gc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),bc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),Ec=e=>{switch(e){case"is":return"is";case"is not":return"is-not";case"is below":return"is-below";case"is above":return"is-above";default:throw zl("When",`Invalid condition: ${e}`)}},Ic=e=>{switch(e){case"breakpoint":return"Breakpoint";case"progression":return"Progression";case"position":return"Position";default:throw zl("When",`Invalid target: ${e}`)}},Sc=e=>{const{target:t,condition:n,value:a}=e;return{type:Ic(t),predicate:{condition:Ec(n),value:a}}};function xc(e){const t={type:"FadeInOut",settings:{duration:e.transition.settings.duration}};return{styles:e.style,transition:t}}function Cc(e){const t=e.children.map((e=>Rc(e)));if(Yl(t))return Object.assign(Object.assign({},e),{children:t,styles:pc(e.styles,vc)});throw zl("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function wc(e){const t=e.children.map((e=>Rc(e)));if(Kl(t))return Object.assign(Object.assign({},e),{children:t,styles:pc(e.styles,gc)});throw zl("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function Oc(e){const t=e.children.map((e=>Rc(e)));if(Zl(t))return Object.assign(Object.assign({},e),{children:t,styles:pc(e.styles,bc)});throw zl("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}const Tc=e=>({own:e.overlayContainer,wrapper:e.overlayWrapper});function Ac(e){var t,n;const a=(null===(t=e.styles)||void 0===t?void 0:t.elements)?{elements:Tc(null===(n=e.styles)||void 0===n?void 0:n.elements)}:void 0,i=e.children.map((e=>Rc(e)));if(Ql(i))return Object.assign(Object.assign({},e),{styles:a,children:i});throw zl("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function Rc(e){switch(e.type){case"When":return{type:"When",node:(s=e.node,{predicates:s.predicates.map(Sc),children:s.children.map((e=>Rc(e)))})};case"OneByOneDistribution":return{type:e.type,node:xc(e.node)};case"Overlay":return{type:e.type,node:Ac(e.node)};case"Column":return{type:e.type,node:(r=e.node,{styles:pc(r.styles,fc),children:r.children.map((e=>Rc(e)))})};case"Row":return{type:e.type,node:(o=e.node,{styles:pc(o.styles,yc),children:o.children.map((e=>Rc(e)))})};case"RichText":return{type:e.type,node:(i=e.node,dc(i))};case"CloseButton":return{type:e.type,node:Cc(e.node)};case"CreativeResponse":return{type:e.type,node:wc(e.node)};case"StaticLink":return{type:e.type,node:Oc(e.node)};case"StaticImage":return{type:e.type,node:(a=e.node,Object.assign(Object.assign({},a),{styles:pc(a.styles,hc)}))};case"DataImage":return{type:e.type,node:(n=e.node,Object.assign(Object.assign({},n),{styles:pc(n.styles,mc)}))};case"ProgressIndicator":return{type:e.type,node:(t=e.node,uc(t))};default:return e}var t,n,a,i,o,r,s}function Nc(e){return Pd(e)}function _c(e,t){return Error(`Migration process from v0_23 to v1_0 failed: could not transform ${e} node. For more details: ${t}`)}const Lc=e=>"scroll"===e||"auto"===e?"visible":e,jc=i.lensPath(["elements","own"]),Dc=i.lensPath(["transitions","transition","value","own"]),kc=i.lensPath(["elements","wrapper"]),Pc=i.lensPath(["transitions","transition","value","wrapper"]),$c=i.lensPath(["elements","indicator"]),Fc=i.lensPath(["transitions","transition","value","indicator"]),Gc=i.lensPath(["elements","activeIndicator"]),Mc=i.lensPath(["transitions","transition","value","activeIndicator"]),Bc=i.lensPath(["elements","seenIndicator"]),Uc=i.lensPath(["transitions","transition","value","seenIndicator"]),Vc=i.lensPath(["default","container","overflow"]),zc=i.lensPath(["pressed","container","overflow"]),Hc=i.lensPath(["hovered","container","overflow"]),qc=i.lensPath(["focussed","container","overflow"]),Wc=i.lensPath(["disabled","container","overflow"]),Jc=i.lensPath(["container","overflow"]),Yc=i.pipe(i.when(i.hasPath(["default","container","overflow"]),i.over(Vc,Lc)),i.when(i.hasPath(["pressed","container","overflow"]),i.over(zc,Lc)),i.when(i.hasPath(["hovered","container","overflow"]),i.over(Hc,Lc)),i.when(i.hasPath(["focussed","container","overflow"]),i.over(qc,Lc)),i.when(i.hasPath(["disabled","container","overflow"]),i.over(Wc,Lc))),Kc=i.when(i.hasPath(["container","overflow"]),i.over(Jc,Lc)),Zc=i.pipe(i.when(i.hasPath(["elements","own"]),i.over(jc,i.map(Yc))),i.when(i.hasPath(["transitions","transition","value","own"]),i.over(Dc,Kc))),Qc=i.when(i.has("transitions"),(e=>{var t;return i.compose(i.omit(["transitions"]),i.assoc("conditionalTransitions",null===(t=e.transitions)||void 0===t?void 0:t.transition))(e)})),Xc=i.pipe(Zc,Qc),ed=i.pipe(i.when(i.hasPath(["elements","wrapper"]),i.over(kc,i.map(Yc))),i.when(i.hasPath(["transitions","transition","value","wrapper"]),i.over(Pc,Kc))),td=i.pipe(i.when(i.hasPath(["elements","indicator"]),i.over($c,i.map(Yc))),i.when(i.hasPath(["transitions","transition","value","indicator"]),i.over(Fc,Kc))),nd=i.pipe(i.when(i.hasPath(["elements","activeIndicator"]),i.over(Gc,i.map(Yc))),i.when(i.hasPath(["transitions","transition","value","activeIndicator"]),i.over(Mc,Kc))),ad=i.pipe(i.when(i.hasPath(["elements","seenIndicator"]),i.over(Bc,i.map(Yc))),i.when(i.hasPath(["transitions","transition","value","seenIndicator"]),i.over(Uc,Kc)));function id(e){return"StaticImage"===e.type}function od(e){return"StaticIcon"===e.type}function rd(e){return"BasicText"===e.type}function sd(e){return"DataImage"===e.type}function ld(e){return"DataIcon"===e.type}function cd(e){return"RichText"===e.type}function dd(e){return"SlideStateTrigger"===e.type}function ud(e){return"ToggleButtonStateTrigger"===e.type}const pd=i.all(i.anyPass([function(e){return"Row"===e.type&&fd(e.node.children)},function(e){return"Column"===e.type&&fd(e.node.children)},id,od,cd,rd,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&fd(e.node.children)},function(e){return"StaticLink"===e.type&&fd(e.node.children)},function(e){return"StackedDistribution"===e.type},function(e){return"CarouselDistribution"===e.type},function(e){return"GroupedDistribution"===e.type},function(e){return"CloseButton"===e.type&&fd(e.node.children)},function(e){return"ProgressControl"===e.type&&xd(e.node.children)},function(e){return"ZStack"===e.type&&fd(e.node.children)},function(e){return"FlowRow"===e.type&&fd(e.node.children)},dd,ud]));function fd(e){return pd(e)}const yd=i.pipe(Zc,ed,Qc);function hd(e){const t=e.children.map((e=>Pd(e)));if(fd(t))return Object.assign(Object.assign({},i.omit(["settings"],e)),{children:t,allowBackdropToClose:e.settings.allowBackdropToClose,styles:e.styles?yd(e.styles):void 0});throw _c("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function md(e){const t=e.children.map((e=>Pd(e)));if(xd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Xc(e.styles):void 0});throw _c("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function vd(e){const t=e.children.map((e=>Pd(e)));if(wd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Xc(e.styles):void 0});throw _c("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function gd(e){const t=e.children.map((e=>Pd(e)));if(xd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Xc(e.styles):void 0});throw _c("ProgressControl",`Invalid schema: ${JSON.stringify(e)}`)}const bd=i.pipe(Zc,td,nd,ad,Qc);const Ed=i.all(i.anyPass([rd,id,od,sd,ld,function(e){return"Row"===e.type&&Id(e.node.children)},function(e){return"FlowRow"===e.type&&Id(e.node.children)},function(e){return"Column"===e.type&&Id(e.node.children)},function(e){return"ZStack"===e.type&&Id(e.node.children)},function(e){return"When"===e.type&&Id(e.node.children)}]));function Id(e){return Ed(e)}const Sd=i.all(i.anyPass([rd,id,od,function(e){return"Row"===e.type&&xd(e.node.children)},function(e){return"FlowRow"===e.type&&xd(e.node.children)},function(e){return"Column"===e.type&&xd(e.node.children)},function(e){return"ZStack"===e.type&&xd(e.node.children)},function(e){return"When"===e.type&&xd(e.node.children)}]));function xd(e){return Sd(e)}const Cd=i.all(i.anyPass([rd,id,od,sd,ld,function(e){return"Row"===e.type&&wd(e.node.children)},function(e){return"FlowRow"===e.type&&wd(e.node.children)},function(e){return"Column"===e.type&&wd(e.node.children)},function(e){return"ZStack"===e.type&&wd(e.node.children)},function(e){return"When"===e.type&&wd(e.node.children)}]));function wd(e){return Cd(e)}function Od(e){const t=e.children.map((e=>Pd(e)));if(Id(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Xc(e.styles):void 0});throw _c("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}function Td(e){const t=e.children.map((e=>Pd(e)));if(wd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Xc(e.styles):void 0});throw _c("CatalogResponseButton",`Invalid schema: ${JSON.stringify(e)}`)}function Ad(e){return"Row"===e.type&&_d(e.node.children)}function Rd(e){return"Column"===e.type&&_d(e.node.children)}const Nd=i.all(i.anyPass([rd,id,od,sd,ld,cd,function(e){return"StaticLink"===e.type},dd,ud,function(e){return"CatalogResponseButton"===e.type},Ad,function(e){return"FlowRow"===e.type&&_d(e.node.children)},Rd,function(e){return"ZStack"===e.type&&_d(e.node.children)},function(e){return"When"===e.type&&_d(e.node.children)}]));function _d(e){return Nd(e)}const Ld=i.anyPass([Ad,Rd]);function jd(e){const t=Pd(e.template);if(function(e){return Ld(e)}(t))return Object.assign(Object.assign({},e),{template:t,styles:e.styles?Xc(e.styles):void 0});throw _c("CatalogStackedCollection",`Invalid schema: ${JSON.stringify(e)}`)}function Dd(e){const t=e.children.map((e=>Pd(e)));if(Id(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Xc(e.styles):void 0});throw _c("ToggleButtonStateTrigger",`Invalid schema: ${JSON.stringify(e)}`)}function kd(e){const t=e.transition?{inTransition:e.transition.in,outTransition:e.transition.out}:void 0;return Object.assign(Object.assign({},e),{children:e.children.map((e=>Pd(e))),transition:t})}function Pd(e){switch(e.type){case"Row":return{type:e.type,node:(g=e.node,Object.assign(Object.assign({},g),{children:g.children.map((e=>Pd(e))),styles:g.styles?Xc(g.styles):void 0}))};case"When":return{type:e.type,node:kd(e.node)};case"FlowRow":return{type:e.type,node:(v=e.node,Object.assign(Object.assign({},v),{styles:v.styles?Xc(v.styles):void 0,children:v.children.map((e=>Pd(e)))}))};case"Column":return{type:e.type,node:(m=e.node,Object.assign(Object.assign({},m),{children:m.children.map((e=>Pd(e))),styles:m.styles?Xc(m.styles):void 0}))};case"ZStack":return{type:e.type,node:(h=e.node,Object.assign(Object.assign({},h),{styles:h.styles?Xc(h.styles):void 0,children:h.children.map((e=>Pd(e)))}))};case"Overlay":return{type:e.type,node:hd(e.node)};case"ProgressControl":return{type:e.type,node:gd(e.node)};case"CarouselDistribution":return{type:"CarouselDistribution",node:(y=e.node,Object.assign(Object.assign({},i.omit(["settings"],y)),{viewableItems:y.settings.viewableItems,peekThroughSize:y.settings.peekThroughSize,styles:y.styles?Xc(y.styles):void 0}))};case"CloseButton":return{type:"CloseButton",node:md(e.node)};case"CreativeResponse":return{type:"CreativeResponse",node:vd(e.node)};case"GroupedDistribution":return{type:"GroupedDistribution",node:(f=e.node,Object.assign(Object.assign({},i.omit(["settings"],f)),{viewableItems:f.settings.viewableItems,transition:f.settings.transition,styles:f.styles?Xc(f.styles):void 0}))};case"OneByOneDistribution":return{type:"OneByOneDistribution",node:(p=e.node,Object.assign(Object.assign({},p),{styles:p.styles?Xc(p.styles):void 0}))};case"ProgressIndicator":return{type:"ProgressIndicator",node:(d=e.node,Object.assign(Object.assign({},i.omit(["settings"],d)),{startPosition:null===(u=d.settings)||void 0===u?void 0:u.startPosition,styles:d.styles?bd(d.styles):void 0}))};case"SlideStateTrigger":return{type:"SlideStateTrigger",node:(c=e.node,Object.assign(Object.assign({},c),{styles:c.styles?Xc(c.styles):void 0}))};case"StackedDistribution":return{type:"StackedDistribution",node:(l=e.node,Object.assign(Object.assign({viewableItems:[]},l),{styles:l.styles?Xc(l.styles):void 0}))};case"StaticLink":return{type:"StaticLink",node:Od(e.node)};case"ToggleButtonStateTrigger":return{type:"ToggleButtonStateTrigger",node:Dd(e.node)};case"CatalogResponseButton":return{type:"CatalogResponseButton",node:Td(e.node)};case"CatalogStackedCollection":return{type:"CatalogStackedCollection",node:jd(e.node)};case"RichText":return{type:"RichText",node:(s=e.node,Object.assign(Object.assign({},s),{styles:s.styles?Qc(s.styles):void 0}))};case"DataImage":return{type:"DataImage",node:(r=e.node,Object.assign(Object.assign({},r),{styles:r.styles?Qc(r.styles):void 0}))};case"StaticImage":return{type:"StaticImage",node:(o=e.node,Object.assign(Object.assign({},o),{styles:o.styles?Qc(o.styles):void 0}))};case"DataIcon":return{type:"DataIcon",node:(a=e.node,Object.assign(Object.assign({},a),{styles:a.styles?Qc(a.styles):void 0}))};case"StaticIcon":return{type:"StaticIcon",node:(n=e.node,Object.assign(Object.assign({},n),{styles:n.styles?Qc(n.styles):void 0}))};case"BasicText":return{type:"BasicText",node:(t=e.node,Object.assign(Object.assign({},t),{styles:t.styles?Qc(t.styles):void 0}))};default:return e}var t,n,a,o,r,s,l,c,d,u,p,f,y,h,m,v,g}function $d(e){const t=e.split("."),n=Number(t[0]),a=Number(t[1]);if(t.length<2||Number.isNaN(n)||Number.isNaN(a))throw Error(`Fail to convert version ${e} to a valid version.`);return{major:n,minor:a}}function Fd(e,t){return e.major===t.major&&e.minor===t.minor}const Gd=(e,t,n)=>i.allPass([i.lte(e),i.gte(t)])(n);function Md(e,t){return Fd(t,{major:0,minor:0})?Md(Vl(e),{major:0,minor:1}):function(e,t){return 0===t.major&&Gd(1,23,t.minor)}(0,t)?Md(Nc(e),{major:1,minor:0}):e}function Bd(e,t){return Fd(t,{major:0,minor:0})?Bd(function(e){return Object.assign(Object.assign({},e),{layout:Vl(e.layout)})}(e),{major:0,minor:1}):function(e,t){return 0===t.major&&Gd(1,23,t.minor)}(0,t)?Bd(function(e){return Object.assign(Object.assign({},e),{layout:Nc(e.layout)})}(e),{major:1,minor:0}):e}function Ud(e,t,n,a){const i=$d(n);if(a){const s=$d(a);if(r=i,(o=s).major<r.major||o.major===r.major&&o.minor<r.minor||Fd(s,i))return t(e,s);throw Error(`Could not migrate received layout config, config schema version ${a} is higher than the supported version ${n}.`)}return t(e,$d("0.0"));var o,r}function Vd(e){var t;try{return Object.assign(Object.assign({},i.clone(e)),{offer:Object.assign(Object.assign({},i.clone(e.offer)),{creative:Nl(e.offer.creative)}),layoutVariant:Object.assign(Object.assign({},i.clone(e.layoutVariant)),{layoutVariantSchema:"string"==typeof e.layoutVariant.layoutVariantSchema?Ll(e.layoutVariant.layoutVariantSchema,"LayoutSlotLayoutVariant",e.instanceGuid):e.layoutVariant.layoutVariantSchema,childLayouts:i.map(zd,null!==(t=e.layoutVariant.childLayouts)&&void 0!==t?t:[])})})}catch(t){throw t.message?t:Rl("Slot",e.instanceGuid)}}function zd(e){return Object.assign(Object.assign({},i.clone(e)),{childLayoutSchema:"string"==typeof e.childLayoutSchema?Ll(e.childLayoutSchema,"ChildLayoutRootSchema",e.childLayoutId):e.childLayoutSchema})}function Hd(e){if(e){const t=function(e){try{return Object.assign(Object.assign({},i.clone(e)),{outerLayoutSchema:"string"==typeof e.outerLayoutSchema?Ll(e.outerLayoutSchema,"LayoutRootLayoutSchema",e.instanceGuid):e.outerLayoutSchema,slots:i.map(Vd,e.slots)})}catch(t){throw t.message?t:Rl("LayoutConfig",e.instanceGuid)}}(e);return function(e,t){const{layoutSchemaVersion:n}=e,a=i.lensPath(["outerLayoutSchema"]),o=i.lensPath(["slots"]),r=i.lensPath(["layoutVariant","layoutVariantSchema"]);return i.pipe(i.over(o,i.map(i.over(r,(e=>Ud(e,Md,t,n))))),i.over(a,(e=>Ud(e,Bd,t,n))))(e)}(t,wo.DCUI_SCHEMA_VERSION)}}const qd=i.cond([[i.where({signalType:i.equals("SignalSecondaryResponse")}),function*(e,t){return yield r.put({type:Xi,payload:{level:xo,code:Do,message:"DCUI does not support SignalSecondaryResponse creative response signal type.",additionalInformation:{instanceGuid:e.instanceGuid}}}),e.isPositive?"ERROR":"EXPLICIT_DISMISSAL"}],[i.where({isPositive:i.equals(!0)}),function*(e,t,n){var a;if("url"in e&&e.url){const i=e.instanceGuid;yield r.put({type:Z,payload:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:i,responseActionPayload:{name:"Url",transformedTrafficURL:e.url,creativeInstanceGuid:e.creativeInstanceGuid}}});const o=t.getOverrideLinkNavigation()?"overrideLinkNavigation":null!==(a=e.urlBehavior)&&void 0!==a?a:"newTab",s=yield*function*(e,t,n){try{const a=yield r.call(gr,t),i=Sr(a)?a.ref:void 0;return yield r.call(e.addAdvertiserWindowRef,i,n),Sr(a)||"newTab"!==t.urlBehavior?"SUCCESS":(yield r.put({type:Xi,payload:{level:xo,code:ko,message:`Did not receive a window reference opening link ${t.url}`}}),"UNSPECIFIED")}catch(e){return yield r.put({type:Xi,payload:{level:xo,code:ko,message:`Errored attempting to open link ${t.url}: ${e.message}`,stack:e.stack}}),"ERROR"}}(t,{url:e.url,urlBehavior:o,external:{partner:n}},i);return"self"===o?"END":s}return yield r.put({type:Xi,payload:{level:xo,code:Do,message:"URL response doesn't have a valid url",additionalInformation:{instanceGuid:e.instanceGuid}}}),"ERROR"}],[i.T,function*(){return"EXPLICIT_DISMISSAL"}]]);function*Wd(e){return yield r.put({type:Xi,payload:{level:xo,code:Do,message:"DCUI does not support SignalSecondaryResponse creative response signal type.",additionalInformation:{instanceGuid:e.instanceGuid}}}),e.isPositive?"ERROR":"EXPLICIT_DISMISSAL"}function*Jd(e,t){let n="IMPLICIT_DISMISSAL";const a=t.payload.offerPositionIndex,i=W(t.payload)||J(t.payload)||q(t.payload)?t.payload:t.payload.responseOption;switch(i.action){case"Url":yield r.put({type:ee,payload:{name:"OFFER_ENGAGEMENT"}}),i.isPositive&&(yield r.put({type:eo,payload:{code:"CREATIVE_RESPONSE",message:"creative positive response",data:{type:i.action,isPositive:i.isPositive,responseInstanceGuid:i.instanceGuid}}}),yield r.put({type:ee,payload:{name:"POSITIVE_ENGAGEMENT"}})),n="SignalSecondaryResponse"===i.signalType?yield*Wd(i):yield*qd(i,e.context,e.partner);break;case"CaptureOnly":yield r.put({type:ee,payload:{name:"OFFER_ENGAGEMENT"}}),i.isPositive&&(yield r.put({type:ee,payload:{name:"POSITIVE_ENGAGEMENT"}})),n="SignalSecondaryResponse"===i.signalType?yield*Wd(i):yield*function*(e){return yield r.put({type:Z,payload:{name:"SignalGatedResponse"===e.signalType?"SignalGatedResponse":"SignalResponse",parentGuid:e.instanceGuid,responseActionPayload:{name:"CaptureOnly",creativeInstanceGuid:e.creativeInstanceGuid}}}),e.isPositive?"SUCCESS":"EXPLICIT_DISMISSAL"}(i);break;case"Fulfillment":yield r.put({type:Xi,payload:{level:xo,code:"INCORRECTLY_HANDLE_FULFILLMENT_ACTION",message:`Fulfillment action is incorrectly handled by the orchestrator instead of a module with the option ID: ${i.instanceGuid}`}}),n="ERROR";break;case"ExternalPaymentTrigger":yield r.put({type:Xi,payload:{level:xo,code:"INCORRECTLY_HANDLE_EXTERNAL_ACTION",message:`External action was dispatched as an engagement erroneously. Instance GUID: ${i.instanceGuid}`}}),n="ERROR"}Y(t.payload)||(yield r.put(function(e,t){switch(e){case"SUCCESS":return{type:nl,payload:{event:"Completed",completionReason:"Success",offerPositionIndex:t}};case"UNSPECIFIED":return{type:nl,payload:{event:"Completed",completionReason:"Unspecified",offerPositionIndex:t}};case"ERROR":return{type:nl,payload:{event:"Completed",completionReason:"Error",offerPositionIndex:t}};case"EXPLICIT_DISMISSAL":return{type:nl,payload:{event:"Dismissed",dismissalReason:"Explicit",offerPositionIndex:t}};case"IMPLICIT_DISMISSAL":return{type:nl,payload:{event:"Dismissed",dismissalReason:"Implicit",offerPositionIndex:t}};default:return{type:Xs,payload:{offerProcessStatus:"END"}}}}(n,a)))}function Yd(e,t,n,a){return l.eventChannel((i=>(a().then((e=>Promise.all([t.getRoktPageInstanceGuid(),(t.getUId||t.getPluginInstanceId)()]).then((([t,n])=>Object.assign(Object.assign({},e),{pageInstanceGuid:t,pluginInstanceId:n}))).catch((()=>e)))).then((({moduleConnectorBuilder:t,pageInstanceGuid:a,pluginInstanceId:o})=>{const r=`rokt-${n}-${o}`.toLowerCase();if(!customElements.get(r)){const o=t.withGatewayFactory(e).withLogger((e=>{i({type:Xi,payload:{level:e.level,code:e.code,message:e.message,additionalInformation:Object.assign(Object.assign({},e.additionalInformation),{moduleName:n,layoutType:"LayoutVariant",pageInstanceGuid:null!=a?a:"N/A"})}})})).build();customElements.define(r,o)}})).catch((e=>{const t=e&&"object"==typeof e&&"message"in e?e.message:void 0,a=e&&"object"==typeof e&&"stack"in e?e.stack:void 0;i({type:Xi,payload:{level:R,code:"FAILED_TO_LOAD_MODULE",message:t,additionalInformation:{stack:a,reason:t?void 0:e,moduleName:n}}}),i(l.END)})),()=>{})))}const Kd={"standard-marketing":()=>Promise.resolve().then((function(){return ep})),"add-to-cart":()=>Promise.resolve().then((function(){return af})),"instant-purchase":()=>Promise.resolve().then((function(){return sy})),"layouts-xp-sandbox":()=>Promise.resolve().then((function(){return Gy}))};function*Zd(e,t,n){let a=yield r.select((e=>e.module.loadedModules));for(const i of n.payload.modules)a&&!(null==a?void 0:a.includes(i))&&(a=[...a,i],yield r.fork(Qd,e,t,i))}function*Qd(e,t,n){if(n in Kd){yield r.put({type:Ws,payload:n});const a=yield r.call(Yd,e,t,n,Kd[n]);yield r.call(Lo,a)}else yield r.put({type:Xi,payload:{level:Io,code:"INVALID_MODULE_NAME",message:`Could not load unknown module ${n}`}})}function*Xd(e){const t=yield r.select((e=>Gl.getDistributionViewableItems(e.layout?Gl.getDistribution(e.layout.layoutSchema):void 0))),n=yield r.select((n=>{var a;const i=Xo(e.payload.activeBreakpoint)(n);return i>=0&&t?null!==(a=t[Math.min(t.length-1,i)])&&void 0!==a?a:1:void 0}));if("number"==typeof n){const e={type:Qs,payload:{groupSize:n}};yield r.put(e)}}const eu=i.cond([[(e,t,n,a)=>"END"===e.offerProcessStatus,i.always({type:zi})],[(e,t,n,a)=>t.isLastOffer&&n,i.always({type:zi})],[(e,t,n,a)=>1===a&&!t.isLastOffer,i.always({type:Ks})],[i.T,i.always(void 0)]]);function*tu(e){const t=yield r.select((e=>({exists:null!==e.progression,isLastOffer:yl(e)}))),n=yield r.select((e=>{var t;return null===(t=e.progression)||void 0===t?void 0:t.groupSize}));var a;null!=(a=t)&&a instanceof Object&&"exists"in a&&"isLastOffer"in a&&t.exists&&(yield*function*(e,t,n){const a=yield r.select((e=>e.settings.closeOnComplete)),i=eu(e,t,"boolean"==typeof a&&a,n);i&&(i.type===zi&&(yield r.put({type:ee,payload:{name:"PLACEMENT_COMPLETED"}})),yield r.put(i))}(e.payload,t,n))}function nu(e){return e.type===nl&&"Interactive"===e.payload.event}function au(e){return e.type===nl&&"Interactive"!==e.payload.event}function*iu(e){switch(e.payload.event){case"Dismissed":yield r.put({type:Xs,payload:{offerProcessStatus:"CONTINUE"}});break;case"Completed":yield r.put({type:al,payload:{key:"offerComplete",value:i.cond([[i.equals("Error"),i.always(-1)],[i.equals("Success"),i.always(1)],[i.T,i.always(2)]])(e.payload.completionReason),offerPositionIndex:e.payload.offerPositionIndex}}),yield r.put({type:Xs,payload:{offerProcessStatus:"CONTINUE"}});break;case"Interactive":yield r.put({type:V,payload:{name:"Interactive",offerPositionIndex:e.payload.offerPositionIndex}}),yield r.put({type:ee,payload:{name:"PLACEMENT_INTERACTIVE"}})}}function*ou(e,t){var n;try{const n=yield r.select((e=>{var t,n,a;return null!==(a=null===(n=null===(t=e.layout)||void 0===t?void 0:t.settings)||void 0===n?void 0:n.enablePartnerValidation)&&void 0!==a&&a}));n&&(yield r.call(e.partner.send,pr.PartnerValidationEvent.SET_PARTNER_VALIDATION_STATUS,{errors:t.payload.errors}))}catch(a){const i=yield r.select((({slots:e})=>{var n,a;return"number"==typeof t.payload.offerPositionIndex?null!==(a=null===(n=e.at(t.payload.offerPositionIndex))||void 0===n?void 0:n.layoutVariant.moduleName)&&void 0!==a?a:"Unknown":"orchestrator"})),o=null!==(n=yield r.call(e.context.getRoktPageInstanceGuid))&&void 0!==n?n:"N/A",s={type:Xi,payload:{level:N,code:"PARTNER_VALIDATION_UPDATE_FAILED",message:"Failed to update the partner with error status",additionalInformation:{moduleName:i,layoutType:"number"==typeof t.payload.offerPositionIndex?"LayoutVariant":"OuterLayout",pageInstanceGuid:o}}};yield r.put(s)}}function*ru(e){const t=yield r.select((e=>{var t;return null===(t=e.layout)||void 0===t?void 0:t.instanceGuid}));yield r.put({type:rl.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:zi}),t?(yield r.put({type:Z,payload:{name:"SignalInstantPurchaseDismissal",parentGuid:t}}),yield r.put({type:Z,payload:{name:"SignalDismissal",parentGuid:t}})):yield r.put({type:Xi,payload:{level:So,code:Po,message:"ParentGuid does not exist"}})}function*su(e,t){yield r.all([r.takeEvery(Xi,jo.bind(null,e.errorService.raise)),r.takeLatest(Vi,Bl.bind(null,{display:e.displayService,partner:e.partnerInteractionService})),r.takeEvery(Js,Zd.bind(null,t,e.contextService)),r.takeLatest(il,Jd.bind(null,{partner:e.partnerInteractionService,context:e.contextService})),r.takeEvery(Xs,tu),r.takeEvery(au,iu),_o(nu,iu),r.takeLatest(Mi,rr.bind(null,e.displayService)),r.takeLatest(zi,Ar.bind(null,e.contextService)),r.takeLatest(tl,ru),r.takeLatest(Qi,Xr),r.takeEvery(Z,kr),r.takeEvery(ne,Pr),No(V,Zr.bind(null,e.metricsService)),No(Zi,$r.bind(null,e.rdnService)),r.takeEvery(eo,Dr.bind(null,e.errorService.raise)),r.takeLatest(Fi,Xd),r.takeEvery(X,Kr),r.takeEvery(ae,Qr.bind(null,{createChildPlugin:e.childPlugin.create,partner:e.partnerInteractionService,context:e.contextService})),r.takeLatest(ie,ou.bind(null,{partner:e.partnerInteractionService,context:e.contextService}))])}var lu,cu,du,uu,pu,fu=function(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n},yu=function(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)};const hu={[se.SET_CUSTOM_STATE]:rl.SET_CUSTOM_STATE,[se.SET_DOMAIN_STATE]:rl.SET_DOMAIN_STATE,[se.SET_GLOBAL_OFFER_DATA_CART]:rl.SET_GLOBAL_OFFER_DATA_CART,[se.OFFER_LIFECYCLE]:sl.OFFER_LIFECYCLE,[se.OFFER_ENGAGEMENT]:sl.OFFER_ENGAGEMENT,[se.SET_PARTNER_VALIDATION_STATUS]:sl.SET_PARTNER_VALIDATION_STATUS};class mu{constructor(e){lu.add(this),cu.set(this,void 0),fu(this,cu,e,"f")}getState(e){const t=yu(this,cu,"f").getState();return{breakpoint:t.breakpoint,progression:hl(t),customStates:tr(t,e.offerPositionIndex),domainStates:ml(t,e.offerPositionIndex)}}dispatch(e,t){yu(this,cu,"f").dispatch(yu(this,lu,"m",pu).call(this,e,t))}subscribe(e,t){return t(this.getState(e)),yu(this,cu,"f").subscribe((()=>{t(this.getState(e))}))}}function vu(e,t){const n=l(),a={},i=s.configureStore({reducer:pl,devTools:{name:"Orchestrator"},preloadedState:Object.assign(Object.assign({},fl()),t),middleware:e=>{return e({thunk:!1,serializableCheck:!1}).concat((t=a,e=>e=>n=>{if("object"==typeof n&&null!==n&&"type"in n){const a=n.type,i=t[`${a}`];return e(i?i(n):n)}return e(n)}),n);var t}}),o=(r=function(e){return new mu(e)}(i),c=e.childPlugin.create,d=e.partnerInteractionService.onEvent,(e,t)=>new pn(r,c,e,t,d));var r,c,d;n.run(su,e,o),n.run(Lr,e,Hd);const u={};return Object.assign(Object.assign({},i),{extend:({reducer:e,interceptors:t,sagas:o})=>{e&&(Object.assign(u,e),i.replaceReducer(s.combineReducers(Object.assign(Object.assign({},pl),u)))),t&&Object.assign(a,t),o&&n.run(o)}})}cu=new WeakMap,lu=new WeakSet,du=function(e,t,n){return{type:e,payload:Object.assign(Object.assign({},t),{offerPositionIndex:n.offerPositionIndex,creativeInstanceGuid:n.creativeInstanceGuid})}},uu=function(e,t){return t.type===ne?t.payload.signal.parentGuid||(t.payload.signal.parentGuid=e.creativeInstanceGuid):(t.payload.creativeInstanceGuid=e.creativeInstanceGuid,t.payload.parentGuid||(t.payload.parentGuid=e.creativeInstanceGuid)),t},pu=function(e,t){return function(e){return e.type in hu}(t)?yu(this,lu,"m",du).call(this,hu[t.type],t.payload,e):t.type===Z||t.type===ne?yu(this,lu,"m",uu).call(this,e,t):t};var gu=function(e,t,n,a){return new(n||(n=Promise))((function(i,o){function r(e){try{l(a.next(e))}catch(e){o(e)}}function s(e){try{l(a.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,s)}l((a=a.apply(e,t||[])).next())}))};const bu={ctx:new Map([[qs.name,qs],[Us.name,Us],[Cs.name,Cs],[js.name,js],[Vs.name,Vs]]),cache:[]};class Eu{constructor(){this._subscribers=[]}add(e){this._subscribers.push(e)}unsubscribe(){this._subscribers.forEach((e=>e.unsubscribe()))}}const Iu=()=>{},Su=(e=Iu,t=Iu,n=Iu)=>"function"!=typeof e?e:{next:e,error:t,complete:n};class xu{constructor(e){this._setupFn=e}subscribe(e,t,n){const a=Su(e,t,n);let i,o=!0;const r={next:e=>{o&&a.next(e)},complete:()=>{o&&(i&&i(),a.complete(),o=!1)},error:e=>{o&&(a.error(e),o=!1)}};i=this._setupFn(r),o||i&&i();const s=new Eu;return s.add({unsubscribe:()=>{i&&i(),o=!1}}),s}}class Cu extends xu{constructor(){super((e=>(this._isComplete&&e.complete(),this._observers.push(e),()=>this._observers=this._observers.filter((t=>t!==e))))),this._observers=[],this._isComplete=!1}next(e){for(const t of this._observers)t.next(e)}error(e){for(const t of this._observers)t.error(e)}complete(){this._isComplete=!0;for(const e of this._observers)e.complete()}asObservable(){return new xu((e=>{const t=this.subscribe(e);return()=>t.unsubscribe()}))}}const wu={CompletedBeforeEmit:"CompletedBeforeEmit"};var Ou=function(e,t,n,a){return new(n||(n=Promise))((function(i,o){function r(e){try{l(a.next(e))}catch(e){o(e)}}function s(e){try{l(a.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,s)}l((a=a.apply(e,t||[])).next())}))};class Tu{constructor(e,t){this._target=e,this._handler=t}subscribe(e,t,n){const a=e.next?e.next.bind(e):e,i={next:(...e)=>Ou(this,void 0,void 0,(function*(){try{yield a(...e)}catch(e){this._handler(e)}})),error:e.error?e.error.bind(e):t,complete:e.complete?e.complete.bind(e):n};return this._target.subscribe(i)}}class Au{constructor(e){this.value=e,this.complete=!1,this.skip=!1}}var Ru=function(e,t,n,a){return new(n||(n=Promise))((function(i,o){function r(e){try{l(a.next(e))}catch(e){o(e)}}function s(e){try{l(a.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,s)}l((a=a.apply(e,t||[])).next())}))};const Nu={getBreakpointCSSClass:B},_u="CHILD_LAYOUTS/ADD_LAUNCHED",Lu="DYNAMIC_DATA/ADD";function ju(e={launched:{}},t){if(t.type===_u){const n=t.payload;return n.childLayoutId?i.assocPath(["launched",n.childLayoutId],n.shouldRelaunch,e):e}return e}function Du(e=null,t){return e}function ku(e=null,t){if(t.type===Lu){const n=t.payload;return e?n?i.mergeDeepRight(e,n):e:n}return e}function Pu(e,t){var n;return null===(n=e.childLayouts.launched[t])||void 0===n||n}function $u(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer}function Fu(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.schemaVersion}const Gu=Object.freeze({});function Mu(e){var t;return(null===(t=e.dynamicData)||void 0===t?void 0:t.text)?e.dynamicData.text:Gu}const Bu="FAILED_TO_LAUNCH_CHILD_LAYOUT";function*Uu(e,t,n){var a;if(yield null===(a=r.select(Pu,n.payload.childLayoutId))||void 0===a||a){const a=yield r.select(Fu),o=yield r.select($u),s=yield r.select(Mu);try{const l=(i=function(e,t,n,a){return{instanceGuid:e.instanceGuid,childLayoutId:e.childLayoutId,childLayoutSchema:e.childLayoutSchema,offer:t,layoutSchemaVersion:n,content:{text:a}}}(n.payload,o,a,s),JSON.parse(JSON.stringify(i)));try{yield r.call(e.createChildPlugin,{name:"dcui-child",config:l,targetElementSelector:n.payload.targetElementSelector})}catch(e){yield r.call(t,{level:N,code:Bu,message:"Could not launch child layout, failed creating plugin."})}}catch(e){yield r.call(t,{level:N,code:Bu,message:"Could not launch child layout, failed to make the child layout config serializable."})}yield r.put({type:_u,payload:{childLayoutId:n.payload.childLayoutId,shouldRelaunch:!1}})}var i}function Vu(){const t=Tn(),n=a.useSelector(Mu),i=Yt()({state:n},"textContent");return e.jsx(Jt,{value:i,children:e.jsx(It,{children:e=>e(t)})})}const zu={staticData:Du,dynamicData:ku,childLayouts:ju};function Hu(e={}){return Object.assign({staticData:null,dynamicData:null,childLayouts:{launched:{}}},e)}function qu(e){let t,n,a;return l.eventChannel((i=>(Promise.race([e.onClose().then((()=>"CLOSED")),new Promise((n=>{t=e.onEvent("PLUGIN_TRANSITION_OFFER_SUCCESS").subscribe((()=>{n("SUCCESS")}))})),new Promise((t=>{n=e.onEvent("PLUGIN_TRANSITION_OFFER_CLOSE").subscribe((()=>{t("UNSPECIFIED")}))})),new Promise((e=>{a=e}))]).then((e=>{"END"!==e&&(i(e),i(l.END))})),()=>{null==t||t.unsubscribe(),null==n||n.unsubscribe(),a("END")})))}function Wu(e){return"object"==typeof e&&null!==e&&Object.entries(e).every((([e,t])=>"string"==typeof e&&"string"==typeof t))}function*Ju(e,t,n,a,i){for(;;){switch(yield r.take(e)){case"CLOSED":t({type:Q,payload:{event:"Dismissed",dismissalReason:"Implicit"}});break;case"SUCCESS":if((n||a)&&i){yield r.call(i);break}t({type:Q,payload:{event:"Completed",completionReason:"Success"}});break;case"UNSPECIFIED":t({type:Q,payload:{event:"Completed",completionReason:"Unspecified"}})}}}function*Yu(e,t,n){if(H(n)){const{responseOption:a,fulfillment:i}=n,o=Y(n),s=K(n);yield r.put({type:Z,payload:{name:"SignalResponse",parentGuid:a.instanceGuid,responseActionPayload:{name:"Fulfillment"}}});const l=yield r.call(e.createChildPlugin.bind(e),i);if("object"==typeof l&&"onClose"in l&&"close"in l){const a=yield r.call(qu,l);if("object"==typeof a&&"take"in a){const i=function(e,t,n,a){if(n.responseOption.rclid)return function*(){yield r.put({type:ee,payload:{name:"REALTIME_OFFER_FULFILLMENT_CONVERSION",body:{rclid:n.responseOption.rclid,accountID:n.accountID,referralCreativeID:n.referralCreativeID}}}),yield r.call(Ku,e,t,a)}}(e,t,n,l);return void(yield r.call(Ju,a,e.globalDispatch.bind(e),o,s,i))}}yield r.call(t,{level:R,code:"UNEXPECTED_NEXT_VALUE_IN_SAGA",message:'Received an unexpected input at a step in the saga "handleFullfillmentResponse" and could not continue.'})}else yield r.call(t,{level:R,code:"INVALID_FULFILLMENT_PAYLOAD",message:`Fulfillment payload is invalid, fulfillment: ${n}`})}function*Ku(e,t,n){const a=function(e){return l.eventChannel((t=>{const n=e.onEvent({name:yr,source:"partner",callback:e=>{Wu(e)&&t({eventName:yr,data:e})}},{name:hr,source:"partner",callback:e=>{Wu(e)&&t({eventName:hr,data:e})}});return()=>{n()}}))}(e);try{for(;;){const i=yield r.take(a);switch(i.eventName){case yr:yield r.put({type:ee,payload:{name:yr,body:i.data}}),yield r.put({type:Lu,payload:{text:i.data}}),e.globalDispatch({type:Q,payload:{event:"Completed",completionReason:"Success"}}),n&&(yield r.call(n.close.bind(n)));break;case hr:e.globalDispatch({type:Q,payload:{event:"Completed",completionReason:"Error"}}),n&&(yield r.call(n.close.bind(n)));break;default:t({level:R,code:"UNKNOWN_REALTIME_OFFER_FULFILLMENT_EVENT",message:`Unknown event: ${i.eventName}`})}}}catch(e){const n=e;t({level:N,code:"FAILED_TO_PROCESS_REALTIME_OFFER_FULFILLMENT_EVENT",message:null==n?void 0:n.message})}finally{(yield r.cancelled())&&a.close()}}function*Zu(e,t,n){const a=W(n.payload)||J(n.payload)||q(n.payload)?n.payload:n.payload.responseOption;switch(a.action){case"Url":yield r.call(e.globalDispatch.bind(e),n),(Y(n.payload)||K(n.payload))&&(yield r.put({type:ee,payload:{name:"REALTIME_OFFER_FULFILLMENT_REFERRAL",body:{rclid:a.rclid,accountID:a.accountID,referralCreativeID:a.referralCreativeID,referralOnly:K(n.payload)}}}),Y(n.payload)&&(yield r.call(Ku,e,t)));break;case"CaptureOnly":yield r.call(e.globalDispatch.bind(e),n);break;case"Fulfillment":yield r.put({type:ee,payload:{name:"OFFER_ENGAGEMENT"}}),a.isPositive&&(yield r.put({type:ee,payload:{name:"POSITIVE_ENGAGEMENT"}})),K(n.payload)&&(yield r.put({type:ee,payload:{name:"REALTIME_OFFER_FULFILLMENT_REFERRAL",body:{rclid:a.rclid,accountID:n.payload.accountID,referralCreativeID:n.payload.referralCreativeID,referralOnly:!0}}})),yield*Yu(e,t,n.payload)}}function*Qu(e,t){yield r.all([r.takeLatest(z,Zu.bind(null,e,t)),r.takeEvery(re,Uu.bind(null,e,t)),r.takeEvery("*",Oo.bind(null,[z,re],e))])}Object.assign({},se);const Xu=(new Sn).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=Hu({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n=Hu()){const a=l(),i=s.configureStore({reducer:zu,devTools:{name:"Standard Marketing"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(Qu,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs($n,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(_i,{}),e.jsx(a.Provider,{store:d,children:e.jsx(Ri,{settings:i,dispatch:d.dispatch,children:e.jsx(Vu,{})})})]})}))}}));var ep=Object.freeze({__proto__:null,moduleConnectorBuilder:Xu});const tp="CART/UPDATE",np="CATALOG_ITEM/RESPONSE",ap="USER_CREATIVE_RESPONSE_HISTORY/ADD",ip=i.cond([[(e,t)=>0!==t,i.equals],[(e,t)=>!Number.isNaN(e)&&0===t,i.equals],[(e,t)=>Number.isNaN(e)&&0===t,i.F]]);function op({isChecked:t,isDisabled:n,outerClassname:a,outerCheckedClassname:i,innerClassname:o,innerCheckedClassname:r}){return e.jsx("span",{style:{display:"flex"},children:e.jsx("span",{className:`${a} ${t?i:""}`,tabIndex:n?-1:1,style:{display:"flex",boxSizing:"border-box"},children:e.jsx("span",{className:`${o} ${t?r:""}`,style:{flex:1}})})})}const rp="catalogRadioGroup__label",sp=["Enter","Space"],lp={elements:{own:[],optionContainer:[],radioButtonInner:[{default:{border:{borderRadius:11},background:{backgroundColor:{light:"#FFF"}}}}],radioButtonInnerChecked:[{default:{background:{backgroundColor:{light:"#529ff4"}}}}],radioButtonOuter:[{default:{border:{borderRadius:16,borderColor:{light:"#999"},borderStyle:"solid",borderWidth:"1"},dimension:{width:{type:"fixed",value:16},height:{type:"fixed",value:16}},spacing:{padding:"4"}}}],radioButtonOuterChecked:[]}};function cp(e,t,n){return e.map(i.cond([[i.compose(i.equals("Required"),i.propOr("","type")),({value:e})=>Number.isNaN(n)&&t>0?e.message:""],[i.T,i.always("")]])).filter(i.isNotEmpty)}function dp({schema:n,testId:i}){var o;const r=a.useDispatch(),s=Mn(),l=null!==(o=a.useSelector((e=>{var t,n;return s.cartItemId in e.cart?null!==(n=null===(t=e.cart[s.cartItemId])||void 0===t?void 0:t.quantity)&&void 0!==n?n:0:void 0})))&&void 0!==o?o:NaN,c=t.useMemo((()=>cp(n.validations,n.options.length,l)),[n.validations,n.options.length,l]),d=Rn(),{tabIndex:u,styles:p,isDisabled:f}=m(d);t.useEffect((()=>{f||r(up(c))}),[]);const y=n.options.filter((({quantity:e})=>{var t,n;return e>=(null!==(t=s.minItemCount)&&void 0!==t?t:-1/0)&&e<=(null!==(n=s.maxItemCount)&&void 0!==n?n:1/0)}));function h(e){r({type:np,payload:{catalogItem:s,quantity:e}});const t=cp(n.validations,n.options.length,e);r(up(t))}return y.length>0?e.jsx(Aa,{styles:n.styles?M(lp,n.styles):lp,children:({classnames:n,mapperRef:a})=>e.jsx("div",{className:null==n?void 0:n.own,style:Object.assign({display:"flex",flexDirection:"column"},p),children:e.jsx(Zt,{value:a(rp),children:t.Children.toArray(y.map(((t,a)=>{var o;const r=ip(l,t.quantity),c=e=>i?`${i}-option${a}${e}`:void 0;return e.jsxs("label",{tabIndex:u,"aria-disabled":f,style:{display:"flex"},className:`${rp} ${null!==(o=null==n?void 0:n.optionContainer)&&void 0!==o?o:""}`,onKeyDown:e=>{r||!sp.includes(e.code)||f||h(t.quantity)},"data-e2e":"CatalogRadioGroup-Option","data-e2e-quantity":`${t.quantity}`,"data-testid":c("Label"),children:[e.jsx("input",{type:"radio",style:{display:"none"},tabIndex:-1,name:s.instanceGuid,value:t.quantity,checked:r,onChange:()=>h(t.quantity),"aria-disabled":f,disabled:f}),e.jsx(op,{isChecked:r,isDisabled:f,innerClassname:null==n?void 0:n.radioButtonInner,innerCheckedClassname:null==n?void 0:n.radioButtonInnerChecked,outerClassname:null==n?void 0:n.radioButtonOuter,outerCheckedClassname:null==n?void 0:n.radioButtonOuterChecked}),e.jsx(ki,{schema:t,testId:c("Content")})]})})))})})}):null}function up(e){return{type:ie,payload:{errors:e}}}function pp(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function fp(t){const n=a.useDispatch(),i=St(),o=Mn(),r=Rn(),{tabIndex:s,styles:l,isDisabled:c}=m(r);return e.jsx(Aa,{styles:t.schema.styles,children:({classnames:a})=>e.jsx("button",{type:"button",tabIndex:s,"aria-disabled":c,disabled:c,style:Object.assign({cursor:"pointer"},l),"data-testid":t.testId,"data-e2e":"CatalogItemResponse",onClick:e=>{e.preventDefault();n({type:np,payload:{catalogItem:o,quantity:1}})},className:null==a?void 0:a.own,children:pp(t.schema.children,i,t.testId)})})}const yp={allowedTags:["em","strong","a","br","u","p","li","ul","ol","span"],allowedAttributes:{a:["href","target"],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],span:[]},allowedSchemes:["http","https"]},hp=new Map([["&","_;^;_"]]),mp=new RegExp(`<a *(?=${yp.allowedAttributes.a.join("|")}|>)`,"g"),vp=new RegExp(`<a *(?:(?:${yp.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),gp=new RegExp("(<br *?>)|(<br *?/>)","g"),bp=new RegExp(`<ul *(?=${yp.allowedAttributes.ul.join("|")}|>)`,"g"),Ep=new RegExp(`<ol *(?=${yp.allowedAttributes.ol.join("|")}|>)`,"g"),Ip=new RegExp("<li *(?=>|\\s[^>]*>)","g"),Sp="<br/>";function xp(n){const a=Yt(),i=Rn(),o=t.useMemo((()=>{const e=a(n.schema.value);if(!function(e){const t=function(e){return e.replaceAll(vp,((e,t)=>{const n=t.replaceAll("&",hp.get("&"));return e.replace(t,n)})).replaceAll(gp,Sp)}(e);return t===u(t,yp)}(e))throw new _("FAILED_SANITISING_HTML","Invalid HTML tags");return e}),[n.schema.value,a]),{tabIndex:r,styles:s,isDisabled:l}=m(i);return o?e.jsx(Aa,{styles:n.schema.styles,children:({classnames:t})=>{const a=[(null==t?void 0:t.link)?`class="${null==t?void 0:t.link}"`:"",l?'tabindex="-1"':"",l?"style=\"pointer-events: 'none'; user-select: none;\"":"",l?'aria-disabled="true"':""].filter((e=>e.length>0)),i=((null==t?void 0:t.list)?`class="${t.list}"`:"")+' style="list-style-type: none; padding-inline-start: 0px; display: flex; flex-direction: column;"',c=((null==t?void 0:t.listItem)?`class="${t.listItem}"`:"")+' style="display: flex; align-items: flex-start; flex-shrink: 0; flex-grow: 1;"',d=`class="rokt-icon${(null==t?void 0:t.span)?" "+t.span:""}" style="display: inline-block; pointer-events: none; user-select: none;" aria-disabled="true"`,u=o.replace(mp,`<a ${a.join(" ")}`).replace(bp,`<ul ${i}`).replace(Ep,`<ol ${i}`).replace(Ip,`<li ${c}><span ${d}>Check</span`);return p=o,new RegExp("</(p|ul|ol)>").test(p)?e.jsx("div",{tabIndex:r,style:s,"aria-hidden":l,className:null==t?void 0:t.own,"data-testid":n.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:u}}):e.jsx("p",{tabIndex:r,style:s,"aria-hidden":l,className:null==t?void 0:t.own,"data-testid":n.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:u}});var p}}):null}const Cp={internally:"_top",externally:"_blank"};function wp(t,n,a,i,o){return e.jsx(Zt,{value:a(n),children:Op(t,i,o)})}function Op(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Tp(t){var n,i;const o=Cp[t.schema.open],r=St(),s=Mn(),l=Rn(),c=a.useDispatch(),d=null!==(n=s.url)&&void 0!==n?n:"",{tabIndex:u,styles:p,isDisabled:f}=m(l);return Boolean(d)&&(null===(i=t.schema.children)||void 0===i?void 0:i.length)>0?e.jsx(Aa,{styles:t.schema.styles,children:({classnames:n,mapperRef:a})=>{var i;return e.jsx("a",{href:d,onClick:()=>{var e;c({type:Z,payload:{name:"SignalResponse",parentGuid:null!==(e=s.instanceGuid)&&void 0!==e?e:"",responseActionPayload:{name:"Url",transformedTrafficURL:d}}})},"data-testid":t.testId,"data-e2e":"CatalogUrlLink",target:null!=o?o:"_blank",tabIndex:u,"aria-disabled":f,"aria-label":null!==(i=t.schema.a11yLabel)&&void 0!==i?i:void 0,style:Object.assign({cursor:"pointer",textDecoration:"none",display:"block"},p),className:null==n?void 0:n.own,children:(null==n?void 0:n.own)?wp(t.schema.children,null==n?void 0:n.own,a,r,t.testId):Op(t.schema.children,r,t.testId)})}}):null}function Ap(e,t){const n=e.cart[t];return n||null}function Rp(e){var t,n;const a=null!==(n=null===(t=e.staticData)||void 0===t?void 0:t.offer.catalogItems)&&void 0!==n?n:[],i=function(e){return Object.values(e.cart).filter((e=>null!==e))}(e);return i.filter((e=>a.find((t=>t.catalogItemId===e.catalogItemId))))}function Np(e,t){var n,a,i,o;const r=null===(n=e.staticData)||void 0===n?void 0:n.offer;if(r){const n=function(e){return Rp(e).reduce(((e,t)=>e+t.quantity),0)}(e),s=Ap(e,t.cartItemId),l=(null!==(a=null==r?void 0:r.maxTotalItemsQtyInOffer)&&void 0!==a?a:1/0)-n,c=(null!==(i=t.maxItemCount)&&void 0!==i?i:1/0)-(null!==(o=null==s?void 0:s.quantity)&&void 0!==o?o:0);return Math.min(l,c)}return 0}function _p(e){var t,n;const a=null!==(n=null===(t=e.staticData)||void 0===t?void 0:t.offer.catalogItems)&&void 0!==n?n:[];return a.length>0?a:null}function Lp(e,t){var n,a;return null!==(a=null===(n=_p(e))||void 0===n?void 0:n.find((e=>e.catalogItemId===t)))&&void 0!==a?a:null}function jp(e){var t;const n=null===(t=_p(e))||void 0===t?void 0:t.filter((e=>e.preSelectedQuantity&&e.preSelectedQuantity>0));return n&&n.length>0?n:null}function Dp(e){var t,n;return null!==(n=null===(t=jp(e))||void 0===t?void 0:t.reduce(((e,t)=>{var n;return e+(null!==(n=t.preSelectedQuantity)&&void 0!==n?n:0)}),0))&&void 0!==n?n:0}const kp=i.compose((e=>e.filter((e=>!i.isNil(e[1]))).map((([e,t])=>({cartItemId:t.cartItemId,quantity:t.quantity})))),i.toPairs,i.prop("cart"));function Pp(t,n,a,i,o){return e.jsx(Zt,{value:a(n),children:i(t,void 0,o)})}function $p(e,t,n){return t(e,void 0,n)}function Fp(t){var n;const{schema:i,testId:o}=t,{a11yInputLabel:r,styles:s,showInputField:l,buttons:c,forcedUpsellText:d}=i,{increment:u,decrement:p,a11yIncrementLabel:f,a11yDecrementLabel:y}=c||{},h=a.useDispatch(),v=Mn(),g=St(),b=Yt(),E=Rn(),{tabIndex:I,styles:S,isDisabled:x}=m(E),C=a.useSelector((e=>function(e,t){var n,a,i;const o=Lp(e,t);return Boolean(o&&(null!==(n=o.preSelectedQuantity)&&void 0!==n?n:0)>0&&o.preSelectedQuantity===(null!==(a=o.minItemCount)&&void 0!==a?a:0)&&o.preSelectedQuantity===(null!==(i=o.maxItemCount)&&void 0!==i?i:0))}(e,v.catalogItemId))),w=a.useSelector((e=>Ap(e,v.cartItemId))),O=a.useSelector((e=>Np(e,v))),T=(null==w?void 0:w.quantity)||0,A=m(x||T<=(null!==(n=v.minItemCount)&&void 0!==n?n:0)?"DISABLED":E),R=m(x||O<=0?"DISABLED":E),N=m(x||C?"DISABLED":E),_=e=>{var t;const n=e.target.value;if(0===n.length)L(null!==(t=v.minItemCount)&&void 0!==t?t:0);else{const e=Number(n);!Number.isNaN(e)&&e>=0&&L(e)}},L=e=>{x||h({type:np,payload:{catalogItem:v,quantity:e}})};return e.jsx(Aa,{styles:s,children:({classnames:t,mapperRef:n})=>e.jsx("div",{className:null==t?void 0:t.own,style:Object.assign({display:"flex",flexDirection:"row"},S),children:C&&d?e.jsx(Fa,{schema:d,isInline:!1,testId:o?`${o}-forced-upsell-text`:void 0}):e.jsxs(e.Fragment,{children:[p?e.jsx("button",{className:null==t?void 0:t.decrementButton,style:Object.assign(Object.assign({},A.styles),{cursor:A.isDisabled?"not-allowed":"pointer",pointerEvents:"auto"}),onClick:e=>{e.preventDefault(),L(T-1)},tabIndex:A.tabIndex,"aria-label":y||void 0,disabled:A.isDisabled,"data-testid":o?`${o}-decrement-button`:void 0,children:e.jsx(Jt,{value:b,children:(null==t?void 0:t.decrementButton)?Pp(p,t.decrementButton,n,g,o):$p(p,g,o)})}):null,l?e.jsx("input",{type:"text",className:null==t?void 0:t.input,style:Object.assign(Object.assign({},N),{cursor:N.isDisabled?"not-allowed":"auto",caretColor:N.isDisabled?"transparent":"auto",pointerEvents:"auto",outline:"none"}),value:T,onChange:_,"aria-label":r||void 0,tabIndex:I,disabled:x,"data-testid":o?`${o}-input`:void 0}):e.jsx("p",{className:null==t?void 0:t.input,style:S,"data-testid":o?`${o}-quantity-text`:void 0,children:T}),u?e.jsx("button",{className:null==t?void 0:t.incrementButton,style:Object.assign(Object.assign({},R.styles),{cursor:R.isDisabled?"not-allowed":"pointer",pointerEvents:"auto"}),onClick:e=>{e.preventDefault(),L(T+1)},tabIndex:R.tabIndex,"aria-label":f||void 0,disabled:R.isDisabled,"data-testid":o?`${o}-increment-button`:void 0,children:e.jsx(Jt,{value:b,children:(null==t?void 0:t.incrementButton)?Pp(u,t.incrementButton,n,g,o):$p(u,g,o)})}):null]})})})}const Gp={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(fp,{schema:t.node,testId:n})},EscapeHatch:function(t){if("EscapeHatch"===t.type&&t.node.data){const n=JSON.parse(t.node.data);switch(null==n?void 0:n.type){case"InsuranceRichText":return e.jsx(xp,{schema:n.node});case"CatalogUrlLink":return e.jsx(Tp,{schema:n.node});default:return}}},CatalogRadioGroup:function(t){if("CatalogRadioGroup"===t.type)return e.jsx(dp,{schema:t.node})},CatalogQuantityCounter:function(t){if("CatalogQuantityCounter"===t.type)return e.jsx(Fp,{schema:t.node})}};function Mp(){const t=Tn(),n=St();return e.jsx(xt,{value:n,overrides:Gp,children:e.jsx(It,{children:e=>e(t)})})}function Bp(e){return e.reduce(((e,t)=>(e[t.cartItemId]=function(e={}){return Object.assign({cartItemId:"cartItemId",catalogItemId:"catalogItemId",name:"Catalog Title",description:"This is a catalog item",unitPrice:10,totalPrice:10,quantity:1,currency:"USD",linkedProductId:void 0,quantityMustBeSynchronized:void 0,providerData:""},e)}({cartItemId:t.cartItemId,quantity:t.quantity}),e)),{})}const Up={cart:function(e=Bp([]),t){if(t.type===tp){const{catalogItem:n,quantity:a}=t.payload,i=n.cartItemId,o=To(n,a);return Object.assign(Object.assign({},e),{[i]:o})}return e},userCreativeResponseHistory:function(e=[],t){return t.type===ap?e.concat(t.payload.responseId):e},staticData:Du,childLayouts:ju};const Vp="INVALID_PARTNER_MESSAGE",zp="MISCONFIGURED_CATALOG_ITEM",Hp="FAILED_TO_PROCESS_PARTNER_UPDATE_CART_ITEM";function*qp(e){var t,n;const a=yield r.select(jp),i=yield r.select(Dp),o=yield r.select((e=>{var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer.maxTotalItemsQtyInOffer}));if(Zp(i)&&Zp(o)&&i>o)yield r.call(e,{level:N,code:zp,message:`Catalog items preselected quantities (${i}) exceeds the maximum allowed quantity (${o}) for this offer`});else if(a&&Array.isArray(a))for(const i of a){const a=null!==(t=i.preSelectedQuantity)&&void 0!==t?t:0,o=null!==(n=i.maxItemCount)&&void 0!==n?n:1/0;a>o?yield r.call(e,{level:N,code:zp,message:`Preselected quantity (${a}) is greater than maxItemCount (${o}) for catalog item (${i.instanceGuid})`}):yield*Kp(i,a,!0)}}function*Wp(e,t,n){const{catalogItem:a,quantity:i}=n.payload;if(yield*Kp(a,i,!1)){const n=yield r.select((e=>{var t,n,a;const i=null===(t=e.staticData)||void 0===t?void 0:t.offer.creative.responseOptionsMap.positive,o=e.userCreativeResponseHistory.at(-1),r=null===(n=e.staticData)||void 0===n?void 0:n.offer.creative.responseOptionsMap.negative;if(i&&o&&i.id===o&&"SignalGatedResponse"===(null==r?void 0:r.signalType))return function(e,t){var n;switch(e.action){case"Fulfillment":{const a=null==t?void 0:t.creative.fulfillment;return b(a)?{type:z,payload:{fulfillment:a,responseOption:e,accountID:null!==(n=null==t?void 0:t.accountId)&&void 0!==n?n:""}}:`Could not get fulfillment for response (instanceGuid: ${e.instanceGuid})`}case"Url":return(null==t?void 0:t.accountId)?{type:z,payload:Object.assign(Object.assign({},e),{accountID:t.accountId})}:`Could not get accountId for response (instanceGuid: ${e.instanceGuid})`;default:return{type:z,payload:e}}}(r,null===(a=e.staticData)||void 0===a?void 0:a.offer)}));null!=(o=n)&&"object"==typeof o&&"type"in o&&"payload"in o&&"object"==typeof o.payload?yield r.call(e.globalDispatch,n):function(e){return"string"==typeof e}(n)&&(yield r.call(t,{level:N,code:"INVALID_RESPONSE_OBJECT",message:n}))}var o}function*Jp(e,t){const n=function(e,t){return l.eventChannel((n=>{const a=e.onEvent({name:dr.V2.PartnerMessage.UpdateCartItem,source:"partner",callback:e=>{!function(e){return null!==e&&"object"==typeof e&&"cartItemId"in e&&"quantity"in e&&!("unitPrice"in e)}(e)?t({level:N,code:Vp,message:`Invalid UpdateCartItemPartnerMessageBody: ${JSON.stringify(e)}`}):n(e)}});return()=>{a()}}))}(e,t);try{for(;;){const e=yield r.take(n);yield r.call(Yp,e,t)}}catch(e){const n=e;t({level:N,code:Hp,message:null==n?void 0:n.message})}finally{(yield r.cancelled())&&n.close()}}function*Yp(e,t){const{cartItemId:n,quantity:a}=e,i=yield r.select(Ap,n);if(Qp(i)){const e=yield r.select(Lp,i.catalogItemId);null!==(o=e)&&"object"==typeof o&&"catalogItemId"in o&&"price"in o?yield*Kp(e,a,!1):yield r.call(t,{level:N,code:Hp,message:`Catalog item not found for cart item id (${n})`})}else yield r.call(t,{level:N,code:Hp,message:`Cart item not found for cart item id (${n})`});var o}function*Kp(e,t,n){var a;const i=yield r.select(Ap,e.cartItemId),o=yield r.select(Np,e),s=Zp(o)?o:0,l=Qp(i)?i.quantity:0;if(t!==l&&t>=(null!==(a=e.minItemCount)&&void 0!==a?a:0)&&t-l<=s){yield r.put({type:tp,payload:{catalogItem:e,quantity:t}});const a=yield r.select(Ap,e.cartItemId),o=yield r.select(kp);return yield r.put({type:oe,payload:{cart:o}}),yield r.put({type:Z,payload:{name:"SignalCartItemQuantitySelected",parentGuid:e.instanceGuid,objectData:{quantity:t,preselected:n}}}),yield r.put({type:ee,payload:{name:"V2_CART_ITEM_UPDATED",body:{oldCartItem:i,cartItem:a}}}),!0}return!1}function Zp(e){return"number"==typeof e}function Qp(e){return null!=e&&"object"==typeof e&&"cartItemId"in e&&"quantity"in e&&"unitPrice"in e}function*Xp(e,t){var n;yield r.put({type:ap,payload:{responseId:(n=t.payload,H(n)?n.responseOption.id:n.id)}}),yield r.call(e.globalDispatch.bind(e),t)}function*ef(e,t){yield r.all([r.spawn(qp.bind(null,t)),r.spawn(Jp.bind(null,e,t)),r.takeLatest(np,Wp.bind(null,e,t)),r.takeLatest(z,Xp.bind(null,e)),r.takeEvery(re,Uu.bind(null,e,t)),r.takeEvery("*",Oo.bind(null,[z,re],e))])}function tf(e){return"object"==typeof e&&null!==e&&"cartItemId"in e&&"quantity"in e}Object.assign(Object.assign({},se),{CATALOG_ITEM_RESPONSE:np});const nf=(new Sn).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=function(e){return"object"==typeof e&&null!==e&&"cart"in e&&Array.isArray(e.cart)&&e.cart.every(tf)}(i.offerState)?i.offerState:{cart:[]},d=function(e={}){return Object.assign({cart:Bp([]),userCreativeResponseHistory:[],staticData:null,childLayouts:{launched:{}}},e)}({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion},cart:Bp(c.cart)}),u=function(e,t,n){const a=l(),i=s.configureStore({reducer:Up,devTools:{name:"Add To Cart"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(ef,e,t),i}(i.gateway,i.logger,d);r.render(e.jsx(t.StrictMode,{children:e.jsxs($n,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(_i,{}),e.jsx(a.Provider,{store:u,children:e.jsx(Ri,{settings:i,dispatch:u.dispatch,children:e.jsx(Mp,{})})})]})}))}}));var af=Object.freeze({__proto__:null,moduleConnectorBuilder:nf});const of="CATALOG/TRIGGER_SELECT_ITEM",rf="CATALOG/SET_SELECTED_ITEM",sf="CHECKOUT_LIFECYCLE",lf="INSTANT_PURCHASE/INITIATE",cf="INSTANT_PURCHASE/PARTNER_RESPONSE",df="INSTANT_PURCAHSE/WSDK_RESPONSE";function uf(t,n,a,i,o){return e.jsx(Zt,{value:a(n),children:pf(t,i,o)})}function pf(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function ff(t){const n=a.useDispatch(),i=St(),o=Rn(),{tabIndex:r,styles:s,isDisabled:l}=m(o),c=Mn(),d=zt(c,"catalogItem");return e.jsx(Aa,{styles:t.schema.styles,children:({classnames:a,mapperRef:o})=>e.jsx("button",{type:"button",tabIndex:r,"aria-disabled":l,disabled:l,style:Object.assign({cursor:"pointer"},s),"data-testid":t.testId,"data-e2e":"CatalogItemResponse",onClick:e=>{e.preventDefault();n({type:lf,payload:{catalogItem:c,quantity:1,useInstantPurchaseExtension:!0}})},className:null==a?void 0:a.own,children:e.jsx(Jt,{value:d,children:(null==a?void 0:a.own)?uf(t.schema.children,a.own,o,i,t.testId):pf(t.schema.children,i,t.testId)})})})}function yf(t,n,a,i,o){return e.jsx(Zt,{value:a(n),children:i(t,void 0,o)})}function hf(e,t,n){return t(e,void 0,n)}const mf=["ArrowDown","ArrowUp","Enter","Escape","Tab"];function vf(n){const i=At(),o=St(),r=Mn(),s=Yt(),l=e=>s({data:e},"catalogItem"),c=t.useMemo((()=>i.catalogItems||[]),[i]),d=Rn(),{styles:u,isDisabled:p}=m(d),f=t.useRef(null),y=t.useRef([]),[h,v]=t.useState(!1),[g,b]=t.useState(0),E=a.useDispatch();function I(){p||(h?x():S())}function S(){p||v(!0)}function x(){p||v(!1)}function C(e){b(c.indexOf(e)),x(),E({type:of,payload:{catalogItem:e}})}t.useEffect((()=>{if(h){const e=y.current[g];e&&e.focus()}}),[h,g]);const w={elements:{own:[{default:{background:{backgroundColor:{light:"#ffffff"}},dimension:{width:{type:"percentage",value:100}}}}]}};function O(e){if(!p&&mf.includes(e.key))switch(e.key){case"ArrowDown":{e.preventDefault();const t=g+1;t<c.length&&b(t);break}case"ArrowUp":{e.preventDefault();const t=g-1;t>=0&&b(t);break}case"Enter":if(e.preventDefault(),h){const e=c[g];e&&C(e)}else S();break;case"Tab":if(h){x();const e=c.indexOf(r);-1!==e&&b(e)}break;case"Escape":if(e.preventDefault(),h){x();const e=c.indexOf(r);-1!==e&&b(e)}}}return c.length>1?e.jsx(Aa,{styles:n.schema.styles?M(w,n.schema.styles):w,children:({classnames:t,mapperRef:a})=>e.jsxs("div",{ref:f,className:null==t?void 0:t.own,onKeyDown:O,onClick:I,onBlur:e=>{var t;(null===(t=f.current)||void 0===t?void 0:t.contains(e.relatedTarget))||h&&x()},"data-e2e":"DropDown","data-testid":n.testId?`${n.testId}-drop-down-container`:void 0,"aria-disabled":p,style:Object.assign({position:"relative"},u),tabIndex:0,children:[e.jsx("div",{className:null==t?void 0:t.dropDownSelectedElement,"aria-disabled":p,"data-testid":n.testId?`${n.testId}-drop-down-selected-element`:void 0,style:Object.assign({cursor:"pointer"},u),children:e.jsx(Jt,{value:l(r),children:(null==t?void 0:t.dropDownSelectedElement)?yf(n.schema.closedTemplate,t.dropDownSelectedElement,a,o,n.testId):hf(n.schema.closedTemplate,o,n.testId)})}),h&&e.jsx("ul",{className:null==t?void 0:t.dropDownListContainer,onClick:e=>e.stopPropagation(),"data-testid":n.testId?`${n.testId}-drop-down-list-container`:void 0,tabIndex:-1,style:Object.assign({listStyle:"none",padding:0,zIndex:9999,position:"absolute",top:"100%",left:0,right:0,backgroundColor:"#FFF",overflow:"hidden"},u),children:c.map(((i,r)=>e.jsx("li",{ref:e=>function(e,t){y.current[t]=e}(e,r),className:null==t?void 0:t.dropDownListElement,onClick:e=>{e.stopPropagation(),p||C(i)},tabIndex:-1,"data-e2e":"DropDownItem","data-testid":n.testId?`${n.testId}-drop-down-item-${r}`:void 0,style:Object.assign({cursor:"pointer",display:"flex"},u),children:e.jsx(Jt,{value:l(i),children:(null==t?void 0:t.dropDownListElement)?yf(n.schema.openTemplate,t.dropDownListElement,a,o,n.testId):hf(n.schema.openTemplate,o,n.testId)})},i.catalogItemId)))})]})}):null}function gf(n){const i=n.schema.styles,o=a.useDispatch(),r=a.useSelector((e=>e.staticData)),s=Rn(),{tabIndex:l,styles:c,isDisabled:d}=m(s),u=()=>{var e;o({type:sf,payload:{event:"Checkout",targetStep:n.schema.targetStep,offerPositionIndex:null!==(e=null==r?void 0:r.position)&&void 0!==e?e:0,data:n.schema.data}})};return e.jsx(Aa,{styles:i,children:({classnames:a})=>{var i;return e.jsx("button",{title:n.schema.targetStep,className:null==a?void 0:a.own,onClick:u,"data-testid":n.testId,"data-e2e":"CheckoutStateButtonTrigger",disabled:d,"aria-disabled":d,"aria-label":null!==(i=n.schema.a11yLabel)&&void 0!==i?i:n.schema.targetStep,tabIndex:l,style:Object.assign({cursor:"pointer"},c),children:e.jsx(It,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,U(a,n.testId)))))})})}})}const bf=/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{3})$/;function Ef(t){const n=Yt(),a=Rn(),{schema:i,testId:o}=t,r=n(i.value),{tabIndex:s,styles:l,isDisabled:c}=m(a);return"string"==typeof(d=r)&&bf.test(d)?e.jsx(Aa,{styles:i.styles,children:({classnames:t})=>e.jsx("div",{"aria-hidden":c,className:null==t?void 0:t.own,"data-e2e":"ColorSwatch","data-testid":o,style:Object.assign({backgroundColor:r},l),tabIndex:s})}):null;var d}function If(n){const{schema:{styles:a},testId:i}=n,[o,r]=t.useState(0),s=Mn(),l=Rn(),{styles:c,isDisabled:d,tabIndex:u}=m(l);t.useEffect((()=>{r(0)}),[s.catalogItemId]);const p=Object.values(s.images||{}),f=p[o]||p[0];return p.length>0&&f?e.jsx(Aa,{styles:a,children:({classnames:n})=>e.jsxs("div",{className:null==n?void 0:n.own,children:[e.jsx("img",{"aria-hidden":d,src:f.light,alt:f.alt,title:f.title,className:null==n?void 0:n.mainImage,style:c,"data-testid":`${i}-main-image`,"data-e2e":"CatalogImageGallery-mainImage"}),e.jsx("div",{className:null==n?void 0:n.thumbnailList,style:Object.assign(Object.assign({},c),{display:"flex"}),children:t.Children.toArray(p.map(((t,a)=>e.jsx("img",{src:t.light,alt:t.alt,title:t.title,className:null==n?void 0:n.thumbnailImage,style:Object.assign(Object.assign({},c),{cursor:d?"not-allowed":"pointer",pointerEvents:"auto"}),"data-testid":`${i}-thumbnail-${a}`,"data-e2e":"CatalogImageGallery-thumbnail",tabIndex:u,onClick:()=>r(a)}))))})]})}):null}const Sf={size:80,radius:30,stroke:7,duration:2,primaryColor:"#222",secondaryColor:"#d6d6d6",primaryRotation:-50,secondaryRotation:45,arcFraction:1/3.5},xf={elements:{own:[{default:{container:{justifyContent:"center",alignItems:"center"},dimension:{width:{type:"percentage",value:100}}}}],spinner:[{default:{container:{justifyContent:"center",alignItems:"center"}}}]}};function Cf(t){var n;const{config:a}=t.schema,i=Object.assign(Object.assign({},Sf),a),o=i.radius,r=2*Math.PI*o,s=r*(null!==(n=i.arcFraction)&&void 0!==n?n:1/3.5),l=r-s,c=i.size/2,d={container:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"100%"},spinner:{display:"block",animation:`spin ${i.duration}s ease-in-out infinite`,transformOrigin:"center center"}};return e.jsx(Aa,{styles:t.schema.styles?M(xf,t.schema.styles):xf,children:({classnames:n})=>e.jsxs("div",{className:null==n?void 0:n.own,"data-testid":t.testId,"data-e2e":"LoadingSpinner",style:d.container,children:[e.jsxs("svg",{width:i.size,height:i.size,viewBox:`0 0 ${i.size} ${i.size}`,className:null==n?void 0:n.spinner,style:d.spinner,children:[e.jsx("circle",{cx:c,cy:c,r:o,fill:"none",stroke:i.primaryColor,strokeWidth:i.stroke,strokeDasharray:`${s} ${l}`,strokeDashoffset:"0",strokeLinecap:"butt",transform:`rotate(${i.primaryRotation} ${c} ${c})`}),i.secondaryColor&&e.jsx("circle",{cx:c,cy:c,r:o,fill:"none",stroke:i.secondaryColor,strokeWidth:i.stroke,strokeDasharray:`${s} ${l}`,strokeDashoffset:"0",strokeLinecap:"butt",transform:`rotate(${i.secondaryRotation} ${c} ${c})`})]}),e.jsx("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]})})}function wf(n){const i=1e3*n.schema.durationInSeconds,o=n.schema.format||"M:SS",r=n.testId,s=a.useDispatch(),[l,c]=t.useState(i),d=t.useRef(null),u=t.useRef(null);function p(){const e=Math.ceil(l/1e3);if("S"===o)return e;{const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,"0")}`}}return t.useEffect((()=>(u.current=requestAnimationFrame((function e(t){d.current||(d.current=t);const n=t-d.current,a=Math.max(i-n,0);c(a),a>0?u.current=requestAnimationFrame(e):s({type:Q,payload:{event:"Dismissed",dismissalReason:"Implicit"}})})),()=>{u.current&&cancelAnimationFrame(u.current)})),[i,s]),e.jsx(Aa,{styles:n.schema.styles,children:({classnames:t})=>e.jsx("span",{className:null==t?void 0:t.own,"data-testid":r||"","data-e2e":"OfferLifecycleTimer",children:p()})})}function Of(n){const i=St(),o=kn(),r=Yt(),s=vt(),l=At().catalogItems||[],c=a.useSelector((e=>e.selectedItem))||l[0];return t.useEffect((()=>{c&&s({type:Z,payload:{name:"SignalImpression",parentGuid:null==c?void 0:c.instanceGuid}})}),[c,s]),c?e.jsx(Aa,{styles:n.schema.styles,children:({classnames:a})=>{return e.jsx("div",{"data-testid":n.testId,"data-e2e":"CatalogCombinedCollection",className:null==a?void 0:a.own,style:{display:"flex",flexDirection:"column"},children:t.Children.toArray(e.jsx(Gn,{context:c,children:e.jsx(Dn,{value:o(c),children:e.jsx(Jt,{value:(s=c,r({data:s},"catalogItem")),children:i(n.schema.template,void 0,n.testId?`${n.testId}-child`:"")})})}))});var s}}):null}const Tf={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(ff,{schema:t.node,testId:n})},CatalogCombinedCollection:function(t,n){if("CatalogCombinedCollection"===t.type)return e.jsx(Of,{schema:t.node,testId:n})},EscapeHatch:function(t){if("EscapeHatch"===t.type&&t.node.data){const n=JSON.parse(t.node.data);switch(null==n?void 0:n.type){case"CatalogDropDown":return e.jsx(vf,{schema:n.node});case"CheckoutStateButtonTrigger":return e.jsx(gf,{schema:n.node});case"ColorSwatch":return e.jsx(Ef,{schema:n.node});case"CatalogImageGallery":return e.jsx(If,{schema:n.node});case"LoadingSpinner":return e.jsx(Cf,{schema:n.node});case"OfferLifecycleTimer":return e.jsx(wf,{schema:n.node});default:return}}}};function Af(){const t=Tn(),n=St(),i=a.useSelector(Mu),o=Yt()({state:i},"textContent");return e.jsx(xt,{value:n,overrides:Tf,children:e.jsx(Jt,{value:o,children:e.jsx(It,{children:e=>e(t)})})})}function Rf(e){if(!e.copy)return null;const t=t=>e.copy[`ppu.${t}`]||"";return{shippingAttributes:{address1:t("shippingAddress1"),address2:t("shippingAddress2"),city:t("shippingCity"),state:t("shippingState"),country:t("shippingCountry"),postalCode:t("shippingZipCode")}}}const Nf={staticData:Du,selectedItem:(e=null,t)=>t.type===rf?t.payload:e,dynamicData:ku,childLayouts:ju,fulfillmentDetails:(e=null,t)=>"INSTANT_PURCHASE/SET_FULFILLMENT_DETAILS"===t.type?t.payload:e};function _f(e={}){return Object.assign({staticData:null,selectedItem:null,dynamicData:null,childLayouts:{launched:{}},fulfillmentDetails:null},e)}const Lf="INVALID_RESPONSE_OBJECT",jf="MISSING_APP_STATE_IN_INSTANT_PURCHASE_MODULE",Df="MISSING_PAYMENT_REF_IN_INSTANT_PURCHASE_MODULE",kf="MISSING_STATIC_DATA_IN_INSTANT_PURCHASE_MODULE";function Pf(e,t){return l.eventChannel((n=>e.onEvent({name:ur.PartnerMessage.CartItemInstantPurchaseResponse,source:"partner",callback:e=>{var a;"object"==typeof(a=e)&&null!==a&&"upsellItems"in a&&Array.isArray(a.upsellItems)&&a.upsellItems.every((e=>"object"==typeof e))&&"totalUpsellPrice"in a&&"number"==typeof a.totalUpsellPrice&&"currency"in a&&"string"==typeof a.currency&&"paid"in a&&"boolean"==typeof a.paid&&"success"in a&&"boolean"==typeof a.success?n(e):t({level:N,code:"MALFORMED_INSTANT_PURCHASE_PARTNER_DATA",message:`Malformed data received from partner\n ${e}`})}})))}function*$f(e,t){var n;try{for(;;){const t=yield r.take(e);t&&(yield r.put({type:cf,payload:t}))}}catch(e){yield r.call(t,{level:N,code:"INSTANT_PURCHASE_PARTNER_CHANNEL_ERROR",message:null!==(n=e.message)&&void 0!==n?n:"Unknown error in instant-purchase partner channel"})}finally{e.close()}}function*Ff(e,t){var n;try{for(;;){const t=yield r.take(e);if(t){yield r.put({type:df,payload:t});break}}}catch(e){yield r.call(t,{level:N,code:"INSTANT_PURCHASE_WSDK_CHANNEL_ERROR",message:null!==(n=e.message)&&void 0!==n?n:"Unknown error in instant-purchase WSDK channel"})}finally{e.close()}}function Gf(e){const t=function(e){var t,n;return null!==(n=null===(t=e.staticData)||void 0===t?void 0:t.offer.catalogItems)&&void 0!==n?n:[]}(e);return t[0]}const Mf="Unknown failure reason",Bf=6e4;function*Uf(){const e=yield r.select(Gf);e&&(yield*Yf(e))}function*Vf(e){const{catalogItem:t}=e.payload;yield*Yf(t)}function*zf(e,t,n){const{catalogItem:a,quantity:i}=n.payload,o=To(a,i);o?(yield r.put({type:Z,payload:{name:"SignalCartItemInstantPurchaseInitiated",parentGuid:a.instanceGuid,objectData:{catalogItemId:a.catalogItemId,quantity:i}}}),yield*Xf("ProcessingState",1),n.payload.useInstantPurchaseExtension?yield*function*(e,t,n){const a=yield r.select((e=>e));if(!a)return yield r.call(n,{level:N,code:jf,message:"App state is not set within Redux store."}),void(yield*ey("offerComplete",2));if(!a.staticData)return yield r.call(n,{level:N,code:kf,message:"App state is not configured with static data."}),void(yield*ey("offerComplete",2));const i=a.staticData.offer.creative.copy["ppu.partnerPaymentReference"];if(!i)return yield r.call(n,{level:N,code:Df,message:"Partner payment reference is not set within creative copy."}),void(yield*ey("offerComplete",2));const o={upsellItems:[{cartItemId:e.cartItemId,catalogItemId:e.catalogItemId,quantity:e.quantity,unitPrice:e.unitPrice,totalPrice:e.totalPrice,currency:e.currency}],totalUpsellPrice:e.totalPrice,currency:e.currency,paymentDetails:{partnerPaymentReference:i}};a.fulfillmentDetails&&(o.fulfillmentDetails=a.fulfillmentDetails);yield r.fork(Jf,t,n),yield r.put({type:ee,payload:{name:"INITIATE_INSTANT_PURCHASE_EVENT",body:o}})}(o,e,t):yield*function*(e,t,n){yield r.fork(Wf,t,n),yield r.put({type:ee,payload:{name:"CART_ITEM_INSTANT_PURCHASE",body:{upsellItems:[e],totalUpsellPrice:e.totalPrice||0,currency:e.currency}}})}(o,e,t)):(yield r.call(t,{level:N,code:Lf,message:`Unable to translate catalog item with ID ${a.catalogItemId} to cart item for instant purchase transaction.`}),yield*ey("offerComplete",2))}function*Hf(e,t){const n=yield r.select((e=>e.staticData));if(!n)return yield r.call(e,{level:N,code:kf,message:"App state is not configured with static data."}),void(yield*Qf("Error"));if(!n.offer.catalogItems)return yield r.call(e,{level:N,code:"MISSING_CATALOG_ITEMS",message:"No catalog items found within offer data."}),void(yield*Qf("Error"));const a={accountId:n.offer.accountId,catalogItems:n.offer.catalogItems};let i,o;t.payload.success?(i=Kf,o="Success"):(i=(e,n)=>function(e,t,n,a){return{name:"SignalCartItemInstantPurchaseFailure",parentGuid:e.instanceGuid,objectData:{catalogItemId:e.catalogItemId,quantity:t,failureReason:a.reason||Mf,providerId:n.accountId.toString()}}}(e,n,a,t.payload),o="Unspecified"),yield*function*(e,t,n,a){const i=[];for(const a of e.upsellItems){const e=Zf(a,t.catalogItems);void 0===e?i.push(a):yield r.put({type:Z,payload:n(e,a.quantity)})}i.length>0&&(yield*function*(e,t){const n=JSON.stringify(e,null,"\t").replaceAll('"',"");yield r.call(t,{level:N,code:Lf,message:`Unable to map cart items to catalog items in the instant purchase partner response: ${n}.`})}(i,a))}(t.payload,a,i,e),yield*Qf(o)}function*qf(e){e.payload.response&&e.payload.response.success?yield*ey("offerComplete",1):yield*ey("offerComplete",2)}function*Wf(e,t){const n=Pf(e,t),{timeout:a}=yield r.race({channel:r.call($f,n,t),timeout:r.delay(Bf)});a&&(yield r.call(t,{level:N,code:"INSTANT_PURCHASE_PARTNER_RESPONSE_TIMEOUT",message:"Instant-purchase partner response timed out after 60000ms"}),n.close(),yield*function*(e){yield*Xf("ProcessingState",0),yield r.put({type:Q,payload:{event:"Dismissed",dismissalReason:e}})}("Implicit"))}function*Jf(e,t){const n=function(e,t){return l.eventChannel((n=>e.onEvent(...["INSTANT_PURCHASE_SUCCESS","INSTANT_PURCHASE_FAILURE"].map((e=>({name:e,source:"partner",callback:e=>{var a;"object"==typeof(a=e)&&null!==a&&"timestamp"in a&&"string"==typeof a.timestamp&&"sessionId"in a&&"string"==typeof a.sessionId?n(e):t({level:N,code:"MALFORMED_INSTANT_PURCHASE_WSDK_DATA",message:`Malformed data received from wsdk\n ${e}`})}}))))))}(e,t),{timeout:a}=yield r.race({channel:r.call(Ff,n,t),timeout:r.delay(Bf)});a&&(yield r.call(t,{level:N,code:"INSTANT_PURCHASE_WSDK_RESPONSE_TIMEOUT",message:"Instant-purchase wsdk response timed out after 60000ms"}),n.close(),yield*ey("offerComplete",2))}function*Yf(e){var t,n,a;yield r.put({type:rf,payload:e});const i={title:null!==(t=e.title)&&void 0!==t?t:"",description:null!==(n=e.description)&&void 0!==n?n:"",price:null!==(a=e.priceFormatted)&&void 0!==a?a:""};e.copy&&Object.entries(e.copy).forEach((([e,t])=>{i[`copy.${e}`]=t})),yield r.put({type:Lu,payload:{text:i}})}function Kf(e,t){return{name:"SignalCartItemInstantPurchase",parentGuid:e.instanceGuid,objectData:{catalogItemId:e.catalogItemId,quantity:t,initiatedBy:T.DCUI}}}function Zf(e,t){return t.find((t=>t.catalogItemId===e.catalogItemId))}function*Qf(e){yield*Xf("ProcessingState",0),yield r.put({type:Q,payload:{event:"Completed",completionReason:e}})}function*Xf(e,t){yield r.put({type:X,payload:{key:e,value:t}})}function*ey(e,t){yield*Xf("ProcessingState",0),yield r.put({type:te,payload:{key:e,value:t}})}const ty=["Success","Unspecified","Error"],ny=["Implicit","Explicit"];function*ay(e,t){if("Checkout"!==t.payload.event)return;yield r.put({type:te,payload:{key:"checkout",value:iy(t.payload),offerPositionIndex:t.payload.offerPositionIndex}});const n=t.payload.data;if(n){const a="Completed"===n.event;if("Completed"===n.event||"Dismissed"===n.event){(a?ty.includes(n.reason):ny.includes(n.reason))?yield r.put({type:Q,payload:Object.assign(Object.assign({event:n.event},a?{completionReason:n.reason}:{dismissalReason:n.reason}),{offerPositionIndex:t.payload.offerPositionIndex})}):yield r.call(e,{level:N,code:"CHECKOUT_BUTTON_INVALID_OFFERLIFECYCLE",message:`Misconfigured offer lifecycle payload in handleCheckoutLifecycle: ${n}.`})}else yield r.call(e,{level:N,code:"CHECKOUT_BUTTON_UNKNOWN_EVENT",message:`Unknown event type in checkout lifecycle: ${JSON.stringify(n)}`})}}function iy(e){var t;return null!==(t={ViewOffer:0,ViewTransactionDetails:1,EditPayment:2,EditShipping:3,EditPaymentAndShipping:4,CostBreakdown:5,Confirmation:6,CloseOffer:7}[e.targetStep])&&void 0!==t?t:0}function*oy(e,t){yield r.all([r.spawn(Uf),r.takeEvery(sf,ay.bind(null,t)),r.takeEvery(of,Vf),r.takeLatest(lf,zf.bind(null,e,t)),r.takeLatest(cf,Hf.bind(null,t)),r.takeLatest(df,qf.bind(null)),r.takeEvery(re,Uu.bind(null,e,t)),r.takeEvery("*",Oo.bind(null,[z,re],e))])}Object.assign(Object.assign({},se),{INITIATE_INSTANT_PURCHASE:lf,INSTANT_PURCHASE_PARTNER_RESPONSE:cf,INSTANT_PURCHASE_WSDK_RESPONSE:df});const ry=(new Sn).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=_f({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion},fulfillmentDetails:Rf(i.offerData.creative)}),d=function(e,t,n=_f()){const a=l(),i=s.configureStore({reducer:Nf,devTools:{name:"Instant Purchase"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(oy,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs($n,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(_i,{}),e.jsx(a.Provider,{store:d,children:e.jsx(Ri,{settings:i,dispatch:d.dispatch,children:e.jsx(Af,{})})})]})}))}}));var sy=Object.freeze({__proto__:null,moduleConnectorBuilder:ry});const ly=t.createContext(null),cy=({children:n})=>{var a;const[i,o]=t.useState([]),[r,s]=t.useState(0),[l,c]=t.useState(0),d=Yt();return t.useEffect((()=>{let e=0;const t=i.length,n=setInterval((()=>{e=e+1>=t?0:e+1,s(e)}),l);return()=>clearInterval(n)}),[l,i]),e.jsx(ly.Provider,{value:{images:i,activeIndex:r,duration:l,setImages:o,setActiveIndex:s,setDuration:c},children:e.jsx(Jt,{value:d({data:{"image.title":null===(a=i[r])||void 0===a?void 0:a.title}},"creativeCopy"),children:n})})};function dy({active:n,duration:a,containerStyles:i,indicatorStyles:o}){const r=t.useRef(null);return t.useEffect((()=>{n&&r.current&&function(e,t){const n="animate"in e&&"onfinish"in Animation.prototype&&"oncancel"in Animation.prototype&&"finish"in Animation.prototype,a=[{width:0},{width:"100%"}];if(n){const n=e.animate(a,{duration:t,iterations:1});return()=>{n.finish()}}}(r.current,a)}),[n]),e.jsx("div",{style:Object.assign({position:"relative",height:"2px",width:"100%",backgroundColor:"#FFFFFF66"},i),children:e.jsx("span",{ref:r,style:Object.assign({animationIterationCount:"infinite",animationFillMode:"forwards",animationTimingFunction:"linear",position:"absolute",top:0,left:0,height:"100%",backgroundColor:"#FFF",width:n?"100%":0},o)})})}function uy(e){const n=t.useContext(jn),a=[];return e.forEach((e=>{const t=n(`${e}.src`,"copy"),i=n(`${e}.title`,"copy");if(void 0===t)return;const o=function(e={}){return Object.assign({light:"https://plus.unsplash.com/premium_photo-1675826774817-fe983ceb0475?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=200&q=80",dark:"https://images.unsplash.com/photo-1679941734238-56628f5991f7?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=200&q=80"},e)}({light:t,title:i});a.push(o)})),a}function py({schema:n,testId:a}){const i=JSON.parse(n.data),{styles:o,duration:r,imageKeys:s}=i,l=t.useContext(ly),c=uy(s);return t.useEffect((()=>{null==l||l.setImages(c),null==l||l.setDuration(r)}),[]),e.jsxs("div",{"data-testid":a,style:Object.assign({position:"relative",flexShrink:1,flexGrow:0,width:"100%"},o.elements.own),children:[t.Children.toArray(c.map(((t,n)=>e.jsx("img",{src:t.light,alt:t.title,style:Object.assign({opacity:n===(null==l?void 0:l.activeIndex)?1:0,position:0===n?"relative":"absolute",display:0===n?"block":"",top:0,width:"100%",height:"100%",maxHeight:"100%",maxWidth:"100%",transition:"opacity 300ms ease-in-out",objectFit:"contain"},o.elements.image)})))),e.jsx("div",{style:Object.assign({display:"flex",gap:"2px",width:"70%",position:"absolute",margin:"0 15%",bottom:"8px",zIndex:20,justifyContent:"center"},o.elements.indicatorWrapper),children:t.Children.toArray(c.map(((t,n)=>e.jsx(dy,{duration:r,active:n===(null==l?void 0:l.activeIndex),containerStyles:o.elements.indicatorContainer,indicatorStyles:o.elements.indicator}))))})]})}const fy={allowedTags:["em","strong","a","br","u","p","li","ul","ol","span"],allowedAttributes:{a:["href","target"],strong:[],em:[],br:[],u:[],p:[],ol:[],ul:[],li:[],span:[]},allowedSchemes:["http","https"]},yy=new Map([["&","_;^;_"]]),hy=new RegExp(`<a *(?=${fy.allowedAttributes.a.join("|")}|>)`,"g"),my=new RegExp("<span*>","g"),vy=new RegExp(`<a *(?:(?:${fy.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),gy=new RegExp("(<br *?>)|(<br *?/>)","g"),by="<br/>";function Ey(n){const a=Yt(),i=Rn(),o=t.useMemo((()=>{const e=a(n.schema.value);if(!function(e){const t=function(e){return e.replaceAll(vy,((e,t)=>{const n=t.replaceAll("&",yy.get("&"));return e.replace(t,n)})).replaceAll(gy,by)}(e);return t===u(t,fy)}(e))throw new _("FAILED_SANITISING_HTML","Invalid HTML tags");return e}),[n.schema.value,a]),{tabIndex:r,styles:s,isDisabled:l}=m(i);return o?e.jsx(Aa,{styles:n.schema.styles,children:({classnames:t})=>{const a=[(null==t?void 0:t.link)?`class = "${null==t?void 0:t.link}"`:"",l?'tabindex="-1"':"",l?"style=\"pointer-events: 'none'; user-select: none;\"":"",l?'aria-disabled="true"':""].filter((e=>e.length>0));return i=o,new RegExp("</(p|ul|ol)>").test(i)?e.jsx("div",{tabIndex:r,style:s,"aria-hidden":l,className:null==t?void 0:t.own,"data-testid":n.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:o.replace(hy,`<a ${a.join(" ")}`).replace(my,`<span${(null==t?void 0:t.span)?` class=${t.span}`:""}>`)}}):e.jsx("p",{tabIndex:r,style:s,"aria-hidden":l,className:null==t?void 0:t.own,"data-testid":n.testId,"data-e2e":"RichText",dangerouslySetInnerHTML:{__html:o.replace(hy,`<a ${a.join(" ")}`).replace(my,`<span${(null==t?void 0:t.span)?` class=${t.span}`:""}>`)}});var i}}):null}function Iy({schema:n}){const a=St(),i=ut(Un(),tn()),o=JSON.parse(n.data),[r]=d({loop:!1,align:"start",slidesToScroll:2,containScroll:"trimSnaps"}),{styles:s,body:{tierItems:l}}=o;if(!l||!l.length)return;const c=l.length>2;return e.jsx("div",{className:i`
137
137
  position: relative;
138
138
  `,"data-testid":"ProductTierCarousel",children:e.jsx("div",Object.assign({},c&&{ref:r},{className:i`
139
139
  width: 100%;
@@ -172,24 +172,24 @@
172
172
  background-color: ${(null===(d=null==s?void 0:s.primaryColor)||void 0===d?void 0:d.light)||"#F9FAFB"};
173
173
  color: #f9fafb;
174
174
  }
175
- `,children:t.Children.toArray(n.map((e=>a(e))))})})))})}))})}const my=(e,t)=>`\n position: absolute;\n top: 0;\n ${t?"right: 0;":"left: 0;"}\n bottom: 0;\n opacity: 0;\n z-index: 10;\n padding: 0 16px;\n transition: opacity 200ms ease-in-out;\n pointer-events: ${e?"none":"auto"};\n background: linear-gradient(${t?"":"-"}90deg, rgba(0,0,0,0.00) 0%, rgba(0,0,0,0.70) 100%);\n &:hover {\n opacity: ${e?0:1};\n }\n`;function vy({disabled:t,onClick:n}){const a=dt(Bn(),en());return e.jsx("button",{onClick:n,disabled:t,className:a`
176
- ${my(t)}
177
- `,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M14.2951 18L15.7051 16.59L11.1251 12L15.7051 7.41L14.2951 6L8.29508 12L14.2951 18Z",fill:"#ffffff"})})})}function gy({disabled:t,onClick:n}){const a=dt(Bn(),en());return e.jsx("button",{onClick:n,disabled:t,className:a`
178
- ${my(t,!0)}
179
- `,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M9.70492 6L8.29492 7.41L12.8749 12L8.29492 16.59L9.70492 18L15.7049 12L9.70492 6Z",fill:"#ffffff"})})})}function by(e){const n=t.useContext(_n);return e.map((e=>({src:n(`${e}.link.src`,"copy"),open:n(`${e}.link.open`,"copy")})))}function Ey(e){return{type:"StaticImage",node:{url:e,styles:{elements:{own:[{default:{border:{borderRadius:5,borderWidth:"0"},dimension:{width:{type:"percentage",value:100}}}}]}}}}}function Iy(e,t){return{type:"CreativeResponse",node:{responseKey:"positive",styles:{elements:{own:[{default:{spacing:{padding:"0"},background:{backgroundColor:{light:"#F9FAFB"}},border:{borderWidth:"0"}}}]}},children:t?[Ey(t)]:[]}}}function Sy({schema:n}){var a,i;const o=It(),r=dt(Bn(),en()),s=function(e){try{return JSON.parse(e.data)}catch(e){return null}}(n),[l,c]=[oy((null===(a=null==s?void 0:s.body)||void 0===a?void 0:a.imageKeys)||[]),by((null===(i=null==s?void 0:s.body)||void 0===i?void 0:i.imageKeys)||[])],u=Tt(),p=u.creative.responseOptionsMap.positive,{carousel:f,styles:y}=(null==s?void 0:s.body)||{},h=(null==f?void 0:f.slidesToScroll)||3,m=(null==f?void 0:f.aspectRatio)||"1/1",v=!(null==f?void 0:f.disabled)&&Array.isArray(l)&&l.length>2,g=v?l:null==l?void 0:l.slice(0,h),[b,E]=d({loop:!1,align:"start",slidesToScroll:h,containScroll:"trimSnaps"}),{prevBtnDisabled:I,nextBtnDisabled:S,onPrevButtonClick:x,onNextButtonClick:C}=function(e){const[n,a]=t.useState(!0),[i,o]=t.useState(!0);return t.useEffect((()=>{if(!e)return;const t=()=>{a(!e.canScrollPrev()),o(!e.canScrollNext())};t(),e.on("reInit",t).on("select",t)}),[e]),{prevBtnDisabled:n,nextBtnDisabled:i,onPrevButtonClick:e?e.scrollPrev:void 0,onNextButtonClick:e?e.scrollNext:void 0}}(E);return s&&g&&g.length&&p?e.jsxs("div",{"data-testid":"product-catalog-carousel",className:r`
175
+ `,children:t.Children.toArray(n.map((e=>a(e))))})})))})}))})}const Sy=(e,t)=>`\n position: absolute;\n top: 0;\n ${t?"right: 0;":"left: 0;"}\n bottom: 0;\n opacity: 0;\n z-index: 10;\n padding: 0 16px;\n transition: opacity 200ms ease-in-out;\n pointer-events: ${e?"none":"auto"};\n background: linear-gradient(${t?"":"-"}90deg, rgba(0,0,0,0.00) 0%, rgba(0,0,0,0.70) 100%);\n &:hover {\n opacity: ${e?0:1};\n }\n`;function xy({disabled:t,onClick:n}){const a=ut(Un(),tn());return e.jsx("button",{onClick:n,disabled:t,className:a`
176
+ ${Sy(t)}
177
+ `,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M14.2951 18L15.7051 16.59L11.1251 12L15.7051 7.41L14.2951 6L8.29508 12L14.2951 18Z",fill:"#ffffff"})})})}function Cy({disabled:t,onClick:n}){const a=ut(Un(),tn());return e.jsx("button",{onClick:n,disabled:t,className:a`
178
+ ${Sy(t,!0)}
179
+ `,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M9.70492 6L8.29492 7.41L12.8749 12L8.29492 16.59L9.70492 18L15.7049 12L9.70492 6Z",fill:"#ffffff"})})})}function wy(e){const n=t.useContext(jn);return e.map((e=>({src:n(`${e}.link.src`,"copy"),open:n(`${e}.link.open`,"copy")})))}function Oy(e){return{type:"StaticImage",node:{url:e,styles:{elements:{own:[{default:{border:{borderRadius:5,borderWidth:"0"},dimension:{width:{type:"percentage",value:100}}}}]}}}}}function Ty(e,t){return{type:"CreativeResponse",node:{responseKey:"positive",styles:{elements:{own:[{default:{spacing:{padding:"0"},background:{backgroundColor:{light:"#F9FAFB"}},border:{borderWidth:"0"}}}]}},children:t?[Oy(t)]:[]}}}function Ay({schema:n}){var a,i;const o=St(),r=ut(Un(),tn()),s=function(e){try{return JSON.parse(e.data)}catch(e){return null}}(n),[l,c]=[uy((null===(a=null==s?void 0:s.body)||void 0===a?void 0:a.imageKeys)||[]),wy((null===(i=null==s?void 0:s.body)||void 0===i?void 0:i.imageKeys)||[])],u=At(),p=u.creative.responseOptionsMap.positive,{carousel:f,styles:y}=(null==s?void 0:s.body)||{},h=(null==f?void 0:f.slidesToScroll)||3,m=(null==f?void 0:f.aspectRatio)||"1/1",v=!(null==f?void 0:f.disabled)&&Array.isArray(l)&&l.length>2,g=v?l:null==l?void 0:l.slice(0,h),[b,E]=d({loop:!1,align:"start",slidesToScroll:h,containScroll:"trimSnaps"}),{prevBtnDisabled:I,nextBtnDisabled:S,onPrevButtonClick:x,onNextButtonClick:C}=function(e){const[n,a]=t.useState(!0),[i,o]=t.useState(!0);return t.useEffect((()=>{if(!e)return;const t=()=>{a(!e.canScrollPrev()),o(!e.canScrollNext())};t(),e.on("reInit",t).on("select",t)}),[e]),{prevBtnDisabled:n,nextBtnDisabled:i,onPrevButtonClick:e?e.scrollPrev:void 0,onNextButtonClick:e?e.scrollNext:void 0}}(E);return s&&g&&g.length&&p?e.jsxs("div",{"data-testid":"product-catalog-carousel",className:r`
180
180
  position: relative;
181
181
  margin: 8px 0;
182
182
  ${y||""}
183
- `,children:[v?e.jsx(vy,{onClick:x,disabled:I}):null,e.jsx("div",Object.assign({},v&&{ref:b},{className:r`
183
+ `,children:[v?e.jsx(xy,{onClick:x,disabled:I}):null,e.jsx("div",Object.assign({},v&&{ref:b},{className:r`
184
184
  width: 100%;
185
185
  margin: auto;
186
186
  overflow: hidden;
187
187
  `,children:e.jsx("div",{className:r`
188
188
  display: flex;
189
189
  gap: 16px;
190
- `,children:t.Children.toArray(g.map(((t,n)=>{var a,i;const s=Object.assign(Object.assign({},p),{url:null===(a=null==c?void 0:c[n])||void 0===a?void 0:a.src}),l=Object.assign(Object.assign({},u),{creative:Object.assign(Object.assign({},u.creative),{responseOptionsMap:Object.assign(Object.assign({},u.creative.responseOptionsMap),{positive:s})})});return e.jsx(Ot,{context:l,children:e.jsx("div",{"data-testid":"carousel-item",className:r`
190
+ `,children:t.Children.toArray(g.map(((t,n)=>{var a,i;const s=Object.assign(Object.assign({},p),{url:null===(a=null==c?void 0:c[n])||void 0===a?void 0:a.src}),l=Object.assign(Object.assign({},u),{creative:Object.assign(Object.assign({},u.creative),{responseOptionsMap:Object.assign(Object.assign({},u.creative.responseOptionsMap),{positive:s})})});return e.jsx(Tt,{context:l,children:e.jsx("div",{"data-testid":"carousel-item",className:r`
191
191
  min-width: 0;
192
192
  overflow: hidden;
193
193
  aspect-ratio: ${m};
194
194
  ${v?"flex: 0 0 33%;":`width: ${100/h}%;`}
195
- `,children:o((null===(i=null==c?void 0:c[n])||void 0===i?void 0:i.src)?Iy(c[n],t):Ey(t))})})})))})})),v?e.jsx(gy,{onClick:C,disabled:S}):null]}):null}function xy({schema:t}){const n=JSON.parse(t.data),{styles:a,content:i,smallFontSize:o,largeFontSize:r}=n,s=Jt(),l=`\n @keyframes textAnimation {\n 0% { transform: scale(1); }\n 42% { transform: scale(1.2); } /* 800ms out of 1900ms cycle */\n 60% { transform: scale(1.2); }\n 100% { transform: scale(1); }\n }\n\n .animated-text {\n font-size: ${o}px;\n animation: textAnimation 1.9s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;\n }\n `;return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:l}),e.jsx("p",{style:Object.assign({},a),className:"animated-text",children:s(i)})]})}const Cy={EscapeHatch:function(t){if("EscapeHatch"===t.type&&t.node.data){const n=JSON.parse(t.node.data);switch(null==n?void 0:n.type){case"ImageCarousel":return e.jsx(ry,{schema:t.node});case"RichText":return e.jsx(yy,{schema:n.node});case"ProductTierCarousel":return e.jsx(hy,{schema:t.node});case"ProductCatalogCarousel":return e.jsx(Sy,{schema:t.node});case"TextAnimate":return e.jsx(xy,{schema:t.node});default:return}}}};function wy(){const t=On(),n=It();return e.jsx(ay,{children:e.jsx(St,{value:n,overrides:Cy,children:e.jsx(Et,{children:e=>e(t)})})})}const Oy={staticData:_u,childLayouts:Lu};function Ty(e={}){return Object.assign({staticData:null,childLayouts:{launched:{}}},e)}function Ay(e){let t,n,a;return l.eventChannel((i=>(Promise.race([e.onClose().then((()=>"CLOSED")),new Promise((n=>{t=e.onEvent("PLUGIN_TRANSITION_OFFER_SUCCESS").subscribe((()=>{n("SUCCESS")}))})),new Promise((t=>{n=e.onEvent("PLUGIN_TRANSITION_OFFER_CLOSE").subscribe((()=>{t("UNSPECIFIED")}))})),new Promise((e=>{a=e}))]).then((e=>{"END"!==e&&(i(e),i(l.END))})),()=>{null==t||t.unsubscribe(),null==n||n.unsubscribe(),a("END")})))}function*Ry(e,t){for(;;){switch(yield r.take(e)){case"CLOSED":t({type:Q,payload:{event:"Dismissed",dismissalReason:"Implicit"}});break;case"SUCCESS":t({type:Q,payload:{event:"Completed",completionReason:"Success"}});break;case"UNSPECIFIED":t({type:Q,payload:{event:"Completed",completionReason:"Unspecified"}})}}}function*Ny(e,t,n){const a=W(n.payload)||J(n.payload)||H(n.payload)?n.payload:n.payload.responseOption;switch(a.action){case"Url":case"CaptureOnly":yield r.call(e.globalDispatch.bind(e),n);break;case"Fulfillment":yield r.put({type:ee,payload:{name:"OFFER_ENGAGEMENT"}}),a.isPositive&&(yield r.put({type:ee,payload:{name:"POSITIVE_ENGAGEMENT"}})),yield*function*(e,t,n){if(q(n)){const{responseOption:a,fulfillment:i}=n;yield r.put({type:Z,payload:{name:"SignalResponse",parentGuid:a.instanceGuid,responseActionPayload:{name:"Fulfillment"}}});const o=yield r.call(e.createChildPlugin.bind(e),i);if("object"==typeof o&&"onClose"in o){const t=yield r.call(Ay,o);if("object"==typeof t&&"take"in t)return void(yield r.call(Ry,t,e.globalDispatch.bind(e)))}yield r.call(t,{level:R,code:"UNEXPECTED_NEXT_VALUE_IN_SAGA",message:'Received an unexpected input at a step in the saga "handleFullfillmentResponse" and could not continue.'})}else yield r.call(t,{level:R,code:"INVALID_FULFILLMENT_PAYLOAD",message:`Fulfillment payload is invalid, fulfillment: ${n}`})}(e,t,n.payload)}}function*Ly(e,t){yield r.all([r.takeLatest(z,Ny.bind(null,e,t)),r.takeEvery(re,Mu.bind(null,e,t)),r.takeEvery("*",wo.bind(null,[z,re],e))])}Object.assign({},se);const _y=(new In).withAppFactory((function(i){if(i.rootElement){const o=n.createRoot(i.rootElement),r=Ty({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),c=function(e,t,n=Ty()){const a=l(),i=s.configureStore({reducer:Oy,devTools:{name:"layouts-xp-sandbox"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(Ly,e,t),i}(i.gateway,i.logger,r);o.render(e.jsx(t.StrictMode,{children:e.jsxs(Pn,{info:{layoutType:"LayoutVariant",referralCreativeId:String(i.offerData.creative.referralCreativeId)||"N/A"},children:[e.jsx(Ni,{}),e.jsx(a.Provider,{store:c,children:e.jsx(Ai,{settings:i,dispatch:c.dispatch,children:e.jsx(wy,{})})})]})}))}}));var jy=Object.freeze({__proto__:null,moduleConnectorBuilder:_y});exports.BehaviorSubject=class extends Su{constructor(e){super(),this._lastValue=e}subscribe(e,t,n){const a=Eu(e,t,n);return a.next(this._lastValue),super.subscribe(a)}next(e){return this._lastValue=e,super.next(e)}getValue(){return this._lastValue}},exports.CatchSubscriber=wu,exports.DisplayPreset={FULLSCREEN:"DisplayPreset.FULLSCREEN",EMBEDDED:"DisplayPreset.EMBEDDED",ATTACHED:"DisplayPreset.ATTACHED"},exports.ErrorLevel={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},exports.FirstValueFromError=xu,exports.Observable=Iu,exports.ReplaySubject=class extends Su{constructor(e=-1){super(),this._buffer=[],this._error=null,this._bufferLength=e}subscribe(e,t,n){const a=Eu(e,t,n);let i=!0;return this._buffer.filter((e=>(e===this._error&&(i=!1),i))).forEach((e=>a.next(e))),this._error&&a.error(this._error),a.error=e=>{this._error=e,t(e)},super.subscribe(a)}next(e){this._error||this._addToBuffer(e),super.next(e)}error(e){this._error=e,this._addToBuffer(e),super.error(e)}_addToBuffer(e){-1!==this._bufferLength&&this._buffer.length===this._bufferLength?(this._buffer.shift(),this._buffer.push(e)):this._buffer.push(e)}},exports.Subject=Su,exports.Subscription=gu,exports.addCatchToSubscriber=function(e,t){return new wu(e,t)},exports.combineLatest=(...e)=>new Iu((t=>{if(!e.length)return t.complete(),bu;const n=new gu,a=new Array(e.length),i=new Array(e.length),o=e=>!a.includes(void 0)&&t.next(e);for(let t=0;t<e.length;t++){const r=e[t].subscribe((e=>{i[t]=e,a[t]=!0,o(i)}));n.add(r)}return()=>n.unsubscribe()})),exports.dcuiUtils=Au,exports.filter=e=>t=>(!1===e(t.value)&&(t.skip=!0),t),exports.first=e=>t=>(e?!0===e(t.value)?t.complete=!0:t.skip=!0:t.complete=!0,t),exports.firstValueFrom=(e,t)=>{let n;const a="object"==typeof t;return new Promise(((i,o)=>{n=e.subscribe(i,o,(()=>{a?i(t.defaultValue):o(new Error(xu.CompletedBeforeEmit))}))})).then((e=>(n.unsubscribe(),e))).catch((e=>{throw n.unsubscribe(),e}))},exports.fromEvent=(e,t)=>new Iu((n=>{const a=e=>n.next(e);return e.addEventListener(t,a),()=>e.removeEventListener(t,a)})),exports.fromPromise=function(e){return new Iu((t=>{e.then((e=>{t.next(e),t.complete()}),(e=>t.error(e)))}))},exports.init=function(i,o){return mu(this,void 0,void 0,(function*(){const{pluginId:r,pageInstanceGuid:s}=yield function(e){return Promise.allSettled([(e.contextService.getUId||e.contextService.getPluginInstanceId)(),e.contextService.getRoktPageInstanceGuid()]).then((([e,t])=>({pluginId:"fulfilled"===e.status?e.value:O.pluginId,pageInstanceGuid:"fulfilled"===t.status?t.value:O.pageInstanceGuid}))).catch((()=>O))}(o),l=n.createRoot(i),c=hu(o);l.render(e.jsxs(t.StrictMode,{children:[e.jsx(Ni,{}),e.jsx(zn,{children:e.jsx(a.Provider,{store:c,children:e.jsxs(Mn.Provider,{value:r,children:[e.jsx(Ho,{}),e.jsx(xt.Provider,{value:i,children:e.jsx(ui,{extensions:vu,extendStore:c.extend.bind(c),children:e.jsx(kl,{pageInstanceGuid:s})})})]})})})]}))}))},exports.lastValueFrom=(e,t)=>new Promise(((n,a)=>{let i;"object"==typeof t&&(i=t.defaultValue),e.subscribe((e=>i=e),(e=>a(e)),(()=>n(i)))})),exports.map=e=>t=>{const n=e(t.value);return new Ou(n)},exports.merge=(...e)=>new Iu((t=>{const n=new gu;let a=0;for(const i of e)n.add(i.subscribe((e=>t.next(e)),(e=>t.error(e)),(()=>{a+=1,a>=e.length&&t.complete()})));return()=>n.unsubscribe()})),exports.noop=bu,exports.normaliseToObserver=Eu,exports.of=(...e)=>new Iu((t=>{for(const n of e)t.next(n)})),exports.pipe=e=>(...t)=>new Iu((n=>{const a=e.subscribe((e=>Tu(void 0,void 0,void 0,(function*(){try{let a=new Ou(e);for(const e of t){const t=e(a);if(a=t.then?yield t:t,!0===a.skip||!0===a.complete)break}if(a.skip)return;n.next(a.value),!0===a.complete&&n.complete()}catch(e){n.error(e)}}))),(e=>n.error(e)),(()=>n.complete()));return()=>a.unsubscribe()})),exports.tap=e=>t=>(e(t.value),t);
195
+ `,children:o((null===(i=null==c?void 0:c[n])||void 0===i?void 0:i.src)?Ty(c[n],t):Oy(t))})})})))})})),v?e.jsx(Cy,{onClick:C,disabled:S}):null]}):null}function Ry({schema:t}){const n=JSON.parse(t.data),{styles:a,content:i,smallFontSize:o,largeFontSize:r}=n,s=Yt(),l=`\n @keyframes textAnimation {\n 0% { transform: scale(1); }\n 42% { transform: scale(1.2); } /* 800ms out of 1900ms cycle */\n 60% { transform: scale(1.2); }\n 100% { transform: scale(1); }\n }\n\n .animated-text {\n font-size: ${o}px;\n animation: textAnimation 1.9s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;\n }\n `;return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:l}),e.jsx("p",{style:Object.assign({},a),className:"animated-text",children:s(i)})]})}const Ny={EscapeHatch:function(t){if("EscapeHatch"===t.type&&t.node.data){const n=JSON.parse(t.node.data);switch(null==n?void 0:n.type){case"ImageCarousel":return e.jsx(py,{schema:t.node});case"RichText":return e.jsx(Ey,{schema:n.node});case"ProductTierCarousel":return e.jsx(Iy,{schema:t.node});case"ProductCatalogCarousel":return e.jsx(Ay,{schema:t.node});case"TextAnimate":return e.jsx(Ry,{schema:t.node});default:return}}}};function _y(){const t=Tn(),n=St();return e.jsx(cy,{children:e.jsx(xt,{value:n,overrides:Ny,children:e.jsx(It,{children:e=>e(t)})})})}const Ly={staticData:Du,childLayouts:ju};function jy(e={}){return Object.assign({staticData:null,childLayouts:{launched:{}}},e)}function Dy(e){let t,n,a;return l.eventChannel((i=>(Promise.race([e.onClose().then((()=>"CLOSED")),new Promise((n=>{t=e.onEvent("PLUGIN_TRANSITION_OFFER_SUCCESS").subscribe((()=>{n("SUCCESS")}))})),new Promise((t=>{n=e.onEvent("PLUGIN_TRANSITION_OFFER_CLOSE").subscribe((()=>{t("UNSPECIFIED")}))})),new Promise((e=>{a=e}))]).then((e=>{"END"!==e&&(i(e),i(l.END))})),()=>{null==t||t.unsubscribe(),null==n||n.unsubscribe(),a("END")})))}function*ky(e,t){for(;;){switch(yield r.take(e)){case"CLOSED":t({type:Q,payload:{event:"Dismissed",dismissalReason:"Implicit"}});break;case"SUCCESS":t({type:Q,payload:{event:"Completed",completionReason:"Success"}});break;case"UNSPECIFIED":t({type:Q,payload:{event:"Completed",completionReason:"Unspecified"}})}}}function*Py(e,t,n){const a=W(n.payload)||J(n.payload)||q(n.payload)?n.payload:n.payload.responseOption;switch(a.action){case"Url":case"CaptureOnly":yield r.call(e.globalDispatch.bind(e),n);break;case"Fulfillment":yield r.put({type:ee,payload:{name:"OFFER_ENGAGEMENT"}}),a.isPositive&&(yield r.put({type:ee,payload:{name:"POSITIVE_ENGAGEMENT"}})),yield*function*(e,t,n){if(H(n)){const{responseOption:a,fulfillment:i}=n;yield r.put({type:Z,payload:{name:"SignalResponse",parentGuid:a.instanceGuid,responseActionPayload:{name:"Fulfillment"}}});const o=yield r.call(e.createChildPlugin.bind(e),i);if("object"==typeof o&&"onClose"in o){const t=yield r.call(Dy,o);if("object"==typeof t&&"take"in t)return void(yield r.call(ky,t,e.globalDispatch.bind(e)))}yield r.call(t,{level:R,code:"UNEXPECTED_NEXT_VALUE_IN_SAGA",message:'Received an unexpected input at a step in the saga "handleFullfillmentResponse" and could not continue.'})}else yield r.call(t,{level:R,code:"INVALID_FULFILLMENT_PAYLOAD",message:`Fulfillment payload is invalid, fulfillment: ${n}`})}(e,t,n.payload)}}function*$y(e,t){yield r.all([r.takeLatest(z,Py.bind(null,e,t)),r.takeEvery(re,Uu.bind(null,e,t)),r.takeEvery("*",Oo.bind(null,[z,re],e))])}Object.assign({},se);const Fy=(new Sn).withAppFactory((function(i){if(i.rootElement){const o=n.createRoot(i.rootElement),r=jy({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),c=function(e,t,n=jy()){const a=l(),i=s.configureStore({reducer:Ly,devTools:{name:"layouts-xp-sandbox"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run($y,e,t),i}(i.gateway,i.logger,r);o.render(e.jsx(t.StrictMode,{children:e.jsxs($n,{info:{layoutType:"LayoutVariant",referralCreativeId:String(i.offerData.creative.referralCreativeId)||"N/A"},children:[e.jsx(_i,{}),e.jsx(a.Provider,{store:c,children:e.jsx(Ri,{settings:i,dispatch:c.dispatch,children:e.jsx(_y,{})})})]})}))}}));var Gy=Object.freeze({__proto__:null,moduleConnectorBuilder:Fy});exports.BehaviorSubject=class extends Cu{constructor(e){super(),this._lastValue=e}subscribe(e,t,n){const a=Su(e,t,n);return a.next(this._lastValue),super.subscribe(a)}next(e){return this._lastValue=e,super.next(e)}getValue(){return this._lastValue}},exports.CatchSubscriber=Tu,exports.DisplayPreset={FULLSCREEN:"DisplayPreset.FULLSCREEN",EMBEDDED:"DisplayPreset.EMBEDDED",ATTACHED:"DisplayPreset.ATTACHED"},exports.ErrorLevel={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},exports.FirstValueFromError=wu,exports.Observable=xu,exports.ReplaySubject=class extends Cu{constructor(e=-1){super(),this._buffer=[],this._error=null,this._bufferLength=e}subscribe(e,t,n){const a=Su(e,t,n);let i=!0;return this._buffer.filter((e=>(e===this._error&&(i=!1),i))).forEach((e=>a.next(e))),this._error&&a.error(this._error),a.error=e=>{this._error=e,t(e)},super.subscribe(a)}next(e){this._error||this._addToBuffer(e),super.next(e)}error(e){this._error=e,this._addToBuffer(e),super.error(e)}_addToBuffer(e){-1!==this._bufferLength&&this._buffer.length===this._bufferLength?(this._buffer.shift(),this._buffer.push(e)):this._buffer.push(e)}},exports.Subject=Cu,exports.Subscription=Eu,exports.addCatchToSubscriber=function(e,t){return new Tu(e,t)},exports.combineLatest=(...e)=>new xu((t=>{if(!e.length)return t.complete(),Iu;const n=new Eu,a=new Array(e.length),i=new Array(e.length),o=e=>!a.includes(void 0)&&t.next(e);for(let t=0;t<e.length;t++){const r=e[t].subscribe((e=>{i[t]=e,a[t]=!0,o(i)}));n.add(r)}return()=>n.unsubscribe()})),exports.dcuiUtils=Nu,exports.filter=e=>t=>(!1===e(t.value)&&(t.skip=!0),t),exports.first=e=>t=>(e?!0===e(t.value)?t.complete=!0:t.skip=!0:t.complete=!0,t),exports.firstValueFrom=(e,t)=>{let n;const a="object"==typeof t;return new Promise(((i,o)=>{n=e.subscribe(i,o,(()=>{a?i(t.defaultValue):o(new Error(wu.CompletedBeforeEmit))}))})).then((e=>(n.unsubscribe(),e))).catch((e=>{throw n.unsubscribe(),e}))},exports.fromEvent=(e,t)=>new xu((n=>{const a=e=>n.next(e);return e.addEventListener(t,a),()=>e.removeEventListener(t,a)})),exports.fromPromise=function(e){return new xu((t=>{e.then((e=>{t.next(e),t.complete()}),(e=>t.error(e)))}))},exports.init=function(i,o){return gu(this,void 0,void 0,(function*(){const{pluginId:r,pageInstanceGuid:s}=yield function(e){return Promise.allSettled([(e.contextService.getUId||e.contextService.getPluginInstanceId)(),e.contextService.getRoktPageInstanceGuid()]).then((([e,t])=>({pluginId:"fulfilled"===e.status?e.value:O.pluginId,pageInstanceGuid:"fulfilled"===t.status?t.value:O.pageInstanceGuid}))).catch((()=>O))}(o),l=n.createRoot(i),c=vu(o);l.render(e.jsxs(t.StrictMode,{children:[e.jsx(_i,{}),e.jsx(Hn,{children:e.jsx(a.Provider,{store:c,children:e.jsxs(Bn.Provider,{value:r,children:[e.jsx(Wo,{}),e.jsx(Ct.Provider,{value:i,children:e.jsx(pi,{extensions:bu,extendStore:c.extend.bind(c),children:e.jsx($l,{pageInstanceGuid:s})})})]})})})]}))}))},exports.lastValueFrom=(e,t)=>new Promise(((n,a)=>{let i;"object"==typeof t&&(i=t.defaultValue),e.subscribe((e=>i=e),(e=>a(e)),(()=>n(i)))})),exports.map=e=>t=>{const n=e(t.value);return new Au(n)},exports.merge=(...e)=>new xu((t=>{const n=new Eu;let a=0;for(const i of e)n.add(i.subscribe((e=>t.next(e)),(e=>t.error(e)),(()=>{a+=1,a>=e.length&&t.complete()})));return()=>n.unsubscribe()})),exports.noop=Iu,exports.normaliseToObserver=Su,exports.of=(...e)=>new xu((t=>{for(const n of e)t.next(n)})),exports.pipe=e=>(...t)=>new xu((n=>{const a=e.subscribe((e=>Ru(void 0,void 0,void 0,(function*(){try{let a=new Au(e);for(const e of t){const t=e(a);if(a=t.then?yield t:t,!0===a.skip||!0===a.complete)break}if(a.skip)return;n.next(a.value),!0===a.complete&&n.complete()}catch(e){n.error(e)}}))),(e=>n.error(e)),(()=>n.complete()));return()=>a.unsubscribe()})),exports.tap=e=>t=>(e(t.value),t);