@rokt/dcui-orchestrator 0.0.4-rc.20 → 0.0.4-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +14 -14
- package/dist/index.js +14 -14
- package/dist/libraries/dcui-components/src/components/button-state-trigger/button-state-trigger.d.ts +6 -0
- package/dist/libraries/dcui-components/src/components/button-state-trigger/factory.d.ts +2 -0
- package/dist/libraries/dcui-components/src/components/button-state-trigger/index.d.ts +2 -0
- package/dist/modules/instant-purchase/src/components/catalog-combined-collection/catalog-combined-collection.d.ts +1 -19
- package/dist/modules/instant-purchase/src/components/catalog-combined-collection/factory.d.ts +2 -0
- package/dist/modules/instant-purchase/src/components/catalog-combined-collection/index.d.ts +2 -0
- package/node_modules/@rokt/dcui-layout-schema/dist/schema.d.ts +188 -5
- package/node_modules/@rokt/dcui-layout-schema/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@rokt/dcui-layout-schema/package.json +1 -1
- package/node_modules/@rokt/dcui-layout-schema/v1.7/index.d.ts +2218 -0
- package/node_modules/@rokt/dcui-layout-schema/v1.7/index.js +4 -0
- package/package.json +2 -2
- package/dist/modules/instant-purchase/src/components/button-state-trigger/button-state-trigger.d.ts +0 -9
package/dist/index.cjs
CHANGED
|
@@ -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 S={type:Q,payload:{key:d,value:null!=u?u:1}},w={type:Y,payload:{name:"SignalUserInteraction",action:"Swipe",context:"SlideStateTrigger"}},C=e.schema.styles?M(ei,e.schema.styles):ei,O=t.useRef(null),T=t.useRef(null),A=t.useRef(null),R=t.useRef(!1),L=t.useRef(void 0),{isDisabled:j}=m(s);t.useEffect((()=>{if(n)return g()?(document.addEventListener("touchmove",D),document.addEventListener("touchend",N)):(document.addEventListener("mousemove",D),document.addEventListener("mouseup",N)),F}),[n]);const N=()=>{F(),L.current=void 0,a(!1),i||(G(!0),R.current?($(P()),k()):$(0))},_=e=>{n||i||j||(L.current=ai(e),G(!1),a(!0))},D=e=>{var t,n;if(ni(A)){const a=Math.min(Math.max(0,(null!==(t=ai(e))&&void 0!==t?t:0)-(null!==(n=L.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(S),c(w),null===(t=null===(e=ni(O).parentElement)||void 0===e?void 0:e.parentElement)||void 0===t||t.focus()},P=()=>ni(O).getBoundingClientRect().width-ni(A).getBoundingClientRect().width,$=e=>{var t;ni(A).style.transform=`translateX(${e}px)`,ni(T).style.transform=`translateX(${e+(null===(t=ni(A))||void 0===t?void 0:t.getBoundingClientRect().width)/2}px)`},G=e=>{e?(ni(A).style.transition="transform .2s",ni(T).style.transition="transform .2s"):(ni(A).style.transition="",ni(T).style.transition="")},F=()=>{document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",N),document.removeEventListener("touchmove",D),document.removeEventListener("touchend",N)};return t.createElement(Oa,{styles:C},(({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:_,onTouchStart:_},null!==(l=null==y?void 0:y.icon)&&void 0!==l?l:"ArrowForward")),t.createElement("button",{className:x,"aria-label":null!=f?f:void 0,onClick:k,disabled:i||j,"data-testid":e.testId&&`${e.testId}-button`},null!==(c=null==p?void 0:p.value)&&void 0!==c?c:"Unlock Offers"))}))}function ni(e){if(!e.current)throw new Error("Unexpected missing reference to required SlideStateTrigger Element");return e.current}function ai(e){var t;return"touches"in e?null===(t=e.touches[0])||void 0===t?void 0:t.clientX:e.clientX}function ii(e){const n=Et();return t.createElement(Oa,{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 oi(e){const n=Tn(),a=ht(),i=e.schema.customStateKey,o=vt(0,(e=>e.customStates[i])),{tabIndex:r,styles:s,isDisabled:l}=m(n),c=()=>{a({type:Q,payload:{key:i,value:o?0:1}})};return t.createElement(Oa,{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(bt,null,(n=>t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0)))))))}))}function ri(e){const n=Et();return t.createElement(Oa,{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 si(e){const n=Et();return t.createElement(Oa,{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 li=t.createContext({extensions:{ctx:new Map,cache:[]}}),ci=()=>t.useContext(li).extensions;function di({extensions:e,extendStore:n,children:a}){const i=ci(),o=new Map([...i.ctx,...e.ctx]),r=i.cache.concat(e.cache);return t.createElement(li.Provider,{value:{extensions:{ctx:o,cache:r},extendStore:n}},a)}function ui(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 pi({data:e}){const n=ui(ci(),e);var a;if((e=>{const{extendStore:n,extensions:a}=t.useContext(li);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 fi(e,n){if(v("Extension",e))return t.createElement(pi,{data:e.node.data})}function yi(e){const n=_n(),a=Ot(),i=Wt(),o=Et(),r=ht(),s=t.useMemo((()=>a.catalogItems||[]),[a]),l=e=>i({data:e},"catalogItem");return t.useEffect((()=>{for(const e of s)r({type:Y,payload:{name:"SignalImpression",parentGuid:e.instanceGuid}})}),[s,r]),s.length>0?t.createElement(Oa,{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($n,{context:a},t.createElement(Nn,{value:n(a)},t.createElement(Ht,{value:l(a)},o(e.schema.template,void 0,U(i,e.testId))))))))))):null}const hi={BasicText:(e,t)=>$a(e,t,!0),StaticLink:(e,t)=>Ka(e,t,!0)};function mi(e){const n=Et();return t.createElement(It,{value:n,overrides:hi},t.createElement(bt,null,(n=>t.createElement(Oa,{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 vi(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,U(t,a)))))}function gi(e){const n=Tn(),a=ht(),o=Et(),r=Wt(),{event:s}=e.schema,{tabIndex:l,styles:c,isDisabled:d}=m(n),u=i.mapObjIndexed((e=>r(e)),s.data||{}),p=()=>{a({type:X,payload:{name:s.type,body:{offerId:u.providerOfferId,title:u.title,description:u.description}}})};return t.createElement(Oa,{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(Ht,{value:r},(null==n?void 0:n.own)?function(e,n,a,i,o){return t.createElement(Kt,{value:a(n)},vi(e,i,o))}(e.schema.children,n.own,a,o,e.testId):vi(e.schema.children,o,e.testId)))}))}function bi(e){const n=ht(),a=e.schema.delay?e.schema.delay:1,i=e.schema.customStateKey,o=vt(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:Q,payload:{key:i,value:o?0:1}})}}),null}function Ei(e){const n=Tn(),a=Wt()(e.schema.value),i=ht(),o=e.schema.customStateKey,r=vt(0,(e=>e.customStates[o])),{tabIndex:s,styles:l,isDisabled:c}=m(n),d=()=>{navigator.clipboard.writeText(a),r||i({type:Q,payload:{key:o,value:1}})};return t.createElement(Oa,{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(bt,null,(n=>t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0)))))))}))}function Ii(e){return()=>{throw new j("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 xi={Column:function(e,n){if("Column"===e.type)return t.createElement(Ta,{schema:e.node,testId:n})},Row:function(e,n){if("Row"===e.type)return t.createElement(Aa,{schema:e.node,testId:n})},StaticImage:function(e,n){if("StaticImage"===e.type)return t.createElement(Ma,{schema:e.node,testId:n})},DataImage:function(e,n){if("DataImage"===e.type)return t.createElement(Ba,{schema:e.node,testId:n})},CreativeResponse:function(e,n){if("CreativeResponse"===e.type)return t.createElement(Fa,{schema:e.node,testId:n})},OneByOneDistribution:Ii("OneByOneDistribution"),StackedDistribution:Ii("StackedDistribution"),CarouselDistribution:Ii("CarouselDistribution"),GroupedDistribution:Ii("GroupedDistribution"),ProgressIndicator:Ii("ProgressIndicator"),ProgressControl:Ii("ProgressControl"),When:function(e,n){if("When"===e.type)return t.createElement(wa,{schema:e.node,testId:n})},Overlay:Ii("Overlay"),CloseButton:Ii("CloseButton"),RichText:function(e,n){if("RichText"===e.type)return t.createElement(ka,{schema:e.node,testId:n})},BasicText:$a,StaticLink:Ka,DataIcon:function(e,n){if("DataIcon"===e.type)return t.createElement(Za,{schema:e.node,testId:n})},StaticIcon:function(e,n){if("StaticIcon"===e.type)return t.createElement(Va,{schema:e.node,testId:n})},ZStack:function(e,n){if("ZStack"===e.type)return t.createElement(Xa,{schema:e.node,testId:n})},FlowRow:function(e,n){if("FlowRow"===e.type)return t.createElement(ii,{schema:e.node,testId:n})},SlideStateTrigger:function(e,n){if("SlideStateTrigger"===e.type)return t.createElement(ti,{schema:e.node,testId:n})},ToggleButtonStateTrigger:function(e,n){if("ToggleButtonStateTrigger"===e.type)return t.createElement(oi,{schema:e.node,testId:n})},PartnerEventButtonTrigger:function(e,n){if("PartnerEventButtonTrigger"===e.type)return t.createElement(gi,{schema:e.node,testId:n})},TimerStateTrigger:function(e,n){if("TimerStateTrigger"===e.type)return t.createElement(bi,{schema:e.node})},CatalogStackedCollection:function(e,n){if("CatalogStackedCollection"===e.type)return t.createElement(yi,{schema:e.node,testId:n})},CatalogResponseButton:Ii("CatalogResponseButton"),ScrollableRow:function(e,n){if("ScrollableRow"===e.type)return t.createElement(ri,{schema:e.node,testId:n})},ScrollableColumn:function(e,n){if("ScrollableColumn"===e.type)return t.createElement(si,{schema:e.node,testId:n})},EscapeHatch:fi,BottomSheet:Ii("BottomSheet"),CatalogQuantityOption:Ii("CatalogQuantityOption"),CatalogRadioGroup:Ii("CatalogRadioGroup"),CatalogQuantityCounter:Ii("CatalogQuantityCounter"),InlineContainer:function(e,n){if("InlineContainer"===e.type)return t.createElement(mi,{schema:e.node,testId:n})},CopyToClipboardButton:function(e,n){if("CopyToClipboardButton"===e.type)return t.createElement(Ei,{schema:e.node,testId:n})}};function Si(e){return function(n,a,i){const o=a&&a[n.type],r=null!=o?o:xi[n.type];return t.createElement(qa,{schema:n,reporter:e},r&&r(n,i)||function(e){throw new j("FAILED_CREATING_LAYOUT_NODE",`Failed to create layout node ${JSON.stringify(e)}`)}(n))}}const wi={transformLinksToAnchorText:function(e={}){return{data:i.mapObjIndexed((e=>Lt(e)?`<a target="_blank" href="${e.url}">${e.title}</a>`:""),e)}}};function Ci(e){const{childLayouts:n}=e,a=ht(),[o,r]=t.useMemo((()=>{const e=i.indexBy(i.prop("childLayoutId"),n);return[e,i.mapObjIndexed((e=>e.childLayoutSchema.predicates),e)]}),[n]),s=ma(r);t.useEffect((()=>{Object.entries(s).forEach((([e,t])=>{const n=o[e];t&&n&&a({type:oe,payload:n})}))}),[s,o,a])}function Oi(e){const{settings:n,dispatch:a,children:i}=e,o=Ut(n.offerData.creative.copy||{})(wi.transformLinksToAnchorText(n.offerData.creative.links),"creativeLink"),r=Si(n.logger),[s,l]=t.useState("ENABLED");return t.useEffect((()=>n.gateway.onInteractivityChange(l)),[n]),ce(n.rootElement,a),t.createElement(Yt.Provider,{value:"VARIANT"},t.createElement(xt.Provider,{value:n.rootElement},t.createElement(Fn.Provider,{value:n.pluginId},t.createElement(xn,{context:n.gateway},t.createElement(wn,{context:n.layoutSchema},t.createElement(Bn.Provider,{value:n.schemaVersion},t.createElement(Ct,{context:n.offerData},t.createElement(Nn,{value:An(n.offerData.creative)},t.createElement(On.Provider,{value:s},t.createElement(It,{value:r},t.createElement(Qt.Provider,{value:n.offerPositionIndex},t.createElement(yt.Provider,{value:a},t.createElement(Ht,{value:o},t.createElement(Ti,null,t.createElement(Ci,{childLayouts:n.childLayouts}),i))))))))))))))}function Ti(e){var n;const{children:a}=e,o=Mn(),r=function(){const[e,n]=t.useState(null),a=t.useContext(In).get();return t.useEffect((()=>a.onGlobalStateChange((t=>{i.equals(t,e)||n(t)}))),[a]),e}(),s=t.useContext(xt)||void 0,l=Xt(),c=t.useCallback((e=>pt(e,o,l,s)),[s]);return r?t.createElement(Kt,{value:c(Object.values(null!==(n=null==r?void 0:r.breakpoint.breakpoints)&&void 0!==n?n:{}))},t.createElement(mt.Provider,{value:r},a)):null}function Ai(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 Ri(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?va(e):ga(e),o.current.isRunning=!1},r.oncancel=()=>{"in"===t?va(e):ga(e),o.current.isRunning=!1},()=>{r.finish()}}return"in"===t?va(e):ga(e),()=>{}}const Li={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=ba(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&&(va(l.current),t.observe(l.current)),()=>{t.disconnect()}}),[e,i]),t.useEffect((()=>e&&!r&&l.current&&i?(s(!0),Ri(l.current,"in",Li[n.type].in,d,i,c)):!e&&r&&l.current&&i?(s(!1),Ri(l.current,"out",Li[n.type].out,d/2,i,c)):()=>{}),[e,i,d]),t.createElement("div",{ref:l,style:{display:"none"},className:o},a)}function Ni(e){const n=Et();return t.createElement(Oa,{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 _i="ACTIVE/ADD",Di="ACTIVE/DELETE",ki="BREAKPOINT/UPDATE_ACTIVE",Pi="BREAKPOINT/INITIALISE",$i="BREAKPOINT/SET_BREAKPOINTS",Gi="FONTS/SET",Fi="LAYOUT/UPDATE",Mi="CONFIG/HANDLE",Bi="PLUGIN/CLOSE_PLUGIN",Ui="SETTINGS/SET",Vi="CACHE/ADD_SERIALIZED_VALUE",zi="CACHE/UPDATE_SERIALIZED_VALUE",qi="CACHE/CLEAR_SERIALIZED_VALUE",Hi="SIGNAL/QUEUE",Wi="SIGNAL/PROCESSED",Ji="SIGNAL/PROCESS",Ki="OVERLAY/DISMISS_OVERLAY",Yi="ERROR/REPORT",Zi="LOG",Qi="CUSTOM_STATES/SET",Xi={LAYOUT_UPDATE:Fi,UPDATE_ACTIVE_BREAKPOINT:ki,INITIALISE_BREAKPOINT:Pi,ACTIVE_ADD:_i,ACTIVE_DELETE:Di,SET_FONTS:Gi,QUEUE_SIGNAL:Hi,SIGNAL_PROCESSED:Wi,CACHE_SERIALIZED_VALUE:Vi,UPDATE_CACHED_SERIALIZED_VALUE:zi,CLEAR_SERIALIZED_VALUE_FROM_CACHE:qi,SET_SETTINGS:Ui,SET_CUSTOM_STATE:Qi},eo={HANDLE_CONFIG:Mi,SET_BREAKPOINTS:$i,CLOSE_PLUGIN:Bi,RAISE_METRIC:V,PREPARE_SIGNAL:te,DISMISS_OVERLAY:Ki,REPORT_ERROR:Yi,LOG:Zi,OPEN_LINK:ne},to="plugin-overlay",no="plugin";function ao(n){var i;const o=n.schema.styles,r=a.useDispatch(),s={type:(null===(i=n.action)||void 0===i?void 0:i.type)||Ki,payload:{id:to,dismissalMethod:n.schema.dismissalMethod}},l=()=>{r(s)},c=Tn(),{tabIndex:d,styles:u,isDisabled:p}=m(c);return e.jsx(Oa,{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(bt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}const io={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var oo;function ro({isOpen:n,schema:o,testId:r,children:s}){const l=de(),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(no))),u=a.useDispatch(),p=()=>{u({type:eo.DISMISS_OVERLAY,payload:{id:to,dismissalMethod:"rokt_backdrop"}})};t.useEffect((()=>{c&&u({type:Y,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=Tn(),{tabIndex:y,isDisabled:h,styles:v}=m(f),g=o.styles?i.mergeRight(io,o.styles):io;if(!n)return null;const b=e.jsx(bt,{children:e=>t.Children.toArray(o.children.map(((t,n)=>e(t,void 0,r?`${r}-child${n}`:void 0))))});return e.jsx(Oa,{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"}(oo||(oo={}));const so={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const lo=t.forwardRef((function({schema:t,testId:n,children:a},o){const r=t.styles?i.mergeRight(so,t.styles):so;return e.jsx(Oa,{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"},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 co=a.connect((function(e){return{isOpen:e.active.has(to)}}))((function(t){return e.jsx(ro,Object.assign({},t,{children:(n,a)=>e.jsx(lo,Object.assign({},t,{ref:a,children:n}))}))}));const uo=a.connect((function(e){return{isOpen:e.active.has(to)}})),po={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const fo=t.forwardRef((function({schema:n,testId:a,children:o},r){const s=t.useRef(null),l=n.styles?i.mergeRight(po,n.styles):po;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(Oa,{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 yo=uo((function(t){return e.jsx(ro,Object.assign({},t,{children:(n,a)=>e.jsx(fo,Object.assign({},t,{ref:a,children:n}))}))}));const ho="DisplayPreset.FULLSCREEN",mo="DisplayPreset.EMBEDDED",vo="DisplayPreset.ATTACHED",go="ERROR",bo="INFO",Eo="WARNING";var Io;!function(e){e.PAYPAL="Paypal"}(Io||(Io={}));const xo="undefined"!=typeof __environment?__environment:{ENVIRONMENT:"local",DCUI_SCHEMA_VERSION:"",ROKT_DOMAIN:""};function*So(e,t,n){(function(e){return"object"==typeof e&&null!==e&&"type"in e&&Object.values(re).includes(e.type)})(n)&&!e.includes(n.type)&&(yield r.call(t.globalDispatch.bind(t),n))}function wo(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 Co(e){switch(typeof e){case"undefined":return"";case"object":return null===e?"":JSON.stringify(e);case"string":return e;default:return String(e)}}function Oo(e){return i.map(Co,e)}function*To(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*Ao(e,t){const n=yield r.take(e);yield r.call(t,n)}function*Ro(e){for(;;){const t=yield r.take(e);yield r.put(t)}}function*Lo(e,t){const n=i.over(i.lensProp("moduleName"),i.defaultTo("orchestrator"),t.payload.additionalInformation||{}),a=Object.assign(Object.assign({},t.payload),{additionalInformation:n?Oo(n):{}});try{yield r.call(e,a)}catch(e){}t.payload.level===go&&(yield r.put({type:X,payload:{name:"PLACEMENT_FAILURE"}}),yield r.put({type:eo.CLOSE_PLUGIN}))}const jo="INVALID_RESPONSE_OBJECT",No="FAILED_TO_OPEN_LINK",_o="NO_PARENT_GUID",Do="FAILED_TO_NOTIFY_INTERACTIVE",ko="FAILED_TO_ESTABLISH_PARTNER_VALIDATION";var Po=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 $o(e,t){return n=>n&&n.replace(e,t)}const Go=$o(/['""();{}@:[\]!/=]/g,""),Fo=/^(normal|italic|oblique( \d+deg)*)$/i,Mo=(e="")=>Fo.test(e)?e:void 0,Bo=$o(/[;{}@[\]!]/g,"");function Uo(e){const{fontFamily:t,sources:n}=e,a=Po(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 Vo(e=[]){const t=Array.from(document.fonts.values());return Promise.all(e.map((e=>{const n=function(e){return{fontFamily:Go(e.fontFamily)||"",style:Mo(e.style),weight:Go(e.weight),sources:e.sources.map((e=>Bo(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():Uo(n).then((()=>{})).catch((e=>`${e}`.includes("SyntaxError")?(n.fontFamily='"'+n.fontFamily+'"',Uo(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 zo(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=xo.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((()=>{Vo(JSON.parse(i)).catch((e=>{const t={type:Yi,payload:{level:bo,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 qo(e){return null!=e?e:null}function Ho(){return new Set([to])}function Wo(e){return e.breakpoint.breakpoints[e.breakpoint.activeBreakpoint]||0}const Jo=i.sortBy(i.prop(1)),Ko=i.map(i.prop(0)),Yo=e=>i.compose(i.findIndex(i.equals(e)),Ko,Jo,i.toPairs,i.pathOr({},["breakpoint","breakpoints"]));function Zo(e){return Yo(e.breakpoint.activeBreakpoint)(e)}function Qo(e,t){return e.customStates[`module${t}`]||{}}function Xo(e){return`${e.name}:${e.parentGuid}`}function er(e,t){return!e.processed.includes(Xo(t))||(n=t.name,void 0!==A.find((e=>e===n)));var n}function tr(){return new Map}const nr={layout:function(e=qo(),t){return t.type===Fi?t.payload:e},breakpoint:function(e={breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},t){var n;switch(t.type){case ki:return Object.prototype.hasOwnProperty.call(e.breakpoints,t.payload.activeBreakpoint)?Object.assign(Object.assign({},e),{activeBreakpoint:t.payload.activeBreakpoint}):e;case Pi: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=Ho(),t){var n,a;switch(t.type){case _i:{const a=new Set(e);return a.add(null===(n=t.payload)||void 0===n?void 0:n.id),a}case Di:{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===Gi?t.payload:e},signal:function(e={queue:[],processed:[]},t){switch(t.type){case Hi:return i.evolve({queue:n=>er(e,t.payload.signal)?i.uniqBy(i.pipe(i.prop("signal"),Xo),n.concat(t.payload)):n},e);case Wi: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(Xo(t.payload))},e);default:return e}},serializableCache:function(e=tr(),t){switch(t.type){case Vi:case zi:if(t.payload.key&&t.payload.value){return new Map([...e]).set(t.payload.key,t.payload.value)}return e;case qi:{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===Ui?i.mergeDeepWith(((e,t)=>i.isNil(t)?e:t),e,t.payload):e},customStates:function(e={root:{}},t){if(t.type===Qi){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*ar(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:Xi.INITIALISE_BREAKPOINT,payload:{activeBreakpoint:e,breakpoints:t.payload}});;)e=yield r.take(i),yield r.put({type:Xi.UPDATE_ACTIVE_BREAKPOINT,payload:{activeBreakpoint:e}})}catch(e){const n=e;yield r.put({type:Yi,payload:{level:Eo,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:Yi,payload:{level:go,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 ir(e,t,n){return l.eventChannel((a=>{const i=e.subscribe((e=>{const t=n(e);t&&a({type:Mi,payload:t})}),(e=>{a(e)})),o=t.fonts.subscribe((e=>{a({type:Gi,payload:e})}),(e=>{a(e)}));return()=>{i.unsubscribe(),o.unsubscribe()}}),l.buffers.sliding(2))}var or=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"}}),rr=Object.freeze({__proto__:null,PartnerMessage:{UpdateCartItem:"V2_UPDATE_CART_ITEM"},PlacementMessage:{CartItemUpdated:"V2_CART_ITEM_UPDATED"}}),sr=Object.freeze({__proto__:null,V1:or,V2:rr}),lr=Object.freeze({__proto__:null,PartnerMessage:{CartItemInstantPurchaseResponse:"CART_ITEM_INSTANT_PURCHASE_RESPONSE"},PlacementMessage:{CartItemInstantPurchase:"CART_ITEM_INSTANT_PURCHASE"}}),cr=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 dr="LINK_NAVIGATION_REQUEST",ur="REALTIME_OFFER_FULFILLMENT_SUCCESS",pr="REALTIME_OFFER_FULFILLMENT_FAILURE";var fr=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 yr={newTab:"_blank",self:"_top",roktWebViewSDK:"roktWebViewSDK",inApp:"inApp",overrideLinkNavigation:"overrideLinkNavigation"};function hr({url:e,urlBehavior:t,external:n},a=window){return fr(this,void 0,void 0,(function*(){if(!e)return null;if("overrideLinkNavigation"===t)return n.partner.send(dr,{url:e}).then((()=>null));const i=yr[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 mr=Object.freeze({__proto__:null,openLink:hr});function vr(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:Yi,payload:{level:Eo,code:i?"COMMUNICATION_FAILURE_WITH_WSDK":n,message:t,additionalInformation:Object.assign(Object.assign({},o),a)}}}var gr=Object.freeze({__proto__:null,makePluginWarningAction:vr});function br(e){return null!=e&&"object"==typeof e&&"ref"in e&&"object"==typeof e.ref&&!Array.isArray(e.ref)&&null!=e.ref}var Er=Object.freeze({__proto__:null,isWindow:br}),Ir=Object.assign(Object.assign(Object.assign({},mr),gr),Er);function*xr(e=10){(yield r.select((e=>e.signal.queue.length>0)))&&(yield c.delay(30),e>=1&&(yield*xr(e-1)))}function*Sr(e){try{yield*xr(10),yield c.call(e.close)}catch(e){const t=Ir.makePluginWarningAction(e,"Failed to close the plugin","FAILED_TO_CLOSE_PLUGIN");yield c.put(t)}}function*wr(e,{payload:t}){var n;if("string"==typeof(n=t.name)&&N.includes(n))switch(t.name){case"V2_CART_ITEM_UPDATED":case"CART_ITEM_INSTANT_PURCHASE":case"UPSELL_CREATIVE_SENT":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 Cr=i.propOr("FAILED_TO_PARSE_CONFIG","code");function*Or(e,t){var n;const a=yield c.call(ir,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:Yi,payload:{level:go,code:Cr(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*Tr(e,t){yield c.all([c.spawn(Or,e,t),c.takeEvery(X,wr,e.partnerInteractionService)])}function Ar(e){switch(e){case"ATTACHED":return vo;case"EMBEDDED":return mo;default:return ho}}function*Rr(e,t){const n={preset:Ar(t)};yield c.call(e.setDisplaySettings,n),yield c.put({type:Xi.ACTIVE_ADD,payload:{id:no}})}function*Lr(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:bo,message:t.payload.message||"Plugin Generic Log",additionalInformation:Oo(a)})}catch(e){}}function*jr(e){yield r.put({type:Xi.QUEUE_SIGNAL,payload:{signal:e.payload}}),yield r.put({type:Ji})}function*Nr(e){yield r.put({type:Xi.QUEUE_SIGNAL,payload:e.payload}),yield r.put({type:Ji})}function*_r(e,t){const n=yield r.select((e=>e.signal.queue.filter((t=>er(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*Dr(e.signal,a(t));break;case"SignalViewed":yield*kr(e.signal,a(t));break;case"SignalDismissal":yield*Pr(e.signal,a(t));break;case"SignalInstantPurchaseDismissal":yield*$r(e.signal,a(t));break;case"SignalLoadStart":yield*Gr(e.signal,a(t));break;case"SignalGatedResponse":case"SignalResponse":yield*Fr(e.signal,a(t,!0));break;case"SignalUserInteraction":yield*Mr(e.signal,a(t));break;case"SignalCartItemQuantitySelected":yield*Br(e.signal,a(t));break;case"SignalCartItemInstantPurchaseInitiated":yield*Ur(e.signal,a(t));break;case"SignalCartItemInstantPurchase":yield*Vr(e.signal,a(t));break;case"SignalCartItemInstantPurchaseFailure":yield*zr(e.signal,a(t))}yield r.put({type:Xi.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*Dr(e,t){let n;e.creativeInstanceGuid&&(n={},n.creativeInstanceGuid=e.creativeInstanceGuid);try{yield t(e.name,e.parentGuid,n)}catch(t){yield qr(e,t)}}function*kr(e,t){try{yield t(e.name,e.parentGuid,{objectData:{supportedByBrowser:e.supportedByBrowser.toString()},metadata:[{name:"inferred",value:e.inferred.toString()}]})}catch(t){yield qr(e,t)}}function*Pr(e,t){try{yield t(e.name,e.parentGuid,e.dismissalMethod?{objectData:{dismissalMethod:e.dismissalMethod}}:void 0)}catch(t){yield qr(e,t)}}function*$r(e,t){try{yield t(e.name,e.parentGuid,void 0)}catch(t){yield qr(e,t)}}function*Gr(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 qr(e,t)}}function*Fr(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 qr(e,t)}}function*Mr(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 qr(e,t)}}function*Br(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 qr(e,t)}}function*Ur(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 qr(e,t)}}function*Vr(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 qr(e,t)}}function*zr(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 qr(e,t)}}function qr(e,t){const n=Ir.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*Hr(e){yield r.put({type:Qi,payload:e.payload})}function*Wr(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:Vi,payload:{key:t,value:"Interactive"}}))}(e)}catch(e){const t=e;yield*function*(e){var t;yield r.put({type:Yi,payload:{level:bo,code:Do,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*Jr(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(hr,{url:t.payload.url,urlBehavior:n,external:e})}catch(e){yield r.put(vr(e,"Failed to open link",No,{url:t.payload.url,urlBehaviour:n}))}}function*Kr(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:Xi.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:Bi}),t?yield r.put({type:Y,payload:{name:"SignalDismissal",parentGuid:t,dismissalMethod:e.payload.dismissalMethod}}):yield r.put({type:Yi,payload:{level:bo,code:_o,message:"ParentGuid does not exist"}})}const Yr=a.connect((function(e){return{isOpen:e.active.has(to)}})),Zr="undefined"!=typeof window;function Qr(e,n){t.useEffect((()=>{if(!Zr||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 Xr="Minimized",es=()=>{const e=t.useRef(null),n=t.useRef(null),a=t.useRef(null),i=t.useRef(null),o=t.useRef(null),r=vt(0,(e=>e.customStates[Xr])),s=ht(),l=Tn(),c=t.useRef(0),d=t.useRef(!1),u=t.useRef(0),p=t.useRef([]),f=t.useRef(void 0),{isDisabled:y}=m(l);Qr(e,!!r);const h=t.useCallback((()=>{D(),f.current=void 0,d.current=!1,j(!0);v()?x():L(0)}),[]),v=()=>{const e=R();return r?e<=-.2:e>=.2};t.useEffect((()=>{r?(w(),s(ns(!0))):(C(),s(ns(!1)))}),[r,s]),t.useEffect((()=>{requestAnimationFrame((()=>{_(!r,a),_(!!r,i),N()}))}),[]);const b=t.useCallback((e=>{if(n.current){e.preventDefault();const t=I(e);L(t)}}),[n]),E=t.useCallback((e=>{Date.now()-u.current<200||(u.current=Date.now(),r?S(!1):d.current||y||(d.current=!0,A(),f.current=ts(e),j(!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=ts(e))&&void 0!==t?t:0)-(null!==(n=f.current)&&void 0!==n?n:0)},x=()=>{S(!r)},S=e=>{const t=(e=>({type:Q,payload:{key:Xr,value:e?1:0}}))(e);t&&s(t)},w=()=>{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;j(!0),N(!0,!0),L(s),_(!1,a),_(!0,i),P()},C=()=>{j(!0),N(!0,!1),L(0),f.current=void 0,_(!0,a),_(!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},L=e=>{const t=Math.round(e);c.current=t,n.current&&(n.current.style.transform=`translateY(${t}px)`)},j=e=>{e?n.current&&(n.current.style.transition="transform .2s"):n.current&&(n.current.style.transition="")},N=(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")},_=(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 ts(e){var t;return"touches"in e?null===(t=e.touches[0])||void 0===t?void 0:t.clientY:e.clientY}const ns=e=>({type:Y,payload:{action:e?"BottomSheetMinimized":"BottomSheetMaximized",name:"SignalUserInteraction",context:"BottomSheetMinimized"}}),as={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var is;function os({schema:n,testId:o}){const r=de(),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(no))),c=t.useRef(null),d=a.useDispatch(),u=()=>{d({type:eo.DISMISS_OVERLAY,payload:{id:to,dismissalMethod:"rokt_backdrop"}})},p=vt(0,(e=>e.customStates[Xr]));t.useEffect((()=>{f(!!p)}),[p]),Qr(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:Y,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=Tn(),{tabIndex:h,isDisabled:v,styles:g}=m(y),b=n.styles?i.mergeRight(as,n.styles):as;return e.jsx(Oa,{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 rs(){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"}(is||(is={}));const ss={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};function ls(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(cs,Object.assign({},t,{slots:n,currentIndex:i}))}function cs(t){const{wrapperRef:n,containerRef:a,minimizedChildRef:i,maximizedChildRef:o}=es();return t.isOpen?e.jsxs("div",{ref:n,style:{height:"100000px"},children:[e.jsx(os,Object.assign({},t)),e.jsx(us,Object.assign({},t,{containerRef:a,minimizedChildRef:i,maximizedChildRef:o}))]}):null}const ds=o.css`
|
|
57
|
+
`}}(r,l);if(!d)throw new Error("No custom state key provided for state trigger node.");const S={type:Q,payload:{key:d,value:null!=u?u:1}},w={type:Y,payload:{name:"SignalUserInteraction",action:"Swipe",context:"SlideStateTrigger"}},C=e.schema.styles?M(ei,e.schema.styles):ei,O=t.useRef(null),T=t.useRef(null),A=t.useRef(null),R=t.useRef(!1),L=t.useRef(void 0),{isDisabled:j}=m(s);t.useEffect((()=>{if(n)return g()?(document.addEventListener("touchmove",D),document.addEventListener("touchend",N)):(document.addEventListener("mousemove",D),document.addEventListener("mouseup",N)),F}),[n]);const N=()=>{F(),L.current=void 0,a(!1),i||(G(!0),R.current?($(P()),k()):$(0))},_=e=>{n||i||j||(L.current=ai(e),G(!1),a(!0))},D=e=>{var t,n;if(ni(A)){const a=Math.min(Math.max(0,(null!==(t=ai(e))&&void 0!==t?t:0)-(null!==(n=L.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(S),c(w),null===(t=null===(e=ni(O).parentElement)||void 0===e?void 0:e.parentElement)||void 0===t||t.focus()},P=()=>ni(O).getBoundingClientRect().width-ni(A).getBoundingClientRect().width,$=e=>{var t;ni(A).style.transform=`translateX(${e}px)`,ni(T).style.transform=`translateX(${e+(null===(t=ni(A))||void 0===t?void 0:t.getBoundingClientRect().width)/2}px)`},G=e=>{e?(ni(A).style.transition="transform .2s",ni(T).style.transition="transform .2s"):(ni(A).style.transition="",ni(T).style.transition="")},F=()=>{document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",N),document.removeEventListener("touchmove",D),document.removeEventListener("touchend",N)};return t.createElement(Oa,{styles:C},(({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:_,onTouchStart:_},null!==(l=null==y?void 0:y.icon)&&void 0!==l?l:"ArrowForward")),t.createElement("button",{className:x,"aria-label":null!=f?f:void 0,onClick:k,disabled:i||j,"data-testid":e.testId&&`${e.testId}-button`},null!==(c=null==p?void 0:p.value)&&void 0!==c?c:"Unlock Offers"))}))}function ni(e){if(!e.current)throw new Error("Unexpected missing reference to required SlideStateTrigger Element");return e.current}function ai(e){var t;return"touches"in e?null===(t=e.touches[0])||void 0===t?void 0:t.clientX:e.clientX}function ii(e){const n=Et();return t.createElement(Oa,{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 oi(e){const n=Tn(),a=ht(),i=e.schema.customStateKey,o=vt(0,(e=>e.customStates[i])),{tabIndex:r,styles:s,isDisabled:l}=m(n),c=()=>{a({type:Q,payload:{key:i,value:o?0:1}})};return t.createElement(Oa,{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(bt,null,(n=>t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0)))))))}))}function ri(e){const n=Et();return t.createElement(Oa,{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 si(e){const n=Et();return t.createElement(Oa,{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 li=t.createContext({extensions:{ctx:new Map,cache:[]}}),ci=()=>t.useContext(li).extensions;function di({extensions:e,extendStore:n,children:a}){const i=ci(),o=new Map([...i.ctx,...e.ctx]),r=i.cache.concat(e.cache);return t.createElement(li.Provider,{value:{extensions:{ctx:o,cache:r},extendStore:n}},a)}function ui(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 pi({data:e}){const n=ui(ci(),e);var a;if((e=>{const{extendStore:n,extensions:a}=t.useContext(li);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 fi(e,n){if(v("Extension",e))return t.createElement(pi,{data:e.node.data})}function yi(e){const n=_n(),a=Ot(),i=Wt(),o=Et(),r=ht(),s=t.useMemo((()=>a.catalogItems||[]),[a]),l=e=>i({data:e},"catalogItem");return t.useEffect((()=>{for(const e of s)r({type:Y,payload:{name:"SignalImpression",parentGuid:e.instanceGuid}})}),[s,r]),s.length>0?t.createElement(Oa,{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($n,{context:a},t.createElement(Nn,{value:n(a)},t.createElement(Ht,{value:l(a)},o(e.schema.template,void 0,U(i,e.testId))))))))))):null}const hi={BasicText:(e,t)=>$a(e,t,!0),StaticLink:(e,t)=>Ka(e,t,!0)};function mi(e){const n=Et();return t.createElement(It,{value:n,overrides:hi},t.createElement(bt,null,(n=>t.createElement(Oa,{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 vi(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,U(t,a)))))}function gi(e){const n=Tn(),a=ht(),o=Et(),r=Wt(),{event:s}=e.schema,{tabIndex:l,styles:c,isDisabled:d}=m(n),u=i.mapObjIndexed((e=>r(e)),s.data||{}),p=()=>{a({type:X,payload:{name:s.type,body:{offerId:u.providerOfferId,title:u.title,description:u.description}}})};return t.createElement(Oa,{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(Ht,{value:r},(null==n?void 0:n.own)?function(e,n,a,i,o){return t.createElement(Kt,{value:a(n)},vi(e,i,o))}(e.schema.children,n.own,a,o,e.testId):vi(e.schema.children,o,e.testId)))}))}function bi(e){const n=ht(),a=e.schema.delay?e.schema.delay:1,i=e.schema.customStateKey,o=vt(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:Q,payload:{key:i,value:o?0:1}})}}),null}function Ei(e){const n=Tn(),a=Wt()(e.schema.value),i=ht(),o=e.schema.customStateKey,r=vt(0,(e=>e.customStates[o])),{tabIndex:s,styles:l,isDisabled:c}=m(n),d=()=>{navigator.clipboard.writeText(a),r||i({type:Q,payload:{key:o,value:1}})};return t.createElement(Oa,{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(bt,null,(n=>t.Children.toArray(e.schema.children.map(((t,a)=>n(t,void 0,e.testId?`${e.testId}-child${a}`:void 0)))))))}))}function Ii(e){const n=Tn(),a=ht(),{customStateKey:i,value:o}=e.schema,{tabIndex:r,styles:s,isDisabled:l}=m(n),c=()=>{a({type:Q,payload:{key:i,value:o}})};return t.createElement(Oa,{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(bt,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 j("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 Si={Column:function(e,n){if("Column"===e.type)return t.createElement(Ta,{schema:e.node,testId:n})},Row:function(e,n){if("Row"===e.type)return t.createElement(Aa,{schema:e.node,testId:n})},StaticImage:function(e,n){if("StaticImage"===e.type)return t.createElement(Ma,{schema:e.node,testId:n})},DataImage:function(e,n){if("DataImage"===e.type)return t.createElement(Ba,{schema:e.node,testId:n})},CreativeResponse:function(e,n){if("CreativeResponse"===e.type)return t.createElement(Fa,{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(ka,{schema:e.node,testId:n})},BasicText:$a,StaticLink:Ka,DataIcon:function(e,n){if("DataIcon"===e.type)return t.createElement(Za,{schema:e.node,testId:n})},StaticIcon:function(e,n){if("StaticIcon"===e.type)return t.createElement(Va,{schema:e.node,testId:n})},ZStack:function(e,n){if("ZStack"===e.type)return t.createElement(Xa,{schema:e.node,testId:n})},FlowRow:function(e,n){if("FlowRow"===e.type)return t.createElement(ii,{schema:e.node,testId:n})},SlideStateTrigger:function(e,n){if("SlideStateTrigger"===e.type)return t.createElement(ti,{schema:e.node,testId:n})},ToggleButtonStateTrigger:function(e,n){if("ToggleButtonStateTrigger"===e.type)return t.createElement(oi,{schema:e.node,testId:n})},PartnerEventButtonTrigger:function(e,n){if("PartnerEventButtonTrigger"===e.type)return t.createElement(gi,{schema:e.node,testId:n})},TimerStateTrigger:function(e,n){if("TimerStateTrigger"===e.type)return t.createElement(bi,{schema:e.node})},CatalogStackedCollection:function(e,n){if("CatalogStackedCollection"===e.type)return t.createElement(yi,{schema:e.node,testId:n})},CatalogResponseButton:xi("CatalogResponseButton"),ScrollableRow:function(e,n){if("ScrollableRow"===e.type)return t.createElement(ri,{schema:e.node,testId:n})},ScrollableColumn:function(e,n){if("ScrollableColumn"===e.type)return t.createElement(si,{schema:e.node,testId:n})},EscapeHatch:fi,BottomSheet:xi("BottomSheet"),CatalogQuantityOption:xi("CatalogQuantityOption"),CatalogRadioGroup:xi("CatalogRadioGroup"),CatalogQuantityCounter:xi("CatalogQuantityCounter"),InlineContainer:function(e,n){if("InlineContainer"===e.type)return t.createElement(mi,{schema:e.node,testId:n})},CopyToClipboardButton:function(e,n){if("CopyToClipboardButton"===e.type)return t.createElement(Ei,{schema:e.node,testId:n})},ButtonStateTrigger:function(e,n){if("ButtonStateTrigger"===e.type)return t.createElement(Ii,{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:Si[n.type];return t.createElement(qa,{schema:n,reporter:e},r&&r(n,i)||function(e){throw new j("FAILED_CREATING_LAYOUT_NODE",`Failed to create layout node ${JSON.stringify(e)}`)}(n))}}const Ci={transformLinksToAnchorText:function(e={}){return{data:i.mapObjIndexed((e=>Lt(e)?`<a target="_blank" href="${e.url}">${e.title}</a>`:""),e)}}};function Oi(e){const{childLayouts:n}=e,a=ht(),[o,r]=t.useMemo((()=>{const e=i.indexBy(i.prop("childLayoutId"),n);return[e,i.mapObjIndexed((e=>e.childLayoutSchema.predicates),e)]}),[n]),s=ma(r);t.useEffect((()=>{Object.entries(s).forEach((([e,t])=>{const n=o[e];t&&n&&a({type:oe,payload:n})}))}),[s,o,a])}function Ti(e){const{settings:n,dispatch:a,children:i}=e,o=Ut(n.offerData.creative.copy||{})(Ci.transformLinksToAnchorText(n.offerData.creative.links),"creativeLink"),r=wi(n.logger),[s,l]=t.useState("ENABLED");return t.useEffect((()=>n.gateway.onInteractivityChange(l)),[n]),ce(n.rootElement,a),t.createElement(Yt.Provider,{value:"VARIANT"},t.createElement(xt.Provider,{value:n.rootElement},t.createElement(Fn.Provider,{value:n.pluginId},t.createElement(xn,{context:n.gateway},t.createElement(wn,{context:n.layoutSchema},t.createElement(Bn.Provider,{value:n.schemaVersion},t.createElement(Ct,{context:n.offerData},t.createElement(Nn,{value:An(n.offerData.creative)},t.createElement(On.Provider,{value:s},t.createElement(It,{value:r},t.createElement(Qt.Provider,{value:n.offerPositionIndex},t.createElement(yt.Provider,{value:a},t.createElement(Ht,{value:o},t.createElement(Ai,null,t.createElement(Oi,{childLayouts:n.childLayouts}),i))))))))))))))}function Ai(e){var n;const{children:a}=e,o=Mn(),r=function(){const[e,n]=t.useState(null),a=t.useContext(In).get();return t.useEffect((()=>a.onGlobalStateChange((t=>{i.equals(t,e)||n(t)}))),[a]),e}(),s=t.useContext(xt)||void 0,l=Xt(),c=t.useCallback((e=>pt(e,o,l,s)),[s]);return r?t.createElement(Kt,{value:c(Object.values(null!==(n=null==r?void 0:r.breakpoint.breakpoints)&&void 0!==n?n:{}))},t.createElement(mt.Provider,{value:r},a)):null}function Ri(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?va(e):ga(e),o.current.isRunning=!1},r.oncancel=()=>{"in"===t?va(e):ga(e),o.current.isRunning=!1},()=>{r.finish()}}return"in"===t?va(e):ga(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 Ni({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=ba(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&&(va(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 _i(e){const n=Et();return t.createElement(Oa,{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 Di="ACTIVE/ADD",ki="ACTIVE/DELETE",Pi="BREAKPOINT/UPDATE_ACTIVE",$i="BREAKPOINT/INITIALISE",Gi="BREAKPOINT/SET_BREAKPOINTS",Fi="FONTS/SET",Mi="LAYOUT/UPDATE",Bi="CONFIG/HANDLE",Ui="PLUGIN/CLOSE_PLUGIN",Vi="SETTINGS/SET",zi="CACHE/ADD_SERIALIZED_VALUE",qi="CACHE/UPDATE_SERIALIZED_VALUE",Hi="CACHE/CLEAR_SERIALIZED_VALUE",Wi="SIGNAL/QUEUE",Ji="SIGNAL/PROCESSED",Ki="SIGNAL/PROCESS",Yi="OVERLAY/DISMISS_OVERLAY",Zi="ERROR/REPORT",Qi="LOG",Xi="CUSTOM_STATES/SET",eo={LAYOUT_UPDATE:Mi,UPDATE_ACTIVE_BREAKPOINT:Pi,INITIALISE_BREAKPOINT:$i,ACTIVE_ADD:Di,ACTIVE_DELETE:ki,SET_FONTS:Fi,QUEUE_SIGNAL:Wi,SIGNAL_PROCESSED:Ji,CACHE_SERIALIZED_VALUE:zi,UPDATE_CACHED_SERIALIZED_VALUE:qi,CLEAR_SERIALIZED_VALUE_FROM_CACHE:Hi,SET_SETTINGS:Vi,SET_CUSTOM_STATE:Xi},to={HANDLE_CONFIG:Bi,SET_BREAKPOINTS:Gi,CLOSE_PLUGIN:Ui,RAISE_METRIC:V,PREPARE_SIGNAL:te,DISMISS_OVERLAY:Yi,REPORT_ERROR:Zi,LOG:Qi,OPEN_LINK:ne},no="plugin-overlay",ao="plugin";function io(n){var i;const o=n.schema.styles,r=a.useDispatch(),s={type:(null===(i=n.action)||void 0===i?void 0:i.type)||Yi,payload:{id:no,dismissalMethod:n.schema.dismissalMethod}},l=()=>{r(s)},c=Tn(),{tabIndex:d,styles:u,isDisabled:p}=m(c);return e.jsx(Oa,{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(bt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}const oo={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var ro;function so({isOpen:n,schema:o,testId:r,children:s}){const l=de(),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(ao))),u=a.useDispatch(),p=()=>{u({type:to.DISMISS_OVERLAY,payload:{id:no,dismissalMethod:"rokt_backdrop"}})};t.useEffect((()=>{c&&u({type:Y,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=Tn(),{tabIndex:y,isDisabled:h,styles:v}=m(f),g=o.styles?i.mergeRight(oo,o.styles):oo;if(!n)return null;const b=e.jsx(bt,{children:e=>t.Children.toArray(o.children.map(((t,n)=>e(t,void 0,r?`${r}-child${n}`:void 0))))});return e.jsx(Oa,{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"}(ro||(ro={}));const lo={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const co=t.forwardRef((function({schema:t,testId:n,children:a},o){const r=t.styles?i.mergeRight(lo,t.styles):lo;return e.jsx(Oa,{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"},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 uo=a.connect((function(e){return{isOpen:e.active.has(no)}}))((function(t){return e.jsx(so,Object.assign({},t,{children:(n,a)=>e.jsx(co,Object.assign({},t,{ref:a,children:n}))}))}));const po=a.connect((function(e){return{isOpen:e.active.has(no)}})),fo={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const yo=t.forwardRef((function({schema:n,testId:a,children:o},r){const s=t.useRef(null),l=n.styles?i.mergeRight(fo,n.styles):fo;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(Oa,{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 ho=po((function(t){return e.jsx(so,Object.assign({},t,{children:(n,a)=>e.jsx(yo,Object.assign({},t,{ref:a,children:n}))}))}));const mo="DisplayPreset.FULLSCREEN",vo="DisplayPreset.EMBEDDED",go="DisplayPreset.ATTACHED",bo="ERROR",Eo="INFO",Io="WARNING";var xo;!function(e){e.PAYPAL="Paypal"}(xo||(xo={}));const So="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(re).includes(e.type)})(n)&&!e.includes(n.type)&&(yield r.call(t.globalDispatch.bind(t),n))}function Co(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 Oo(e){switch(typeof e){case"undefined":return"";case"object":return null===e?"":JSON.stringify(e);case"string":return e;default:return String(e)}}function To(e){return i.map(Oo,e)}function*Ao(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*Ro(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?To(n):{}});try{yield r.call(e,a)}catch(e){}t.payload.level===bo&&(yield r.put({type:X,payload:{name:"PLACEMENT_FAILURE"}}),yield r.put({type:to.CLOSE_PLUGIN}))}const No="INVALID_RESPONSE_OBJECT",_o="FAILED_TO_OPEN_LINK",Do="NO_PARENT_GUID",ko="FAILED_TO_NOTIFY_INTERACTIVE",Po="FAILED_TO_ESTABLISH_PARTNER_VALIDATION";var $o=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 Fo=Go(/['""();{}@:[\]!/=]/g,""),Mo=/^(normal|italic|oblique( \d+deg)*)$/i,Bo=(e="")=>Mo.test(e)?e:void 0,Uo=Go(/[;{}@[\]!]/g,"");function Vo(e){const{fontFamily:t,sources:n}=e,a=$o(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 zo(e=[]){const t=Array.from(document.fonts.values());return Promise.all(e.map((e=>{const n=function(e){return{fontFamily:Fo(e.fontFamily)||"",style:Bo(e.style),weight:Fo(e.weight),sources:e.sources.map((e=>Uo(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():Vo(n).then((()=>{})).catch((e=>`${e}`.includes("SyntaxError")?(n.fontFamily='"'+n.fontFamily+'"',Vo(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 qo(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=So.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((()=>{zo(JSON.parse(i)).catch((e=>{const t={type:Zi,payload:{level:Eo,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 Ho(e){return null!=e?e:null}function Wo(){return new Set([no])}function Jo(e){return e.breakpoint.breakpoints[e.breakpoint.activeBreakpoint]||0}const Ko=i.sortBy(i.prop(1)),Yo=i.map(i.prop(0)),Zo=e=>i.compose(i.findIndex(i.equals(e)),Yo,Ko,i.toPairs,i.pathOr({},["breakpoint","breakpoints"]));function Qo(e){return Zo(e.breakpoint.activeBreakpoint)(e)}function Xo(e,t){return e.customStates[`module${t}`]||{}}function er(e){return`${e.name}:${e.parentGuid}`}function tr(e,t){return!e.processed.includes(er(t))||(n=t.name,void 0!==A.find((e=>e===n)));var n}function nr(){return new Map}const ar={layout:function(e=Ho(),t){return t.type===Mi?t.payload:e},breakpoint:function(e={breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},t){var n;switch(t.type){case Pi:return Object.prototype.hasOwnProperty.call(e.breakpoints,t.payload.activeBreakpoint)?Object.assign(Object.assign({},e),{activeBreakpoint:t.payload.activeBreakpoint}):e;case $i: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=Wo(),t){var n,a;switch(t.type){case Di:{const a=new Set(e);return a.add(null===(n=t.payload)||void 0===n?void 0:n.id),a}case ki:{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===Fi?t.payload:e},signal:function(e={queue:[],processed:[]},t){switch(t.type){case Wi:return i.evolve({queue:n=>tr(e,t.payload.signal)?i.uniqBy(i.pipe(i.prop("signal"),er),n.concat(t.payload)):n},e);case Ji: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(er(t.payload))},e);default:return e}},serializableCache:function(e=nr(),t){switch(t.type){case zi:case qi:if(t.payload.key&&t.payload.value){return new Map([...e]).set(t.payload.key,t.payload.value)}return e;case Hi:{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===Vi?i.mergeDeepWith(((e,t)=>i.isNil(t)?e:t),e,t.payload):e},customStates:function(e={root:{}},t){if(t.type===Xi){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*ir(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:eo.INITIALISE_BREAKPOINT,payload:{activeBreakpoint:e,breakpoints:t.payload}});;)e=yield r.take(i),yield r.put({type:eo.UPDATE_ACTIVE_BREAKPOINT,payload:{activeBreakpoint:e}})}catch(e){const n=e;yield r.put({type:Zi,payload:{level:Io,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:Zi,payload:{level:bo,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 or(e,t,n){return l.eventChannel((a=>{const i=e.subscribe((e=>{const t=n(e);t&&a({type:Bi,payload:t})}),(e=>{a(e)})),o=t.fonts.subscribe((e=>{a({type:Fi,payload:e})}),(e=>{a(e)}));return()=>{i.unsubscribe(),o.unsubscribe()}}),l.buffers.sliding(2))}var rr=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"}}),sr=Object.freeze({__proto__:null,PartnerMessage:{UpdateCartItem:"V2_UPDATE_CART_ITEM"},PlacementMessage:{CartItemUpdated:"V2_CART_ITEM_UPDATED"}}),lr=Object.freeze({__proto__:null,V1:rr,V2:sr}),cr=Object.freeze({__proto__:null,PartnerMessage:{CartItemInstantPurchaseResponse:"CART_ITEM_INSTANT_PURCHASE_RESPONSE"},PlacementMessage:{CartItemInstantPurchase:"CART_ITEM_INSTANT_PURCHASE"}}),dr=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 ur="LINK_NAVIGATION_REQUEST",pr="REALTIME_OFFER_FULFILLMENT_SUCCESS",fr="REALTIME_OFFER_FULFILLMENT_FAILURE";var yr=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 hr={newTab:"_blank",self:"_top",roktWebViewSDK:"roktWebViewSDK",inApp:"inApp",overrideLinkNavigation:"overrideLinkNavigation"};function mr({url:e,urlBehavior:t,external:n},a=window){return yr(this,void 0,void 0,(function*(){if(!e)return null;if("overrideLinkNavigation"===t)return n.partner.send(ur,{url:e}).then((()=>null));const i=hr[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 vr=Object.freeze({__proto__:null,openLink:mr});function gr(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:Zi,payload:{level:Io,code:i?"COMMUNICATION_FAILURE_WITH_WSDK":n,message:t,additionalInformation:Object.assign(Object.assign({},o),a)}}}var br=Object.freeze({__proto__:null,makePluginWarningAction:gr});function Er(e){return null!=e&&"object"==typeof e&&"ref"in e&&"object"==typeof e.ref&&!Array.isArray(e.ref)&&null!=e.ref}var Ir=Object.freeze({__proto__:null,isWindow:Er}),xr=Object.assign(Object.assign(Object.assign({},vr),br),Ir);function*Sr(e=10){(yield r.select((e=>e.signal.queue.length>0)))&&(yield c.delay(30),e>=1&&(yield*Sr(e-1)))}function*wr(e){try{yield*Sr(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*Cr(e,{payload:t}){var n;if("string"==typeof(n=t.name)&&N.includes(n))switch(t.name){case"V2_CART_ITEM_UPDATED":case"CART_ITEM_INSTANT_PURCHASE":case"UPSELL_CREATIVE_SENT":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 Or=i.propOr("FAILED_TO_PARSE_CONFIG","code");function*Tr(e,t){var n;const a=yield c.call(or,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:Zi,payload:{level:bo,code:Or(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*Ar(e,t){yield c.all([c.spawn(Tr,e,t),c.takeEvery(X,Cr,e.partnerInteractionService)])}function Rr(e){switch(e){case"ATTACHED":return go;case"EMBEDDED":return vo;default:return mo}}function*Lr(e,t){const n={preset:Rr(t)};yield c.call(e.setDisplaySettings,n),yield c.put({type:eo.ACTIVE_ADD,payload:{id:ao}})}function*jr(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:Eo,message:t.payload.message||"Plugin Generic Log",additionalInformation:To(a)})}catch(e){}}function*Nr(e){yield r.put({type:eo.QUEUE_SIGNAL,payload:{signal:e.payload}}),yield r.put({type:Ki})}function*_r(e){yield r.put({type:eo.QUEUE_SIGNAL,payload:e.payload}),yield r.put({type:Ki})}function*Dr(e,t){const n=yield r.select((e=>e.signal.queue.filter((t=>tr(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*kr(e.signal,a(t));break;case"SignalViewed":yield*Pr(e.signal,a(t));break;case"SignalDismissal":yield*$r(e.signal,a(t));break;case"SignalInstantPurchaseDismissal":yield*Gr(e.signal,a(t));break;case"SignalLoadStart":yield*Fr(e.signal,a(t));break;case"SignalGatedResponse":case"SignalResponse":yield*Mr(e.signal,a(t,!0));break;case"SignalUserInteraction":yield*Br(e.signal,a(t));break;case"SignalCartItemQuantitySelected":yield*Ur(e.signal,a(t));break;case"SignalCartItemInstantPurchaseInitiated":yield*Vr(e.signal,a(t));break;case"SignalCartItemInstantPurchase":yield*zr(e.signal,a(t));break;case"SignalCartItemInstantPurchaseFailure":yield*qr(e.signal,a(t))}yield r.put({type:eo.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*kr(e,t){let n;e.creativeInstanceGuid&&(n={},n.creativeInstanceGuid=e.creativeInstanceGuid);try{yield t(e.name,e.parentGuid,n)}catch(t){yield Hr(e,t)}}function*Pr(e,t){try{yield t(e.name,e.parentGuid,{objectData:{supportedByBrowser:e.supportedByBrowser.toString()},metadata:[{name:"inferred",value:e.inferred.toString()}]})}catch(t){yield Hr(e,t)}}function*$r(e,t){try{yield t(e.name,e.parentGuid,e.dismissalMethod?{objectData:{dismissalMethod:e.dismissalMethod}}:void 0)}catch(t){yield Hr(e,t)}}function*Gr(e,t){try{yield t(e.name,e.parentGuid,void 0)}catch(t){yield Hr(e,t)}}function*Fr(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 Hr(e,t)}}function*Mr(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 Hr(e,t)}}function*Br(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 Hr(e,t)}}function*Ur(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 Hr(e,t)}}function*Vr(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 Hr(e,t)}}function*zr(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 Hr(e,t)}}function*qr(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 Hr(e,t)}}function Hr(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*Wr(e){yield r.put({type:Xi,payload:e.payload})}function*Jr(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:zi,payload:{key:t,value:"Interactive"}}))}(e)}catch(e){const t=e;yield*function*(e){var t;yield r.put({type:Zi,payload:{level:Eo,code:ko,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*Kr(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(mr,{url:t.payload.url,urlBehavior:n,external:e})}catch(e){yield r.put(gr(e,"Failed to open link",_o,{url:t.payload.url,urlBehaviour:n}))}}function*Yr(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:eo.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:Ui}),t?yield r.put({type:Y,payload:{name:"SignalDismissal",parentGuid:t,dismissalMethod:e.payload.dismissalMethod}}):yield r.put({type:Zi,payload:{level:Eo,code:Do,message:"ParentGuid does not exist"}})}const Zr=a.connect((function(e){return{isOpen:e.active.has(no)}})),Qr="undefined"!=typeof window;function Xr(e,n){t.useEffect((()=>{if(!Qr||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 es="Minimized",ts=()=>{const e=t.useRef(null),n=t.useRef(null),a=t.useRef(null),i=t.useRef(null),o=t.useRef(null),r=vt(0,(e=>e.customStates[es])),s=ht(),l=Tn(),c=t.useRef(0),d=t.useRef(!1),u=t.useRef(0),p=t.useRef([]),f=t.useRef(void 0),{isDisabled:y}=m(l);Xr(e,!!r);const h=t.useCallback((()=>{D(),f.current=void 0,d.current=!1,j(!0);v()?x():L(0)}),[]),v=()=>{const e=R();return r?e<=-.2:e>=.2};t.useEffect((()=>{r?(w(),s(as(!0))):(C(),s(as(!1)))}),[r,s]),t.useEffect((()=>{requestAnimationFrame((()=>{_(!r,a),_(!!r,i),N()}))}),[]);const b=t.useCallback((e=>{if(n.current){e.preventDefault();const t=I(e);L(t)}}),[n]),E=t.useCallback((e=>{Date.now()-u.current<200||(u.current=Date.now(),r?S(!1):d.current||y||(d.current=!0,A(),f.current=ns(e),j(!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=ns(e))&&void 0!==t?t:0)-(null!==(n=f.current)&&void 0!==n?n:0)},x=()=>{S(!r)},S=e=>{const t=(e=>({type:Q,payload:{key:es,value:e?1:0}}))(e);t&&s(t)},w=()=>{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;j(!0),N(!0,!0),L(s),_(!1,a),_(!0,i),P()},C=()=>{j(!0),N(!0,!1),L(0),f.current=void 0,_(!0,a),_(!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},L=e=>{const t=Math.round(e);c.current=t,n.current&&(n.current.style.transform=`translateY(${t}px)`)},j=e=>{e?n.current&&(n.current.style.transition="transform .2s"):n.current&&(n.current.style.transition="")},N=(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")},_=(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 ns(e){var t;return"touches"in e?null===(t=e.touches[0])||void 0===t?void 0:t.clientY:e.clientY}const as=e=>({type:Y,payload:{action:e?"BottomSheetMinimized":"BottomSheetMaximized",name:"SignalUserInteraction",context:"BottomSheetMinimized"}}),is={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var os;function rs({schema:n,testId:o}){const r=de(),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(ao))),c=t.useRef(null),d=a.useDispatch(),u=()=>{d({type:to.DISMISS_OVERLAY,payload:{id:no,dismissalMethod:"rokt_backdrop"}})},p=vt(0,(e=>e.customStates[es]));t.useEffect((()=>{f(!!p)}),[p]),Xr(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:Y,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=Tn(),{tabIndex:h,isDisabled:v,styles:g}=m(y),b=n.styles?i.mergeRight(is,n.styles):is;return e.jsx(Oa,{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 ss(){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"}(os||(os={}));const ls={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};function cs(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(ds,Object.assign({},t,{slots:n,currentIndex:i}))}function ds(t){const{wrapperRef:n,containerRef:a,minimizedChildRef:i,maximizedChildRef:o}=ts();return t.isOpen?e.jsxs("div",{ref:n,style:{height:"100000px"},children:[e.jsx(rs,Object.assign({},t)),e.jsx(ps,Object.assign({},t,{containerRef:a,minimizedChildRef:i,maximizedChildRef:o}))]}):null}const us=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
|
-
`,us=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(ss,n.styles):ss,v=Et(),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=Ut(E||{})(wi.transformLinksToAnchorText(null==b?void 0:b.links),"creativeLink");return e.jsx(Oa,{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(rs,{}),e.jsx("div",{ref:y,className:ds,"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(Ht,{value:I,children:e.jsx(Nn,{value:An(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*ps(){(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:Q,payload:{key:"Minimized",value:1}}))}Yr(ls);const fs={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var ys;function hs({isOpen:n,schema:o,testId:r,children:s}){const l=de(),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(no))),u=a.useDispatch();t.useEffect((()=>{c&&u({type:Y,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=Tn(),{tabIndex:f,isDisabled:y,styles:h}=m(p),v=o.styles?i.mergeRight(fs,o.styles):fs;if(!n)return null;const g=e.jsx(bt,{children:e=>t.Children.toArray(o.children.map(((t,n)=>e(t,void 0,r?`${r}-child${n}`:void 0))))});return e.jsx(Oa,{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"}(ys||(ys={}));const ms={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const vs=t.forwardRef((function({schema:t,testId:n,children:a},o){const r=t.styles?i.mergeRight(ms,t.styles):ms;return e.jsx(Oa,{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 gs=a.connect((function(e){return{isOpen:e.active.has(to)}}))((function(t){return e.jsx(hs,Object.assign({},t,{children:(n,a)=>e.jsx(vs,Object.assign({},t,{ref:a,children:n}))}))})),bs=Yr(ls),Es={name:"minimized-bottomsheet-extension",sagas:function*(){yield r.all([r.takeEvery("OFFER_LIFECYCLE",ps)])},componentFactory:t=>"Overlay"===t.type?e.jsx(gs,{schema:t}):function(e){const t=e.children instanceof Array;return t}(t)?e.jsx(bs,{schema:t}):e.jsx("div",{children:"Could not Render Bottom Sheet"})};const Is=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}})),xs=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"})),Ss="FunFactMode";function ws({activeIndex:e,startIndex:n,numOfIndicators:i,schema:o,slots:r}){var s,l,c;const d=Tn(),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=vt(0,(e=>e.customStates[Ss])),x=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 S=()=>{u({type:Q,payload:{key:Ss,value:1}})},w=null===(l=null===(s=r[e])||void 0===s?void 0:s.offer)||void 0===l?void 0:l.creative,C=null===(c=null==w?void 0:w.images.creativeImage)||void 0===c?void 0:c.light;return i>0&&(T=i+n+1,(O=e)>=n&&O<=T)?t.createElement(qt,null,(a=>t.createElement(Oa,{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?S: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"},xs)):r!==e||I?t.createElement("button",{onClick:(s=r,()=>{x(s)&&(u({type:"PROGRESSION/INITIALISE",payload:{totalCount:i,currentGroupIndex:s,groupSize:1}}),I&&u({type:Q,payload:{key:Ss,value:0}}))}),className:l(r+n),style:{display:"inline-block",borderRadius:"50%",aspectRatio:"1/1",overflow:"hidden",cursor:x(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:x(r)?"pointer":"default"}},a({state:{indicatorPosition:String(r+1+n)}})(""),C?t.createElement("img",{src:C,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 Cs=Is(((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(ws,Object.assign({},e,{slots:i,currentIndex:o,partnerColor:n}))})),Os=({children:e,partnerColor:n,schema:a})=>{var i;const r=Et(),s=t.useMemo((()=>Math.random()),[]),l=Ut((null!==(i=Ts[Math.floor(s*Ts.length)])&&void 0!==i?i:{text:"",header:""})||{},"funfact"),c=o.css`
|
|
65
|
+
`,ps=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(ls,n.styles):ls,v=Et(),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=Ut(E||{})(Ci.transformLinksToAnchorText(null==b?void 0:b.links),"creativeLink");return e.jsx(Oa,{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(ss,{}),e.jsx("div",{ref:y,className:us,"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(Ht,{value:I,children:e.jsx(Nn,{value:An(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*fs(){(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:Q,payload:{key:"Minimized",value:1}}))}Zr(cs);const ys={elements:{own:[],wrapper:[{default:{background:{backgroundColor:{light:"#80000000"}},container:{justifyContent:"center"}}}]}};var hs;function ms({isOpen:n,schema:o,testId:r,children:s}){const l=de(),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(ao))),u=a.useDispatch();t.useEffect((()=>{c&&u({type:Y,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=Tn(),{tabIndex:f,isDisabled:y,styles:h}=m(p),v=o.styles?i.mergeRight(ys,o.styles):ys;if(!n)return null;const g=e.jsx(bt,{children:e=>t.Children.toArray(o.children.map(((t,n)=>e(t,void 0,r?`${r}-child${n}`:void 0))))});return e.jsx(Oa,{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"}(hs||(hs={}));const vs={elements:{own:[{default:{background:{backgroundColor:{light:"#FFF"}},flexChild:{alignSelf:"center"}}}],wrapper:[]}};const gs=t.forwardRef((function({schema:t,testId:n,children:a},o){const r=t.styles?i.mergeRight(vs,t.styles):vs;return e.jsx(Oa,{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 bs=a.connect((function(e){return{isOpen:e.active.has(no)}}))((function(t){return e.jsx(ms,Object.assign({},t,{children:(n,a)=>e.jsx(gs,Object.assign({},t,{ref:a,children:n}))}))})),Es=Zr(cs),Is={name:"minimized-bottomsheet-extension",sagas:function*(){yield r.all([r.takeEvery("OFFER_LIFECYCLE",fs)])},componentFactory:t=>"Overlay"===t.type?e.jsx(bs,{schema:t}):function(e){const t=e.children instanceof Array;return t}(t)?e.jsx(Es,{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}})),Ss=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 Cs({activeIndex:e,startIndex:n,numOfIndicators:i,schema:o,slots:r}){var s,l,c;const d=Tn(),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=vt(0,(e=>e.customStates[ws])),x=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 S=()=>{u({type:Q,payload:{key:ws,value:1}})},w=null===(l=null===(s=r[e])||void 0===s?void 0:s.offer)||void 0===l?void 0:l.creative,C=null===(c=null==w?void 0:w.images.creativeImage)||void 0===c?void 0:c.light;return i>0&&(T=i+n+1,(O=e)>=n&&O<=T)?t.createElement(qt,null,(a=>t.createElement(Oa,{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?S: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"},Ss)):r!==e||I?t.createElement("button",{onClick:(s=r,()=>{x(s)&&(u({type:"PROGRESSION/INITIALISE",payload:{totalCount:i,currentGroupIndex:s,groupSize:1}}),I&&u({type:Q,payload:{key:ws,value:0}}))}),className:l(r+n),style:{display:"inline-block",borderRadius:"50%",aspectRatio:"1/1",overflow:"hidden",cursor:x(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:x(r)?"pointer":"default"}},a({state:{indicatorPosition:String(r+1+n)}})(""),C?t.createElement("img",{src:C,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 Os=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(Cs,Object.assign({},e,{slots:i,currentIndex:o,partnerColor:n}))})),Ts=({children:e,partnerColor:n,schema:a})=>{var i;const r=Et(),s=t.useMemo((()=>Math.random()),[]),l=Ut((null!==(i=As[Math.floor(s*As.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(Ht,{value:l},t.createElement(Oa,{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)))))))})))},
|
|
75
|
+
`;return t.createElement(Ht,{value:l},t.createElement(Oa,{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)))))))})))},As=[{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*Rs(){(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:Q,payload:{key:"FunFactMode",value:1}}))}const Ls={name:"logo-clickable-progression-extension",sagas:function*(){yield r.all([r.takeEvery("OFFER_LIFECYCLE",Rs)])},componentFactory:e=>e?"fun-fact"===e.variant?t.createElement(Ts,{partnerColor:e.partnerColor,schema:e},e.children):t.createElement(Os,{schema:Object.assign(Object.assign({},e),{indicator:""}),partnerColor:e.partnerColor}):t.createElement("div",null,"Could not render Logo Clickable Progression"),interceptors:{}};const js=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`
|
|
85
|
-
width: 75%;
|
|
86
84
|
`,Ns=o.css`
|
|
85
|
+
width: 75%;
|
|
86
|
+
`,_s=o.css`
|
|
87
87
|
height: 40px;
|
|
88
88
|
width: 200px;
|
|
89
|
-
`,
|
|
89
|
+
`,Ds=o.css`
|
|
90
90
|
width: 150px;
|
|
91
|
-
`;function
|
|
91
|
+
`;function ks({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:
|
|
98
|
+
`},t.createElement("div",{className:js}),t.createElement("div",{className:js}),t.createElement("div",{className:js}),t.createElement("div",{className:o.cx(js,Ns)}),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(
|
|
102
|
+
`},t.createElement("div",{className:o.cx(js,_s)}),t.createElement("div",{className:o.cx(js,Ds)})))):null}function Ps({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
|
|
107
|
+
`},e)))):null):null}const $s=o.keyframes`
|
|
108
108
|
0% { width: 0; }
|
|
109
109
|
100% { width: 100%; }
|
|
110
|
-
}`;function
|
|
110
|
+
}`;function Gs(e){const[n,i]=t.useState(!1),[r,s]=t.useState(!1),l=a.useDispatch(),c=Et(),{type:d,children:u,durationMS:p,styles:f,partnerText:y,animationSpeedMS:h}=e.data;let m=null;switch(d){case"skeleton":m=t.createElement(ks,{hasLoaded:n,animationSpeedMS:h,styles:f});break;case"partnerText":m=t.createElement(Ps,{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: ${
|
|
117
|
+
animation: ${$s} ${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 Gs={name:"loading-extension",componentFactory:e=>t.createElement($s,{data:e}),interceptors:{}},Fs=1e3;function Ms(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()/Fs,o=t.useRef(null),r=()=>{const t=(new Date).getTime()/Fs;a(Math.max(Math.floor(e-(t-i)),0))};return t.useEffect((()=>(o.current=setInterval(r,Fs),()=>{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,Fs)}}}((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:Y,payload:{name:"SignalUserInteraction",action:"TimerExpired",context:"TimerProgression"}}),d({type:"PROGRESSION/PROCESS",payload:{offerProcessStatus:"CONTINUE"}}))}),[o,r]);const u=Tn(),{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 Bs={name:"timer-progression-extension",componentFactory:e=>t.createElement(Ms,{data:e}),interceptors:{}},Us="MODULE/ADD_LOADED",Vs="MODULE/LOAD",zs="PROGRESSION/INITIALISE",qs="PROGRESSION/NEXT",Hs="PROGRESSION/PREV",Ws="PROGRESSION/UPDATE_GROUP_SIZE",Js="PROGRESSION/PROCESS",Ks="SLOTS/SET",Ys="INSTANT_PURCHASE/DISMISS",Zs="OFFER_LIFECYCLE",Qs="DOMAIN_STATES/SET",Xs="OFFER_ENGAGEMENT",el="GLOBAL_OFFER_DATA_STATE/SET_CART",tl=Object.assign(Object.assign({},Xi),{NEXT_IN_PROGRESSION:qs,PREV_IN_PROGRESSION:Hs,INITIALISE_PROGRESSION:zs,UPDATE_GROUP_SIZE:Ws,SET_SLOTS:Ks,ADD_LOADED_MODULE:Us,SET_DOMAIN_STATE:Qs,SET_GLOBAL_OFFER_DATA_CART:el}),nl=Object.assign(Object.assign({},eo),{LOAD_MODULES:Vs,DISMISS_INSTANT_PURCHASE:Ys,PROCESS_PROGRESSION:Js,OFFER_LIFECYCLE:Zs,OFFER_ENGAGEMENT:Xs,SET_PARTNER_VALIDATION_STATUS:ae});function al(e,t){return t<=0||e<=0||t>e?0:Math.ceil(e/t)}function il(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<al(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 ol=Symbol("root");function rl(){return{[ol]:{}}}const sl=Object.assign({progression:function(e=null,t){switch(t.type){case zs:if(function(e){const{totalCount:t,currentGroupIndex:n,groupSize:a}=e;return t>=0&&a>=0&&n>=0&&a<=t&&n<al(t,a)}(t.payload)){const{totalCount:e,_:n,groupSize:a}=t.payload;return Object.assign(Object.assign({},t.payload),{indexGroups:il(e,a)})}return null;case Ws:{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:il(a,n),currentGroupIndex:0}):null}case qs:{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,al(t,n)-1)}):null}case Hs:{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===Ks?t.payload:e},module:function(e={loadedModules:[]},t){return t.type===Us?Object.assign(Object.assign({},e),{loadedModules:[...e.loadedModules,t.payload]}):e},domainStates:function(e=rl(),t){if(t.type===Qs){if(t.payload.key&&!isNaN(t.payload.value)){const n=void 0!==t.payload.offerPositionIndex?`module${t.payload.offerPositionIndex}`:ol;return n===ol?e:Object.assign(Object.assign({},i.assocPath([n,t.payload.key],Number(t.payload.value),e)),{[ol]:{}})}return e}return e},globalOfferDataState:function(e={},t){if(t.type===el){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}},nr);function ll(e={}){return Object.assign(Object.assign(Object.assign({},function(e={}){return Object.assign({layout:qo(),breakpoint:{breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},active:Ho(),fonts:[],signal:{queue:[],processed:[]},serializableCache:tr(),settings:{closeOnComplete:!0},customStates:{root:{}}},e)}(e)),{progression:null,slots:[],module:{loadedModules:[]},domainStates:rl(),globalOfferDataState:{}}),e)}function cl(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 dl(e){return e.progression?{activeGroupIndex:e.progression.currentGroupIndex,totalOffers:e.progression.totalCount,totalGroups:al(e.progression.totalCount,e.progression.groupSize),isLast:cl(e)}:null}function ul(e,t){return e.domainStates[`module${t}`]||{offerComplete:0,checkout:0}}function pl(e){return Object.values(e.globalOfferDataState).reduce(((e,t)=>t.cart?e+t.cart.reduce(((e,t)=>e+t.quantity),0):e),0)}function fl(n){var i;const{config:o,position:r,visible:s,container:l,testId:c}=n,d=Mn(),u=Tn(),p=a.useSelector(Wo),f=t.useContext(Bn),y=t.useContext(Un),h=`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(h,{style:{display:"flex",flexDirection:"column"===l?"column":"row",width:"100%"},slotInstanceGuid:o.instanceGuid,layoutSchema:JSON.stringify(o.layoutVariant.layoutVariantSchema),schemaVersion:f,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==y?void 0:y.inert)&&!s?"":void 0,"aria-hidden":(null==y?void 0:y.inert)?void 0:!s,"module-component":!0,"plugin-id":d,"active-breakpoint":B(p)})]})}function yl({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=Tn(),{tabIndex:d,isDisabled:u,styles:p}=m(c);return r.length&&r[l]?e.jsx(Oa,{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(fl,{config:t,position:a,visible:a===l,container:"column"})}))))})}):null}const hl=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=al(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=Tn(),{tabIndex:r,styles:s,isDisabled:l}=m(o),c=Array(a).fill(i.indicator);return a>0&&(u=a+n-1,(d=t)>=n&&d<=u)?e.jsx(qt,{children:a=>e.jsx(Oa,{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 ml="partnerValidationUI",vl="stackedViewableItems";function gl(n){var o;const r=a.useDispatch(),s=a.useSelector((e=>e.slots)),l=null!==(o=n.schema.viewableItems)&&void 0!==o?o:[],c=ma(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:zi,payload:{key:vl,value:String(d)}})}),[d]);const u=s.slice(0,d),p=Tn(),{tabIndex:f,isDisabled:y,styles:h}=m(p);return(null==u?void 0:u.length)>0?e.jsx(Oa,{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(fl,{config:t,position:n,visible:!0,container:"column"}))))})}):null}function bl(n){const i=n.schema.styles,o=a.useDispatch(),r=Tn(),s="Backward"===n.schema.direction?"Previous":"Next",{tabIndex:l,styles:c,isDisabled:d}=m(r),u=()=>{o({type:"Backward"===n.schema.direction?tl.PREV_IN_PROGRESSION:tl.NEXT_IN_PROGRESSION})};return e.jsx(Oa,{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(bt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}function El({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(Zo),I=n.viewableItems.length-1,[x,S]=d({slidesToScroll:null!==(r=n.viewableItems[Math.min(E,I)])&&void 0!==r?r:"auto",containScroll:"trimSnaps"}),w=a.useDispatch(),C=Tn(),{tabIndex:O,isDisabled:T,styles:A}=m(C),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?w({type:tl.NEXT_IN_PROGRESSION}):a<i&&w({type:tl.PREV_IN_PROGRESSION}))}return null!=g&&(null==S||S.on("select",e),null==S||S.scrollTo(g)),()=>{null==S||S.off("select",e)}}),[S,g,w]);const L={overflow:"hidden"},j={backfaceVisibility:"hidden",display:"flex",touchAction:"pan-y",gap:R,alignItems:"stretch"},N=e=>{var t;return null!==(t=null==v?void 0:v.includes(e))&&void 0!==t&&t},_=n.peekThroughSize[Math.min(E,n.peekThroughSize.length-1)],D=_?"Fixed"===(k=_).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(Oa,{styles:n.styles,children:({classnames:n})=>e.jsx("div",{ref:x,style:Object.assign(Object.assign({},L),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:j,"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(fl,{config:t,position:n,container:"row",visible:N(n)})}))))})})}):null}function Il({schema:n,testId:i}){const o=Mn(),r=t.useMemo((()=>ct(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)||[]).map((t=>t.map((t=>e.slots[t])).filter((e=>null!=e))))})),c=t.useRef(null),d=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})),u=Tn(),{tabIndex:p,isDisabled:f,styles:y}=m(u);return l.length?e.jsx(Oa,{styles:n.styles,children:({classnames:a})=>e.jsx("div",{ref:c,"data-testid":i,"data-e2e":"GroupedDistribution","aria-disabled":f,tabIndex:p,style:Object.assign({position:"relative",transition:`height ${n.transition.settings.duration/2}ms ease-in-out`,overflow:"hidden",boxSizing:"content-box"},y),children:t.Children.toArray(l.map(((o,l)=>e.jsx(ji,{effect:n.transition,visible:l===d,parentElement:c.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(fl,{config:t,position:a,visible:l===d,container:"column",testId:i?`${i}-child${a}`:void 0})})))}))))})}):null}const xl={action:{CaptureOnly:"CaptureOnly",Url:"Url",Fulfillment:"Fulfillment",External:"External"},urlBehavior:{newTab:"newTab",roktWebViewSDK:"roktWebViewSDK",self:"self"},signalType:{SignalResponse:"SignalResponse",SignalGatedResponse:"SignalGatedResponse",SignalSecondaryResponse:"SignalSecondaryResponse"},conversionType:{Default:"Default",RealTime:"RealTime"}};function Sl(e,t,n=!1){return Error(`Could not translate ${e} with guid: ${t}${n?" for child layout":""}`)}function wl(e,t=!1){var n;try{if(e.responseOptionsMap||t)return Object.assign(Object.assign({},e),{responseOptionsMap:i.mapObjIndexed(Cl,null!==(n=e.responseOptionsMap)&&void 0!==n?n:{})});{const t=`Creative: ${e.instanceGuid}, did not receive a valid response options map.`;throw new j("NO_CREATIVE_RESPONSE_OPTIONS_MAP",t)}}catch(n){throw n.message?n:Sl("Creative",e.instanceGuid,t)}}function Cl(e){try{let t,n;e.urlBehavior&&(t=xl.urlBehavior[e.urlBehavior]),e.conversionType&&(n=xl.conversionType[e.conversionType]);return Object.assign(Object.assign({},e),{urlBehavior:t,action:xl.action[e.action],signalType:xl.signalType[e.signalType],conversionType:n})}catch(t){throw t.message?t:Sl("CreativeResponse",e.instanceGuid)}}function Ol(e,t,n){try{return JSON.parse(e)}catch(e){throw Error(`Parse JSON failed, invalid JSON file for ${t} with guid ${n}.`)}}function Tl(){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 Al={OneByOneDistribution:function(t){if("OneByOneDistribution"===t.type)return e.jsx(yl,{schema:t.node})},StackedDistribution:function(t){if("StackedDistribution"===t.type)return e.jsx(gl,{schema:t.node})},ProgressIndicator:function(t){if("ProgressIndicator"===t.type)return e.jsx(hl,{schema:t.node})},ProgressControl:function(t){if("ProgressControl"===t.type)return e.jsx(bl,{schema:t.node})},Overlay:function(t){if("Overlay"===t.type)return e.jsx(co,{schema:t.node})},CloseButton:function(t){if("CloseButton"===t.type)return e.jsx(ao,{schema:t.node})},EscapeHatch:(Rl=[function(t,n){if(v("CloseButton",t)){const n=JSON.parse(t.node.data);return e.jsx(ao,{schema:n.node,action:n.action})}},fi],e=>Rl.reduce(((t,n)=>void 0===t?n(e):t),void 0)),CarouselDistribution:function(t){if("CarouselDistribution"===t.type)return e.jsx(El,{schema:t.node})},GroupedDistribution:function(t){if("GroupedDistribution"===t.type)return e.jsx(Il,{schema:t.node})},BottomSheet:function(t){if("BottomSheet"===t.type)return e.jsx(yo,{schema:t.node})}};var Rl;function Ll(e,t){e({type:Y,payload:{name:"SignalActivation",parentGuid:t}})}function jl({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:dl(e),customStates:e.customStates.root,domainStates:e.domainStates[ol]})),i.equals),y=a.useSelector((e=>e.slots.length)),h=a.useSelector((e=>{var t;const n=Number(null!==(t=e.serializableCache.get(vl))&&void 0!==t?t:"");return y-n})),m=a.useSelector(pl);ce(St(),p),t.useEffect((()=>(u&&document.body.addEventListener("click",Ll.bind(null,p,u.instanceGuid),{once:!0}),()=>{u&&document.body.removeEventListener("click",Ll.bind(null,p,u.instanceGuid))})),[null==u?void 0:u.instanceGuid]),Tl(),t.useEffect((()=>{if(u){const e={type:Y,payload:{name:"SignalImpression",parentGuid:u.instanceGuid}},t={type:Zi,payload:{code:"LAYOUT_IMPRESSED"}};p(e),p(t)}}),[u]);const v=e=>{p({type:nl.REPORT_ERROR,payload:e})},g=a.useSelector((e=>e.breakpoint.initialised));if(u&&g){const t=Ut({})({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=Si(v);return e.jsx(kn,{info:{layoutType:"OuterLayout",pageInstanceGuid:n},children:e.jsx(Ht,{value:t,children:e.jsx(It,{value:a,overrides:Al,children:e.jsx(mt.Provider,{value:f,children:e.jsx(yt.Provider,{value:p,children:e.jsx(Yt.Provider,{value:"OUTER",children:e.jsx(Bn.Provider,{value:u.layoutSchemaVersion,children:e.jsx(bt,{children:e=>e(u.layoutSchema)})})})})})})})})}return null}var Nl=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":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({},Nl);function*Dl(e,t){const n=_l.getDistribution(t),a=null==n?void 0:n.type,i=yield r.select(Zo),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:tl.INITIALISE_PROGRESSION,payload:{currentGroupIndex:0,totalCount:e,groupSize:o}}))}function*kl(e,t){const{instanceGuid:n,layoutSchemaVersion:a,outerLayoutSchema:o,slots:r}=t.payload;n?yield c.put({type:Y,payload:{name:"SignalLoadComplete",parentGuid:n}}):yield c.put({type:Yi,payload:{level:bo,code:_o,message:"Layout instance guid does not exist"}}),yield c.put({type:Vs,payload:{modules:r.map((e=>e.layoutVariant.moduleName))}}),yield c.put({type:$i,payload:o.breakpoints}),yield c.put({type:tl.LAYOUT_UPDATE,payload:{instanceGuid:n,layoutSchemaVersion:a,layoutSchema:o.layout,settings:o.settings}}),yield c.put({type:tl.SET_SLOTS,payload:r}),i.isNil(o.settings)||(yield c.put({type:tl.SET_SETTINGS,payload:o.settings})),yield*Dl(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,cr.PartnerValidationEvent.OPT_IN_TO_PARTNER_VALIDATION),yield c.spawn(Pl,e,cr.PartnerValidationEvent.SHOW_PARTNER_VALIDATION_STATUS,(()=>({type:"ACTIVE/ADD",payload:{id:ml}})))}catch(e){return yield c.put({type:Yi,payload:{level:go,code:ko,message:"Failed to establish partner validation."}}),"FAILURE"}return"OK"}(e.partner,o.settings,r);"OK"===s&&(yield c.call(Rr,e.display,o.display))}function*Pl(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 $l(e){return Sc(e)}function Gl(e,t){return Error(`Migration process from v0_0 to v0_1 failed: could not transform ${e} node. For more details: ${t}`)}const Fl=i.all(i.anyPass([function(e){return"Row"===e.type&&Vl(e.node.children)},function(e){return"Column"===e.type&&Vl(e.node.children)},Wl,Jl])),Ml=i.all(i.anyPass([function(e){return"Row"===e.type&&zl(e.node.children)},function(e){return"Column"===e.type&&zl(e.node.children)},Jl,Wl,function(e){return"DataImage"===e.type},function(e){return"When"===e.type&&zl(e.node.children)}])),Bl=i.all(i.anyPass([function(e){return"Row"===e.type&&ql(e.node.children)},function(e){return"Column"===e.type&&ql(e.node.children)},Jl,Wl])),Ul=i.all(i.anyPass([function(e){return"Row"===e.type&&Hl(e.node.children)},function(e){return"Column"===e.type&&Hl(e.node.children)},Wl,function(e){return"RichText"===e.type},Jl,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&Hl(e.node.children)},function(e){return"StaticLink"===e.type&&Hl(e.node.children)},function(e){return"StackedDistribution"===e.type},function(e){return"CloseButton"===e.type&&Hl(e.node.children)}]));function Vl(e){return Fl(e)}function zl(e){return Ml(e)}function ql(e){return Bl(e)}function Hl(e){return Ul(e)}function Wl(e){return"StaticImage"===e.type}function Jl(e){return"BasicText"===e.type}const Kl=i.lensPath(["styles","elements","link"]),Yl=i.lensPath(["styles","elements","activeIndicator"]),Zl=i.lensPath(["styles","elements","indicator"]),Ql=i.lensPath(["styles","elements","seenIndicator"]),Xl=i.lensPath(["focussed"]),ec=i.lensPath(["hovered"]),tc=i.lensPath(["default"]),nc=i.lensPath(["pressed"]),ac=e=>{var t;return{text:null!==(t=null==e?void 0:e.text)&&void 0!==t?t:{}}},ic=i.when(i.hasPath(["styles","elements","link"]),i.pipe(i.over(Kl,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default})))),i.over(Kl,i.map(i.when(i.has("focussed"),i.over(Xl,ac)))),i.over(Kl,i.map(i.when(i.has("hovered"),i.over(ec,ac)))),i.over(Kl,i.map(i.when(i.has("default"),i.over(tc,ac)))),i.over(Kl,i.map(i.when(i.has("pressed"),i.over(nc,ac)))))),oc=i.pipe(i.when(i.hasPath(["styles","elements","activeIndicator"]),i.over(Yl,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","indicator"]),i.over(Zl,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","seenIndicator"]),i.over(Ql,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))));function rc(e,t){return e?{elements:{own:e.elements.own.map(t)}}:void 0}const sc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),lc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),cc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),dc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),uc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),pc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),fc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),yc=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 Gl("When",`Invalid condition: ${e}`)}},hc=e=>{switch(e){case"breakpoint":return"Breakpoint";case"progression":return"Progression";case"position":return"Position";default:throw Gl("When",`Invalid target: ${e}`)}},mc=e=>{const{target:t,condition:n,value:a}=e;return{type:hc(t),predicate:{condition:yc(n),value:a}}};function vc(e){const t={type:"FadeInOut",settings:{duration:e.transition.settings.duration}};return{styles:e.style,transition:t}}function gc(e){const t=e.children.map((e=>Sc(e)));if(Vl(t))return Object.assign(Object.assign({},e),{children:t,styles:rc(e.styles,uc)});throw Gl("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function bc(e){const t=e.children.map((e=>Sc(e)));if(zl(t))return Object.assign(Object.assign({},e),{children:t,styles:rc(e.styles,pc)});throw Gl("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function Ec(e){const t=e.children.map((e=>Sc(e)));if(ql(t))return Object.assign(Object.assign({},e),{children:t,styles:rc(e.styles,fc)});throw Gl("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}const Ic=e=>({own:e.overlayContainer,wrapper:e.overlayWrapper});function xc(e){var t,n;const a=(null===(t=e.styles)||void 0===t?void 0:t.elements)?{elements:Ic(null===(n=e.styles)||void 0===n?void 0:n.elements)}:void 0,i=e.children.map((e=>Sc(e)));if(Hl(i))return Object.assign(Object.assign({},e),{styles:a,children:i});throw Gl("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function Sc(e){switch(e.type){case"When":return{type:"When",node:(s=e.node,{predicates:s.predicates.map(mc),children:s.children.map((e=>Sc(e)))})};case"OneByOneDistribution":return{type:e.type,node:vc(e.node)};case"Overlay":return{type:e.type,node:xc(e.node)};case"Column":return{type:e.type,node:(r=e.node,{styles:rc(r.styles,sc),children:r.children.map((e=>Sc(e)))})};case"Row":return{type:e.type,node:(o=e.node,{styles:rc(o.styles,lc),children:o.children.map((e=>Sc(e)))})};case"RichText":return{type:e.type,node:(i=e.node,ic(i))};case"CloseButton":return{type:e.type,node:gc(e.node)};case"CreativeResponse":return{type:e.type,node:bc(e.node)};case"StaticLink":return{type:e.type,node:Ec(e.node)};case"StaticImage":return{type:e.type,node:(a=e.node,Object.assign(Object.assign({},a),{styles:rc(a.styles,cc)}))};case"DataImage":return{type:e.type,node:(n=e.node,Object.assign(Object.assign({},n),{styles:rc(n.styles,dc)}))};case"ProgressIndicator":return{type:e.type,node:(t=e.node,oc(t))};default:return e}var t,n,a,i,o,r,s}function wc(e){return Ld(e)}function Cc(e,t){return Error(`Migration process from v0_23 to v1_0 failed: could not transform ${e} node. For more details: ${t}`)}const Oc=e=>"scroll"===e||"auto"===e?"visible":e,Tc=i.lensPath(["elements","own"]),Ac=i.lensPath(["transitions","transition","value","own"]),Rc=i.lensPath(["elements","wrapper"]),Lc=i.lensPath(["transitions","transition","value","wrapper"]),jc=i.lensPath(["elements","indicator"]),Nc=i.lensPath(["transitions","transition","value","indicator"]),_c=i.lensPath(["elements","activeIndicator"]),Dc=i.lensPath(["transitions","transition","value","activeIndicator"]),kc=i.lensPath(["elements","seenIndicator"]),Pc=i.lensPath(["transitions","transition","value","seenIndicator"]),$c=i.lensPath(["default","container","overflow"]),Gc=i.lensPath(["pressed","container","overflow"]),Fc=i.lensPath(["hovered","container","overflow"]),Mc=i.lensPath(["focussed","container","overflow"]),Bc=i.lensPath(["disabled","container","overflow"]),Uc=i.lensPath(["container","overflow"]),Vc=i.pipe(i.when(i.hasPath(["default","container","overflow"]),i.over($c,Oc)),i.when(i.hasPath(["pressed","container","overflow"]),i.over(Gc,Oc)),i.when(i.hasPath(["hovered","container","overflow"]),i.over(Fc,Oc)),i.when(i.hasPath(["focussed","container","overflow"]),i.over(Mc,Oc)),i.when(i.hasPath(["disabled","container","overflow"]),i.over(Bc,Oc))),zc=i.when(i.hasPath(["container","overflow"]),i.over(Uc,Oc)),qc=i.pipe(i.when(i.hasPath(["elements","own"]),i.over(Tc,i.map(Vc))),i.when(i.hasPath(["transitions","transition","value","own"]),i.over(Ac,zc))),Hc=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)})),Wc=i.pipe(qc,Hc),Jc=i.pipe(i.when(i.hasPath(["elements","wrapper"]),i.over(Rc,i.map(Vc))),i.when(i.hasPath(["transitions","transition","value","wrapper"]),i.over(Lc,zc))),Kc=i.pipe(i.when(i.hasPath(["elements","indicator"]),i.over(jc,i.map(Vc))),i.when(i.hasPath(["transitions","transition","value","indicator"]),i.over(Nc,zc))),Yc=i.pipe(i.when(i.hasPath(["elements","activeIndicator"]),i.over(_c,i.map(Vc))),i.when(i.hasPath(["transitions","transition","value","activeIndicator"]),i.over(Dc,zc))),Zc=i.pipe(i.when(i.hasPath(["elements","seenIndicator"]),i.over(kc,i.map(Vc))),i.when(i.hasPath(["transitions","transition","value","seenIndicator"]),i.over(Pc,zc)));function Qc(e){return"StaticImage"===e.type}function Xc(e){return"StaticIcon"===e.type}function ed(e){return"BasicText"===e.type}function td(e){return"DataImage"===e.type}function nd(e){return"DataIcon"===e.type}function ad(e){return"RichText"===e.type}function id(e){return"SlideStateTrigger"===e.type}function od(e){return"ToggleButtonStateTrigger"===e.type}const rd=i.all(i.anyPass([function(e){return"Row"===e.type&&sd(e.node.children)},function(e){return"Column"===e.type&&sd(e.node.children)},Qc,Xc,ad,ed,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&sd(e.node.children)},function(e){return"StaticLink"===e.type&&sd(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&&sd(e.node.children)},function(e){return"ProgressControl"===e.type&&vd(e.node.children)},function(e){return"ZStack"===e.type&&sd(e.node.children)},function(e){return"FlowRow"===e.type&&sd(e.node.children)},id,od]));function sd(e){return rd(e)}const ld=i.pipe(qc,Jc,Hc);function cd(e){const t=e.children.map((e=>Ld(e)));if(sd(t))return Object.assign(Object.assign({},i.omit(["settings"],e)),{children:t,allowBackdropToClose:e.settings.allowBackdropToClose,styles:e.styles?ld(e.styles):void 0});throw Cc("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function dd(e){const t=e.children.map((e=>Ld(e)));if(vd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Wc(e.styles):void 0});throw Cc("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function ud(e){const t=e.children.map((e=>Ld(e)));if(bd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Wc(e.styles):void 0});throw Cc("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function pd(e){const t=e.children.map((e=>Ld(e)));if(vd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Wc(e.styles):void 0});throw Cc("ProgressControl",`Invalid schema: ${JSON.stringify(e)}`)}const fd=i.pipe(qc,Kc,Yc,Zc,Hc);const yd=i.all(i.anyPass([ed,Qc,Xc,td,nd,function(e){return"Row"===e.type&&hd(e.node.children)},function(e){return"FlowRow"===e.type&&hd(e.node.children)},function(e){return"Column"===e.type&&hd(e.node.children)},function(e){return"ZStack"===e.type&&hd(e.node.children)},function(e){return"When"===e.type&&hd(e.node.children)}]));function hd(e){return yd(e)}const md=i.all(i.anyPass([ed,Qc,Xc,function(e){return"Row"===e.type&&vd(e.node.children)},function(e){return"FlowRow"===e.type&&vd(e.node.children)},function(e){return"Column"===e.type&&vd(e.node.children)},function(e){return"ZStack"===e.type&&vd(e.node.children)},function(e){return"When"===e.type&&vd(e.node.children)}]));function vd(e){return md(e)}const gd=i.all(i.anyPass([ed,Qc,Xc,td,nd,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)}function Ed(e){const t=e.children.map((e=>Ld(e)));if(hd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Wc(e.styles):void 0});throw Cc("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}function Id(e){const t=e.children.map((e=>Ld(e)));if(bd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Wc(e.styles):void 0});throw Cc("CatalogResponseButton",`Invalid schema: ${JSON.stringify(e)}`)}function xd(e){return"Row"===e.type&&Cd(e.node.children)}function Sd(e){return"Column"===e.type&&Cd(e.node.children)}const wd=i.all(i.anyPass([ed,Qc,Xc,td,nd,ad,function(e){return"StaticLink"===e.type},id,od,function(e){return"CatalogResponseButton"===e.type},xd,function(e){return"FlowRow"===e.type&&Cd(e.node.children)},Sd,function(e){return"ZStack"===e.type&&Cd(e.node.children)},function(e){return"When"===e.type&&Cd(e.node.children)}]));function Cd(e){return wd(e)}const Od=i.anyPass([xd,Sd]);function Td(e){const t=Ld(e.template);if(function(e){return Od(e)}(t))return Object.assign(Object.assign({},e),{template:t,styles:e.styles?Wc(e.styles):void 0});throw Cc("CatalogStackedCollection",`Invalid schema: ${JSON.stringify(e)}`)}function Ad(e){const t=e.children.map((e=>Ld(e)));if(hd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Wc(e.styles):void 0});throw Cc("ToggleButtonStateTrigger",`Invalid schema: ${JSON.stringify(e)}`)}function Rd(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=>Ld(e))),transition:t})}function Ld(e){switch(e.type){case"Row":return{type:e.type,node:(g=e.node,Object.assign(Object.assign({},g),{children:g.children.map((e=>Ld(e))),styles:g.styles?Wc(g.styles):void 0}))};case"When":return{type:e.type,node:Rd(e.node)};case"FlowRow":return{type:e.type,node:(v=e.node,Object.assign(Object.assign({},v),{styles:v.styles?Wc(v.styles):void 0,children:v.children.map((e=>Ld(e)))}))};case"Column":return{type:e.type,node:(m=e.node,Object.assign(Object.assign({},m),{children:m.children.map((e=>Ld(e))),styles:m.styles?Wc(m.styles):void 0}))};case"ZStack":return{type:e.type,node:(h=e.node,Object.assign(Object.assign({},h),{styles:h.styles?Wc(h.styles):void 0,children:h.children.map((e=>Ld(e)))}))};case"Overlay":return{type:e.type,node:cd(e.node)};case"ProgressControl":return{type:e.type,node:pd(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?Wc(y.styles):void 0}))};case"CloseButton":return{type:"CloseButton",node:dd(e.node)};case"CreativeResponse":return{type:"CreativeResponse",node:ud(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?Wc(f.styles):void 0}))};case"OneByOneDistribution":return{type:"OneByOneDistribution",node:(p=e.node,Object.assign(Object.assign({},p),{styles:p.styles?Wc(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?fd(d.styles):void 0}))};case"SlideStateTrigger":return{type:"SlideStateTrigger",node:(c=e.node,Object.assign(Object.assign({},c),{styles:c.styles?Wc(c.styles):void 0}))};case"StackedDistribution":return{type:"StackedDistribution",node:(l=e.node,Object.assign(Object.assign({viewableItems:[]},l),{styles:l.styles?Wc(l.styles):void 0}))};case"StaticLink":return{type:"StaticLink",node:Ed(e.node)};case"ToggleButtonStateTrigger":return{type:"ToggleButtonStateTrigger",node:Ad(e.node)};case"CatalogResponseButton":return{type:"CatalogResponseButton",node:Id(e.node)};case"CatalogStackedCollection":return{type:"CatalogStackedCollection",node:Td(e.node)};case"RichText":return{type:"RichText",node:(s=e.node,Object.assign(Object.assign({},s),{styles:s.styles?Hc(s.styles):void 0}))};case"DataImage":return{type:"DataImage",node:(r=e.node,Object.assign(Object.assign({},r),{styles:r.styles?Hc(r.styles):void 0}))};case"StaticImage":return{type:"StaticImage",node:(o=e.node,Object.assign(Object.assign({},o),{styles:o.styles?Hc(o.styles):void 0}))};case"DataIcon":return{type:"DataIcon",node:(a=e.node,Object.assign(Object.assign({},a),{styles:a.styles?Hc(a.styles):void 0}))};case"StaticIcon":return{type:"StaticIcon",node:(n=e.node,Object.assign(Object.assign({},n),{styles:n.styles?Hc(n.styles):void 0}))};case"BasicText":return{type:"BasicText",node:(t=e.node,Object.assign(Object.assign({},t),{styles:t.styles?Hc(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 jd(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 Nd(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 Dd(e,t){return Nd(t,{major:0,minor:0})?Dd($l(e),{major:0,minor:1}):function(e,t){return 0===t.major&&_d(1,23,t.minor)}(0,t)?Dd(wc(e),{major:1,minor:0}):e}function kd(e,t){return Nd(t,{major:0,minor:0})?kd(function(e){return Object.assign(Object.assign({},e),{layout:$l(e.layout)})}(e),{major:0,minor:1}):function(e,t){return 0===t.major&&_d(1,23,t.minor)}(0,t)?kd(function(e){return Object.assign(Object.assign({},e),{layout:wc(e.layout)})}(e),{major:1,minor:0}):e}function Pd(e,t,n,a){const i=jd(n);if(a){const s=jd(a);if(r=i,(o=s).major<r.major||o.major===r.major&&o.minor<r.minor||Nd(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,jd("0.0"));var o,r}function $d(e){var t;try{return Object.assign(Object.assign({},i.clone(e)),{offer:Object.assign(Object.assign({},i.clone(e.offer)),{creative:wl(e.offer.creative)}),layoutVariant:Object.assign(Object.assign({},i.clone(e.layoutVariant)),{layoutVariantSchema:"string"==typeof e.layoutVariant.layoutVariantSchema?Ol(e.layoutVariant.layoutVariantSchema,"LayoutSlotLayoutVariant",e.instanceGuid):e.layoutVariant.layoutVariantSchema,childLayouts:i.map(Gd,null!==(t=e.layoutVariant.childLayouts)&&void 0!==t?t:[])})})}catch(t){throw t.message?t:Sl("Slot",e.instanceGuid)}}function Gd(e){return Object.assign(Object.assign({},i.clone(e)),{childLayoutSchema:"string"==typeof e.childLayoutSchema?Ol(e.childLayoutSchema,"ChildLayoutRootSchema",e.childLayoutId):e.childLayoutSchema})}function Fd(e){if(e){const t=function(e){try{return Object.assign(Object.assign({},i.clone(e)),{outerLayoutSchema:"string"==typeof e.outerLayoutSchema?Ol(e.outerLayoutSchema,"LayoutRootLayoutSchema",e.instanceGuid):e.outerLayoutSchema,slots:i.map($d,e.slots)})}catch(t){throw t.message?t:Sl("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=>Pd(e,Dd,t,n))))),i.over(a,(e=>Pd(e,kd,t,n))))(e)}(t,xo.DCUI_SCHEMA_VERSION)}}const Md=i.cond([[i.where({signalType:i.equals("SignalSecondaryResponse")}),function*(e,t){return yield r.put({type:Yi,payload:{level:Eo,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:Y,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(hr,t),i=br(a)?a.ref:void 0;return yield r.call(e.addAdvertiserWindowRef,i,n),br(a)||"newTab"!==t.urlBehavior?"SUCCESS":(yield r.put({type:Yi,payload:{level:Eo,code:No,message:`Did not receive a window reference opening link ${t.url}`}}),"UNSPECIFIED")}catch(e){return yield r.put({type:Yi,payload:{level:Eo,code:No,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:Yi,payload:{level:Eo,code:jo,message:"URL response doesn't have a valid url",additionalInformation:{instanceGuid:e.instanceGuid}}}),"ERROR"}],[i.T,function*(){return"EXPLICIT_DISMISSAL"}]]);function*Bd(e){return yield r.put({type:Yi,payload:{level:Eo,code:jo,message:"DCUI does not support SignalSecondaryResponse creative response signal type.",additionalInformation:{instanceGuid:e.instanceGuid}}}),e.isPositive?"ERROR":"EXPLICIT_DISMISSAL"}function*Ud(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:X,payload:{name:"OFFER_ENGAGEMENT"}}),i.isPositive&&(yield r.put({type:Zi,payload:{code:"CREATIVE_RESPONSE",message:"creative positive response",data:{type:i.action,isPositive:i.isPositive,responseInstanceGuid:i.instanceGuid}}}),yield r.put({type:X,payload:{name:"POSITIVE_ENGAGEMENT"}})),n="SignalSecondaryResponse"===i.signalType?yield*Bd(i):yield*Md(i,e.context,e.partner);break;case"CaptureOnly":yield r.put({type:X,payload:{name:"OFFER_ENGAGEMENT"}}),i.isPositive&&(yield r.put({type:X,payload:{name:"POSITIVE_ENGAGEMENT"}})),n="SignalSecondaryResponse"===i.signalType?yield*Bd(i):yield*function*(e){return yield r.put({type:Y,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:Yi,payload:{level:Eo,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"External":yield r.put({type:Yi,payload:{level:Eo,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:Zs,payload:{event:"Completed",completionReason:"Success",offerPositionIndex:t}};case"UNSPECIFIED":return{type:Zs,payload:{event:"Completed",completionReason:"Unspecified",offerPositionIndex:t}};case"ERROR":return{type:Zs,payload:{event:"Completed",completionReason:"Error",offerPositionIndex:t}};case"EXPLICIT_DISMISSAL":return{type:Zs,payload:{event:"Dismissed",dismissalReason:"Explicit",offerPositionIndex:t}};case"IMPLICIT_DISMISSAL":return{type:Zs,payload:{event:"Dismissed",dismissalReason:"Implicit",offerPositionIndex:t}};default:return{type:Js,payload:{offerProcessStatus:"END"}}}}(n,a)))}function Vd(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:Yi,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:Yi,payload:{level:R,code:"FAILED_TO_LOAD_MODULE",message:t,additionalInformation:{stack:a,reason:t?void 0:e,moduleName:n}}}),i(l.END)})),()=>{})))}const zd={"standard-marketing":()=>Promise.resolve().then((function(){return Wu})),"add-to-cart":()=>Promise.resolve().then((function(){return Jp})),"instant-purchase":()=>Promise.resolve().then((function(){return $f})),"layouts-xp-sandbox":()=>Promise.resolve().then((function(){return hy}))};function*qd(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(Hd,e,t,i))}function*Hd(e,t,n){if(n in zd){yield r.put({type:Us,payload:n});const a=yield r.call(Vd,e,t,n,zd[n]);yield r.call(Ro,a)}else yield r.put({type:Yi,payload:{level:go,code:"INVALID_MODULE_NAME",message:`Could not load unknown module ${n}`}})}function*Wd(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=Yo(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:Ws,payload:{groupSize:n}};yield r.put(e)}}const Jd=i.cond([[(e,t,n,a)=>"END"===e.offerProcessStatus,i.always({type:Bi})],[(e,t,n,a)=>t.isLastOffer&&n,i.always({type:Bi})],[(e,t,n,a)=>1===a&&!t.isLastOffer,i.always({type:qs})],[i.T,i.always(void 0)]]);function*Kd(e){const t=yield r.select((e=>({exists:null!==e.progression,isLastOffer:cl(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=Jd(e,t,"boolean"==typeof a&&a,n);i&&(i.type===Bi&&(yield r.put({type:X,payload:{name:"PLACEMENT_COMPLETED"}})),yield r.put(i))}(e.payload,t,n))}function Yd(e){return e.type===Zs&&"Interactive"===e.payload.event}function Zd(e){return e.type===Zs&&"Interactive"!==e.payload.event}function*Qd(e){switch(e.payload.event){case"Dismissed":yield r.put({type:Js,payload:{offerProcessStatus:"CONTINUE"}});break;case"Completed":yield r.put({type:Qs,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:Js,payload:{offerProcessStatus:"CONTINUE"}});break;case"Interactive":yield r.put({type:V,payload:{name:"Interactive",offerPositionIndex:e.payload.offerPositionIndex}}),yield r.put({type:X,payload:{name:"PLACEMENT_INTERACTIVE"}})}}function*Xd(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,cr.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:Yi,payload:{level:L,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*eu(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:tl.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:Bi}),t?(yield r.put({type:Y,payload:{name:"SignalInstantPurchaseDismissal",parentGuid:t}}),yield r.put({type:Y,payload:{name:"SignalDismissal",parentGuid:t}})):yield r.put({type:Yi,payload:{level:bo,code:_o,message:"ParentGuid does not exist"}})}function*tu(e,t){yield r.all([r.takeEvery(Yi,Lo.bind(null,e.errorService.raise)),r.takeLatest(Mi,kl.bind(null,{display:e.displayService,partner:e.partnerInteractionService})),r.takeEvery(Vs,qd.bind(null,t,e.contextService)),r.takeLatest(Xs,Ud.bind(null,{partner:e.partnerInteractionService,context:e.contextService})),r.takeEvery(Js,Kd),r.takeEvery(Zd,Qd),Ao(Yd,Qd),r.takeLatest($i,ar.bind(null,e.displayService)),r.takeLatest(Bi,Sr.bind(null,e.contextService)),r.takeLatest(Ys,eu),r.takeLatest(Ki,Kr),r.takeEvery(Y,jr),r.takeEvery(te,Nr),To(V,Wr.bind(null,e.metricsService)),To(Ji,_r.bind(null,e.rdnService)),r.takeEvery(Zi,Lr.bind(null,e.errorService.raise)),r.takeLatest(ki,Wd),r.takeEvery(Q,Hr),r.takeEvery(ne,Jr.bind(null,{createChildPlugin:e.childPlugin.create,partner:e.partnerInteractionService,context:e.contextService})),r.takeLatest(ae,Xd.bind(null,{partner:e.partnerInteractionService,context:e.contextService}))])}var nu,au,iu,ou,ru,su=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},lu=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 cu={[re.SET_CUSTOM_STATE]:tl.SET_CUSTOM_STATE,[re.SET_DOMAIN_STATE]:tl.SET_DOMAIN_STATE,[re.SET_GLOBAL_OFFER_DATA_CART]:tl.SET_GLOBAL_OFFER_DATA_CART,[re.OFFER_LIFECYCLE]:nl.OFFER_LIFECYCLE,[re.OFFER_ENGAGEMENT]:nl.OFFER_ENGAGEMENT,[re.SET_PARTNER_VALIDATION_STATUS]:nl.SET_PARTNER_VALIDATION_STATUS};class du{constructor(e){nu.add(this),au.set(this,void 0),su(this,au,e,"f")}getState(e){const t=lu(this,au,"f").getState();return{breakpoint:t.breakpoint,progression:dl(t),customStates:Qo(t,e.offerPositionIndex),domainStates:ul(t,e.offerPositionIndex)}}dispatch(e,t){lu(this,au,"f").dispatch(lu(this,nu,"m",ru).call(this,e,t))}subscribe(e,t){return t(this.getState(e)),lu(this,au,"f").subscribe((()=>{t(this.getState(e))}))}}function uu(e,t){const n=l(),a={},i=s.configureStore({reducer:sl,devTools:{name:"Orchestrator"},preloadedState:Object.assign(Object.assign({},ll()),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 du(e)}(i),c=e.childPlugin.create,d=e.partnerInteractionService.onEvent,(e,t)=>new dn(r,c,e,t,d));var r,c,d;n.run(tu,e,o),n.run(Tr,e,Fd);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({},sl),u)))),t&&Object.assign(a,t),o&&n.run(o)}})}au=new WeakMap,nu=new WeakSet,iu=function(e,t,n){return{type:e,payload:Object.assign(Object.assign({},t),{offerPositionIndex:n.offerPositionIndex,creativeInstanceGuid:n.creativeInstanceGuid})}},ou=function(e,t){return t.type===te?t.payload.signal.parentGuid||(t.payload.signal.parentGuid=e.creativeInstanceGuid):(t.payload.creativeInstanceGuid=e.creativeInstanceGuid,t.payload.parentGuid||(t.payload.parentGuid=e.creativeInstanceGuid)),t},ru=function(e,t){return function(e){return e.type in cu}(t)?lu(this,nu,"m",iu).call(this,cu[t.type],t.payload,e):t.type===Y||t.type===te?lu(this,nu,"m",ou).call(this,e,t):t};var pu=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 fu={ctx:new Map([[Bs.name,Bs],[Gs.name,Gs],[Es.name,Es],[Rs.name,Rs]]),cache:[]};class yu{constructor(){this._subscribers=[]}add(e){this._subscribers.push(e)}unsubscribe(){this._subscribers.forEach((e=>e.unsubscribe()))}}const hu=()=>{},mu=(e=hu,t=hu,n=hu)=>"function"!=typeof e?e:{next:e,error:t,complete:n};class vu{constructor(e){this._setupFn=e}subscribe(e,t,n){const a=mu(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 yu;return s.add({unsubscribe:()=>{i&&i(),o=!1}}),s}}class gu extends vu{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 vu((e=>{const t=this.subscribe(e);return()=>t.unsubscribe()}))}}const bu={CompletedBeforeEmit:"CompletedBeforeEmit"};var Eu=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 Iu{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)=>Eu(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 xu{constructor(e){this.value=e,this.complete=!1,this.skip=!1}}var Su=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 wu={getBreakpointCSSClass:B},Cu="CHILD_LAYOUTS/ADD_LAUNCHED",Ou="DYNAMIC_DATA/ADD";function Tu(e={launched:{}},t){if(t.type===Cu){const n=t.payload;return n.childLayoutId?i.assocPath(["launched",n.childLayoutId],n.shouldRelaunch,e):e}return e}function Au(e=null,t){return e}function Ru(e=null,t){if(t.type===Ou){const n=t.payload;return e?n?i.mergeDeepRight(e,n):e:n}return e}function Lu(e,t){var n;return null===(n=e.childLayouts.launched[t])||void 0===n||n}function ju(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer}function Nu(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.schemaVersion}function _u(e){var t,n;return null!==(n=null===(t=e.dynamicData)||void 0===t?void 0:t.text)&&void 0!==n?n:{}}const Du="FAILED_TO_LAUNCH_CHILD_LAYOUT";function*ku(e,t,n){var a;if(yield null===(a=r.select(Lu,n.payload.childLayoutId))||void 0===a||a){const a=yield r.select(Nu),o=yield r.select(ju),s=yield r.select(_u);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:L,code:Du,message:"Could not launch child layout, failed creating plugin."})}}catch(e){yield r.call(t,{level:L,code:Du,message:"Could not launch child layout, failed to make the child layout config serializable."})}yield r.put({type:Cu,payload:{childLayoutId:n.payload.childLayoutId,shouldRelaunch:!1}})}var i}function Pu(){const t=Cn(),n=a.useSelector(_u),i=Wt()({state:n},"textContent");return e.jsx(Ht,{value:i,children:e.jsx(bt,{children:e=>e(t)})})}const $u={staticData:Au,dynamicData:Ru,childLayouts:Tu};function Gu(e={}){return Object.assign({staticData:null,dynamicData:null,childLayouts:{launched:{}}},e)}function Fu(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 Mu(e){return"object"==typeof e&&null!==e&&Object.entries(e).every((([e,t])=>"string"==typeof e&&"string"==typeof t))}function*Bu(e,t,n,a){for(;;){switch(yield r.take(e)){case"CLOSED":t({type:Z,payload:{event:"Dismissed",dismissalReason:"Implicit"}});break;case"SUCCESS":if(n&&a){yield r.call(a);break}t({type:Z,payload:{event:"Completed",completionReason:"Success"}});break;case"UNSPECIFIED":t({type:Z,payload:{event:"Completed",completionReason:"Unspecified"}})}}}function*Uu(e,t,n){if(q(n)){const{responseOption:a,fulfillment:i}=n,o=K(n);yield r.put({type:Y,payload:{name:"SignalResponse",parentGuid:a.instanceGuid,responseActionPayload:{name:"Fulfillment"}}});const s=yield r.call(e.createChildPlugin.bind(e),i);if("object"==typeof s&&"onClose"in s&&"close"in s){const a=yield r.call(Fu,s);if("object"==typeof a&&"take"in a){const i=function(e,t,n,a){if(n.responseOption.rclid)return function*(){yield r.put({type:X,payload:{name:"REALTIME_OFFER_FULFILLMENT_CONVERSION",body:{rclid:n.responseOption.rclid,accountID:n.accountID,referralCreativeID:n.referralCreativeID}}}),yield r.call(Vu,e,t,a)}}(e,t,n,s);return void(yield r.call(Bu,a,e.globalDispatch.bind(e),o,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*Vu(e,t,n){const a=function(e){return l.eventChannel((t=>{const n=e.onEvent({name:ur,source:"partner",callback:e=>{Mu(e)&&t({eventName:ur,data:e})}},{name:pr,source:"partner",callback:e=>{Mu(e)&&t({eventName:pr,data:e})}});return()=>{n()}}))}(e);try{for(;;){const i=yield r.take(a);switch(i.eventName){case ur:yield r.put({type:X,payload:{name:ur,body:i.data}}),yield r.put({type:Ou,payload:{text:i.data}}),e.globalDispatch({type:Z,payload:{event:"Completed",completionReason:"Success"}}),n&&(yield r.call(n.close.bind(n)));break;case pr:e.globalDispatch({type:Z,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:L,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)||H(n.payload)?n.payload:n.payload.responseOption;switch(a.action){case"Url":yield r.call(e.globalDispatch.bind(e),n),K(n.payload)&&(yield r.put({type:X,payload:{name:"REALTIME_OFFER_FULFILLMENT_REFERRAL",body:{rclid:a.rclid,accountID:a.accountID,referralCreativeID:a.referralCreativeID}}}),yield r.call(Vu,e,t));break;case"CaptureOnly":yield r.call(e.globalDispatch.bind(e),n);break;case"Fulfillment":yield r.put({type:X,payload:{name:"OFFER_ENGAGEMENT"}}),a.isPositive&&(yield r.put({type:X,payload:{name:"POSITIVE_ENGAGEMENT"}})),yield*Uu(e,t,n.payload)}}function*qu(e,t){yield r.all([r.takeLatest(z,zu.bind(null,e,t)),r.takeEvery(oe,ku.bind(null,e,t)),r.takeEvery("*",So.bind(null,[z,oe],e))])}Object.assign({},re);const Hu=(new En).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=Gu({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n=Gu()){const a=l(),i=s.configureStore({reducer:$u,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(kn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Ai,{}),e.jsx(a.Provider,{store:d,children:e.jsx(Oi,{settings:i,dispatch:d.dispatch,children:e.jsx(Pu,{})})})]})}))}}));var Wu=Object.freeze({__proto__:null,moduleConnectorBuilder:Hu});const Ju="CART/UPDATE",Ku="CATALOG_ITEM/RESPONSE",Yu="USER_CREATIVE_RESPONSE_HISTORY/ADD",Zu=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 Qu({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 Xu="catalogRadioGroup__label",ep=["Enter","Space"],tp={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 np(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 ap({schema:n,testId:i}){const o=a.useDispatch(),r=Gn(),[s,l]=a.useSelector((e=>{var t,a;const i=r.cartItemId in e.cart?null!==(a=null===(t=e.cart[r.cartItemId])||void 0===t?void 0:t.quantity)&&void 0!==a?a:0:NaN;return[i,np(n.validations,n.options.length,i)]})),c=Tn(),{tabIndex:d,styles:u,isDisabled:p}=m(c);t.useEffect((()=>{p||o(ip(l))}),[]);const f=n.options.filter((({quantity:e})=>{var t,n;return e>=(null!==(t=r.minItemCount)&&void 0!==t?t:-1/0)&&e<=(null!==(n=r.maxItemCount)&&void 0!==n?n:1/0)}));function y(e){o({type:Ku,payload:{catalogItem:r,quantity:e}});const t=np(n.validations,n.options.length,e);o(ip(t))}return f.length>0?e.jsx(Oa,{styles:n.styles?M(tp,n.styles):tp,children:({classnames:n,mapperRef:a})=>e.jsx("div",{className:null==n?void 0:n.own,style:Object.assign({display:"flex",flexDirection:"column"},u),children:e.jsx(Kt,{value:a(Xu),children:t.Children.toArray(f.map(((t,a)=>{var o;const l=Zu(s,t.quantity),c=e=>i?`${i}-option${a}${e}`:void 0;return e.jsxs("label",{tabIndex:d,"aria-disabled":p,style:{display:"flex"},className:`${Xu} ${null!==(o=null==n?void 0:n.optionContainer)&&void 0!==o?o:""}`,onKeyDown:e=>{l||!ep.includes(e.code)||p||y(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:r.instanceGuid,value:t.quantity,checked:l,onChange:()=>y(t.quantity),"aria-disabled":p,disabled:p}),e.jsx(Qu,{isChecked:l,isDisabled:p,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(Ni,{schema:t,testId:c("Content")})]})})))})})}):null}function ip(e){return{type:ae,payload:{errors:e}}}function op(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function rp(t){const n=a.useDispatch(),i=Et(),o=Gn(),r=Tn(),{tabIndex:s,styles:l,isDisabled:c}=m(r);return e.jsx(Oa,{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:Ku,payload:{catalogItem:o,quantity:1}})},className:null==a?void 0:a.own,children:op(t.schema.children,i,t.testId)})})}const sp={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"]},lp=new Map([["&","_;^;_"]]),cp=new RegExp(`<a *(?=${sp.allowedAttributes.a.join("|")}|>)`,"g"),dp=new RegExp(`<a *(?:(?:${sp.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),up=new RegExp("(<br *?>)|(<br *?/>)","g"),pp=new RegExp(`<ul *(?=${sp.allowedAttributes.ul.join("|")}|>)`,"g"),fp=new RegExp(`<ol *(?=${sp.allowedAttributes.ol.join("|")}|>)`,"g"),yp=new RegExp("<li *(?=>|\\s[^>]*>)","g"),hp="<br/>";function mp(n){const a=Wt(),i=Tn(),o=t.useMemo((()=>{const e=a(n.schema.value);if(!function(e){const t=function(e){return e.replaceAll(dp,((e,t)=>{const n=t.replaceAll("&",lp.get("&"));return e.replace(t,n)})).replaceAll(up,hp)}(e);return t===u(t,sp)}(e))throw new j("FAILED_SANITISING_HTML","Invalid HTML tags");return e}),[n.schema.value,a]),{tabIndex:r,styles:s,isDisabled:l}=m(i);return o?e.jsx(Oa,{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(cp,`<a ${a.join(" ")}`).replace(pp,`<ul ${i}`).replace(fp,`<ol ${i}`).replace(yp,`<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 vp={internally:"_top",externally:"_blank"};function gp(t,n,a,i,o){return e.jsx(Kt,{value:a(n),children:bp(t,i,o)})}function bp(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Ep(t){var n,i;const o=vp[t.schema.open],r=Et(),s=Gn(),l=Tn(),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(Oa,{styles:t.schema.styles,children:({classnames:n,mapperRef:a})=>{var i;return e.jsx("a",{href:d,onClick:()=>{var e;c({type:Y,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)?gp(t.schema.children,null==n?void 0:n.own,a,r,t.testId):bp(t.schema.children,r,t.testId)})}}):null}function Ip(e,t){const n=e.cart[t];return n||null}function xp(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 Sp(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 xp(e).reduce(((e,t)=>e+t.quantity),0)}(e),s=Ip(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 wp(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 Cp(e,t){var n,a;return null!==(a=null===(n=wp(e))||void 0===n?void 0:n.find((e=>e.catalogItemId===t)))&&void 0!==a?a:null}function Op(e){var t;const n=null===(t=wp(e))||void 0===t?void 0:t.filter((e=>e.preSelectedQuantity&&e.preSelectedQuantity>0));return n&&n.length>0?n:null}function Tp(e){var t,n;return null!==(n=null===(t=Op(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 Ap=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 Rp(t,n,a,i,o){return e.jsx(Kt,{value:a(n),children:i(t,void 0,o)})}function Lp(e,t,n){return t(e,void 0,n)}function jp(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=Et(),b=Wt(),E=Tn(),{tabIndex:I,styles:x,isDisabled:S}=m(E),w=a.useSelector((e=>function(e,t){var n,a,i;const o=Cp(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))),C=a.useSelector((e=>Ip(e,v.cartItemId))),O=a.useSelector((e=>Sp(e,v))),T=(null==C?void 0:C.quantity)||0,A=m(S||T<=(null!==(n=v.minItemCount)&&void 0!==n?n:0)?"DISABLED":E),R=m(S||O<=0?"DISABLED":E),L=m(S||w?"DISABLED":E),j=e=>{var t;const n=e.target.value;if(0===n.length)N(null!==(t=v.minItemCount)&&void 0!==t?t:0);else{const e=Number(n);!Number.isNaN(e)&&e>=0&&N(e)}},N=e=>{S||h({type:Ku,payload:{catalogItem:v,quantity:e}})};return e.jsx(Oa,{styles:s,children:({classnames:t,mapperRef:n})=>e.jsx("div",{className:null==t?void 0:t.own,style:Object.assign({display:"flex",flexDirection:"row"},x),children:w&&d?e.jsx(Pa,{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(),N(T-1)},tabIndex:A.tabIndex,"aria-label":y||void 0,disabled:A.isDisabled,"data-testid":o?`${o}-decrement-button`:void 0,children:e.jsx(Ht,{value:b,children:(null==t?void 0:t.decrementButton)?Rp(p,t.decrementButton,n,g,o):Lp(p,g,o)})}):null,l?e.jsx("input",{type:"text",className:null==t?void 0:t.input,style:Object.assign(Object.assign({},L),{cursor:L.isDisabled?"not-allowed":"auto",caretColor:L.isDisabled?"transparent":"auto",pointerEvents:"auto",outline:"none"}),value:T,onChange:j,"aria-label":r||void 0,tabIndex:I,disabled:S,"data-testid":o?`${o}-input`:void 0}):e.jsx("p",{className:null==t?void 0:t.input,style:x,"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(),N(T+1)},tabIndex:R.tabIndex,"aria-label":f||void 0,disabled:R.isDisabled,"data-testid":o?`${o}-increment-button`:void 0,children:e.jsx(Ht,{value:b,children:(null==t?void 0:t.incrementButton)?Rp(u,t.incrementButton,n,g,o):Lp(u,g,o)})}):null]})})})}const Np={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(rp,{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(mp,{schema:n.node});case"CatalogUrlLink":return e.jsx(Ep,{schema:n.node});default:return}}},CatalogRadioGroup:function(t){if("CatalogRadioGroup"===t.type)return e.jsx(ap,{schema:t.node})},CatalogQuantityCounter:function(t){if("CatalogQuantityCounter"===t.type)return e.jsx(jp,{schema:t.node})}};function _p(){const t=Cn(),n=Et();return e.jsx(It,{value:n,overrides:Np,children:e.jsx(bt,{children:e=>e(t)})})}const Dp={cart:function(e={},t){if(t.type===Ju){const{catalogItem:n,quantity:a}=t.payload,i=n.cartItemId,o=wo(n,a);return Object.assign(Object.assign({},e),{[i]:o})}return e},userCreativeResponseHistory:function(e=[],t){return t.type===Yu?e.concat(t.payload.responseId):e},staticData:Au,childLayouts:Tu};const kp="INVALID_PARTNER_MESSAGE",Pp="MISCONFIGURED_CATALOG_ITEM",$p="FAILED_TO_PROCESS_PARTNER_UPDATE_CART_ITEM";function*Gp(e){var t,n;const a=yield r.select(Op),i=yield r.select(Tp),o=yield r.select((e=>{var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer.maxTotalItemsQtyInOffer}));if(Vp(i)&&Vp(o)&&i>o)yield r.call(e,{level:L,code:Pp,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:L,code:Pp,message:`Preselected quantity (${a}) is greater than maxItemCount (${o}) for catalog item (${i.instanceGuid})`}):yield*Up(i,a,!0)}}function*Fp(e,t,n){const{catalogItem:a,quantity:i}=n.payload;if(yield*Up(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:L,code:"INVALID_RESPONSE_OBJECT",message:n}))}var o}function*Mp(e,t){const n=function(e,t){return l.eventChannel((n=>{const a=e.onEvent({name:sr.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:L,code:kp,message:`Invalid UpdateCartItemPartnerMessageBody: ${JSON.stringify(e)}`}):n(e)}});return()=>{a()}}))}(e,t);try{for(;;){const e=yield r.take(n);yield r.call(Bp,e,t)}}catch(e){const n=e;t({level:L,code:$p,message:null==n?void 0:n.message})}finally{(yield r.cancelled())&&n.close()}}function*Bp(e,t){const{cartItemId:n,quantity:a}=e,i=yield r.select(Ip,n);if(zp(i)){const e=yield r.select(Cp,i.catalogItemId);null!==(o=e)&&"object"==typeof o&&"catalogItemId"in o&&"price"in o?yield*Up(e,a,!1):yield r.call(t,{level:L,code:$p,message:`Catalog item not found for cart item id (${n})`})}else yield r.call(t,{level:L,code:$p,message:`Cart item not found for cart item id (${n})`});var o}function*Up(e,t,n){var a;const i=yield r.select(Ip,e.cartItemId),o=yield r.select(Sp,e),s=Vp(o)?o:0,l=zp(i)?i.quantity:0;if(t!==l&&t>=(null!==(a=e.minItemCount)&&void 0!==a?a:0)&&t-l<=s){yield r.put({type:Ju,payload:{catalogItem:e,quantity:t}});const a=yield r.select(Ip,e.cartItemId),o=yield r.select(Ap);return yield r.put({type:ie,payload:{cart:o}}),yield r.put({type:Y,payload:{name:"SignalCartItemQuantitySelected",parentGuid:e.instanceGuid,objectData:{quantity:t,preselected:n}}}),yield r.put({type:X,payload:{name:"V2_CART_ITEM_UPDATED",body:{oldCartItem:i,cartItem:a}}}),!0}return!1}function Vp(e){return"number"==typeof e}function zp(e){return null!=e&&"object"==typeof e&&"cartItemId"in e&&"quantity"in e&&"unitPrice"in e}function*qp(e,t){var n;yield r.put({type:Yu,payload:{responseId:(n=t.payload,q(n)?n.responseOption.id:n.id)}}),yield r.call(e.globalDispatch.bind(e),t)}function*Hp(e,t){yield r.all([r.spawn(Gp.bind(null,t)),r.spawn(Mp.bind(null,e,t)),r.takeLatest(Ku,Fp.bind(null,e,t)),r.takeLatest(z,qp.bind(null,e)),r.takeEvery(oe,ku.bind(null,e,t)),r.takeEvery("*",So.bind(null,[z,oe],e))])}Object.assign(Object.assign({},re),{CATALOG_ITEM_RESPONSE:Ku});const Wp=(new En).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=function(e={}){return Object.assign({cart:{},userCreativeResponseHistory:[],staticData:null,childLayouts:{launched:{}}},e)}({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n){const a=l(),i=s.configureStore({reducer:Dp,devTools:{name:"Add To Cart"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(Hp,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(kn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Ai,{}),e.jsx(a.Provider,{store:d,children:e.jsx(Oi,{settings:i,dispatch:d.dispatch,children:e.jsx(_p,{})})})]})}))}}));var Jp=Object.freeze({__proto__:null,moduleConnectorBuilder:Wp});const Kp="CATALOG/TRIGGER_SELECT_ITEM",Yp="CATALOG/SET_SELECTED_ITEM",Zp="CHECKOUT_LIFECYCLE",Qp="INSTANT_PURCHASE/INITIATE",Xp="INSTANT_PURCHASE/PARTNER_RESPONSE";function ef(t,n,a,i,o){return e.jsx(Kt,{value:a(n),children:tf(t,i,o)})}function tf(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function nf(t){const n=a.useDispatch(),i=Et(),o=Tn(),{tabIndex:r,styles:s,isDisabled:l}=m(o),c=Gn(),d=Ut(c,"catalogItem");return e.jsx(Oa,{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:Qp,payload:{catalogItem:c,quantity:1,useInstantPurchaseExtension:!0}})},className:null==a?void 0:a.own,children:e.jsx(Ht,{value:d,children:(null==a?void 0:a.own)?ef(t.schema.children,a.own,o,i,t.testId):tf(t.schema.children,i,t.testId)})})})}function af(n){const a=Tn(),i=ht(),{customStateKey:o,customStateValue:r}=n.schema,{tabIndex:s,styles:l,isDisabled:c}=m(a),d=()=>{i({type:Q,payload:{key:o,value:r}})};return e.jsx(Oa,{styles:n.schema.styles,children:({classnames:a})=>{var i;return e.jsx("button",{className:null==a?void 0:a.own,onClick:d,"data-testid":n.testId,"data-e2e":"ButtonStateTrigger",disabled:c,"aria-disabled":c,"aria-label":null!==(i=n.schema.a11yLabel)&&void 0!==i?i:void 0,tabIndex:s,style:Object.assign({backgroundColor:"transparent",cursor:"pointer",margin:0,padding:0},l),children:e.jsx(bt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}function of(n){const i=Et(),o=_n(),r=Wt(),s=ht(),l=Ot().catalogItems||[],c=a.useSelector((e=>e.selectedItem))||l[0];return t.useEffect((()=>{c&&s({type:Y,payload:{name:"SignalImpression",parentGuid:null==c?void 0:c.instanceGuid}})}),[c,s]),c?e.jsx(Oa,{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($n,{context:c,children:e.jsx(Nn,{value:o(c),children:e.jsx(Ht,{value:(s=c,r({data:s},"catalogItem")),children:i(n.schema.template,void 0,n.testId?`${n.testId}-child`:"")})})}))});var s}}):null}function rf(t,n,a,i,o){return e.jsx(Kt,{value:a(n),children:i(t,void 0,o)})}function sf(e,t,n){return t(e,void 0,n)}const lf=["ArrowDown","ArrowUp","Enter","Escape","Tab"];function cf(n){const i=Ot(),o=Et(),r=Gn(),s=Wt(),l=e=>s({data:e},"catalogItem"),c=t.useMemo((()=>i.catalogItems||[]),[i]),d=Tn(),{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?S():x())}function x(){p||v(!0)}function S(){p||v(!1)}function w(e){b(c.indexOf(e)),S(),E({type:Kp,payload:{catalogItem:e}})}t.useEffect((()=>{if(h){const e=y.current[g];e&&e.focus()}}),[h,g]);const C={elements:{own:[{default:{background:{backgroundColor:{light:"#ffffff"}},dimension:{width:{type:"percentage",value:100}}}}]}};function O(e){if(!p&&lf.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&&w(e)}else x();break;case"Tab":if(h){S();const e=c.indexOf(r);-1!==e&&b(e)}break;case"Escape":if(e.preventDefault(),h){S();const e=c.indexOf(r);-1!==e&&b(e)}}}return e.jsx(Oa,{styles:n.schema.styles?M(C,n.schema.styles):C,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&&S()},"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(Ht,{value:l(r),children:(null==t?void 0:t.dropDownSelectedElement)?rf(n.schema.closedTemplate,t.dropDownSelectedElement,a,o,n.testId):sf(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||w(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(Ht,{value:l(i),children:(null==t?void 0:t.dropDownListElement)?rf(n.schema.openTemplate,t.dropDownListElement,a,o,n.testId):sf(n.schema.openTemplate,o,n.testId)})},i.catalogItemId)))})]})})}function df(n){const i=n.schema.styles,o=a.useDispatch(),r=a.useSelector((e=>e.staticData)),s=Tn(),{tabIndex:l,styles:c,isDisabled:d}=m(s),u=()=>{var e;o({type:Zp,payload:{event:"Checkout",targetStep:n.schema.targetStep,offerPositionIndex:null!==(e=null==r?void 0:r.position)&&void 0!==e?e:0}})};return e.jsx(Oa,{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(bt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,U(a,n.testId)))))})})}})}const uf=/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{3})$/;function pf(t){const n=Wt(),a=Tn(),{schema:i,testId:o}=t,r=n(i.value),{tabIndex:s,styles:l,isDisabled:c}=m(a);return"string"==typeof(d=r)&&uf.test(d)?e.jsx(Oa,{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 ff(n){const{schema:{imageKeys:a,styles:i},testId:o}=n,[r,s]=t.useState(0),l=Tn(),c=function(e){const n=t.useContext(jn);return e.reduce(((e,t)=>{const a=n(`${t}.src`,"copy"),i=n(`${t}.title`,"copy");return void 0===a?e:[...e,C({light:a,title:i})]}),[])}(a),{styles:d,isDisabled:u,tabIndex:p}=m(l),f=c[r]||c[0];return c.length>0&&f?e.jsx(Oa,{styles:i,children:({classnames:n})=>e.jsxs("div",{className:null==n?void 0:n.own,children:[e.jsx("img",{"aria-hidden":u,src:f.light,alt:f.alt,title:f.title,className:null==n?void 0:n.mainImage,style:d,"data-testid":`${o}-main-image`,"data-e2e":"ImageGallery-mainImage"}),e.jsx("div",{className:null==n?void 0:n.thumbnailList,style:Object.assign(Object.assign({},d),{display:"flex"}),children:t.Children.toArray(c.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({},d),{cursor:u?"not-allowed":"pointer",pointerEvents:"auto"}),"data-testid":`${o}-thumbnail-${a}`,"data-e2e":"ImageGallery-thumbnail",tabIndex:p,onClick:()=>s(a)}))))})]})}):null}const yf={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(nf,{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"ButtonStateTrigger":return e.jsx(af,{schema:n.node});case"CatalogCombinedCollection":return e.jsx(of,{schema:n.node});case"CatalogDropDown":return e.jsx(cf,{schema:n.node});case"CheckoutStateButtonTrigger":return e.jsx(df,{schema:n.node});case"ColorSwatch":return e.jsx(pf,{schema:n.node});case"ImageGallery":return e.jsx(ff,{schema:n.node});default:return}}}};function hf(){const t=Cn(),n=Et(),i=a.useSelector(_u),o=Wt()({state:i},"textContent");return e.jsx(It,{value:n,overrides:yf,children:e.jsx(Ht,{value:o,children:e.jsx(bt,{children:e=>e(t)})})})}const mf={staticData:Au,selectedItem:(e=null,t)=>t.type===Yp?t.payload:e,dynamicData:Ru,childLayouts:Tu};function vf(e={}){return Object.assign({staticData:null,selectedItem:null,dynamicData:null,childLayouts:{launched:{}}},e)}const gf="INVALID_RESPONSE_OBJECT";function bf(e,t){return l.eventChannel((n=>e.onEvent({name:lr.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:L,code:"MALFORMED_PARTNER_DATA",message:`Malformed data received from partner\n ${e}`})}})))}function*Ef(e,t){var n;try{for(;;){const t=yield r.take(e);t&&(yield r.put({type:Xp,payload:t}))}}catch(e){yield r.call(t,{level:L,code:"INSTANT_PURCHASE_CHANNEL_ERROR",message:null!==(n=e.message)&&void 0!==n?n:"Unknown error in instant-purchase channel"})}finally{e.close()}}function If(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 xf="Unknown failure reason";function*Sf(){const e=yield r.select(If);e&&(yield*Af(e))}function*wf(e){const{catalogItem:t}=e.payload;yield*Af(t)}function*Cf(e,t,n){const{catalogItem:a,quantity:i}=n.payload,o=wo(a,i);o?(yield r.put({type:Y,payload:{name:"SignalCartItemInstantPurchaseInitiated",parentGuid:a.instanceGuid,objectData:{catalogItemId:a.catalogItemId,quantity:i}}}),yield*function*(e,t){yield r.put({type:Q,payload:{key:e,value:t}})}("ProcessingState",1),n.payload.useInstantPurchaseExtension?yield*function*(){(yield r.call((function*(){return yield r.delay(5e3),!0})))?yield*Nf("offerComplete",1):yield*Nf("offerComplete",2)}():(yield r.fork(Tf,e,t),yield r.put({type:X,payload:{name:"CART_ITEM_INSTANT_PURCHASE",body:{upsellItems:[o],totalUpsellPrice:o.totalPrice||0,currency:o.currency}}}))):yield r.call(t,{level:L,code:gf,message:`Unable to translate catalog item with ID ${a.catalogItemId} to cart item for instant purchase transaction.`})}function*Of(e,t){const n=yield r.select((e=>e.staticData));if(!n)return yield r.call(e,{level:L,code:"MISSING_STATIC_DATA_IN_INSTANT_PURCHASE_MODULE",message:"App state is not configured with static data."}),void(yield*jf("Error"));if(!n.offer.catalogItems)return yield r.call(e,{level:L,code:"MISSING_CATALOG_ITEMS",message:"No catalog items found within offer data."}),void(yield*jf("Error"));const a={accountId:n.offer.accountId,catalogItems:n.offer.catalogItems};let i,o;t.payload.success?(i=Rf,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||xf,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=Lf(a,t.catalogItems);void 0===e?i.push(a):yield r.put({type:Y,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:L,code:gf,message:`Unable to map cart items to catalog items in the instant purchase partner response: ${n}.`})}(i,a))}(t.payload,a,i,e),yield*jf(o)}function*Tf(e,t){const n=bf(e,t),{timeout:a}=yield r.race({channelListener:r.call(Ef,n,t),timeout:r.delay(6e4)});a&&(yield r.call(t,{level:L,code:"INSTANT_PURCHASE_RESPONSE_TIMEOUT",message:"Instant-purchase response timed out after 60000ms"}),n.close(),yield r.put({type:Z,payload:{event:"Dismissed",dismissalReason:"Implicit"}}))}function*Af(e){var t,n,a;yield r.put({type:Yp,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:Ou,payload:{text:i}})}function Rf(e,t){return{name:"SignalCartItemInstantPurchase",parentGuid:e.instanceGuid,objectData:{catalogItemId:e.catalogItemId,quantity:t,initiatedBy:T.DCUI}}}function Lf(e,t){return t.find((t=>t.catalogItemId===e.catalogItemId))}function*jf(e){yield r.put({type:Z,payload:{event:"Completed",completionReason:e}})}function*Nf(e,t){yield r.put({type:ee,payload:{key:e,value:t}})}function*_f(e){"Checkout"===e.payload.event&&(yield r.put({type:ee,payload:{key:"checkout",value:Df(e.payload),offerPositionIndex:e.payload.offerPositionIndex}}))}function Df(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*kf(e,t){yield r.all([r.spawn(Sf),r.takeEvery(Zp,_f),r.takeEvery(Kp,wf),r.takeLatest(Qp,Cf.bind(null,e,t)),r.takeLatest(Xp,Of.bind(null,t)),r.takeEvery(oe,ku.bind(null,e,t)),r.takeEvery("*",So.bind(null,[z,oe],e))])}Object.assign(Object.assign({},re),{INITIATE_INSTANT_PURCHASE:Qp,INSTANT_PURCHASE_PARTNER_RESPONSE:Xp});const Pf=(new En).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=vf({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n=vf()){const a=l(),i=s.configureStore({reducer:mf,devTools:{name:"Instant Purchase"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(kf,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(kn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Ai,{}),e.jsx(a.Provider,{store:d,children:e.jsx(Oi,{settings:i,dispatch:d.dispatch,children:e.jsx(hf,{})})})]})}))}}));var $f=Object.freeze({__proto__:null,moduleConnectorBuilder:Pf});const Gf=t.createContext(null),Ff=({children:n})=>{var a;const[i,o]=t.useState([]),[r,s]=t.useState(0),[l,c]=t.useState(0),d=Wt();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(Gf.Provider,{value:{images:i,activeIndex:r,duration:l,setImages:o,setActiveIndex:s,setDuration:c},children:e.jsx(Ht,{value:d({data:{"image.title":null===(a=i[r])||void 0===a?void 0:a.title}},"creativeCopy"),children:n})})};function Mf({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 Bf(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=C({light:t,title:i});a.push(o)})),a}function Uf({schema:n,testId:a}){const i=JSON.parse(n.data),{styles:o,duration:r,imageKeys:s}=i,l=t.useContext(Gf),c=Bf(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(Mf,{duration:r,active:n===(null==l?void 0:l.activeIndex),containerStyles:o.elements.indicatorContainer,indicatorStyles:o.elements.indicator}))))})]})}const Vf={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"]},zf=new Map([["&","_;^;_"]]),qf=new RegExp(`<a *(?=${Vf.allowedAttributes.a.join("|")}|>)`,"g"),Hf=new RegExp("<span*>","g"),Wf=new RegExp(`<a *(?:(?:${Vf.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),Jf=new RegExp("(<br *?>)|(<br *?/>)","g"),Kf="<br/>";function Yf(n){const a=Wt(),i=Tn(),o=t.useMemo((()=>{const e=a(n.schema.value);if(!function(e){const t=function(e){return e.replaceAll(Wf,((e,t)=>{const n=t.replaceAll("&",zf.get("&"));return e.replace(t,n)})).replaceAll(Jf,Kf)}(e);return t===u(t,Vf)}(e))throw new j("FAILED_SANITISING_HTML","Invalid HTML tags");return e}),[n.schema.value,a]),{tabIndex:r,styles:s,isDisabled:l}=m(i);return o?e.jsx(Oa,{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(qf,`<a ${a.join(" ")}`).replace(Hf,`<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(qf,`<a ${a.join(" ")}`).replace(Hf,`<span${(null==t?void 0:t.span)?` class=${t.span}`:""}>`)}});var i}}):null}function Zf({schema:n}){const a=Et(),i=ct(Mn(),Xt()),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 Fs={name:"loading-extension",componentFactory:e=>t.createElement(Gs,{data:e}),interceptors:{}},Ms=1e3;function Bs(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()/Ms,o=t.useRef(null),r=()=>{const t=(new Date).getTime()/Ms;a(Math.max(Math.floor(e-(t-i)),0))};return t.useEffect((()=>(o.current=setInterval(r,Ms),()=>{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,Ms)}}}((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:Y,payload:{name:"SignalUserInteraction",action:"TimerExpired",context:"TimerProgression"}}),d({type:"PROGRESSION/PROCESS",payload:{offerProcessStatus:"CONTINUE"}}))}),[o,r]);const u=Tn(),{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 Us={name:"timer-progression-extension",componentFactory:e=>t.createElement(Bs,{data:e}),interceptors:{}},Vs="MODULE/ADD_LOADED",zs="MODULE/LOAD",qs="PROGRESSION/INITIALISE",Hs="PROGRESSION/NEXT",Ws="PROGRESSION/PREV",Js="PROGRESSION/UPDATE_GROUP_SIZE",Ks="PROGRESSION/PROCESS",Ys="SLOTS/SET",Zs="INSTANT_PURCHASE/DISMISS",Qs="OFFER_LIFECYCLE",Xs="DOMAIN_STATES/SET",el="OFFER_ENGAGEMENT",tl="GLOBAL_OFFER_DATA_STATE/SET_CART",nl=Object.assign(Object.assign({},eo),{NEXT_IN_PROGRESSION:Hs,PREV_IN_PROGRESSION:Ws,INITIALISE_PROGRESSION:qs,UPDATE_GROUP_SIZE:Js,SET_SLOTS:Ys,ADD_LOADED_MODULE:Vs,SET_DOMAIN_STATE:Xs,SET_GLOBAL_OFFER_DATA_CART:tl}),al=Object.assign(Object.assign({},to),{LOAD_MODULES:zs,DISMISS_INSTANT_PURCHASE:Zs,PROCESS_PROGRESSION:Ks,OFFER_LIFECYCLE:Qs,OFFER_ENGAGEMENT:el,SET_PARTNER_VALIDATION_STATUS:ae});function il(e,t){return t<=0||e<=0||t>e?0:Math.ceil(e/t)}function ol(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<il(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 rl=Symbol("root");function sl(){return{[rl]:{}}}const ll=Object.assign({progression:function(e=null,t){switch(t.type){case qs:if(function(e){const{totalCount:t,currentGroupIndex:n,groupSize:a}=e;return t>=0&&a>=0&&n>=0&&a<=t&&n<il(t,a)}(t.payload)){const{totalCount:e,_:n,groupSize:a}=t.payload;return Object.assign(Object.assign({},t.payload),{indexGroups:ol(e,a)})}return null;case Js:{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:ol(a,n),currentGroupIndex:0}):null}case Hs:{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,il(t,n)-1)}):null}case Ws:{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===Ys?t.payload:e},module:function(e={loadedModules:[]},t){return t.type===Vs?Object.assign(Object.assign({},e),{loadedModules:[...e.loadedModules,t.payload]}):e},domainStates:function(e=sl(),t){if(t.type===Xs){if(t.payload.key&&!isNaN(t.payload.value)){const n=void 0!==t.payload.offerPositionIndex?`module${t.payload.offerPositionIndex}`:rl;return n===rl?e:Object.assign(Object.assign({},i.assocPath([n,t.payload.key],Number(t.payload.value),e)),{[rl]:{}})}return e}return e},globalOfferDataState:function(e={},t){if(t.type===tl){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}},ar);function cl(e={}){return Object.assign(Object.assign(Object.assign({},function(e={}){return Object.assign({layout:Ho(),breakpoint:{breakpoints:{default:0},activeBreakpoint:"default",initialised:!1},active:Wo(),fonts:[],signal:{queue:[],processed:[]},serializableCache:nr(),settings:{closeOnComplete:!0},customStates:{root:{}}},e)}(e)),{progression:null,slots:[],module:{loadedModules:[]},domainStates:sl(),globalOfferDataState:{}}),e)}function dl(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 ul(e){return e.progression?{activeGroupIndex:e.progression.currentGroupIndex,totalOffers:e.progression.totalCount,totalGroups:il(e.progression.totalCount,e.progression.groupSize),isLast:dl(e)}:null}function pl(e,t){return e.domainStates[`module${t}`]||{offerComplete:0,checkout:0}}function fl(e){return Object.values(e.globalOfferDataState).reduce(((e,t)=>t.cart?e+t.cart.reduce(((e,t)=>e+t.quantity),0):e),0)}function yl(n){var i;const{config:o,position:r,visible:s,container:l,testId:c}=n,d=Mn(),u=Tn(),p=a.useSelector(Jo),f=t.useContext(Bn),y=t.useContext(Un),h=`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(h,{style:{display:"flex",flexDirection:"column"===l?"column":"row",width:"100%"},slotInstanceGuid:o.instanceGuid,layoutSchema:JSON.stringify(o.layoutVariant.layoutVariantSchema),schemaVersion:f,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==y?void 0:y.inert)&&!s?"":void 0,"aria-hidden":(null==y?void 0:y.inert)?void 0:!s,"module-component":!0,"plugin-id":d,"active-breakpoint":B(p)})]})}function hl({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=Tn(),{tabIndex:d,isDisabled:u,styles:p}=m(c);return r.length&&r[l]?e.jsx(Oa,{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(Ni,{effect:n.transition,visible:a===l,parentElement:s.current,children:e.jsx(yl,{config:t,position:a,visible:a===l,container:"column"})}))))})}):null}const ml=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=il(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=Tn(),{tabIndex:r,styles:s,isDisabled:l}=m(o),c=Array(a).fill(i.indicator);return a>0&&(u=a+n-1,(d=t)>=n&&d<=u)?e.jsx(qt,{children:a=>e.jsx(Oa,{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 vl="partnerValidationUI",gl="stackedViewableItems";function bl(n){var o;const r=a.useDispatch(),s=a.useSelector((e=>e.slots)),l=null!==(o=n.schema.viewableItems)&&void 0!==o?o:[],c=ma(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:qi,payload:{key:gl,value:String(d)}})}),[d]);const u=s.slice(0,d),p=Tn(),{tabIndex:f,isDisabled:y,styles:h}=m(p);return(null==u?void 0:u.length)>0?e.jsx(Oa,{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(yl,{config:t,position:n,visible:!0,container:"column"}))))})}):null}function El(n){const i=n.schema.styles,o=a.useDispatch(),r=Tn(),s="Backward"===n.schema.direction?"Previous":"Next",{tabIndex:l,styles:c,isDisabled:d}=m(r),u=()=>{o({type:"Backward"===n.schema.direction?nl.PREV_IN_PROGRESSION:nl.NEXT_IN_PROGRESSION})};return e.jsx(Oa,{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(bt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,n.testId?`${n.testId}-child${a}`:void 0))))})})}})}function Il({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(Qo),I=n.viewableItems.length-1,[x,S]=d({slidesToScroll:null!==(r=n.viewableItems[Math.min(E,I)])&&void 0!==r?r:"auto",containScroll:"trimSnaps"}),w=a.useDispatch(),C=Tn(),{tabIndex:O,isDisabled:T,styles:A}=m(C),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?w({type:nl.NEXT_IN_PROGRESSION}):a<i&&w({type:nl.PREV_IN_PROGRESSION}))}return null!=g&&(null==S||S.on("select",e),null==S||S.scrollTo(g)),()=>{null==S||S.off("select",e)}}),[S,g,w]);const L={overflow:"hidden"},j={backfaceVisibility:"hidden",display:"flex",touchAction:"pan-y",gap:R,alignItems:"stretch"},N=e=>{var t;return null!==(t=null==v?void 0:v.includes(e))&&void 0!==t&&t},_=n.peekThroughSize[Math.min(E,n.peekThroughSize.length-1)],D=_?"Fixed"===(k=_).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(Oa,{styles:n.styles,children:({classnames:n})=>e.jsx("div",{ref:x,style:Object.assign(Object.assign({},L),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:j,"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(yl,{config:t,position:n,container:"row",visible:N(n)})}))))})})}):null}function xl({schema:n,testId:i}){const o=Mn(),r=t.useMemo((()=>ct(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)||[]).map((t=>t.map((t=>e.slots[t])).filter((e=>null!=e))))})),c=t.useRef(null),d=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})),u=Tn(),{tabIndex:p,isDisabled:f,styles:y}=m(u);return l.length?e.jsx(Oa,{styles:n.styles,children:({classnames:a})=>e.jsx("div",{ref:c,"data-testid":i,"data-e2e":"GroupedDistribution","aria-disabled":f,tabIndex:p,style:Object.assign({position:"relative",transition:`height ${n.transition.settings.duration/2}ms ease-in-out`,overflow:"hidden",boxSizing:"content-box"},y),children:t.Children.toArray(l.map(((o,l)=>e.jsx(Ni,{effect:n.transition,visible:l===d,parentElement:c.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(yl,{config:t,position:a,visible:l===d,container:"column",testId:i?`${i}-child${a}`:void 0})})))}))))})}):null}const Sl={action:{CaptureOnly:"CaptureOnly",Url:"Url",Fulfillment:"Fulfillment",External:"External"},urlBehavior:{newTab:"newTab",roktWebViewSDK:"roktWebViewSDK",self:"self"},signalType:{SignalResponse:"SignalResponse",SignalGatedResponse:"SignalGatedResponse",SignalSecondaryResponse:"SignalSecondaryResponse"},conversionType:{Default:"Default",RealTime:"RealTime"}};function wl(e,t,n=!1){return Error(`Could not translate ${e} with guid: ${t}${n?" for child layout":""}`)}function Cl(e,t=!1){var n;try{if(e.responseOptionsMap||t)return Object.assign(Object.assign({},e),{responseOptionsMap:i.mapObjIndexed(Ol,null!==(n=e.responseOptionsMap)&&void 0!==n?n:{})});{const t=`Creative: ${e.instanceGuid}, did not receive a valid response options map.`;throw new j("NO_CREATIVE_RESPONSE_OPTIONS_MAP",t)}}catch(n){throw n.message?n:wl("Creative",e.instanceGuid,t)}}function Ol(e){try{let t,n;e.urlBehavior&&(t=Sl.urlBehavior[e.urlBehavior]),e.conversionType&&(n=Sl.conversionType[e.conversionType]);return Object.assign(Object.assign({},e),{urlBehavior:t,action:Sl.action[e.action],signalType:Sl.signalType[e.signalType],conversionType:n})}catch(t){throw t.message?t:wl("CreativeResponse",e.instanceGuid)}}function Tl(e,t,n){try{return JSON.parse(e)}catch(e){throw Error(`Parse JSON failed, invalid JSON file for ${t} with guid ${n}.`)}}function Al(){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 Rl={OneByOneDistribution:function(t){if("OneByOneDistribution"===t.type)return e.jsx(hl,{schema:t.node})},StackedDistribution:function(t){if("StackedDistribution"===t.type)return e.jsx(bl,{schema:t.node})},ProgressIndicator:function(t){if("ProgressIndicator"===t.type)return e.jsx(ml,{schema:t.node})},ProgressControl:function(t){if("ProgressControl"===t.type)return e.jsx(El,{schema:t.node})},Overlay:function(t){if("Overlay"===t.type)return e.jsx(uo,{schema:t.node})},CloseButton:function(t){if("CloseButton"===t.type)return e.jsx(io,{schema:t.node})},EscapeHatch:(Ll=[function(t,n){if(v("CloseButton",t)){const n=JSON.parse(t.node.data);return e.jsx(io,{schema:n.node,action:n.action})}},fi],e=>Ll.reduce(((t,n)=>void 0===t?n(e):t),void 0)),CarouselDistribution:function(t){if("CarouselDistribution"===t.type)return e.jsx(Il,{schema:t.node})},GroupedDistribution:function(t){if("GroupedDistribution"===t.type)return e.jsx(xl,{schema:t.node})},BottomSheet:function(t){if("BottomSheet"===t.type)return e.jsx(ho,{schema:t.node})}};var Ll;function jl(e,t){e({type:Y,payload:{name:"SignalActivation",parentGuid:t}})}function Nl({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:ul(e),customStates:e.customStates.root,domainStates:e.domainStates[rl]})),i.equals),y=a.useSelector((e=>e.slots.length)),h=a.useSelector((e=>{var t;const n=Number(null!==(t=e.serializableCache.get(gl))&&void 0!==t?t:"");return y-n})),m=a.useSelector(fl);ce(St(),p),t.useEffect((()=>(u&&document.body.addEventListener("click",jl.bind(null,p,u.instanceGuid),{once:!0}),()=>{u&&document.body.removeEventListener("click",jl.bind(null,p,u.instanceGuid))})),[null==u?void 0:u.instanceGuid]),Al(),t.useEffect((()=>{if(u){const e={type:Y,payload:{name:"SignalImpression",parentGuid:u.instanceGuid}},t={type:Qi,payload:{code:"LAYOUT_IMPRESSED"}};p(e),p(t)}}),[u]);const v=e=>{p({type:al.REPORT_ERROR,payload:e})},g=a.useSelector((e=>e.breakpoint.initialised));if(u&&g){const t=Ut({})({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(kn,{info:{layoutType:"OuterLayout",pageInstanceGuid:n},children:e.jsx(Ht,{value:t,children:e.jsx(It,{value:a,overrides:Rl,children:e.jsx(mt.Provider,{value:f,children:e.jsx(yt.Provider,{value:p,children:e.jsx(Yt.Provider,{value:"OUTER",children:e.jsx(Bn.Provider,{value:u.layoutSchemaVersion,children:e.jsx(bt,{children:e=>e(u.layoutSchema)})})})})})})})})}return null}var _l=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}}}),Dl=Object.assign({},_l);function*kl(e,t){const n=Dl.getDistribution(t),a=null==n?void 0:n.type,i=yield r.select(Qo),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:nl.INITIALISE_PROGRESSION,payload:{currentGroupIndex:0,totalCount:e,groupSize:o}}))}function*Pl(e,t){const{instanceGuid:n,layoutSchemaVersion:a,outerLayoutSchema:o,slots:r}=t.payload;n?yield c.put({type:Y,payload:{name:"SignalLoadComplete",parentGuid:n}}):yield c.put({type:Zi,payload:{level:Eo,code:Do,message:"Layout instance guid does not exist"}}),yield c.put({type:zs,payload:{modules:r.map((e=>e.layoutVariant.moduleName))}}),yield c.put({type:Gi,payload:o.breakpoints}),yield c.put({type:nl.LAYOUT_UPDATE,payload:{instanceGuid:n,layoutSchemaVersion:a,layoutSchema:o.layout,settings:o.settings}}),yield c.put({type:nl.SET_SLOTS,payload:r}),i.isNil(o.settings)||(yield c.put({type:nl.SET_SETTINGS,payload:o.settings})),yield*kl(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,dr.PartnerValidationEvent.OPT_IN_TO_PARTNER_VALIDATION),yield c.spawn($l,e,dr.PartnerValidationEvent.SHOW_PARTNER_VALIDATION_STATUS,(()=>({type:"ACTIVE/ADD",payload:{id:vl}})))}catch(e){return yield c.put({type:Zi,payload:{level:bo,code:Po,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*$l(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 Gl(e){return wc(e)}function Fl(e,t){return Error(`Migration process from v0_0 to v0_1 failed: could not transform ${e} node. For more details: ${t}`)}const Ml=i.all(i.anyPass([function(e){return"Row"===e.type&&zl(e.node.children)},function(e){return"Column"===e.type&&zl(e.node.children)},Jl,Kl])),Bl=i.all(i.anyPass([function(e){return"Row"===e.type&&ql(e.node.children)},function(e){return"Column"===e.type&&ql(e.node.children)},Kl,Jl,function(e){return"DataImage"===e.type},function(e){return"When"===e.type&&ql(e.node.children)}])),Ul=i.all(i.anyPass([function(e){return"Row"===e.type&&Hl(e.node.children)},function(e){return"Column"===e.type&&Hl(e.node.children)},Kl,Jl])),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)},Jl,function(e){return"RichText"===e.type},Kl,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&Wl(e.node.children)},function(e){return"StaticLink"===e.type&&Wl(e.node.children)},function(e){return"StackedDistribution"===e.type},function(e){return"CloseButton"===e.type&&Wl(e.node.children)}]));function zl(e){return Ml(e)}function ql(e){return Bl(e)}function Hl(e){return Ul(e)}function Wl(e){return Vl(e)}function Jl(e){return"StaticImage"===e.type}function Kl(e){return"BasicText"===e.type}const Yl=i.lensPath(["styles","elements","link"]),Zl=i.lensPath(["styles","elements","activeIndicator"]),Ql=i.lensPath(["styles","elements","indicator"]),Xl=i.lensPath(["styles","elements","seenIndicator"]),ec=i.lensPath(["focussed"]),tc=i.lensPath(["hovered"]),nc=i.lensPath(["default"]),ac=i.lensPath(["pressed"]),ic=e=>{var t;return{text:null!==(t=null==e?void 0:e.text)&&void 0!==t?t:{}}},oc=i.when(i.hasPath(["styles","elements","link"]),i.pipe(i.over(Yl,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default})))),i.over(Yl,i.map(i.when(i.has("focussed"),i.over(ec,ic)))),i.over(Yl,i.map(i.when(i.has("hovered"),i.over(tc,ic)))),i.over(Yl,i.map(i.when(i.has("default"),i.over(nc,ic)))),i.over(Yl,i.map(i.when(i.has("pressed"),i.over(ac,ic)))))),rc=i.pipe(i.when(i.hasPath(["styles","elements","activeIndicator"]),i.over(Zl,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","indicator"]),i.over(Ql,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))),i.when(i.hasPath(["styles","elements","seenIndicator"]),i.over(Xl,i.map((e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}))))));function sc(e,t){return e?{elements:{own:e.elements.own.map(t)}}:void 0}const lc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),cc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),dc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default}),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,disabled:e.disabled}),fc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),yc=e=>({focussed:e.focused,hovered:e.hovered,pressed:e.pressed,default:e.default,disabled:e.disabled}),hc=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 Fl("When",`Invalid condition: ${e}`)}},mc=e=>{switch(e){case"breakpoint":return"Breakpoint";case"progression":return"Progression";case"position":return"Position";default:throw Fl("When",`Invalid target: ${e}`)}},vc=e=>{const{target:t,condition:n,value:a}=e;return{type:mc(t),predicate:{condition:hc(n),value:a}}};function gc(e){const t={type:"FadeInOut",settings:{duration:e.transition.settings.duration}};return{styles:e.style,transition:t}}function bc(e){const t=e.children.map((e=>wc(e)));if(zl(t))return Object.assign(Object.assign({},e),{children:t,styles:sc(e.styles,pc)});throw Fl("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function Ec(e){const t=e.children.map((e=>wc(e)));if(ql(t))return Object.assign(Object.assign({},e),{children:t,styles:sc(e.styles,fc)});throw Fl("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function Ic(e){const t=e.children.map((e=>wc(e)));if(Hl(t))return Object.assign(Object.assign({},e),{children:t,styles:sc(e.styles,yc)});throw Fl("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}const xc=e=>({own:e.overlayContainer,wrapper:e.overlayWrapper});function Sc(e){var t,n;const a=(null===(t=e.styles)||void 0===t?void 0:t.elements)?{elements:xc(null===(n=e.styles)||void 0===n?void 0:n.elements)}:void 0,i=e.children.map((e=>wc(e)));if(Wl(i))return Object.assign(Object.assign({},e),{styles:a,children:i});throw Fl("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function wc(e){switch(e.type){case"When":return{type:"When",node:(s=e.node,{predicates:s.predicates.map(vc),children:s.children.map((e=>wc(e)))})};case"OneByOneDistribution":return{type:e.type,node:gc(e.node)};case"Overlay":return{type:e.type,node:Sc(e.node)};case"Column":return{type:e.type,node:(r=e.node,{styles:sc(r.styles,lc),children:r.children.map((e=>wc(e)))})};case"Row":return{type:e.type,node:(o=e.node,{styles:sc(o.styles,cc),children:o.children.map((e=>wc(e)))})};case"RichText":return{type:e.type,node:(i=e.node,oc(i))};case"CloseButton":return{type:e.type,node:bc(e.node)};case"CreativeResponse":return{type:e.type,node:Ec(e.node)};case"StaticLink":return{type:e.type,node:Ic(e.node)};case"StaticImage":return{type:e.type,node:(a=e.node,Object.assign(Object.assign({},a),{styles:sc(a.styles,dc)}))};case"DataImage":return{type:e.type,node:(n=e.node,Object.assign(Object.assign({},n),{styles:sc(n.styles,uc)}))};case"ProgressIndicator":return{type:e.type,node:(t=e.node,rc(t))};default:return e}var t,n,a,i,o,r,s}function Cc(e){return jd(e)}function Oc(e,t){return Error(`Migration process from v0_23 to v1_0 failed: could not transform ${e} node. For more details: ${t}`)}const Tc=e=>"scroll"===e||"auto"===e?"visible":e,Ac=i.lensPath(["elements","own"]),Rc=i.lensPath(["transitions","transition","value","own"]),Lc=i.lensPath(["elements","wrapper"]),jc=i.lensPath(["transitions","transition","value","wrapper"]),Nc=i.lensPath(["elements","indicator"]),_c=i.lensPath(["transitions","transition","value","indicator"]),Dc=i.lensPath(["elements","activeIndicator"]),kc=i.lensPath(["transitions","transition","value","activeIndicator"]),Pc=i.lensPath(["elements","seenIndicator"]),$c=i.lensPath(["transitions","transition","value","seenIndicator"]),Gc=i.lensPath(["default","container","overflow"]),Fc=i.lensPath(["pressed","container","overflow"]),Mc=i.lensPath(["hovered","container","overflow"]),Bc=i.lensPath(["focussed","container","overflow"]),Uc=i.lensPath(["disabled","container","overflow"]),Vc=i.lensPath(["container","overflow"]),zc=i.pipe(i.when(i.hasPath(["default","container","overflow"]),i.over(Gc,Tc)),i.when(i.hasPath(["pressed","container","overflow"]),i.over(Fc,Tc)),i.when(i.hasPath(["hovered","container","overflow"]),i.over(Mc,Tc)),i.when(i.hasPath(["focussed","container","overflow"]),i.over(Bc,Tc)),i.when(i.hasPath(["disabled","container","overflow"]),i.over(Uc,Tc))),qc=i.when(i.hasPath(["container","overflow"]),i.over(Vc,Tc)),Hc=i.pipe(i.when(i.hasPath(["elements","own"]),i.over(Ac,i.map(zc))),i.when(i.hasPath(["transitions","transition","value","own"]),i.over(Rc,qc))),Wc=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)})),Jc=i.pipe(Hc,Wc),Kc=i.pipe(i.when(i.hasPath(["elements","wrapper"]),i.over(Lc,i.map(zc))),i.when(i.hasPath(["transitions","transition","value","wrapper"]),i.over(jc,qc))),Yc=i.pipe(i.when(i.hasPath(["elements","indicator"]),i.over(Nc,i.map(zc))),i.when(i.hasPath(["transitions","transition","value","indicator"]),i.over(_c,qc))),Zc=i.pipe(i.when(i.hasPath(["elements","activeIndicator"]),i.over(Dc,i.map(zc))),i.when(i.hasPath(["transitions","transition","value","activeIndicator"]),i.over(kc,qc))),Qc=i.pipe(i.when(i.hasPath(["elements","seenIndicator"]),i.over(Pc,i.map(zc))),i.when(i.hasPath(["transitions","transition","value","seenIndicator"]),i.over($c,qc)));function Xc(e){return"StaticImage"===e.type}function ed(e){return"StaticIcon"===e.type}function td(e){return"BasicText"===e.type}function nd(e){return"DataImage"===e.type}function ad(e){return"DataIcon"===e.type}function id(e){return"RichText"===e.type}function od(e){return"SlideStateTrigger"===e.type}function rd(e){return"ToggleButtonStateTrigger"===e.type}const sd=i.all(i.anyPass([function(e){return"Row"===e.type&&ld(e.node.children)},function(e){return"Column"===e.type&&ld(e.node.children)},Xc,ed,id,td,function(e){return"ProgressIndicator"===e.type},function(e){return"OneByOneDistribution"===e.type},function(e){return"When"===e.type&&ld(e.node.children)},function(e){return"StaticLink"===e.type&&ld(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&&ld(e.node.children)},function(e){return"ProgressControl"===e.type&&gd(e.node.children)},function(e){return"ZStack"===e.type&&ld(e.node.children)},function(e){return"FlowRow"===e.type&&ld(e.node.children)},od,rd]));function ld(e){return sd(e)}const cd=i.pipe(Hc,Kc,Wc);function dd(e){const t=e.children.map((e=>jd(e)));if(ld(t))return Object.assign(Object.assign({},i.omit(["settings"],e)),{children:t,allowBackdropToClose:e.settings.allowBackdropToClose,styles:e.styles?cd(e.styles):void 0});throw Oc("Overlay",`Invalid schema: ${JSON.stringify(e)}`)}function ud(e){const t=e.children.map((e=>jd(e)));if(gd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Jc(e.styles):void 0});throw Oc("CloseButton",`Invalid schema: ${JSON.stringify(e)}`)}function pd(e){const t=e.children.map((e=>jd(e)));if(Ed(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Jc(e.styles):void 0});throw Oc("CreativeResponse",`Invalid schema: ${JSON.stringify(e)}`)}function fd(e){const t=e.children.map((e=>jd(e)));if(gd(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Jc(e.styles):void 0});throw Oc("ProgressControl",`Invalid schema: ${JSON.stringify(e)}`)}const yd=i.pipe(Hc,Yc,Zc,Qc,Wc);const hd=i.all(i.anyPass([td,Xc,ed,nd,ad,function(e){return"Row"===e.type&&md(e.node.children)},function(e){return"FlowRow"===e.type&&md(e.node.children)},function(e){return"Column"===e.type&&md(e.node.children)},function(e){return"ZStack"===e.type&&md(e.node.children)},function(e){return"When"===e.type&&md(e.node.children)}]));function md(e){return hd(e)}const vd=i.all(i.anyPass([td,Xc,ed,function(e){return"Row"===e.type&&gd(e.node.children)},function(e){return"FlowRow"===e.type&&gd(e.node.children)},function(e){return"Column"===e.type&&gd(e.node.children)},function(e){return"ZStack"===e.type&&gd(e.node.children)},function(e){return"When"===e.type&&gd(e.node.children)}]));function gd(e){return vd(e)}const bd=i.all(i.anyPass([td,Xc,ed,nd,ad,function(e){return"Row"===e.type&&Ed(e.node.children)},function(e){return"FlowRow"===e.type&&Ed(e.node.children)},function(e){return"Column"===e.type&&Ed(e.node.children)},function(e){return"ZStack"===e.type&&Ed(e.node.children)},function(e){return"When"===e.type&&Ed(e.node.children)}]));function Ed(e){return bd(e)}function Id(e){const t=e.children.map((e=>jd(e)));if(md(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Jc(e.styles):void 0});throw Oc("StaticLink",`Invalid schema: ${JSON.stringify(e)}`)}function xd(e){const t=e.children.map((e=>jd(e)));if(Ed(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Jc(e.styles):void 0});throw Oc("CatalogResponseButton",`Invalid schema: ${JSON.stringify(e)}`)}function Sd(e){return"Row"===e.type&&Od(e.node.children)}function wd(e){return"Column"===e.type&&Od(e.node.children)}const Cd=i.all(i.anyPass([td,Xc,ed,nd,ad,id,function(e){return"StaticLink"===e.type},od,rd,function(e){return"CatalogResponseButton"===e.type},Sd,function(e){return"FlowRow"===e.type&&Od(e.node.children)},wd,function(e){return"ZStack"===e.type&&Od(e.node.children)},function(e){return"When"===e.type&&Od(e.node.children)}]));function Od(e){return Cd(e)}const Td=i.anyPass([Sd,wd]);function Ad(e){const t=jd(e.template);if(function(e){return Td(e)}(t))return Object.assign(Object.assign({},e),{template:t,styles:e.styles?Jc(e.styles):void 0});throw Oc("CatalogStackedCollection",`Invalid schema: ${JSON.stringify(e)}`)}function Rd(e){const t=e.children.map((e=>jd(e)));if(md(t))return Object.assign(Object.assign({},e),{children:t,styles:e.styles?Jc(e.styles):void 0});throw Oc("ToggleButtonStateTrigger",`Invalid schema: ${JSON.stringify(e)}`)}function Ld(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=>jd(e))),transition:t})}function jd(e){switch(e.type){case"Row":return{type:e.type,node:(g=e.node,Object.assign(Object.assign({},g),{children:g.children.map((e=>jd(e))),styles:g.styles?Jc(g.styles):void 0}))};case"When":return{type:e.type,node:Ld(e.node)};case"FlowRow":return{type:e.type,node:(v=e.node,Object.assign(Object.assign({},v),{styles:v.styles?Jc(v.styles):void 0,children:v.children.map((e=>jd(e)))}))};case"Column":return{type:e.type,node:(m=e.node,Object.assign(Object.assign({},m),{children:m.children.map((e=>jd(e))),styles:m.styles?Jc(m.styles):void 0}))};case"ZStack":return{type:e.type,node:(h=e.node,Object.assign(Object.assign({},h),{styles:h.styles?Jc(h.styles):void 0,children:h.children.map((e=>jd(e)))}))};case"Overlay":return{type:e.type,node:dd(e.node)};case"ProgressControl":return{type:e.type,node:fd(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?Jc(y.styles):void 0}))};case"CloseButton":return{type:"CloseButton",node:ud(e.node)};case"CreativeResponse":return{type:"CreativeResponse",node:pd(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?Jc(f.styles):void 0}))};case"OneByOneDistribution":return{type:"OneByOneDistribution",node:(p=e.node,Object.assign(Object.assign({},p),{styles:p.styles?Jc(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?yd(d.styles):void 0}))};case"SlideStateTrigger":return{type:"SlideStateTrigger",node:(c=e.node,Object.assign(Object.assign({},c),{styles:c.styles?Jc(c.styles):void 0}))};case"StackedDistribution":return{type:"StackedDistribution",node:(l=e.node,Object.assign(Object.assign({viewableItems:[]},l),{styles:l.styles?Jc(l.styles):void 0}))};case"StaticLink":return{type:"StaticLink",node:Id(e.node)};case"ToggleButtonStateTrigger":return{type:"ToggleButtonStateTrigger",node:Rd(e.node)};case"CatalogResponseButton":return{type:"CatalogResponseButton",node:xd(e.node)};case"CatalogStackedCollection":return{type:"CatalogStackedCollection",node:Ad(e.node)};case"RichText":return{type:"RichText",node:(s=e.node,Object.assign(Object.assign({},s),{styles:s.styles?Wc(s.styles):void 0}))};case"DataImage":return{type:"DataImage",node:(r=e.node,Object.assign(Object.assign({},r),{styles:r.styles?Wc(r.styles):void 0}))};case"StaticImage":return{type:"StaticImage",node:(o=e.node,Object.assign(Object.assign({},o),{styles:o.styles?Wc(o.styles):void 0}))};case"DataIcon":return{type:"DataIcon",node:(a=e.node,Object.assign(Object.assign({},a),{styles:a.styles?Wc(a.styles):void 0}))};case"StaticIcon":return{type:"StaticIcon",node:(n=e.node,Object.assign(Object.assign({},n),{styles:n.styles?Wc(n.styles):void 0}))};case"BasicText":return{type:"BasicText",node:(t=e.node,Object.assign(Object.assign({},t),{styles:t.styles?Wc(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 Nd(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 _d(e,t){return e.major===t.major&&e.minor===t.minor}const Dd=(e,t,n)=>i.allPass([i.lte(e),i.gte(t)])(n);function kd(e,t){return _d(t,{major:0,minor:0})?kd(Gl(e),{major:0,minor:1}):function(e,t){return 0===t.major&&Dd(1,23,t.minor)}(0,t)?kd(Cc(e),{major:1,minor:0}):e}function Pd(e,t){return _d(t,{major:0,minor:0})?Pd(function(e){return Object.assign(Object.assign({},e),{layout:Gl(e.layout)})}(e),{major:0,minor:1}):function(e,t){return 0===t.major&&Dd(1,23,t.minor)}(0,t)?Pd(function(e){return Object.assign(Object.assign({},e),{layout:Cc(e.layout)})}(e),{major:1,minor:0}):e}function $d(e,t,n,a){const i=Nd(n);if(a){const s=Nd(a);if(r=i,(o=s).major<r.major||o.major===r.major&&o.minor<r.minor||_d(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,Nd("0.0"));var o,r}function Gd(e){var t;try{return Object.assign(Object.assign({},i.clone(e)),{offer:Object.assign(Object.assign({},i.clone(e.offer)),{creative:Cl(e.offer.creative)}),layoutVariant:Object.assign(Object.assign({},i.clone(e.layoutVariant)),{layoutVariantSchema:"string"==typeof e.layoutVariant.layoutVariantSchema?Tl(e.layoutVariant.layoutVariantSchema,"LayoutSlotLayoutVariant",e.instanceGuid):e.layoutVariant.layoutVariantSchema,childLayouts:i.map(Fd,null!==(t=e.layoutVariant.childLayouts)&&void 0!==t?t:[])})})}catch(t){throw t.message?t:wl("Slot",e.instanceGuid)}}function Fd(e){return Object.assign(Object.assign({},i.clone(e)),{childLayoutSchema:"string"==typeof e.childLayoutSchema?Tl(e.childLayoutSchema,"ChildLayoutRootSchema",e.childLayoutId):e.childLayoutSchema})}function Md(e){if(e){const t=function(e){try{return Object.assign(Object.assign({},i.clone(e)),{outerLayoutSchema:"string"==typeof e.outerLayoutSchema?Tl(e.outerLayoutSchema,"LayoutRootLayoutSchema",e.instanceGuid):e.outerLayoutSchema,slots:i.map(Gd,e.slots)})}catch(t){throw t.message?t:wl("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=>$d(e,kd,t,n))))),i.over(a,(e=>$d(e,Pd,t,n))))(e)}(t,So.DCUI_SCHEMA_VERSION)}}const Bd=i.cond([[i.where({signalType:i.equals("SignalSecondaryResponse")}),function*(e,t){return yield r.put({type:Zi,payload:{level:Io,code:No,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:Y,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(mr,t),i=Er(a)?a.ref:void 0;return yield r.call(e.addAdvertiserWindowRef,i,n),Er(a)||"newTab"!==t.urlBehavior?"SUCCESS":(yield r.put({type:Zi,payload:{level:Io,code:_o,message:`Did not receive a window reference opening link ${t.url}`}}),"UNSPECIFIED")}catch(e){return yield r.put({type:Zi,payload:{level:Io,code:_o,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:Zi,payload:{level:Io,code:No,message:"URL response doesn't have a valid url",additionalInformation:{instanceGuid:e.instanceGuid}}}),"ERROR"}],[i.T,function*(){return"EXPLICIT_DISMISSAL"}]]);function*Ud(e){return yield r.put({type:Zi,payload:{level:Io,code:No,message:"DCUI does not support SignalSecondaryResponse creative response signal type.",additionalInformation:{instanceGuid:e.instanceGuid}}}),e.isPositive?"ERROR":"EXPLICIT_DISMISSAL"}function*Vd(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:X,payload:{name:"OFFER_ENGAGEMENT"}}),i.isPositive&&(yield r.put({type:Qi,payload:{code:"CREATIVE_RESPONSE",message:"creative positive response",data:{type:i.action,isPositive:i.isPositive,responseInstanceGuid:i.instanceGuid}}}),yield r.put({type:X,payload:{name:"POSITIVE_ENGAGEMENT"}})),n="SignalSecondaryResponse"===i.signalType?yield*Ud(i):yield*Bd(i,e.context,e.partner);break;case"CaptureOnly":yield r.put({type:X,payload:{name:"OFFER_ENGAGEMENT"}}),i.isPositive&&(yield r.put({type:X,payload:{name:"POSITIVE_ENGAGEMENT"}})),n="SignalSecondaryResponse"===i.signalType?yield*Ud(i):yield*function*(e){return yield r.put({type:Y,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:Zi,payload:{level:Io,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"External":yield r.put({type:Zi,payload:{level:Io,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:Qs,payload:{event:"Completed",completionReason:"Success",offerPositionIndex:t}};case"UNSPECIFIED":return{type:Qs,payload:{event:"Completed",completionReason:"Unspecified",offerPositionIndex:t}};case"ERROR":return{type:Qs,payload:{event:"Completed",completionReason:"Error",offerPositionIndex:t}};case"EXPLICIT_DISMISSAL":return{type:Qs,payload:{event:"Dismissed",dismissalReason:"Explicit",offerPositionIndex:t}};case"IMPLICIT_DISMISSAL":return{type:Qs,payload:{event:"Dismissed",dismissalReason:"Implicit",offerPositionIndex:t}};default:return{type:Ks,payload:{offerProcessStatus:"END"}}}}(n,a)))}function zd(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:Zi,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:Zi,payload:{level:R,code:"FAILED_TO_LOAD_MODULE",message:t,additionalInformation:{stack:a,reason:t?void 0:e,moduleName:n}}}),i(l.END)})),()=>{})))}const qd={"standard-marketing":()=>Promise.resolve().then((function(){return Ju})),"add-to-cart":()=>Promise.resolve().then((function(){return Kp})),"instant-purchase":()=>Promise.resolve().then((function(){return $f})),"layouts-xp-sandbox":()=>Promise.resolve().then((function(){return hy}))};function*Hd(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(Wd,e,t,i))}function*Wd(e,t,n){if(n in qd){yield r.put({type:Vs,payload:n});const a=yield r.call(zd,e,t,n,qd[n]);yield r.call(Lo,a)}else yield r.put({type:Zi,payload:{level:bo,code:"INVALID_MODULE_NAME",message:`Could not load unknown module ${n}`}})}function*Jd(e){const t=yield r.select((e=>Dl.getDistributionViewableItems(e.layout?Dl.getDistribution(e.layout.layoutSchema):void 0))),n=yield r.select((n=>{var a;const i=Zo(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:Js,payload:{groupSize:n}};yield r.put(e)}}const Kd=i.cond([[(e,t,n,a)=>"END"===e.offerProcessStatus,i.always({type:Ui})],[(e,t,n,a)=>t.isLastOffer&&n,i.always({type:Ui})],[(e,t,n,a)=>1===a&&!t.isLastOffer,i.always({type:Hs})],[i.T,i.always(void 0)]]);function*Yd(e){const t=yield r.select((e=>({exists:null!==e.progression,isLastOffer:dl(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=Kd(e,t,"boolean"==typeof a&&a,n);i&&(i.type===Ui&&(yield r.put({type:X,payload:{name:"PLACEMENT_COMPLETED"}})),yield r.put(i))}(e.payload,t,n))}function Zd(e){return e.type===Qs&&"Interactive"===e.payload.event}function Qd(e){return e.type===Qs&&"Interactive"!==e.payload.event}function*Xd(e){switch(e.payload.event){case"Dismissed":yield r.put({type:Ks,payload:{offerProcessStatus:"CONTINUE"}});break;case"Completed":yield r.put({type:Xs,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:Ks,payload:{offerProcessStatus:"CONTINUE"}});break;case"Interactive":yield r.put({type:V,payload:{name:"Interactive",offerPositionIndex:e.payload.offerPositionIndex}}),yield r.put({type:X,payload:{name:"PLACEMENT_INTERACTIVE"}})}}function*eu(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,dr.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:Zi,payload:{level:L,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*tu(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:nl.ACTIVE_DELETE,payload:{id:e.payload.id}}),yield r.put({type:Ui}),t?(yield r.put({type:Y,payload:{name:"SignalInstantPurchaseDismissal",parentGuid:t}}),yield r.put({type:Y,payload:{name:"SignalDismissal",parentGuid:t}})):yield r.put({type:Zi,payload:{level:Eo,code:Do,message:"ParentGuid does not exist"}})}function*nu(e,t){yield r.all([r.takeEvery(Zi,jo.bind(null,e.errorService.raise)),r.takeLatest(Bi,Pl.bind(null,{display:e.displayService,partner:e.partnerInteractionService})),r.takeEvery(zs,Hd.bind(null,t,e.contextService)),r.takeLatest(el,Vd.bind(null,{partner:e.partnerInteractionService,context:e.contextService})),r.takeEvery(Ks,Yd),r.takeEvery(Qd,Xd),Ro(Zd,Xd),r.takeLatest(Gi,ir.bind(null,e.displayService)),r.takeLatest(Ui,wr.bind(null,e.contextService)),r.takeLatest(Zs,tu),r.takeLatest(Yi,Yr),r.takeEvery(Y,Nr),r.takeEvery(te,_r),Ao(V,Jr.bind(null,e.metricsService)),Ao(Ki,Dr.bind(null,e.rdnService)),r.takeEvery(Qi,jr.bind(null,e.errorService.raise)),r.takeLatest(Pi,Jd),r.takeEvery(Q,Wr),r.takeEvery(ne,Kr.bind(null,{createChildPlugin:e.childPlugin.create,partner:e.partnerInteractionService,context:e.contextService})),r.takeLatest(ae,eu.bind(null,{partner:e.partnerInteractionService,context:e.contextService}))])}var au,iu,ou,ru,su,lu=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},cu=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 du={[re.SET_CUSTOM_STATE]:nl.SET_CUSTOM_STATE,[re.SET_DOMAIN_STATE]:nl.SET_DOMAIN_STATE,[re.SET_GLOBAL_OFFER_DATA_CART]:nl.SET_GLOBAL_OFFER_DATA_CART,[re.OFFER_LIFECYCLE]:al.OFFER_LIFECYCLE,[re.OFFER_ENGAGEMENT]:al.OFFER_ENGAGEMENT,[re.SET_PARTNER_VALIDATION_STATUS]:al.SET_PARTNER_VALIDATION_STATUS};class uu{constructor(e){au.add(this),iu.set(this,void 0),lu(this,iu,e,"f")}getState(e){const t=cu(this,iu,"f").getState();return{breakpoint:t.breakpoint,progression:ul(t),customStates:Xo(t,e.offerPositionIndex),domainStates:pl(t,e.offerPositionIndex)}}dispatch(e,t){cu(this,iu,"f").dispatch(cu(this,au,"m",su).call(this,e,t))}subscribe(e,t){return t(this.getState(e)),cu(this,iu,"f").subscribe((()=>{t(this.getState(e))}))}}function pu(e,t){const n=l(),a={},i=s.configureStore({reducer:ll,devTools:{name:"Orchestrator"},preloadedState:Object.assign(Object.assign({},cl()),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 uu(e)}(i),c=e.childPlugin.create,d=e.partnerInteractionService.onEvent,(e,t)=>new dn(r,c,e,t,d));var r,c,d;n.run(nu,e,o),n.run(Ar,e,Md);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({},ll),u)))),t&&Object.assign(a,t),o&&n.run(o)}})}iu=new WeakMap,au=new WeakSet,ou=function(e,t,n){return{type:e,payload:Object.assign(Object.assign({},t),{offerPositionIndex:n.offerPositionIndex,creativeInstanceGuid:n.creativeInstanceGuid})}},ru=function(e,t){return t.type===te?t.payload.signal.parentGuid||(t.payload.signal.parentGuid=e.creativeInstanceGuid):(t.payload.creativeInstanceGuid=e.creativeInstanceGuid,t.payload.parentGuid||(t.payload.parentGuid=e.creativeInstanceGuid)),t},su=function(e,t){return function(e){return e.type in du}(t)?cu(this,au,"m",ou).call(this,du[t.type],t.payload,e):t.type===Y||t.type===te?cu(this,au,"m",ru).call(this,e,t):t};var fu=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 yu={ctx:new Map([[Us.name,Us],[Fs.name,Fs],[Is.name,Is],[Ls.name,Ls]]),cache:[]};class hu{constructor(){this._subscribers=[]}add(e){this._subscribers.push(e)}unsubscribe(){this._subscribers.forEach((e=>e.unsubscribe()))}}const mu=()=>{},vu=(e=mu,t=mu,n=mu)=>"function"!=typeof e?e:{next:e,error:t,complete:n};class gu{constructor(e){this._setupFn=e}subscribe(e,t,n){const a=vu(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 hu;return s.add({unsubscribe:()=>{i&&i(),o=!1}}),s}}class bu extends gu{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 gu((e=>{const t=this.subscribe(e);return()=>t.unsubscribe()}))}}const Eu={CompletedBeforeEmit:"CompletedBeforeEmit"};var Iu=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 xu{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)=>Iu(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 Su{constructor(e){this.value=e,this.complete=!1,this.skip=!1}}var wu=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 Cu={getBreakpointCSSClass:B},Ou="CHILD_LAYOUTS/ADD_LAUNCHED",Tu="DYNAMIC_DATA/ADD";function Au(e={launched:{}},t){if(t.type===Ou){const n=t.payload;return n.childLayoutId?i.assocPath(["launched",n.childLayoutId],n.shouldRelaunch,e):e}return e}function Ru(e=null,t){return e}function Lu(e=null,t){if(t.type===Tu){const n=t.payload;return e?n?i.mergeDeepRight(e,n):e:n}return e}function ju(e,t){var n;return null===(n=e.childLayouts.launched[t])||void 0===n||n}function Nu(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.offer}function _u(e){var t;return null===(t=e.staticData)||void 0===t?void 0:t.schemaVersion}function Du(e){var t,n;return null!==(n=null===(t=e.dynamicData)||void 0===t?void 0:t.text)&&void 0!==n?n:{}}const ku="FAILED_TO_LAUNCH_CHILD_LAYOUT";function*Pu(e,t,n){var a;if(yield null===(a=r.select(ju,n.payload.childLayoutId))||void 0===a||a){const a=yield r.select(_u),o=yield r.select(Nu),s=yield r.select(Du);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:L,code:ku,message:"Could not launch child layout, failed creating plugin."})}}catch(e){yield r.call(t,{level:L,code:ku,message:"Could not launch child layout, failed to make the child layout config serializable."})}yield r.put({type:Ou,payload:{childLayoutId:n.payload.childLayoutId,shouldRelaunch:!1}})}var i}function $u(){const t=Cn(),n=a.useSelector(Du),i=Wt()({state:n},"textContent");return e.jsx(Ht,{value:i,children:e.jsx(bt,{children:e=>e(t)})})}const Gu={staticData:Ru,dynamicData:Lu,childLayouts:Au};function Fu(e={}){return Object.assign({staticData:null,dynamicData:null,childLayouts:{launched:{}}},e)}function Mu(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 Bu(e){return"object"==typeof e&&null!==e&&Object.entries(e).every((([e,t])=>"string"==typeof e&&"string"==typeof t))}function*Uu(e,t,n,a){for(;;){switch(yield r.take(e)){case"CLOSED":t({type:Z,payload:{event:"Dismissed",dismissalReason:"Implicit"}});break;case"SUCCESS":if(n&&a){yield r.call(a);break}t({type:Z,payload:{event:"Completed",completionReason:"Success"}});break;case"UNSPECIFIED":t({type:Z,payload:{event:"Completed",completionReason:"Unspecified"}})}}}function*Vu(e,t,n){if(q(n)){const{responseOption:a,fulfillment:i}=n,o=K(n);yield r.put({type:Y,payload:{name:"SignalResponse",parentGuid:a.instanceGuid,responseActionPayload:{name:"Fulfillment"}}});const s=yield r.call(e.createChildPlugin.bind(e),i);if("object"==typeof s&&"onClose"in s&&"close"in s){const a=yield r.call(Mu,s);if("object"==typeof a&&"take"in a){const i=function(e,t,n,a){if(n.responseOption.rclid)return function*(){yield r.put({type:X,payload:{name:"REALTIME_OFFER_FULFILLMENT_CONVERSION",body:{rclid:n.responseOption.rclid,accountID:n.accountID,referralCreativeID:n.referralCreativeID}}}),yield r.call(zu,e,t,a)}}(e,t,n,s);return void(yield r.call(Uu,a,e.globalDispatch.bind(e),o,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*zu(e,t,n){const a=function(e){return l.eventChannel((t=>{const n=e.onEvent({name:pr,source:"partner",callback:e=>{Bu(e)&&t({eventName:pr,data:e})}},{name:fr,source:"partner",callback:e=>{Bu(e)&&t({eventName:fr,data:e})}});return()=>{n()}}))}(e);try{for(;;){const i=yield r.take(a);switch(i.eventName){case pr:yield r.put({type:X,payload:{name:pr,body:i.data}}),yield r.put({type:Tu,payload:{text:i.data}}),e.globalDispatch({type:Z,payload:{event:"Completed",completionReason:"Success"}}),n&&(yield r.call(n.close.bind(n)));break;case fr:e.globalDispatch({type:Z,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:L,code:"FAILED_TO_PROCESS_REALTIME_OFFER_FULFILLMENT_EVENT",message:null==n?void 0:n.message})}finally{(yield r.cancelled())&&a.close()}}function*qu(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)&&(yield r.put({type:X,payload:{name:"REALTIME_OFFER_FULFILLMENT_REFERRAL",body:{rclid:a.rclid,accountID:a.accountID,referralCreativeID:a.referralCreativeID}}}),yield r.call(zu,e,t));break;case"CaptureOnly":yield r.call(e.globalDispatch.bind(e),n);break;case"Fulfillment":yield r.put({type:X,payload:{name:"OFFER_ENGAGEMENT"}}),a.isPositive&&(yield r.put({type:X,payload:{name:"POSITIVE_ENGAGEMENT"}})),yield*Vu(e,t,n.payload)}}function*Hu(e,t){yield r.all([r.takeLatest(z,qu.bind(null,e,t)),r.takeEvery(oe,Pu.bind(null,e,t)),r.takeEvery("*",wo.bind(null,[z,oe],e))])}Object.assign({},re);const Wu=(new En).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=Fu({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n=Fu()){const a=l(),i=s.configureStore({reducer:Gu,devTools:{name:"Standard Marketing"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(Hu,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(kn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Ri,{}),e.jsx(a.Provider,{store:d,children:e.jsx(Ti,{settings:i,dispatch:d.dispatch,children:e.jsx($u,{})})})]})}))}}));var Ju=Object.freeze({__proto__:null,moduleConnectorBuilder:Wu});const Ku="CART/UPDATE",Yu="CATALOG_ITEM/RESPONSE",Zu="USER_CREATIVE_RESPONSE_HISTORY/ADD",Qu=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 Xu({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 ep="catalogRadioGroup__label",tp=["Enter","Space"],np={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 ap(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 ip({schema:n,testId:i}){const o=a.useDispatch(),r=Gn(),[s,l]=a.useSelector((e=>{var t,a;const i=r.cartItemId in e.cart?null!==(a=null===(t=e.cart[r.cartItemId])||void 0===t?void 0:t.quantity)&&void 0!==a?a:0:NaN;return[i,ap(n.validations,n.options.length,i)]})),c=Tn(),{tabIndex:d,styles:u,isDisabled:p}=m(c);t.useEffect((()=>{p||o(op(l))}),[]);const f=n.options.filter((({quantity:e})=>{var t,n;return e>=(null!==(t=r.minItemCount)&&void 0!==t?t:-1/0)&&e<=(null!==(n=r.maxItemCount)&&void 0!==n?n:1/0)}));function y(e){o({type:Yu,payload:{catalogItem:r,quantity:e}});const t=ap(n.validations,n.options.length,e);o(op(t))}return f.length>0?e.jsx(Oa,{styles:n.styles?M(np,n.styles):np,children:({classnames:n,mapperRef:a})=>e.jsx("div",{className:null==n?void 0:n.own,style:Object.assign({display:"flex",flexDirection:"column"},u),children:e.jsx(Kt,{value:a(ep),children:t.Children.toArray(f.map(((t,a)=>{var o;const l=Qu(s,t.quantity),c=e=>i?`${i}-option${a}${e}`:void 0;return e.jsxs("label",{tabIndex:d,"aria-disabled":p,style:{display:"flex"},className:`${ep} ${null!==(o=null==n?void 0:n.optionContainer)&&void 0!==o?o:""}`,onKeyDown:e=>{l||!tp.includes(e.code)||p||y(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:r.instanceGuid,value:t.quantity,checked:l,onChange:()=>y(t.quantity),"aria-disabled":p,disabled:p}),e.jsx(Xu,{isChecked:l,isDisabled:p,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(_i,{schema:t,testId:c("Content")})]})})))})})}):null}function op(e){return{type:ae,payload:{errors:e}}}function rp(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function sp(t){const n=a.useDispatch(),i=Et(),o=Gn(),r=Tn(),{tabIndex:s,styles:l,isDisabled:c}=m(r);return e.jsx(Oa,{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:Yu,payload:{catalogItem:o,quantity:1}})},className:null==a?void 0:a.own,children:rp(t.schema.children,i,t.testId)})})}const lp={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"]},cp=new Map([["&","_;^;_"]]),dp=new RegExp(`<a *(?=${lp.allowedAttributes.a.join("|")}|>)`,"g"),up=new RegExp(`<a *(?:(?:${lp.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),pp=new RegExp("(<br *?>)|(<br *?/>)","g"),fp=new RegExp(`<ul *(?=${lp.allowedAttributes.ul.join("|")}|>)`,"g"),yp=new RegExp(`<ol *(?=${lp.allowedAttributes.ol.join("|")}|>)`,"g"),hp=new RegExp("<li *(?=>|\\s[^>]*>)","g"),mp="<br/>";function vp(n){const a=Wt(),i=Tn(),o=t.useMemo((()=>{const e=a(n.schema.value);if(!function(e){const t=function(e){return e.replaceAll(up,((e,t)=>{const n=t.replaceAll("&",cp.get("&"));return e.replace(t,n)})).replaceAll(pp,mp)}(e);return t===u(t,lp)}(e))throw new j("FAILED_SANITISING_HTML","Invalid HTML tags");return e}),[n.schema.value,a]),{tabIndex:r,styles:s,isDisabled:l}=m(i);return o?e.jsx(Oa,{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(dp,`<a ${a.join(" ")}`).replace(fp,`<ul ${i}`).replace(yp,`<ol ${i}`).replace(hp,`<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 gp={internally:"_top",externally:"_blank"};function bp(t,n,a,i,o){return e.jsx(Kt,{value:a(n),children:Ep(t,i,o)})}function Ep(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function Ip(t){var n,i;const o=gp[t.schema.open],r=Et(),s=Gn(),l=Tn(),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(Oa,{styles:t.schema.styles,children:({classnames:n,mapperRef:a})=>{var i;return e.jsx("a",{href:d,onClick:()=>{var e;c({type:Y,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)?bp(t.schema.children,null==n?void 0:n.own,a,r,t.testId):Ep(t.schema.children,r,t.testId)})}}):null}function xp(e,t){const n=e.cart[t];return n||null}function Sp(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 wp(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 Sp(e).reduce(((e,t)=>e+t.quantity),0)}(e),s=xp(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 Cp(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 Op(e,t){var n,a;return null!==(a=null===(n=Cp(e))||void 0===n?void 0:n.find((e=>e.catalogItemId===t)))&&void 0!==a?a:null}function Tp(e){var t;const n=null===(t=Cp(e))||void 0===t?void 0:t.filter((e=>e.preSelectedQuantity&&e.preSelectedQuantity>0));return n&&n.length>0?n:null}function Ap(e){var t,n;return null!==(n=null===(t=Tp(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 Rp=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 Lp(t,n,a,i,o){return e.jsx(Kt,{value:a(n),children:i(t,void 0,o)})}function jp(e,t,n){return t(e,void 0,n)}function Np(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=Et(),b=Wt(),E=Tn(),{tabIndex:I,styles:x,isDisabled:S}=m(E),w=a.useSelector((e=>function(e,t){var n,a,i;const o=Op(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))),C=a.useSelector((e=>xp(e,v.cartItemId))),O=a.useSelector((e=>wp(e,v))),T=(null==C?void 0:C.quantity)||0,A=m(S||T<=(null!==(n=v.minItemCount)&&void 0!==n?n:0)?"DISABLED":E),R=m(S||O<=0?"DISABLED":E),L=m(S||w?"DISABLED":E),j=e=>{var t;const n=e.target.value;if(0===n.length)N(null!==(t=v.minItemCount)&&void 0!==t?t:0);else{const e=Number(n);!Number.isNaN(e)&&e>=0&&N(e)}},N=e=>{S||h({type:Yu,payload:{catalogItem:v,quantity:e}})};return e.jsx(Oa,{styles:s,children:({classnames:t,mapperRef:n})=>e.jsx("div",{className:null==t?void 0:t.own,style:Object.assign({display:"flex",flexDirection:"row"},x),children:w&&d?e.jsx(Pa,{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(),N(T-1)},tabIndex:A.tabIndex,"aria-label":y||void 0,disabled:A.isDisabled,"data-testid":o?`${o}-decrement-button`:void 0,children:e.jsx(Ht,{value:b,children:(null==t?void 0:t.decrementButton)?Lp(p,t.decrementButton,n,g,o):jp(p,g,o)})}):null,l?e.jsx("input",{type:"text",className:null==t?void 0:t.input,style:Object.assign(Object.assign({},L),{cursor:L.isDisabled?"not-allowed":"auto",caretColor:L.isDisabled?"transparent":"auto",pointerEvents:"auto",outline:"none"}),value:T,onChange:j,"aria-label":r||void 0,tabIndex:I,disabled:S,"data-testid":o?`${o}-input`:void 0}):e.jsx("p",{className:null==t?void 0:t.input,style:x,"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(),N(T+1)},tabIndex:R.tabIndex,"aria-label":f||void 0,disabled:R.isDisabled,"data-testid":o?`${o}-increment-button`:void 0,children:e.jsx(Ht,{value:b,children:(null==t?void 0:t.incrementButton)?Lp(u,t.incrementButton,n,g,o):jp(u,g,o)})}):null]})})})}const _p={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(sp,{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(vp,{schema:n.node});case"CatalogUrlLink":return e.jsx(Ip,{schema:n.node});default:return}}},CatalogRadioGroup:function(t){if("CatalogRadioGroup"===t.type)return e.jsx(ip,{schema:t.node})},CatalogQuantityCounter:function(t){if("CatalogQuantityCounter"===t.type)return e.jsx(Np,{schema:t.node})}};function Dp(){const t=Cn(),n=Et();return e.jsx(It,{value:n,overrides:_p,children:e.jsx(bt,{children:e=>e(t)})})}const kp={cart:function(e={},t){if(t.type===Ku){const{catalogItem:n,quantity:a}=t.payload,i=n.cartItemId,o=Co(n,a);return Object.assign(Object.assign({},e),{[i]:o})}return e},userCreativeResponseHistory:function(e=[],t){return t.type===Zu?e.concat(t.payload.responseId):e},staticData:Ru,childLayouts:Au};const Pp="INVALID_PARTNER_MESSAGE",$p="MISCONFIGURED_CATALOG_ITEM",Gp="FAILED_TO_PROCESS_PARTNER_UPDATE_CART_ITEM";function*Fp(e){var t,n;const a=yield r.select(Tp),i=yield r.select(Ap),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:L,code:$p,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:L,code:$p,message:`Preselected quantity (${a}) is greater than maxItemCount (${o}) for catalog item (${i.instanceGuid})`}):yield*Vp(i,a,!0)}}function*Mp(e,t,n){const{catalogItem:a,quantity:i}=n.payload;if(yield*Vp(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:L,code:"INVALID_RESPONSE_OBJECT",message:n}))}var o}function*Bp(e,t){const n=function(e,t){return l.eventChannel((n=>{const a=e.onEvent({name:lr.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:L,code:Pp,message:`Invalid UpdateCartItemPartnerMessageBody: ${JSON.stringify(e)}`}):n(e)}});return()=>{a()}}))}(e,t);try{for(;;){const e=yield r.take(n);yield r.call(Up,e,t)}}catch(e){const n=e;t({level:L,code:Gp,message:null==n?void 0:n.message})}finally{(yield r.cancelled())&&n.close()}}function*Up(e,t){const{cartItemId:n,quantity:a}=e,i=yield r.select(xp,n);if(qp(i)){const e=yield r.select(Op,i.catalogItemId);null!==(o=e)&&"object"==typeof o&&"catalogItemId"in o&&"price"in o?yield*Vp(e,a,!1):yield r.call(t,{level:L,code:Gp,message:`Catalog item not found for cart item id (${n})`})}else yield r.call(t,{level:L,code:Gp,message:`Cart item not found for cart item id (${n})`});var o}function*Vp(e,t,n){var a;const i=yield r.select(xp,e.cartItemId),o=yield r.select(wp,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:Ku,payload:{catalogItem:e,quantity:t}});const a=yield r.select(xp,e.cartItemId),o=yield r.select(Rp);return yield r.put({type:ie,payload:{cart:o}}),yield r.put({type:Y,payload:{name:"SignalCartItemQuantitySelected",parentGuid:e.instanceGuid,objectData:{quantity:t,preselected:n}}}),yield r.put({type:X,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*Hp(e,t){var n;yield r.put({type:Zu,payload:{responseId:(n=t.payload,q(n)?n.responseOption.id:n.id)}}),yield r.call(e.globalDispatch.bind(e),t)}function*Wp(e,t){yield r.all([r.spawn(Fp.bind(null,t)),r.spawn(Bp.bind(null,e,t)),r.takeLatest(Yu,Mp.bind(null,e,t)),r.takeLatest(z,Hp.bind(null,e)),r.takeEvery(oe,Pu.bind(null,e,t)),r.takeEvery("*",wo.bind(null,[z,oe],e))])}Object.assign(Object.assign({},re),{CATALOG_ITEM_RESPONSE:Yu});const Jp=(new En).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=function(e={}){return Object.assign({cart:{},userCreativeResponseHistory:[],staticData:null,childLayouts:{launched:{}}},e)}({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n){const a=l(),i=s.configureStore({reducer:kp,devTools:{name:"Add To Cart"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(Wp,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(kn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Ri,{}),e.jsx(a.Provider,{store:d,children:e.jsx(Ti,{settings:i,dispatch:d.dispatch,children:e.jsx(Dp,{})})})]})}))}}));var Kp=Object.freeze({__proto__:null,moduleConnectorBuilder:Jp});const Yp="CATALOG/TRIGGER_SELECT_ITEM",Zp="CATALOG/SET_SELECTED_ITEM",Qp="CHECKOUT_LIFECYCLE",Xp="INSTANT_PURCHASE/INITIATE",ef="INSTANT_PURCHASE/PARTNER_RESPONSE";function tf(t,n,a,i,o){return e.jsx(Kt,{value:a(n),children:nf(t,i,o)})}function nf(e,n,a){return t.Children.toArray(e.map(((e,t)=>n(e,void 0,a?`${a}-child${t}`:void 0))))}function af(t){const n=a.useDispatch(),i=Et(),o=Tn(),{tabIndex:r,styles:s,isDisabled:l}=m(o),c=Gn(),d=Ut(c,"catalogItem");return e.jsx(Oa,{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:Xp,payload:{catalogItem:c,quantity:1,useInstantPurchaseExtension:!0}})},className:null==a?void 0:a.own,children:e.jsx(Ht,{value:d,children:(null==a?void 0:a.own)?tf(t.schema.children,a.own,o,i,t.testId):nf(t.schema.children,i,t.testId)})})})}function of(t,n,a,i,o){return e.jsx(Kt,{value:a(n),children:i(t,void 0,o)})}function rf(e,t,n){return t(e,void 0,n)}const sf=["ArrowDown","ArrowUp","Enter","Escape","Tab"];function lf(n){const i=Ot(),o=Et(),r=Gn(),s=Wt(),l=e=>s({data:e},"catalogItem"),c=t.useMemo((()=>i.catalogItems||[]),[i]),d=Tn(),{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?S():x())}function x(){p||v(!0)}function S(){p||v(!1)}function w(e){b(c.indexOf(e)),S(),E({type:Yp,payload:{catalogItem:e}})}t.useEffect((()=>{if(h){const e=y.current[g];e&&e.focus()}}),[h,g]);const C={elements:{own:[{default:{background:{backgroundColor:{light:"#ffffff"}},dimension:{width:{type:"percentage",value:100}}}}]}};function O(e){if(!p&&sf.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&&w(e)}else x();break;case"Tab":if(h){S();const e=c.indexOf(r);-1!==e&&b(e)}break;case"Escape":if(e.preventDefault(),h){S();const e=c.indexOf(r);-1!==e&&b(e)}}}return e.jsx(Oa,{styles:n.schema.styles?M(C,n.schema.styles):C,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&&S()},"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(Ht,{value:l(r),children:(null==t?void 0:t.dropDownSelectedElement)?of(n.schema.closedTemplate,t.dropDownSelectedElement,a,o,n.testId):rf(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||w(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(Ht,{value:l(i),children:(null==t?void 0:t.dropDownListElement)?of(n.schema.openTemplate,t.dropDownListElement,a,o,n.testId):rf(n.schema.openTemplate,o,n.testId)})},i.catalogItemId)))})]})})}function cf(n){const i=n.schema.styles,o=a.useDispatch(),r=a.useSelector((e=>e.staticData)),s=Tn(),{tabIndex:l,styles:c,isDisabled:d}=m(s),u=()=>{var e;o({type:Qp,payload:{event:"Checkout",targetStep:n.schema.targetStep,offerPositionIndex:null!==(e=null==r?void 0:r.position)&&void 0!==e?e:0}})};return e.jsx(Oa,{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(bt,{children:e=>t.Children.toArray(n.schema.children.map(((t,a)=>e(t,void 0,U(a,n.testId)))))})})}})}const df=/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{3})$/;function uf(t){const n=Wt(),a=Tn(),{schema:i,testId:o}=t,r=n(i.value),{tabIndex:s,styles:l,isDisabled:c}=m(a);return"string"==typeof(d=r)&&df.test(d)?e.jsx(Oa,{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 pf(n){const{schema:{imageKeys:a,styles:i},testId:o}=n,[r,s]=t.useState(0),l=Tn(),c=function(e){const n=t.useContext(jn);return e.reduce(((e,t)=>{const a=n(`${t}.src`,"copy"),i=n(`${t}.title`,"copy");return void 0===a?e:[...e,C({light:a,title:i})]}),[])}(a),{styles:d,isDisabled:u,tabIndex:p}=m(l),f=c[r]||c[0];return c.length>0&&f?e.jsx(Oa,{styles:i,children:({classnames:n})=>e.jsxs("div",{className:null==n?void 0:n.own,children:[e.jsx("img",{"aria-hidden":u,src:f.light,alt:f.alt,title:f.title,className:null==n?void 0:n.mainImage,style:d,"data-testid":`${o}-main-image`,"data-e2e":"ImageGallery-mainImage"}),e.jsx("div",{className:null==n?void 0:n.thumbnailList,style:Object.assign(Object.assign({},d),{display:"flex"}),children:t.Children.toArray(c.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({},d),{cursor:u?"not-allowed":"pointer",pointerEvents:"auto"}),"data-testid":`${o}-thumbnail-${a}`,"data-e2e":"ImageGallery-thumbnail",tabIndex:p,onClick:()=>s(a)}))))})]})}):null}function ff(n){const i=Et(),o=_n(),r=Wt(),s=ht(),l=Ot().catalogItems||[],c=a.useSelector((e=>e.selectedItem))||l[0];return t.useEffect((()=>{c&&s({type:Y,payload:{name:"SignalImpression",parentGuid:null==c?void 0:c.instanceGuid}})}),[c,s]),c?e.jsx(Oa,{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($n,{context:c,children:e.jsx(Nn,{value:o(c),children:e.jsx(Ht,{value:(s=c,r({data:s},"catalogItem")),children:i(n.schema.template,void 0,n.testId?`${n.testId}-child`:"")})})}))});var s}}):null}const yf={CatalogResponseButton:function(t,n){if("CatalogResponseButton"===t.type)return e.jsx(af,{schema:t.node,testId:n})},CatalogCombinedCollection:function(t,n){if("CatalogCombinedCollection"===t.type)return e.jsx(ff,{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(lf,{schema:n.node});case"CheckoutStateButtonTrigger":return e.jsx(cf,{schema:n.node});case"ColorSwatch":return e.jsx(uf,{schema:n.node});case"ImageGallery":return e.jsx(pf,{schema:n.node});default:return}}}};function hf(){const t=Cn(),n=Et(),i=a.useSelector(Du),o=Wt()({state:i},"textContent");return e.jsx(It,{value:n,overrides:yf,children:e.jsx(Ht,{value:o,children:e.jsx(bt,{children:e=>e(t)})})})}const mf={staticData:Ru,selectedItem:(e=null,t)=>t.type===Zp?t.payload:e,dynamicData:Lu,childLayouts:Au};function vf(e={}){return Object.assign({staticData:null,selectedItem:null,dynamicData:null,childLayouts:{launched:{}}},e)}const gf="INVALID_RESPONSE_OBJECT";function bf(e,t){return l.eventChannel((n=>e.onEvent({name:cr.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:L,code:"MALFORMED_PARTNER_DATA",message:`Malformed data received from partner\n ${e}`})}})))}function*Ef(e,t){var n;try{for(;;){const t=yield r.take(e);t&&(yield r.put({type:ef,payload:t}))}}catch(e){yield r.call(t,{level:L,code:"INSTANT_PURCHASE_CHANNEL_ERROR",message:null!==(n=e.message)&&void 0!==n?n:"Unknown error in instant-purchase channel"})}finally{e.close()}}function If(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 xf="Unknown failure reason";function*Sf(){const e=yield r.select(If);e&&(yield*Af(e))}function*wf(e){const{catalogItem:t}=e.payload;yield*Af(t)}function*Cf(e,t,n){const{catalogItem:a,quantity:i}=n.payload,o=Co(a,i);o?(yield r.put({type:Y,payload:{name:"SignalCartItemInstantPurchaseInitiated",parentGuid:a.instanceGuid,objectData:{catalogItemId:a.catalogItemId,quantity:i}}}),yield*function*(e,t){yield r.put({type:Q,payload:{key:e,value:t}})}("ProcessingState",1),n.payload.useInstantPurchaseExtension?yield*function*(){(yield r.call((function*(){return yield r.delay(5e3),!0})))?yield*Nf("offerComplete",1):yield*Nf("offerComplete",2)}():(yield r.fork(Tf,e,t),yield r.put({type:X,payload:{name:"CART_ITEM_INSTANT_PURCHASE",body:{upsellItems:[o],totalUpsellPrice:o.totalPrice||0,currency:o.currency}}}))):yield r.call(t,{level:L,code:gf,message:`Unable to translate catalog item with ID ${a.catalogItemId} to cart item for instant purchase transaction.`})}function*Of(e,t){const n=yield r.select((e=>e.staticData));if(!n)return yield r.call(e,{level:L,code:"MISSING_STATIC_DATA_IN_INSTANT_PURCHASE_MODULE",message:"App state is not configured with static data."}),void(yield*jf("Error"));if(!n.offer.catalogItems)return yield r.call(e,{level:L,code:"MISSING_CATALOG_ITEMS",message:"No catalog items found within offer data."}),void(yield*jf("Error"));const a={accountId:n.offer.accountId,catalogItems:n.offer.catalogItems};let i,o;t.payload.success?(i=Rf,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||xf,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=Lf(a,t.catalogItems);void 0===e?i.push(a):yield r.put({type:Y,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:L,code:gf,message:`Unable to map cart items to catalog items in the instant purchase partner response: ${n}.`})}(i,a))}(t.payload,a,i,e),yield*jf(o)}function*Tf(e,t){const n=bf(e,t),{timeout:a}=yield r.race({channelListener:r.call(Ef,n,t),timeout:r.delay(6e4)});a&&(yield r.call(t,{level:L,code:"INSTANT_PURCHASE_RESPONSE_TIMEOUT",message:"Instant-purchase response timed out after 60000ms"}),n.close(),yield r.put({type:Z,payload:{event:"Dismissed",dismissalReason:"Implicit"}}))}function*Af(e){var t,n,a;yield r.put({type:Zp,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:Tu,payload:{text:i}})}function Rf(e,t){return{name:"SignalCartItemInstantPurchase",parentGuid:e.instanceGuid,objectData:{catalogItemId:e.catalogItemId,quantity:t,initiatedBy:T.DCUI}}}function Lf(e,t){return t.find((t=>t.catalogItemId===e.catalogItemId))}function*jf(e){yield r.put({type:Z,payload:{event:"Completed",completionReason:e}})}function*Nf(e,t){yield r.put({type:ee,payload:{key:e,value:t}})}function*_f(e){"Checkout"===e.payload.event&&(yield r.put({type:ee,payload:{key:"checkout",value:Df(e.payload),offerPositionIndex:e.payload.offerPositionIndex}}))}function Df(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*kf(e,t){yield r.all([r.spawn(Sf),r.takeEvery(Qp,_f),r.takeEvery(Yp,wf),r.takeLatest(Xp,Cf.bind(null,e,t)),r.takeLatest(ef,Of.bind(null,t)),r.takeEvery(oe,Pu.bind(null,e,t)),r.takeEvery("*",wo.bind(null,[z,oe],e))])}Object.assign(Object.assign({},re),{INITIATE_INSTANT_PURCHASE:Xp,INSTANT_PURCHASE_PARTNER_RESPONSE:ef});const Pf=(new En).withAppFactory((function(i){var o;if(i.rootElement){const r=n.createRoot(i.rootElement),c=vf({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),d=function(e,t,n=vf()){const a=l(),i=s.configureStore({reducer:mf,devTools:{name:"Instant Purchase"},preloadedState:n,middleware:e=>e({thunk:!1}).concat(a)});return a.run(kf,e,t),i}(i.gateway,i.logger,c);r.render(e.jsx(t.StrictMode,{children:e.jsxs(kn,{info:{referralCreativeId:(null===(o=i.offerData.creative.referralCreativeId)||void 0===o?void 0:o.toString())||"N/A"},children:[e.jsx(Ri,{}),e.jsx(a.Provider,{store:d,children:e.jsx(Ti,{settings:i,dispatch:d.dispatch,children:e.jsx(hf,{})})})]})}))}}));var $f=Object.freeze({__proto__:null,moduleConnectorBuilder:Pf});const Gf=t.createContext(null),Ff=({children:n})=>{var a;const[i,o]=t.useState([]),[r,s]=t.useState(0),[l,c]=t.useState(0),d=Wt();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(Gf.Provider,{value:{images:i,activeIndex:r,duration:l,setImages:o,setActiveIndex:s,setDuration:c},children:e.jsx(Ht,{value:d({data:{"image.title":null===(a=i[r])||void 0===a?void 0:a.title}},"creativeCopy"),children:n})})};function Mf({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 Bf(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=C({light:t,title:i});a.push(o)})),a}function Uf({schema:n,testId:a}){const i=JSON.parse(n.data),{styles:o,duration:r,imageKeys:s}=i,l=t.useContext(Gf),c=Bf(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(Mf,{duration:r,active:n===(null==l?void 0:l.activeIndex),containerStyles:o.elements.indicatorContainer,indicatorStyles:o.elements.indicator}))))})]})}const Vf={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"]},zf=new Map([["&","_;^;_"]]),qf=new RegExp(`<a *(?=${Vf.allowedAttributes.a.join("|")}|>)`,"g"),Hf=new RegExp("<span*>","g"),Wf=new RegExp(`<a *(?:(?:${Vf.allowedAttributes.a.filter((e=>"href"!==e)).join("|")})="[^"]*")* *href="([^"]+)"`,"g"),Jf=new RegExp("(<br *?>)|(<br *?/>)","g"),Kf="<br/>";function Yf(n){const a=Wt(),i=Tn(),o=t.useMemo((()=>{const e=a(n.schema.value);if(!function(e){const t=function(e){return e.replaceAll(Wf,((e,t)=>{const n=t.replaceAll("&",zf.get("&"));return e.replace(t,n)})).replaceAll(Jf,Kf)}(e);return t===u(t,Vf)}(e))throw new j("FAILED_SANITISING_HTML","Invalid HTML tags");return e}),[n.schema.value,a]),{tabIndex:r,styles:s,isDisabled:l}=m(i);return o?e.jsx(Oa,{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(qf,`<a ${a.join(" ")}`).replace(Hf,`<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(qf,`<a ${a.join(" ")}`).replace(Hf,`<span${(null==t?void 0:t.span)?` class=${t.span}`:""}>`)}});var i}}):null}function Zf({schema:n}){const a=Et(),i=ct(Mn(),Xt()),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%;
|
|
@@ -192,4 +192,4 @@
|
|
|
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)?ay(c[n],t):ny(t))})})})))})})),v?e.jsx(ey,{onClick:w,disabled:x}):null]}):null}function oy({schema:t}){const n=JSON.parse(t.data),{styles:a,content:i,smallFontSize:o,largeFontSize:r}=n,s=Wt(),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 ry={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(Uf,{schema:t.node});case"RichText":return e.jsx(Yf,{schema:n.node});case"ProductTierCarousel":return e.jsx(Zf,{schema:t.node});case"ProductCatalogCarousel":return e.jsx(iy,{schema:t.node});case"TextAnimate":return e.jsx(oy,{schema:t.node});default:return}}}};function sy(){const t=Cn(),n=Et();return e.jsx(Ff,{children:e.jsx(It,{value:n,overrides:ry,children:e.jsx(bt,{children:e=>e(t)})})})}const ly={staticData:
|
|
195
|
+
`,children:o((null===(i=null==c?void 0:c[n])||void 0===i?void 0:i.src)?ay(c[n],t):ny(t))})})})))})})),v?e.jsx(ey,{onClick:w,disabled:x}):null]}):null}function oy({schema:t}){const n=JSON.parse(t.data),{styles:a,content:i,smallFontSize:o,largeFontSize:r}=n,s=Wt(),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 ry={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(Uf,{schema:t.node});case"RichText":return e.jsx(Yf,{schema:n.node});case"ProductTierCarousel":return e.jsx(Zf,{schema:t.node});case"ProductCatalogCarousel":return e.jsx(iy,{schema:t.node});case"TextAnimate":return e.jsx(oy,{schema:t.node});default:return}}}};function sy(){const t=Cn(),n=Et();return e.jsx(Ff,{children:e.jsx(It,{value:n,overrides:ry,children:e.jsx(bt,{children:e=>e(t)})})})}const ly={staticData:Ru,childLayouts:Au};function cy(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*uy(e,t){for(;;){switch(yield r.take(e)){case"CLOSED":t({type:Z,payload:{event:"Dismissed",dismissalReason:"Implicit"}});break;case"SUCCESS":t({type:Z,payload:{event:"Completed",completionReason:"Success"}});break;case"UNSPECIFIED":t({type:Z,payload:{event:"Completed",completionReason:"Unspecified"}})}}}function*py(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:X,payload:{name:"OFFER_ENGAGEMENT"}}),a.isPositive&&(yield r.put({type:X,payload:{name:"POSITIVE_ENGAGEMENT"}})),yield*function*(e,t,n){if(q(n)){const{responseOption:a,fulfillment:i}=n;yield r.put({type:Y,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(uy,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*fy(e,t){yield r.all([r.takeLatest(z,py.bind(null,e,t)),r.takeEvery(oe,Pu.bind(null,e,t)),r.takeEvery("*",wo.bind(null,[z,oe],e))])}Object.assign({},re);const yy=(new En).withAppFactory((function(i){if(i.rootElement){const o=n.createRoot(i.rootElement),r=cy({staticData:{offer:i.offerData,position:i.offerPositionIndex,schemaVersion:i.schemaVersion}}),c=function(e,t,n=cy()){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(fy,e,t),i}(i.gateway,i.logger,r);o.render(e.jsx(t.StrictMode,{children:e.jsxs(kn,{info:{layoutType:"LayoutVariant",referralCreativeId:String(i.offerData.creative.referralCreativeId)||"N/A"},children:[e.jsx(Ri,{}),e.jsx(a.Provider,{store:c,children:e.jsx(Ti,{settings:i,dispatch:c.dispatch,children:e.jsx(sy,{})})})]})}))}}));var hy=Object.freeze({__proto__:null,moduleConnectorBuilder:yy});exports.BehaviorSubject=class extends bu{constructor(e){super(),this._lastValue=e}subscribe(e,t,n){const a=vu(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=xu,exports.DisplayPreset={FULLSCREEN:"DisplayPreset.FULLSCREEN",EMBEDDED:"DisplayPreset.EMBEDDED",ATTACHED:"DisplayPreset.ATTACHED"},exports.ErrorLevel={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},exports.FirstValueFromError=Eu,exports.Observable=gu,exports.ReplaySubject=class extends bu{constructor(e=-1){super(),this._buffer=[],this._error=null,this._bufferLength=e}subscribe(e,t,n){const a=vu(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=bu,exports.Subscription=hu,exports.addCatchToSubscriber=function(e,t){return new xu(e,t)},exports.combineLatest=(...e)=>new gu((t=>{if(!e.length)return t.complete(),mu;const n=new hu,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=Cu,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(Eu.CompletedBeforeEmit))}))})).then((e=>(n.unsubscribe(),e))).catch((e=>{throw n.unsubscribe(),e}))},exports.fromEvent=(e,t)=>new gu((n=>{const a=e=>n.next(e);return e.addEventListener(t,a),()=>e.removeEventListener(t,a)})),exports.fromPromise=function(e){return new gu((t=>{e.then((e=>{t.next(e),t.complete()}),(e=>t.error(e)))}))},exports.init=function(i,o){return fu(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=pu(o);l.render(e.jsxs(t.StrictMode,{children:[e.jsx(Ri,{}),e.jsx(Vn,{children:e.jsx(a.Provider,{store:c,children:e.jsxs(Fn.Provider,{value:r,children:[e.jsx(qo,{}),e.jsx(xt.Provider,{value:i,children:e.jsx(di,{extensions:yu,extendStore:c.extend.bind(c),children:e.jsx(Nl,{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 Su(n)},exports.merge=(...e)=>new gu((t=>{const n=new hu;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=mu,exports.normaliseToObserver=vu,exports.of=(...e)=>new gu((t=>{for(const n of e)t.next(n)})),exports.pipe=e=>(...t)=>new gu((n=>{const a=e.subscribe((e=>wu(void 0,void 0,void 0,(function*(){try{let a=new Su(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);
|