web-push-notifications 3.110.0 → 3.113.1

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.
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("preact"),require("preact/compat"),require("preact/jsx-runtime"));else if("function"==typeof define&&define.amd)define(["preact","preact/compat","preact/jsx-runtime"],t);else{var n="object"==typeof exports?t(require("preact"),require("preact/compat"),require("preact/jsx-runtime")):t(e.preact,e.preactCompat,e.jsxRuntime);for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(this,(e,t,n)=>(()=>{"use strict";var o={524(t){t.exports=e},873(e){e.exports=t},247(e){e.exports=n}};const i={};function r(e){const t=i[e];if(void 0!==t)return t.exports;const n=i[e]={exports:{}};return o[e](n,n.exports,r),n.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};let s={};r.r(s),r.d(s,{WebPopupsWidget:()=>qo});const a=/^(https?:|mailto:|tel:)/i,c="#101828",l="#667085",u="#FFFFFF",d="#FFFFFF",p="#2970FF",h=c,m=l,f="#FFFFFF",g={h1:{fontSize:24,fontWeight:600,lineHeight:1.25},h2:{fontSize:18,fontWeight:600,lineHeight:1.3},h3:{fontSize:16,fontWeight:600,lineHeight:1.35},body:{fontSize:14,fontWeight:"normal",lineHeight:1.5},caption:{fontSize:12,fontWeight:"normal",lineHeight:1.4},eyebrow:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",lineHeight:1.4},icon:{fontSize:24,lineHeight:1.2}},y={h1:1,h2:1,h3:1,icon:1,eyebrow:.8,body:.9,caption:.75};function b(e,t,n){return n?function(e,t){if(t>=1)return e;const n=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.exec(e)?.[1];if(!n)return e;const o=3===n.length?n.split("").map(e=>e+e).join(""):n,[i,r,s]=[0,2,4].map(e=>parseInt(o.slice(e,e+2),16));return`rgba(${i}, ${r}, ${s}, ${t})`}(t.textInverse,y[e]??1):"icon"!==e?"caption"===e||"eyebrow"===e?t.textSecondary:t.text:void 0}const v=["h1","h2","h3","icon"];function x(e){return"glyph"===e.type?"heading":"text"!==e.type?"action":v.includes(e.variant)?"heading":"text"}const k="8px 0 4px";function w(e,t){return{display:"block",boxSizing:"border-box",width:"100%",padding:"10px 25px",borderRadius:6,fontSize:14,fontWeight:600,fontFamily:"inherit",lineHeight:1.5,textAlign:"center",textDecoration:"none",cursor:"pointer",..."secondary"===e?{backgroundColor:t.surface,color:t.accent,border:`1px solid ${t.accent}`}:{backgroundColor:t.accent,color:t.onAccent,border:"none"}}}function S(e,t=e.border){return{display:"block",boxSizing:"border-box",width:"100%",padding:"10px 12px",borderRadius:6,fontSize:14,fontFamily:"inherit",lineHeight:1.5,backgroundColor:e.surface,color:e.surfaceText,border:`1px solid ${t}`,outline:"none"}}const C="Subscribe",j="Thanks for subscribing!",P="Please check your inbox and confirm your email.",E="Save",M="Thanks! Your choice is saved.",A="Shop now",$=4,I="Send",F="Thanks for the feedback!";const R="Something went wrong. Please try again.",T=/^\S+@\S+\.\S+$/,_="Enter a valid email",q="Required",N="Required",L="Please accept the privacy policy",D="Submit",O=R,B="\n@keyframes pw-vpopup-fade { from { opacity: 0; } }\n@keyframes pw-vpopup-slide { from { opacity: 0; translate: 0 28px; } }\n@keyframes pw-vpopup-overlay { from { opacity: 0; } }\n@keyframes pw-vpopup-page { from { opacity: 0; } }\n",W={bell:"M6 10a6 6 0 0 1 12 0c0 4 1.5 5.5 2 6H4c.5-.5 2-2 2-6M10 20a2 2 0 0 0 4 0",gift:"M3 11h18v9a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1zM2.5 7h19v4h-19zM12 7v14M12 7c-1 0-3-.2-3.5-1a2 2 0 0 1 3.5-1 2 2 0 0 1 3.5 1c-.5.8-2.5 1-3.5 1z",cart:"M2 4h2.2l2.4 11.2A2 2 0 0 0 8.6 17H19M6 7h15l-2.2 7.5H8M10.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M19.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0",chart:"M3 21h18M7 21V11M12 21V6M17 21v-8",lock:"M5 11h14v10H5zM8 11V8a4 4 0 0 1 8 0v3",calendar:"M4 6h16v15H4zM4 10h16M9 3v4M15 3v4",check:"M4 13l5 5L20 6",star:"M12 3l2.9 5.9 6.5.9-4.7 4.6 1.1 6.5-5.8-3.1-5.8 3.1 1.1-6.5L2.6 9.8l6.5-.9z",clock:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0M12 7v5l4 2",tag:"M20.6 13.4l-7.2 7.2a2 2 0 0 1-2.8 0l-7-7A2 2 0 0 1 3 12.2V5a2 2 0 0 1 2-2h7.2a2 2 0 0 1 1.4.6l7 7a2 2 0 0 1 0 2.8zM9 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0",mail:"M3 6h18v12H3zM3 7l9 6 9-6",phone:"M7 2h10a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1M10 19h4",download:"M12 3v12M7 11l5 5 5-5M4 20h16",play:"M8 5l12 7-12 7z",shield:"M12 3l8 3v6c0 5-3.4 8.6-8 10-4.6-1.4-8-5-8-10V6z",sparkle:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM18 15l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1L15 18l2.1-.9z",percent:"M19 5L5 19M8.5 8.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0M20.5 15.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0",truck:"M2 7h12v10H2zM14 10h4l3 3v4h-7M8.5 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M20 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0",ticket:"M4 7h16v4a2 2 0 0 0 0 4v3H4v-3a2 2 0 0 0 0-4zM14 7v12",user:"M20 21a8 8 0 0 0-16 0M16 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0"},z=Object.keys(W),V=[24,32,48],H=["Vertical","Horizontal","Columns","Rows"],U=["normal","reverse"],K=["start","center","end","stretch"],Y=["start","center","end","space-between"],Z=["left","center","right"],G=["default","inverse"],J=2e3,Q={px:J,"%":100,em:125,rem:125},X=/^(\d{1,4}(?:\.\d+)?)(px|%|em|rem)$/,ee={px:J,"%":100,fr:100},te=/^(\d{1,4}(?:\.\d+)?)(px|%|fr)$/,ne=["auto","min-content","max-content"];function oe(e,t){return t.includes(e)?e:void 0}function ie(e){if("number"==typeof e&&Number.isFinite(e))return Math.min(Math.max(e,0),J);if("string"!=typeof e)return;const t=X.exec(e.trim());if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),Q[o])}${o}`}const re=["top","right","bottom","left"];function se(e){if(ne.includes(e))return e;const t=te.exec(e);if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),ee[o])}${o}`}function ae(e){return"string"==typeof e&&e.length>0?e:void 0}function ce(e){const t={},n=ie(e.gap);void 0!==n&&(t.gap=n);const o=function(e){const t=ie(e);if(void 0!==t)return t;if("object"!=typeof e||null===e)return;const n={};for(const t of re){const o=ie(e[t]);void 0!==o&&(n[t]=o)}return Object.keys(n).length>0?n:void 0}(e.padding);void 0!==o&&(t.padding=o);const i=oe(e.alignItems,K);i&&(t.alignItems=i);const r=oe(e.justifyContent,Y);r&&(t.justifyContent=r);const s=oe(e.alignContent,Y);s&&(t.alignContent=s);const a=ae(e.backgroundImage);a&&(t.backgroundImage=a);const c=function(e){if("number"==typeof e)return Number.isInteger(e)&&e>=1&&e<=12?e:void 0;if("string"!=typeof e)return;const t=e.trim().split(/\s+/);if(t.length<1||t.length>12)return;const n=t.map(se);return n.every(e=>void 0!==e)?n.join(" "):void 0}(e.sizes);return void 0!==c&&(t.sizes=c),t}function le(e,t,n){if(t>10||n.nodes<=0)return null;if("object"!=typeof e||null===e)return null;n.nodes-=1;const o=e,i="object"==typeof o.props&&null!==o.props?o.props:{};if("Content"===o.type){const e=ae(i.content);if(!e)return null;const t={type:"Content",props:{content:e}},n=oe(i.align,Z);n&&(t.props.align=n);const o=oe(i.tone,G);return o&&"default"!==o&&(t.props.tone=o),t}if("Image"===o.type){const e=ae(i.image);if(!e)return null;return{type:"Image",props:{image:e}}}if(!Array.isArray(o.children))return null;const r=oe(o.type,H)??"Vertical",s=[];for(const e of o.children){const o=le(e,t+1,n);o&&s.push(o)}const a=ce(i);return"reverse"===oe(i.order,U)&&(s.reverse(),"string"==typeof a.sizes&&(a.sizes=a.sizes.split(" ").reverse().join(" "))),{type:r,props:a,children:s}}function ue(e){return le(e,0,{nodes:100})}const de=/^[a-zA-Z][a-zA-Z0-9-]*$/,pe=/^\$([a-zA-Z][a-zA-Z0-9-]*)$/;function he(e,t){return e.includes("$")?e.split(/(\s+)/).map(e=>{const n=pe.exec(e)?.[1];return void 0!==n&&Object.prototype.hasOwnProperty.call(t,n)?t[n]:e}).join(""):e}function me(e,t){return"object"!=typeof e||null===e||0===Object.keys(t).length?e:ge(e,t,0)}const fe=new Set(["content","image","backgroundImage"]);function ge(e,t,n){if(n>10||"object"!=typeof e||null===e)return e;const o=e,i={...o};if("object"==typeof o.props&&null!==o.props){const e={...o.props};for(const[n,o]of Object.entries(e))if(!fe.has(n))if("string"==typeof o)e[n]=he(o,t);else if("object"==typeof o&&null!==o&&!Array.isArray(o)){const i={...o};for(const[e,n]of Object.entries(i))"string"==typeof n&&(i[e]=he(n,t));e[n]=i}i.props=e}return Array.isArray(o.children)&&(i.children=o.children.map(e=>ge(e,t,n+1))),i}function ye(e){return"number"==typeof e?`${e}px`:e}function be(e,t){if("string"==typeof e)return e;return`repeat(${"number"==typeof e?e:Math.max(t,1)}, 1fr)`}function ve(e=0){if(!(e>0))return null;const t=`rgba(16, 24, 40, ${Math.min(e,1)})`;return`linear-gradient(${t}, ${t})`}function xe(e,t=0){const n=`url(${JSON.stringify(e)})`,o=ve(t);return{backgroundImage:o?`${o}, ${n}`:n,backgroundSize:"cover",backgroundPosition:"center"}}function ke(e,t,n=0){const o=e.props??{},i={display:"grid",minWidth:0};return"Horizontal"===e.type&&(i.gridAutoFlow="column"),"Columns"===e.type&&(i.gridTemplateColumns=be(o.sizes,e.children.length)),"Rows"===e.type&&(i.gridTemplateRows=be(o.sizes,e.children.length)),void 0!==o.gap&&(i.gap=ye(o.gap)),void 0!==o.padding&&(i.padding=function(e){if("number"==typeof e||"string"==typeof e)return ye(e);const t=e=>void 0===e?"0":ye(e);return`${t(e.top)} ${t(e.right)} ${t(e.bottom)} ${t(e.left)}`}(o.padding)),o.alignItems&&(i.alignItems=o.alignItems),o.justifyContent&&(i.justifyContent=o.justifyContent),o.alignContent&&(i.alignContent=o.alignContent),t&&Object.assign(i,xe(t,n)),i}const we=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function Se(e){const t=we.exec(e.trim())?.[1];if(!t)return null;const n=3===t.length?t.split("").map(e=>e+e).join(""):t;return[0,2,4].map(e=>parseInt(n.slice(e,e+2),16))}function Ce([e,t,n]){return`#${[e,t,n].map(e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")).join("")}`}function je(e,t,n){let o=n;return o<0&&(o+=1),o>1&&(o-=1),o<1/6?e+6*(t-e)*o:o<.5?t:o<2/3?e+(t-e)*(2/3-o)*6:e}function Pe(e){return e>.5?.07+.86*(1-e):e}function Ee(e){return e<.5?.93-e*((.93-.5)/.5):e}function Me(e,t){const n=Se(e);if(!n)return e;const[o,i,r]=function([e,t,n]){const[o,i,r]=[e/255,t/255,n/255],s=Math.max(o,i,r),a=Math.min(o,i,r),c=(s+a)/2;if(s===a)return[0,0,c];const l=s-a;let u;return u=s===o?(i-r)/l+(i<r?6:0):s===i?(r-o)/l+2:(o-i)/l+4,[u/6,c>.5?l/(2-s-a):l/(s+a),c]}(n);return Ce(function([e,t,n]){if(0===t){const e=255*n;return[e,e,e]}const o=n<.5?n*(1+t):n+t-n*t,i=2*n-o;return[255*je(i,o,e+1/3),255*je(i,o,e),255*je(i,o,e-1/3)]}([o,i,"fold"===t?Pe(r):Ee(r)]))}function Ae(e,t,n){const o=Se(e),i=Se(t);return o&&i?Ce(o.map((e,t)=>e+(i[t]-e)*n)):e}function $e(e,t){const n=Se(e);if(!n||t>=1)return e;const[o,i,r]=n;return`rgba(${o}, ${i}, ${r}, ${t})`}function Ie(e){const t=Se(e);if(!t)return!1;const[n,o,i]=t;return(.299*n+.587*o+.114*i)/255>.6}function Fe(e){return{background:Me(e.background,"fold"),accent:e.accent,text:Me(e.text,"lift"),textSecondary:Me(e.textSecondary,"lift"),textInverse:e.textInverse}}function Re(e,t){return"light"===t?{surface:d,surfaceText:c,border:"#D0D5DD",onAccent:u,error:"#D92D20",chromeIcon:l}:{surface:Ae(e.background,e.text,.08),surfaceText:e.text,border:Ae(e.background,e.text,.24),onAccent:Ie(e.accent)?c:u,error:"#FDA29B",chromeIcon:e.textSecondary}}function Te(e){return!0===e.dark?.enabled}function _e(e,t="light"){return"dark"===t&&Te(e)?"dark":"light"}function qe(e,t="light"){const n=_e(e,t),o="dark"===n?(i=e.colors,r=e.dark,{...Fe(i),...r?.colors??{}}):e.colors;var i,r;return{...o,scheme:n,...Re(o,n)}}function Ne(e,t="light"){return"dark"===t&&e.srcDark?e.srcDark:e.src}function Le(e,t="light"){return"light"===_e(e,t)?{overlay:e.overlay,boxShadow:e.boxShadow}:{overlay:e.dark?.overlay??e.overlay,boxShadow:e.dark?.boxShadow??e.boxShadow}}const De=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?$/,Oe=new Map;function Be(e){const t=Oe.get(e);if(t)return t;try{const t=new Intl.DateTimeFormat("en-US",{timeZone:e,hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"});return Oe.set(e,t),t}catch{return null}}function We(e){return!e||null!==Be(e)}function ze(e,t){const n=t.formatToParts(new Date(e)),o=e=>Number(n.find(t=>t.type===e)?.value??"0");return Date.UTC(o("year"),o("month")-1,o("day"),o("hour")%24,o("minute"),o("second"))-e}const Ve=864e5;const He=new Map;function Ue(e,t){const n=`${e}|${t}`,o=He.get(n);if(void 0!==o)return o;const i=function(e,t){const n=De.exec((e||"").trim());if(!n)return null;const[,o,i,r,s,a,c]=n.map(Number),l=Number.isNaN(c)?0:c;if(i<1||i>12||r<1||r>31)return null;if(s>23||a>59||l>59)return null;const u=Date.UTC(o,i-1,r,s,a,l),d=new Date(u);if(d.getUTCMonth()!==i-1||d.getUTCDate()!==r)return null;if(!t)return u;const p=Be(t);if(!p)return null;const h=function(e,t){const n=[];for(const o of[e-Ve,e,e+Ve]){const e=ze(o,t);n.includes(e)||n.push(e)}return n}(u,p),m=h.filter(e=>ze(u-e,p)===e).map(e=>u-e);return m.length>0?Math.min(...m):u-Math.min(...h)}(e,t);return He.size>100&&He.clear(),He.set(n,i),i}const Ke={en:{days:"Days",hours:"Hours",minutes:"Minutes",seconds:"Seconds"},ru:{days:"Дни",hours:"Часы",minutes:"Минуты",seconds:"Секунды"},de:{days:"Tage",hours:"Stunden",minutes:"Minuten",seconds:"Sekunden"},es:{days:"Días",hours:"Horas",minutes:"Minutos",seconds:"Segundos"},fr:{days:"Jours",hours:"Heures",minutes:"Minutes",seconds:"Secondes"},pt:{days:"Dias",hours:"Horas",minutes:"Minutos",seconds:"Segundos"},ja:{days:"日",hours:"時間",minutes:"分",seconds:"秒"},ko:{days:"일",hours:"시간",minutes:"분",seconds:"초"},zh:{days:"天",hours:"小时",minutes:"分",seconds:"秒"},hi:{days:"दिन",hours:"घंटे",minutes:"मिनट",seconds:"सेकंड"},bn:{days:"দিন",hours:"ঘণ্টা",minutes:"মিনিট",seconds:"সেকেন্ড"},ar:{days:"أيام",hours:"ساعات",minutes:"دقائق",seconds:"ثوان"},he:{days:"ימים",hours:"שעות",minutes:"דקות",seconds:"שניות"},th:{days:"วัน",hours:"ชั่วโมง",minutes:"นาที",seconds:"วินาที"}};function Ye(e){const t=(e||"").trim();if(t)return t.startsWith("#")||t.startsWith("/")||t.startsWith("?")||a.test(t)?t:void 0}function Ze(e){return"_self"===e?{target:"_self"}:{target:"_blank",rel:"noreferrer"}}function Ge(e,t,n){const o="granted"===t?e.onGranted:e.onDenied;return"href"===o?.type&&function(e,t){const n="string"==typeof e.url?Ye(e.url):void 0;if(!n)return void t?.warn("Subscribe button: the link to open after the answer is empty or unsafe, it was not opened");if("_self"===e.target)return void window.location.assign(n);window.open(n,"_blank","noopener,noreferrer")}(o,n),"page"===o?.type?{page:o.page}:"granted"===t||"close"===o?.type?"close":"stay"}const Je=new Set(["STRONG","B","EM","I","U","BR","A"]);function Qe(e,t,n){for(const o of Array.from(e.childNodes)){if(3===o.nodeType){t.appendChild(n.createTextNode(o.textContent??""));continue}if(1!==o.nodeType)continue;const e=o;if(!Je.has(e.tagName)){Qe(e,t,n);continue}const i=n.createElement(e.tagName.toLowerCase());if("A"===e.tagName){const t=Ye(e.getAttribute("href")??void 0);t&&i.setAttribute("href",t);const{target:n,rel:o}=Ze(e.getAttribute("target"));i.setAttribute("target",n),o&&i.setAttribute("rel",o)}t.appendChild(i),Qe(e,i,n)}}function Xe(e){if(!e.includes("<"))return e;const t=(new DOMParser).parseFromString(e,"text/html"),n=t.createElement("div");return Qe(t.body,n,t),n.innerHTML}function et(e){return"string"==typeof e&&e?e:void 0}function tt(e,t){const n=e.dark;if("object"!=typeof n||null===n)return;const o=n,i="object"==typeof o.colors&&null!==o.colors?o.colors:{},r=Fe(t),s=function(e){if("object"!=typeof e||null===e)return;const t=e,n=et(t.color);if(!n)return;return{color:n,opacity:"number"==typeof t.opacity&&Number.isFinite(t.opacity)?Math.max(0,Math.min(1,t.opacity)):1}}(o.overlay);return{enabled:!0===o.enabled,colors:{background:et(i.background)??r.background,accent:et(i.accent)??r.accent,text:et(i.text)??r.text,textSecondary:et(i.textSecondary)??r.textSecondary,textInverse:et(i.textInverse)??r.textInverse},...s?{overlay:s}:{},...et(o.boxShadow)?{boxShadow:o.boxShadow}:{}}}function nt(e){let t;try{t=JSON.parse(e)}catch{return null}if("object"!=typeof t||null===t)return null;const n=t;if(2!==n.version)return null;const o=n.params;if("object"!=typeof o||null===o)return null;if(!Array.isArray(o.pages)||0===o.pages.length)return null;const i=function(e){const t="object"==typeof e.colors&&null!==e.colors?e.colors:{};return{background:et(t.background)??et(e.background)??d,accent:et(t.accent)??et(e.accent)??p,text:et(t.text)??h,textSecondary:et(t.textSecondary)??m,textInverse:et(t.textInverse)??f}}(o),r=tt(o,i);return{version:2,params:{...o,colors:i,...r?{dark:r}:{}}}}const ot=["cover","contain"];function it(e){if("object"!=typeof e||null===e)return;const t=e,n=Ye("string"==typeof t.src?t.src:void 0);return n?{src:n,...!0===t.controls?{controls:!0}:{},...!1===t.loop?{loop:!1}:{}}:void 0}function rt(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=20)break;if("object"!=typeof n||null===n)continue;if("string"!=typeof n.key||!n.key)continue;if("string"!=typeof n.src)continue;const e=it(n.video);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",src:n.src,..."string"==typeof n.srcDark&&n.srcDark?{srcDark:n.srcDark}:{},...e?{video:e}:{},..."string"==typeof n.mediaId&&n.mediaId?{mediaId:n.mediaId}:{},..."string"==typeof n.mediaIdDark&&n.mediaIdDark?{mediaIdDark:n.mediaIdDark}:{},...ot.includes(n.fit)?{fit:n.fit}:{},..."number"==typeof n.blur&&Number.isFinite(n.blur)&&n.blur>0?{blur:Math.min(n.blur,100)}:{},..."number"==typeof n.dim&&Number.isFinite(n.dim)&&n.dim>0?{dim:Math.min(n.dim,1)}:{}})}return t}const st=["px","%","em","rem","fr"];function at(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}function ct(e){if("object"!=typeof e||null===e)return;const t=e;if("text"===t.kind)return{kind:"text"};if("length"===t.kind||"percent"===t.kind){const e=at(t.min),n=at(t.max),o="length"===t.kind&&Array.isArray(t.units)?t.units.filter(e=>st.includes(e)):[],i="length"===t.kind?function(e){if("object"!=typeof e||null===e)return;const t={};for(const n of st){const o=e[n];if("object"!=typeof o||null===o)continue;const i=at(o.min),r=at(o.max);void 0===i&&void 0===r||(t[n]={...void 0!==i?{min:i}:{},...void 0!==r?{max:r}:{}})}return Object.keys(t).length>0?t:void 0}(t.ranges):void 0;return{kind:t.kind,...void 0!==e?{min:e}:{},...void 0!==n?{max:n}:{},...o.length>0?{units:o}:{},...i?{ranges:i}:{}}}if("select"===t.kind&&Array.isArray(t.options)){const e=[];for(const n of t.options){if(e.length>=20)break;"object"==typeof n&&null!==n&&("string"!=typeof n.value||n.value.length>64||e.push({value:n.value,label:"string"==typeof n.label?n.label:n.value}))}if(e.length>0)return{kind:"select",options:e}}}function lt(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=20)break;if("object"!=typeof n||null===n)continue;if("string"!=typeof n.key||!de.test(n.key))continue;if("string"!=typeof n.value||n.value.length>64||n.value.includes("$"))continue;if(t.some(e=>e.key===n.key))continue;const e=ct(n.control);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",value:n.value,...e?{control:e}:{}})}return t}function ut(e){return Object.fromEntries(e.map(e=>[e.key,e.value]))}const dt=["email","firstName","lastName","phone","custom"],pt=["primary","secondary"];function ht(e){const t=[];if(Array.isArray(e))for(const n of e){if(t.length>=10)break;"object"==typeof n&&null!==n&&("string"==typeof n.key&&n.key&&dt.includes(n.kind)&&(t.some(e=>e.key===n.key)||t.push({key:n.key,kind:n.kind,label:"string"==typeof n.label?n.label:"",placeholder:"string"==typeof n.placeholder?n.placeholder:"",required:"email"===n.kind||!0===n.required,..."custom"===n.kind&&"string"==typeof n.tag&&n.tag?{tag:n.tag}:{}})))}if(!t.some(e=>"email"===e.kind)){let e="field-email";for(;t.some(t=>t.key===e);)e=`${e}-1`;t.unshift({key:e,kind:"email",label:"Email",placeholder:"",required:!0})}return t.slice(0,10)}const mt=["checkbox","chips"],ft=["viewed","bestsellers_30d","also_bought","cart"];function gt(e){return ft.includes(e)?e:void 0}const yt=["row","grid"],bt=["nps","stars","thumbs"],vt=["instant","button"],xt=["keep","hide-popup","page"],kt=/^[a-z]{2}$/i,wt=/^#[0-9a-fA-F]{6}$/,St=500;function Ct(e,t=120){return"string"==typeof e?e.trim().slice(0,t):""}function jt(e,t,n=120){return Ct(e,n)||t}function Pt(e){const t=Ct(e,8);return kt.test(t)?t.toLowerCase():""}function Et(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=12)break;if("object"!=typeof n||null===n)continue;const e=Ct(n.value);if(!e)continue;if(t.some(t=>t.value===e))continue;const o=Ct(n.tagValue);t.push({value:e,label:jt(n.label,e),...o?{tagValue:o}:{}})}return t}function Mt(e,t){const n=e=>{const n=at(e);return void 0===n||n<=0?0:Math.min(Math.floor(n),t)},o=n(e.min),i=n(e.max);return{min:o,max:i>0?Math.max(o,i):0}}function At(e){const t=[];for(const n of e){if(t.length>=50)break;if("object"==typeof n&&null!==n&&("string"==typeof n.key&&n.key))if("text"!==n.type)if("button"!==n.type){if("timer"===n.type){const e=Ct(n.timezone,64),o=We(e)?e:"",i=Ct(n.endTime,32);if(null===Ue(i,o))continue;const r=Ct(n.expirePage),s=xt.includes(n.onExpire)?n.onExpire:"keep",a="page"!==s||r?s:"keep";t.push({type:"timer",key:n.key,endTime:i,timezone:o,language:Pt(n.language),showLabels:!1!==n.showLabels,onExpire:a,..."page"===a?{expirePage:r}:{}});continue}if("choice"===n.type){const e=Et(n.options),{min:o,max:i}=Mt(n,e.length);t.push({type:"choice",key:n.key,control:mt.includes(n.control)?n.control:"checkbox",tagName:Ct(n.tagName),options:e,min:o,max:i,submitLabel:jt(n.submitLabel,E),submitVariant:pt.includes(n.submitVariant)?n.submitVariant:"primary",successMessage:jt(n.successMessage,M,St)});continue}if("rating"===n.type){const e="object"==typeof n.labels&&null!==n.labels?n.labels:{};t.push({type:"rating",key:n.key,scale:bt.includes(n.scale)?n.scale:"stars",labels:{low:Ct(e.low),high:Ct(e.high)},submitMode:vt.includes(n.submitMode)?n.submitMode:"instant",submitLabel:jt(n.submitLabel,I),eventName:Ct(n.eventName),successMessage:jt(n.successMessage,F,St)});continue}if("glyph"!==n.type){if("products"===n.type){const e="object"==typeof n.fields&&null!==n.fields?n.fields:{},o=Number.isFinite(n.limit)?Math.round(n.limit):$,i=gt(n.strategy)??"bestsellers_30d",r=gt(n.fallbackStrategy);t.push({type:"products",key:n.key,strategy:i,...r&&r!==i?{fallbackStrategy:r}:{},limit:Math.min(Math.max(o,1),12),layout:yt.includes(n.layout)?n.layout:"row",fields:{title:!1!==e.title,price:!1!==e.price,image:!1!==e.image,cta:!1!==e.cta},ctaText:Ct(n.ctaText),hideWhenEmpty:!0===n.hideWhenEmpty});continue}"email-input"!==n.type?"tag-input"!==n.type?"consent"!==n.type?"submit"!==n.type?"email-subscription-form"===n.type&&t.push({type:"email-subscription-form",key:n.key,formCode:"string"==typeof n.formCode?n.formCode:"",fields:ht(n.fields),submitLabel:"string"==typeof n.submitLabel&&n.submitLabel?n.submitLabel:C,submitVariant:pt.includes(n.submitVariant)?n.submitVariant:"primary",..."object"==typeof n.privacy&&null!==n.privacy&&"string"==typeof n.privacy.checkboxLabel?{privacy:{checkboxLabel:n.privacy.checkboxLabel,url:"string"==typeof n.privacy.url?n.privacy.url:"",linkLabel:"string"==typeof n.privacy.linkLabel?n.privacy.linkLabel:""}}:{},successMessage:"string"==typeof n.successMessage&&n.successMessage?n.successMessage:j,confirmEmailMessage:"string"==typeof n.confirmEmailMessage&&n.confirmEmailMessage?n.confirmEmailMessage:P}):t.push({type:"submit",key:n.key,variant:pt.includes(n.variant)?n.variant:"primary",label:jt(n.label,D),errorMessage:jt(n.errorMessage,O,St)}):t.push({type:"consent",key:n.key,checkboxLabel:Ct(n.checkboxLabel,St),linkLabel:Ct(n.linkLabel),url:Ct(n.url,St),requiredMessage:jt(n.requiredMessage,L)}):t.push({type:"tag-input",key:n.key,tagName:Ct(n.tagName),label:Ct(n.label),placeholder:Ct(n.placeholder),required:!0===n.required,requiredMessage:jt(n.requiredMessage,N)}):t.push({type:"email-input",key:n.key,label:Ct(n.label),placeholder:Ct(n.placeholder),invalidMessage:jt(n.invalidMessage,_),requiredMessage:jt(n.requiredMessage,q)})}else{if(!z.includes(n.name))continue;t.push({type:"glyph",key:n.key,name:n.name,size:V.includes(n.size)?n.size:V[0],color:"string"==typeof n.color&&wt.test(n.color)?n.color:""})}}else"object"==typeof n.action&&null!==n.action&&"string"==typeof n.action.type&&t.push(n);else"string"==typeof n.html&&t.push(n)}return t}function $t(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=20)break;"object"==typeof n&&null!==n&&("string"==typeof n.key&&n.key&&Array.isArray(n.slots)&&t.push({key:n.key,label:"string"==typeof n.label?n.label:"",slots:At(n.slots)}))}return t}function It(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.min(e,2e3):void 0}function Ft(e,t,n){if(null===e)return;let o;return o="stretch"===e?"stretch":It(e)??("stretch"===t?"stretch":It(t)),"width"===n&&"stretch"===o?void 0:o}function Rt(e){const t=[];for(const n of e.pages){const o=lt(n.values),i=ue(me(n.layout,ut(o)));if(!i)continue;const r=Ft(n.width,e.width,"width"),s=Ft(n.height,e.height,"height");t.push({key:n.key,layout:i,images:rt(n.images),contents:$t(n.contents),...void 0!==r?{width:r}:{},...void 0!==s?{height:s}:{},..."success"===n.role?{role:"success"}:{}})}return t}function Tt(e,t){return t.find(t=>t.key===e.startPage)??t[0]}function _t(e){return`calc(100% - ${2*e.offset}px)`}function qt(e){return Array.isArray(e?.slots)?{...e,slots:e.slots.filter(e=>!function(e){const t=e;return"button"===t?.type&&"close"===t.action?.type}(e))}:e}function Nt(e){return Array.isArray(e?.contents)?{...e,contents:e.contents.map(qt)}:e}const Lt=new Set(["email-input","tag-input","consent"]),Dt=new Set([...Lt,"submit"]);function Ot(e){return Lt.has(e.type)}function Bt(e,t){return`${e}/${t}`}function Wt(e){return Rt(e).some(e=>e.contents.some(e=>e.slots.some(e=>Dt.has(e.type))))}function zt(e,t){const{slot:n}=e;if("consent"===n.type)return t.checks[e.id]?void 0:n.requiredMessage;const o=(t.texts[e.id]??"").trim();return"tag-input"===n.type?n.required&&!o?n.requiredMessage:void 0:o?T.test(o)?void 0:n.invalidMessage:n.requiredMessage}function Vt(e,t){const n={};for(const o of e){const e=zt(o,t);e&&(n[o.id]=e)}return n}const Ht="pushwoosh-web-popups",Ut="[WebPopups]",Kt="data-pushwoosh-embedded-order",Yt="keyValue",Zt="messages",Gt="inboxMessages";function Jt(e,t){return function(n){n.objectStoreNames.contains(e)||t(n)}}const Qt=[Jt(Yt,function(e){e.createObjectStore(Yt,{keyPath:"key"})}),Jt("log",function(e){const t=e.createObjectStore("log",{keyPath:"id",autoIncrement:!0});t.createIndex("environment","environment",{unique:!1}),t.createIndex("date","date",{unique:!1}),t.createIndex("type","type",{unique:!1})}),Jt(Zt,function(e){e.createObjectStore(Zt,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),Jt(Gt,function(e){const t="status",n=e.createObjectStore(Gt,{keyPath:"inbox_id",autoIncrement:!1});n.createIndex(t,t,{unique:!1,multiEntry:!0}),n.createIndex("rt","rt",{unique:!1,multiEntry:!0})})];class Xt{get all(){return Qt}}class en{constructor(e,t=new Xt){this.db=e,this.migrationsBuilder=t}applyMigrations(){this.applyMigrationsPack(this.migrationsBuilder.all)}applyMigrationsPack(e){e.forEach(e=>{e(this.db)})}}function tn(e,t){console.info("onversionchange",t),e.close()}let nn;function on(e){return(nn||(nn=new Promise((e,t)=>{const n=indexedDB.open("PUSHWOOSH_SDK_STORE",7);n.onsuccess=n=>{const o=n.target.result;o.onversionchange=tn.bind(null,o,t),e(o)},n.onerror=()=>t(n.error),n.onupgradeneeded=e=>{const n=e.target.result;n.onversionchange=tn.bind(null,n,t),new en(n).applyMigrations()}})),nn).then(t=>new Promise((n,o)=>e(t,n,o)))}class rn{_add(e){return on((t,n,o)=>{const i=t.transaction([this.name],"readwrite").objectStore(this.name).add(e);i.onsuccess=()=>{n(e)},i.onerror=()=>{o(i.error)}}).then(e=>this.getAll().then(t=>{if(Array.isArray(t)){const n=t.map(e=>e.id).sort((e,t)=>e==t?0:e<t?1:-1);if(n.length>this.maxItems)return Promise.all(n.slice(this.maxItems).map(e=>this.delete(e))).then(()=>e)}return e}))}delete(e){return on((t,n,o)=>{const i=t.transaction([this.name],"readwrite").objectStore(this.name).delete(e);i.onsuccess=()=>{n(i.result)},i.onerror=()=>{o(i.error)}})}getAll(){return on((e,t,n)=>{const o=[],i=e.transaction(this.name).objectStore(this.name).openCursor();i.onsuccess=e=>{const n=e.target.result;n?(n.value&&o.push(n.value),n.continue()):t(o)},i.onerror=()=>{n(i.error)}})}}sn=Yt;var sn;const an=new class extends rn{constructor(){super(...arguments),this.name="log",this.maxItems=100,this.environment="undefined"!=typeof self&&self.registration?"worker":"browser"}add(e,t,n){const o={type:e,environment:this.environment,message:`${t}`,date:new Date};return t instanceof Error&&(o.stack=t.stack),n&&(o.additional=n),this._add(o)}},cn=(new class extends rn{constructor(){super(...arguments),this.name=Zt,this.maxItems=25}add(e){return this._add({...e,date:new Date})}},{error:1,info:2,debug:3});let ln=3;const un={setLevel(e){cn[e]||(e="error"),ln=cn[e]},write(e,t,n){return"error"===e?this.error(t):this.info(t),an.add(e,t,n)}};function dn(e){return async({slotKey:t,tagName:n,values:o})=>{try{await e.api.setTags({[n]:{operation:"append",value:o}})}catch(e){throw un.error(e,`Failed to write web popup choice "${t}" to tag "${n}"`),e}}}function pn(e){return async({slotKey:t,eventName:n,score:o,scale:i})=>{try{await e.api.postEvent(n,{score:o,scale:i,slotKey:t})}catch(e){throw un.error(e,`Failed to post web popup rating "${t}" as event "${n}"`),e}}}function hn(e){return async()=>{try{await e.subscribe()}catch(e){un.error(e,"Failed to subscribe from a web popup")}return e.driver?.getPermission()??"default"}}Object.keys(cn).forEach(e=>{const t=cn[e];un[e]=(...n)=>{t<=ln&&(console.groupCollapsed(e),console.info("",...n),console.trace("trace"),console.groupEnd())}});var mn=r(247),fn=r(524),gn=r(873);const yn="(prefers-color-scheme: dark)";function bn(){return"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia(yn).matches}function vn(e,t){const[n,o]=(0,gn.useState)(()=>"auto"===e&&t&&bn()),i=[e,t],[r,s]=(0,gn.useState)(null);return(null===r||i.some((e,t)=>e!==r[t]))&&(s(i),"auto"===e&&t&&o(bn())),(0,gn.useEffect)(()=>{if("auto"!==e||!t||"undefined"==typeof window||"function"!=typeof window.matchMedia)return;const n=window.matchMedia(yn),i=e=>o(e.matches);return n.addEventListener("change",i),()=>n.removeEventListener("change",i)},[e,t]),"auto"!==e?e:n?"dark":"light"}const xn="data-pw-web-popup-inline",kn="data-pw-close",wn="data-pw-submit",Sn={width:"100%"},Cn=`[${xn}] img { max-height: 360px; object-fit: cover; }`,jn=(0,gn.createContext)({pageKey:"",texts:{},checks:{},errors:{},phase:"idle",setText:()=>{},setCheck:()=>{},submit:()=>{},turnPage:(e,t)=>t(e),advance:()=>{}});function Pn(e,t){return t in e?Object.fromEntries(Object.entries(e).filter(([e])=>e!==t)):e}function En(e,t,n,o){const i=(0,gn.useMemo)(()=>Rt(e),[e]),r=(0,gn.useMemo)(()=>function(e){const t=[];for(const n of e)for(const e of n.contents)for(const o of e.slots)Ot(o)&&t.push({id:Bt(n.key,o.key),pageKey:n.key,slot:o});return t}(i),[i]),[s,a]=(0,gn.useState)({}),[c,l]=(0,gn.useState)({}),[u,d]=(0,gn.useState)({}),[p,h]=(0,gn.useState)("idle"),m=e=>i.findIndex(t=>t.key===e),f=()=>{const e=Vt(r.filter(e=>e.pageKey===t),{texts:s,checks:c});return d(e),0===Object.keys(e).length},g=()=>{o&&"submitting"!==p&&((()=>{const e=Vt(r,{texts:s,checks:c});d(e);const t=r.find(t=>t.id in e);return t&&n?.(t.pageKey),!t})()?(h("submitting"),Promise.resolve().then(()=>o(function(e,t){const n={tags:{},policyAccepted:!0};for(const o of e){const{slot:e}=o;if("consent"===e.type){n.policyAccepted=n.policyAccepted&&!0===t.checks[o.id];continue}const i=(t.texts[o.id]??"").trim();"email-input"!==e.type?i&&e.tagName&&(n.tags[e.tagName]=i):n.email=i}return n}(r,{texts:s,checks:c}))).then(e=>{if(h("idle"),"invalid-email"===e)return void(()=>{const e=r.find(e=>"email-input"===e.slot.type);"email-input"===e?.slot.type&&(d({[e.id]:e.slot.invalidMessage}),n?.(e.pageKey))})();const t=i.find(e=>"success"===e.role);t&&n?.(t.key)},()=>h("error"))):h("idle"))};return{pageKey:t,texts:s,checks:c,errors:u,phase:p,setText:(e,t)=>{a(n=>({...n,[e]:t})),d(t=>Pn(t,e))},setCheck:(e,t)=>{l(n=>({...n,[e]:t})),d(t=>Pn(t,e))},submit:g,turnPage:(e,n)=>{if("submitting"===p)return;const r=m(e),s=r>m(t);o&&s?"success"===i[r].role?g():f()&&n(e):n(e)},advance:()=>{if(!o||"submitting"===p)return;const e=i[m(t)+1];e&&"success"!==e.role?f()&&n?.(e.key):g()}}}const Mn={padding:"4px 0",textAlign:"left"};function An({inverse:e,colors:t}){const n=b("caption",t,e);return{...g.caption,...n?{color:n}:{}}}function $n(e){return{fontSize:12,lineHeight:1.4,color:e.error,paddingTop:2}}function In(e){return{...An(e),paddingBottom:4}}function Fn({slotKey:e,label:t,placeholder:n,inputType:o,autoComplete:i,look:r}){const s=(0,gn.useContext)(jn),[a,c]=(0,gn.useState)(!1),l=Bt(s.pageKey,e),u=s.errors[l];let d;return u?d=r.colors.error:a&&(d=r.colors.accent),(0,mn.jsxs)("div",{style:Mn,children:[t&&(0,mn.jsx)("div",{style:In(r),children:t}),(0,mn.jsx)("input",{type:o,autoComplete:i,placeholder:n||void 0,value:s.texts[l]??"",disabled:"submitting"===s.phase,style:S(r.colors,d),onFocus:()=>c(!0),onBlur:()=>c(!1),onChange:e=>s.setText(l,e.currentTarget.value),onKeyDown:e=>{"Enter"===e.key&&s.advance()}}),u&&(0,mn.jsx)("div",{style:$n(r.colors),children:u})]})}function Rn({slot:e,...t}){return(0,mn.jsx)(Fn,{slotKey:e.key,label:e.label,placeholder:e.placeholder,inputType:"email",autoComplete:"email",look:t})}function Tn({slot:e,...t}){return(0,mn.jsx)(Fn,{slotKey:e.key,label:e.label,placeholder:e.placeholder,inputType:"text",look:t})}const _n={margin:"2px 0 0",flexShrink:0};function qn(e){return{...An(e),display:"flex",alignItems:"flex-start",gap:8,cursor:"pointer"}}function Nn({slot:e,...t}){const n=(0,gn.useContext)(jn),o=Bt(n.pageKey,e.key),i=n.errors[o],r=Ye(e.url);return(0,mn.jsxs)("div",{style:Mn,children:[(0,mn.jsxs)("label",{style:qn(t),children:[(0,mn.jsx)("input",{type:"checkbox",checked:!0===n.checks[o],disabled:"submitting"===n.phase,style:_n,onChange:e=>n.setCheck(o,e.currentTarget.checked)}),(0,mn.jsxs)("span",{children:[e.checkboxLabel,r&&(0,mn.jsxs)(mn.Fragment,{children:[" ",(0,mn.jsx)("a",{href:r,...Ze(void 0),style:(s=t.colors,{color:s.accent}),children:e.linkLabel||e.url})]})]})]}),i&&(0,mn.jsx)("div",{style:$n(t.colors),children:i})]});var s}const Ln={padding:k};function Dn(e,t,n){return{...w(e,t),...n?{opacity:.6,cursor:"default"}:{}}}function On({slot:e,align:t,colors:n}){const o=(0,gn.useContext)(jn),i="submitting"===o.phase;return(0,mn.jsxs)("div",{style:Ln,children:[(0,mn.jsx)("button",{type:"button",[wn]:"",disabled:i,style:Dn(e.variant,n,i),onClick:o.submit,children:e.label}),"error"===o.phase&&(0,mn.jsx)("div",{style:{...$n(n),textAlign:t},children:e.errorMessage})]})}const Bn=(0,gn.createContext)(void 0),Wn=new WeakMap;function zn(e,t,n=Date.now()){let o=Wn.get(e);o||(o=new Map,Wn.set(e,o));const i=`${t.key}|${t.strategy}|${t.fallbackStrategy??""}|${t.limit}`,r=o.get(i);if(r&&n-r.at<6e4)return r.items;const s={at:n,items:Promise.resolve([])};return s.items=Promise.resolve().then(()=>e.load(t)).then(e=>Array.isArray(e)?e.slice(0,t.limit):[]).catch(()=>(o.get(i)===s&&o.delete(i),[])),o.set(i,s),s.items}function Vn(e,t){if(!t)return String(e);try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(e)}catch{return`${e} ${t}`}}function Hn({product:e,slot:t,colors:n,inverse:o,onClick:i}){const r=Ye(e.url),s=Ye(e.image),a=b("body",n,o),c=b("caption",n,o),l={display:"flex",flexDirection:"column",gap:6,minWidth:120,color:"inherit",textDecoration:"none",..."row"===t.layout?{flex:"0 0 120px"}:{}},u=(0,mn.jsxs)(mn.Fragment,{children:[t.fields.image?(0,mn.jsx)("div",{style:{aspectRatio:"1 / 1",borderRadius:6,backgroundColor:n.surface,border:`1px solid ${n.border}`,...s?{backgroundImage:`url("${s.replace(/"/g,"%22")}")`,backgroundSize:"cover",backgroundPosition:"center"}:{}}}):null,t.fields.title?(0,mn.jsx)("div",{style:{...g.body,...a?{color:a}:{}},children:e.title}):null,t.fields.price&&void 0!==e.price?(0,mn.jsx)("div",{style:{...g.caption,...c?{color:c}:{}},children:Vn(e.price,e.currency)}):null,t.fields.cta?(0,mn.jsx)("span",{style:{...w("secondary",n),padding:"6px 10px",fontSize:13},children:t.ctaText||A}):null]});return r?(0,mn.jsx)("a",{href:r,...Ze("_self"),style:l,onClick:i,children:u}):(0,mn.jsx)("div",{style:l,children:u})}function Un({slot:e,inverse:t,colors:n,mode:o}){const i=(0,gn.useContext)(Bn),[r,s]=(0,gn.useState)(null),a=`${e.key}|${e.strategy}|${e.fallbackStrategy??""}|${e.limit}`;if((0,gn.useEffect)(()=>{if(!i)return;let t=!1;return zn(i,e).then(e=>{t||s(e)}),()=>{t=!0}},[i,a]),!i&&"live"===o)return null;const c=i?r:(l=Math.min(e.limit,3),Array.from({length:l},(e,t)=>({id:`placeholder-${t}`,title:"Product name",url:""})));var l;if(!c||0===c.length)return null;const u="grid"===e.layout?{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(120px, 1fr))",gap:12}:{display:"flex",gap:12,overflowX:"auto"};return(0,mn.jsx)("div",{style:{padding:"4px 0"},"data-pw-products":e.key,children:(0,mn.jsx)("div",{style:u,children:c.map(r=>(0,mn.jsx)(Hn,{product:r,slot:e,colors:n,inverse:t,onClick:"live"===o&&i?.onClick?()=>i.onClick?.(r,e):void 0},r.id))})})}const Kn=(0,gn.createContext)({answered:!1,markAnswered:()=>{}});const Yn={none:void 0,fade:"pw-vpopup-fade 0.35s ease-out backwards",slide:"pw-vpopup-slide 0.35s ease-out backwards"};function Zn({slot:e,align:t,inverse:n,colors:o}){const i={...g[e.variant],textAlign:e.align??t},r=b(e.variant,o,n);return r&&(i.color=r),(0,mn.jsx)("div",{style:i,dangerouslySetInnerHTML:{__html:Xe(e.html)}})}function Gn({slot:e,colors:t,logger:n,onRequestClose:o,onPageChange:i,onRequestSubscribe:r,onSubscribeClose:s}){const a=(0,gn.useContext)(jn),c=(0,gn.useContext)(Kn),[l,u]=(0,gn.useState)("idle"),d=w(e.variant,t),p={};if("close"===e.action.type)return(0,mn.jsx)("div",{style:p,children:(0,mn.jsx)("button",{type:"button",style:d,onClick:o,children:e.label})});if("page"===e.action.type){const t=e.action.page;return(0,mn.jsx)("div",{style:p,children:(0,mn.jsx)("button",{type:"button",style:d,onClick:()=>a.turnPage(t,i),children:e.label})})}if("subscribe"===e.action.type){const{action:t}=e,o="idle"!==l||c.answered,a=()=>{r&&!o&&(u("asking"),r().then(e=>{if("default"===e)return void u("idle");c.markAnswered();const o=Ge(t,e,n);"close"!==o?(u(e),"stay"!==o&&i(o.page)):s?.()}).catch(()=>u("idle")))};return(0,mn.jsx)("div",{style:p,children:(0,mn.jsx)("button",{type:"button",disabled:o,style:{...d,...o?{opacity:.7}:{}},onClick:a,children:e.label})})}const h=Ye(e.action.url);return h?(0,mn.jsx)("div",{style:p,children:(0,mn.jsx)("a",{href:h,...Ze(e.action.target),style:d,children:e.label})}):(0,mn.jsx)("div",{style:p,children:(0,mn.jsx)("button",{type:"button",style:d,children:e.label})})}function Jn({message:e,align:t,inverse:n,colors:o}){const i=b("body",o,n);return(0,mn.jsx)("div",{style:{...g.body,padding:"4px 0",textAlign:t,...i?{color:i}:{}},children:e})}const Qn={email:"email",phone:"tel"},Xn={email:"email",firstName:"given-name",lastName:"family-name",phone:"tel"},eo="__privacy";function to({slot:e,align:t,inverse:n,colors:o,onSubmitForm:i}){const[r,s]=(0,gn.useState)({}),[a,c]=(0,gn.useState)(!1),[l,u]=(0,gn.useState)(null),[d,p]=(0,gn.useState)({}),[h,m]=(0,gn.useState)("idle"),f=b("caption",o,n),y={...g.caption,...f?{color:f}:{}},v={fontSize:12,lineHeight:1.4,color:o.error,paddingTop:2};if("success"===h||"confirm"===h)return(0,mn.jsx)(Jn,{message:"confirm"===h?e.confirmEmailMessage:e.successMessage,align:t,inverse:n,colors:o});const x="submitting"===h,C=e.privacy?Ye(e.privacy.url):void 0,j={...w(e.submitVariant,o),...x?{opacity:.6,cursor:"default"}:{}};return(0,mn.jsxs)("form",{noValidate:!0,style:{margin:0,textAlign:"left"},onSubmit:t=>{t.preventDefault(),(()=>{if(!i||!e.formCode||"submitting"===h)return;const t={};for(const n of e.fields){const e=(r[n.key]??"").trim();n.required&&!e?t[n.key]="Required":"email"===n.kind&&e&&!T.test(e)&&(t[n.key]="Enter a valid email")}if(e.privacy&&!a&&(t[eo]="Please accept the privacy policy"),p(t),Object.keys(t).length>0)return;const n={email:"",policyAccepted:!e.privacy||a},o={};for(const t of e.fields){const e=(r[t.key]??"").trim();e&&("email"===t.kind?n.email=n.email||e:"firstName"===t.kind?n.firstName=e:"lastName"===t.kind?n.lastName=e:"phone"===t.kind?n.phone=e:o[t.tag||t.key]=e)}Object.keys(o).length>0&&(n.customFields=o),m("submitting"),Promise.resolve().then(()=>i(e.formCode,n)).then(e=>m("confirm-email"===e?"confirm":"success"),()=>m("error"))})()},children:[e.fields.map(e=>{const t=d[e.key];let n;return t?n=o.error:l===e.key&&(n=o.accent),(0,mn.jsxs)("div",{style:{padding:"4px 0"},children:[e.label&&(0,mn.jsx)("div",{style:{...y,paddingBottom:4},children:e.label}),(0,mn.jsx)("input",{type:Qn[e.kind]??"text",autoComplete:Xn[e.kind],placeholder:e.placeholder||void 0,value:r[e.key]??"",disabled:x,style:S(o,n),onFocus:()=>u(e.key),onBlur:()=>u(t=>t===e.key?null:t),onChange:t=>{return n=e.key,o=t.currentTarget.value,s(e=>({...e,[n]:o})),void p(e=>e[n]?Object.fromEntries(Object.entries(e).filter(([e])=>e!==n)):e);var n,o}}),t&&(0,mn.jsx)("div",{style:v,children:t})]},e.key)}),e.privacy&&(0,mn.jsxs)("div",{style:{padding:"4px 0"},children:[(0,mn.jsxs)("label",{style:{...y,display:"flex",alignItems:"flex-start",gap:8,cursor:"pointer"},children:[(0,mn.jsx)("input",{type:"checkbox",checked:a,disabled:x,style:{margin:"2px 0 0",flexShrink:0},onChange:e=>{c(e.currentTarget.checked),p(e=>e[eo]?Object.fromEntries(Object.entries(e).filter(([e])=>e!==eo)):e)}}),(0,mn.jsxs)("span",{children:[e.privacy.checkboxLabel,C&&(0,mn.jsxs)(mn.Fragment,{children:[" ",(0,mn.jsx)("a",{href:C,...Ze(void 0),style:{color:o.accent},children:e.privacy.linkLabel||e.privacy.url})]})]})]}),d[eo]&&(0,mn.jsx)("div",{style:v,children:d[eo]})]}),(0,mn.jsx)("div",{style:{padding:k},children:(0,mn.jsx)("button",{type:"submit",disabled:x,style:j,children:e.submitLabel})}),"error"===h&&(0,mn.jsx)("div",{style:{...v,textAlign:t},children:R})]})}function no({value:e,label:t,digitStyle:n,labelStyle:o}){return(0,mn.jsxs)("div",{style:{minWidth:44},children:[(0,mn.jsx)("div",{style:n,children:String(e).padStart(2,"0")}),t?(0,mn.jsx)("div",{style:o,children:t}):null]})}function oo({slot:e,align:t,inverse:n,colors:o,mode:i,onRequestClose:r,onPageChange:s}){const[a,c]=(0,gn.useState)(()=>Date.now()),l=function(e,t,n){const o=Ue(e,t),i=null===o?0:Math.max(0,o-n),r=Math.floor(i/1e3);return{total:i,days:Math.floor(r/86400),hours:Math.floor(r/3600)%24,minutes:Math.floor(r/60)%60,seconds:r%60}}(e.endTime,e.timezone,a),u=0===l.total;(0,gn.useEffect)(()=>{if("live"!==i||u)return;const e=setInterval(()=>c(Date.now()),1e3);return()=>clearInterval(e)},[i,u,e.endTime,e.timezone]),(0,gn.useEffect)(()=>{"live"===i&&u&&("hide-popup"===e.onExpire?r?.():"page"===e.onExpire&&e.expirePage&&s(e.expirePage))},[i,u,e.onExpire,e.expirePage,r,s]);const d=b("h2",o,n),p=b("caption",o,n),h={fontSize:28,fontWeight:700,lineHeight:1.2,fontVariantNumeric:"tabular-nums",...d?{color:d}:{}},m={...g.caption,...p?{color:p}:{}},f=(y=e.language,Ke[y]??Ke.en);var y;const v=[{value:l.days,label:f.days},{value:l.hours,label:f.hours},{value:l.minutes,label:f.minutes},{value:l.seconds,label:f.seconds}];return(0,mn.jsx)("div",{style:{padding:"4px 0",textAlign:t},children:(0,mn.jsx)("div",{style:{display:"inline-flex",gap:12,textAlign:"center"},children:v.map(t=>(0,mn.jsx)(no,{value:t.value,label:e.showLabels?t.label:"",digitStyle:h,labelStyle:m},t.label||t.value))})})}function io({slot:e,align:t,inverse:n,colors:o,onSubmitChoice:i}){const[r,s]=(0,gn.useState)([]),[a,c]=(0,gn.useState)("idle"),[l,u]=(0,gn.useState)("");if("success"===a)return(0,mn.jsx)(Jn,{message:e.successMessage,align:t,inverse:n,colors:o});const d=t=>{u(""),s(n=>n.includes(t)?n.filter(e=>e!==t):e.max>0&&n.length>=e.max?(u(`Pick up to ${e.max}`),n):[...n,t])},p="submitting"===a,h=b("body",o,n),m={...g.body,...h?{color:h}:{}};return(0,mn.jsxs)("div",{style:{padding:"4px 0"},children:["chips"===e.control?(0,mn.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,justifyContent:"center"===t?"center":"flex-start"},children:e.options.map(e=>{return(0,mn.jsx)("button",{type:"button","aria-pressed":r.includes(e.value),style:(t=r.includes(e.value),{padding:"6px 14px",borderRadius:999,border:`1px solid ${o.accent}`,backgroundColor:t?o.accent:"transparent",color:t?o.onAccent:o.accent,fontFamily:"inherit",fontSize:14,lineHeight:1.4,cursor:"pointer"}),onClick:()=>d(e.value),children:e.label},e.value);var t})}):(0,mn.jsx)("div",{style:{display:"grid",gap:6},children:e.options.map(e=>(0,mn.jsxs)("label",{style:{...m,display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[(0,mn.jsx)("input",{type:"checkbox",checked:r.includes(e.value),onChange:()=>d(e.value),style:{accentColor:o.accent,width:16,height:16,margin:0}}),e.label]},e.value))}),l?(0,mn.jsx)("div",{style:{...g.caption,color:o.error,paddingTop:4},children:l}):null,"error"===a?(0,mn.jsx)("div",{style:{...g.caption,color:o.error,paddingTop:4},children:R}):null,(0,mn.jsx)("div",{style:{padding:k},children:(0,mn.jsx)("button",{type:"button",style:{...w(e.submitVariant,o),...p?{opacity:.7}:{}},onClick:()=>{if(!i||!e.tagName||"submitting"===a)return;const t=Math.max(e.min,1);if(r.length<t)return void u(1===t?"Pick at least one":`Pick at least ${t}`);const n=e.options.filter(e=>r.includes(e.value)).map(e=>e.tagValue||e.value);u(""),c("submitting"),Promise.resolve().then(()=>i({slotKey:e.key,tagName:e.tagName,values:n})).then(()=>c("success"),()=>c("error"))},children:e.submitLabel})})]})}function ro({score:e,scale:t,selected:n,colors:o,onPick:i}){const r={display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,border:`1px solid ${o.accent}`,backgroundColor:n?o.accent:"transparent",color:n?o.onAccent:o.accent,fontFamily:"inherit",fontSize:14,lineHeight:1,cursor:"pointer"};if("nps"===t)return(0,mn.jsx)("button",{type:"button","aria-label":`Rate ${e}`,"aria-pressed":n,style:{...r,width:30,height:32,borderRadius:6},onClick:i,children:e});const s="thumbs"===t;let a=`Rate ${e}`;return s&&(a=1===e?"Thumbs up":"Thumbs down"),(0,mn.jsx)("button",{type:"button","aria-label":a,"aria-pressed":n,style:{...r,width:s?44:34,height:s?40:34,borderRadius:s?8:6},onClick:i,children:(0,mn.jsx)("svg",{width:s?22:20,height:s?22:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,mn.jsx)("path",{d:s?"M8 21V10l3.5-7A2 2 0 0 1 14 5v5h4.5a2 2 0 0 1 2 2.4l-1.3 6A2 2 0 0 1 17.2 21zM8 10H3.5v11H8":W.star,...s&&0===e?{transform:"rotate(180 12 12)"}:{}})})})}function so({slot:e,align:t,inverse:n,colors:o,onSubmitRating:i}){const[r,s]=(0,gn.useState)(null),[a,c]=(0,gn.useState)("idle");if("success"===a)return(0,mn.jsx)(Jn,{message:e.successMessage,align:t,inverse:n,colors:o});const l=t=>{i&&e.eventName&&"submitting"!==a&&(c("submitting"),Promise.resolve().then(()=>i({slotKey:e.key,eventName:e.eventName,score:t,scale:e.scale})).then(()=>c("success"),()=>c("error")))},u="nps"===(d=e.scale)?[0,1,2,3,4,5,6,7,8,9,10]:"stars"===d?[1,2,3,4,5]:[0,1];var d;const p=b("caption",o,n),h={...g.caption,...p?{color:p}:{}},m=t=>"stars"===e.scale?null!==r&&t<=r:r===t;return(0,mn.jsxs)("div",{style:{padding:"4px 0"},children:[(0,mn.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6,justifyContent:"center"===t?"center":"flex-start"},children:u.map(t=>(0,mn.jsx)(ro,{score:t,scale:e.scale,selected:m(t),colors:o,onPick:()=>(t=>{"submitting"!==a&&(s(t),"instant"===e.submitMode&&l(t))})(t)},t))}),e.labels.low||e.labels.high?(0,mn.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:8,paddingTop:4},children:[(0,mn.jsx)("span",{style:h,children:e.labels.low}),(0,mn.jsx)("span",{style:h,children:e.labels.high})]}):null,"error"===a?(0,mn.jsx)("div",{style:{...g.caption,color:o.error,paddingTop:4},children:R}):null,"button"===e.submitMode?(0,mn.jsx)("div",{style:{padding:k},children:(0,mn.jsx)("button",{type:"button",style:{...w("primary",o),..."submitting"===a?{opacity:.7}:{}},onClick:()=>null===r?void 0:l(r),children:e.submitLabel})}):null]})}function ao({slot:e,align:t,inverse:n,colors:o}){const i=e.color||(n?o.textInverse:o.accent);return(0,mn.jsx)("div",{style:{padding:"4px 0",textAlign:t,lineHeight:0},children:(0,mn.jsx)("svg",{width:e.size,height:e.size,viewBox:"0 0 24 24",fill:"none",stroke:i,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{display:"inline-block"},children:(0,mn.jsx)("path",{d:W[e.name]})})})}function co({slot:e,align:t,inverse:n,colors:o,mode:i="live",onRequestClose:r,onPageChange:s,onSubmitForm:a,onSubmitChoice:c,onSubmitRating:l,onRequestSubscribe:u,onSubscribeClose:d,logger:p}){const h=s??(()=>{});switch(e.type){case"text":return(0,mn.jsx)(Zn,{slot:e,align:t,inverse:n,colors:o});case"button":return(0,mn.jsx)(Gn,{slot:e,colors:o,onRequestClose:r,onPageChange:h,onRequestSubscribe:u,onSubscribeClose:d,logger:p});case"email-subscription-form":return(0,mn.jsx)(to,{slot:e,align:t,inverse:n,colors:o,onSubmitForm:a});case"timer":return(0,mn.jsx)(oo,{slot:e,align:t,inverse:n,colors:o,mode:i,onRequestClose:r,onPageChange:h});case"choice":return(0,mn.jsx)(io,{slot:e,align:t,inverse:n,colors:o,onSubmitChoice:c});case"rating":return(0,mn.jsx)(so,{slot:e,align:t,inverse:n,colors:o,onSubmitRating:l});case"glyph":return(0,mn.jsx)(ao,{slot:e,align:t,inverse:n,colors:o});case"products":return(0,mn.jsx)(Un,{slot:e,inverse:n,colors:o,mode:i});case"email-input":return(0,mn.jsx)(Rn,{slot:e,inverse:n,colors:o});case"tag-input":return(0,mn.jsx)(Tn,{slot:e,inverse:n,colors:o});case"consent":return(0,mn.jsx)(Nn,{slot:e,inverse:n,colors:o});case"submit":return(0,mn.jsx)(On,{slot:e,align:t,colors:o})}}function lo({node:e,page:t,colors:n,mode:o,leaf:i,onRequestClose:r,onPageChange:s,onSubmitForm:a,onSubmitChoice:c,onSubmitRating:l,onRequestSubscribe:u,onSubscribeClose:d,logger:p}){const h=t.contents.find(t=>t.key===e.props.content);if(!h)return null;if(i?.renderZone)return(0,mn.jsx)("div",{style:{minWidth:0},children:i.renderZone(h,e)});const m=e.props.align??"left",f="inverse"===e.props.tone;return(0,mn.jsx)("div",{style:{minWidth:0},children:h.slots.map((e,t)=>{const i=h.slots[t-1],g=i?(y=x(i),"action"===(b=x(e))?"action"===y?6:16:"text"===b&&"heading"===y?4:8):0;var y,b;return(0,mn.jsx)("div",{style:g?{marginTop:g}:void 0,children:(0,mn.jsx)(co,{slot:e,align:m,inverse:f,colors:n,mode:o,onRequestClose:r,onPageChange:s,onSubmitForm:a,onSubmitChoice:c,onSubmitRating:l,onRequestSubscribe:u,onSubscribeClose:d,logger:p})},e.key)})})}function uo(e){return e?.video?Ye(e.video.src):void 0}function po({image:e,poster:t,src:n,style:o,mode:i}){return(0,mn.jsx)("video",{src:n,poster:t||void 0,style:o,autoPlay:"live"===i,muted:!0,playsInline:!0,preload:"metadata",loop:!1!==e.video?.loop,controls:!0===e.video?.controls})}function ho({node:e,page:t,leaf:n,mode:o,scheme:i}){const r=t.images.find(t=>t.key===e.props.image);if(!r)return null;if(n?.renderImage)return(0,mn.jsx)(mn.Fragment,{children:n.renderImage(r,e)});const s=uo(r),a=Ne(r,i);if(!a&&!s)return null;const c={display:"block",width:"100%",minWidth:0};return r.fit?(c.height="100%",c.objectFit=r.fit):c.height="auto",r.blur&&(c.filter=`blur(${r.blur}px)`),s?(0,mn.jsx)(po,{image:r,poster:a,src:s,style:c,mode:o}):(0,mn.jsx)("img",{src:a,alt:"",style:c})}function mo({style:e,outer:t,inner:n,layer:o,children:i}){const{backgroundColor:r,...s}=e;return(0,mn.jsxs)("div",{style:{display:"grid",minWidth:0,backgroundColor:r,...t},children:[o,(0,mn.jsx)("div",{style:{...s,...n},children:i})]})}function fo({node:e,page:t,colors:n,mode:o,scheme:i,leaf:r,onRequestClose:s,onPageChange:a,onSubmitForm:c,onSubmitChoice:l,onSubmitRating:u,onRequestSubscribe:d,onSubscribeClose:p,logger:h}){if("Content"===e.type)return(0,mn.jsx)(lo,{node:e,page:t,colors:n,mode:o,scheme:i,leaf:r,onRequestClose:s,onPageChange:a,onSubmitForm:c,onSubmitChoice:l,onSubmitRating:u,onRequestSubscribe:d,onSubscribeClose:p,logger:h});if("Image"===e.type)return(0,mn.jsx)(ho,{node:e,page:t,leaf:r,mode:o,scheme:i});const m=e.props?.backgroundImage,f=m?t.images.find(e=>e.key===m):void 0,g=f?.blur??0,y=f?.dim??0,b=uo(f),v=f?Ne(f,i):void 0,x=ke(e,g>0||b?void 0:v||void 0,y);m&&(x.backgroundColor="#1D2939");const k=e.children.map((e,m)=>(0,mn.jsx)(fo,{node:e,page:t,colors:n,mode:o,scheme:i,leaf:r,onRequestClose:s,onPageChange:a,onSubmitForm:c,onSubmitChoice:l,onSubmitRating:u,onRequestSubscribe:d,onSubscribeClose:p,logger:h},m));if(b&&f){const e=ve(y);return(0,mn.jsx)(mo,{style:x,outer:{position:"relative",overflow:"hidden",...v?xe(v):{}},inner:{position:"relative",...e?{backgroundImage:e}:{}},layer:(0,mn.jsx)(po,{image:f,poster:v??"",src:b,mode:o,style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",...g>0?{filter:`blur(${g}px)`}:{}}}),children:k})}return g>0?(0,mn.jsx)(mo,{style:x,outer:v?xe(v,y):void 0,inner:{backdropFilter:`blur(${g}px)`,WebkitBackdropFilter:`blur(${g}px)`},children:k}):(0,mn.jsx)("div",{style:x,children:k})}function go({page:e,params:t,mode:n="live",colorScheme:o="light",leafRenderers:i,animatePage:r=!1,onRequestClose:s,onPageChange:a,onSubmitForm:c,onSubmitFormValues:l,onSubmitChoice:u,onSubmitRating:d,products:p,onRequestSubscribe:h,onSubscribeClose:m,logger:f}){const g=En(t,e.key,a,l),y=function(){const[e,t]=(0,gn.useState)(!1);return(0,gn.useMemo)(()=>({answered:e,markAnswered:()=>t(!0)}),[e])}(),b=qe(t,o),v=Le(t,o),x={position:"relative",boxSizing:"border-box",overflow:"hidden",backgroundColor:b.background,colorScheme:b.scheme,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',color:b.text,borderRadius:t.borderRadius>0?t.borderRadius:void 0,boxShadow:v.boxShadow&&"none"!==v.boxShadow?v.boxShadow:void 0,transition:"height 300ms ease"};e.height&&(x.height="stretch"===e.height?"100%":e.height,x.overflowY="auto");const k={...r?{animation:"pw-vpopup-page 300ms ease-out backwards"}:{},..."stretch"===e.height?{display:"grid",minHeight:"100%"}:{}};return(0,mn.jsx)("div",{style:x,children:(0,mn.jsx)(jn.Provider,{value:g,children:(0,mn.jsx)(Bn.Provider,{value:p,children:(0,mn.jsx)(Kn.Provider,{value:y,children:(0,mn.jsx)("div",{style:k,children:(0,mn.jsx)(fo,{node:e.layout,page:e,colors:b,mode:n,scheme:b.scheme,leaf:i,onRequestClose:s,onPageChange:a??(()=>{}),onSubmitForm:c,onSubmitChoice:u,onSubmitRating:d,onRequestSubscribe:h,onSubscribeClose:m,logger:f})},e.key)})})})})}function yo({colors:e,onRequestClose:t}){return(0,mn.jsx)("button",{type:"button","aria-label":"Close",[kn]:"",onClick:t,style:{position:"absolute",top:10,right:10,width:24,height:24,padding:0,border:"none",borderRadius:"50%",background:$e(e.surface,.92),boxShadow:"0 1px 3px rgba(16, 24, 40, 0.25)",color:e.chromeIcon,fontSize:13,lineHeight:1,cursor:"pointer"},children:"✕"})}function bo(e,t,n){const{placement:o}=e,i={position:"fixed",boxSizing:"border-box",maxWidth:_t(o),maxHeight:_t(o),pointerEvents:"auto"};if(t){i.width=t;const e=o.h;"left"===e?i.left=o.offset:"right"===e?i.right=o.offset:i.left="50%"}else i.left=o.offset,i.right=o.offset;"stretch"===n?(i.top=o.offset,i.bottom=o.offset):"top"===o.v?i.top=o.offset:"bottom"===o.v?i.bottom=o.offset:i.top="50%";const r=t&&"center"===o.h?"-50%":"0",s="middle"===o.v&&"stretch"!==n?"-50%":"0";"0"===r&&"0"===s||(i.transform=`translate(${r}, ${s})`);const a=Yn[e.animation];return a&&(i.animation=a),i.transition="width 300ms ease",i}function vo({params:e,mode:t="live",colorScheme:n="auto",onRequestClose:o,onSubmitForm:i,onSubmitFormValues:r,onSubmitChoice:s,onSubmitRating:a,products:c,onRequestSubscribe:l,logger:u,leafRenderers:d}){const[p,h]=(0,gn.useState)(null);(0,gn.useEffect)(()=>{Rt(e).forEach(e=>e.images.forEach(({src:e,srcDark:t})=>{[e,t].forEach(e=>{e&&((new Image).src=e)})}))},[e]);const m=vn(n,Te(e)),f=Rt(e);if(0===f.length)return null;const g=f.find(e=>e.key===p)??Tt(e,f),y=null!==p;if("preview"===t)return(0,mn.jsxs)("div",{style:{position:"relative",width:g.width??"100%",transition:"width 300ms ease"},children:[(0,mn.jsx)("style",{children:B}),(0,mn.jsx)(go,{page:g,params:e,mode:t,colorScheme:m,leafRenderers:d,animatePage:y,onRequestClose:o,onPageChange:h,onSubmitForm:i,onSubmitFormValues:r,onSubmitChoice:s,onSubmitRating:a,products:c,onRequestSubscribe:l,onSubscribeClose:o,logger:u})]});const{overlay:b}=Le(e,m);return(0,mn.jsxs)(mn.Fragment,{children:[(0,mn.jsx)("style",{children:B}),b&&(0,mn.jsx)("div",{style:{position:"fixed",inset:0,backgroundColor:b.color,opacity:b.opacity,animation:"pw-vpopup-overlay 0.2s ease-out backwards",pointerEvents:"auto"},onClick:o}),(0,mn.jsxs)("div",{style:bo(e,g.width,g.height),children:[(0,mn.jsx)(go,{page:g,params:e,mode:t,colorScheme:m,leafRenderers:d,animatePage:y,onRequestClose:o,onPageChange:h,onSubmitForm:i,onSubmitFormValues:r,onSubmitChoice:s,onSubmitRating:a,products:c,onRequestSubscribe:l,onSubscribeClose:o,logger:u}),(0,mn.jsx)(yo,{colors:qe(e,m),onRequestClose:o})]})]})}function xo({params:e,mode:t="live",colorScheme:n="auto",logger:o,onSubmitForm:i,onSubmitFormValues:r,onSubmitChoice:s,onSubmitRating:a,products:c,onRequestSubscribe:l,onRequestRemove:u,onRequestClose:d}){const[p,h]=(0,gn.useState)(null),m=(0,gn.useMemo)(()=>d?e:function(e){return Array.isArray(e?.pages)?{...e,pages:e.pages.map(Nt)}:e}(e),[e,d]),f=vn(n,Te(m)),g=Rt(m);if(0===g.length)return null;const y=g.find(e=>e.key===p)??Tt(m,g);return(0,mn.jsxs)("div",{[xn]:"",style:Sn,children:[(0,mn.jsx)("style",{children:Cn}),(0,mn.jsx)(go,{page:y,params:m,mode:t,colorScheme:f,onRequestClose:d,onPageChange:h,onSubmitForm:i,onSubmitFormValues:r,onSubmitChoice:s,onSubmitRating:a,products:c,onRequestSubscribe:l,onSubscribeClose:u,logger:o})]})}const ko={SUBMIT_FORM_RESULT_SUBSCRIBED:"subscribed",SUBMIT_FORM_RESULT_CONFIRM_EMAIL:"confirm-email",SUBMIT_FORM_RESULT_ALREADY_SUBSCRIBED:"already-subscribed"},wo=(e,t)=>`https://subscription-form.svc-nue.pushwoosh.com/api/v1/forms/code/${encodeURIComponent(e)}${t}`,So=async(e,t)=>{try{const n=await fetch(wo(e,"/submit"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,userId:t.email})});if(!n.ok)throw new Error(`Subscription form submit failed: HTTP ${n.status}`);const o=await n.json(),i=ko[o.result??""];if(!i)throw new Error(`Subscription form submit failed: unexpected result "${o.result}"`);return i}catch(t){throw un.error(t,`Failed to submit subscription form "${e}"`),t}},Co={warn:e=>un.error(Ut,e)},jo=e=>"EMBEDDED"===e.kind;class Po{constructor(e){this.blocks=new Map,this.viewed=new Set,this.autoSkipLogged=new Set,this.deps=e}syncWithPage(e,t){for(const n of e){if(!jo(n.popup))continue;const{code:e}=n.popup;!1===this.blocks.get(e)?.host.isConnected&&this.remove(e),"api"!==this.blocks.get(e)?.trigger&&(this.deps.matchesPage(n.popup)?n.content&&t(n)&&this.place(n,n.content,"auto"):this.remove(e))}}show(e,t){return this.place(e,t,"api")}removeWhere(e){for(const[t,n]of[...this.blocks])e(n.entry)&&this.remove(t)}place(e,t,n){const{popup:o}=e,i=this.findContainer(o,n);if(!i)return this.remove(o.code),!1;const r=this.blocks.get(o.code);if(r?.element===i&&r.host.isConnected)return"api"===n&&(r.trigger="api"),!0;this.remove(o.code);const s=document.createElement("div");s.id=`${Ht}-embedded-${o.code}`,s.setAttribute(Kt,String(e.order)),s.style.width=e.placement?.width||"100%",i.insertBefore(s,this.firstBlockAfter(i,e.order));const a=s.attachShadow({mode:"open"}),c=document.createElement("div");return a.appendChild(c),e.placement?.dismissible&&(s.style.position="relative",a.appendChild(this.createDismissButton(()=>this.deps.dismiss(e)))),this.deps.render(c,t,e),this.blocks.set(o.code,{entry:e,element:i,host:s,container:c,trigger:n,observer:this.watchFirstView(e,t,s)}),this.reportShown(e,n),!0}createDismissButton(e){const t=document.createElement("button");return t.type="button",t.textContent="×",t.setAttribute("aria-label","Close"),t.setAttribute("data-pushwoosh-placement-dismiss",""),Object.assign(t.style,{position:"absolute",top:"8px",right:"8px",width:"24px",height:"24px",padding:"0",border:"none",borderRadius:"50%",background:"rgba(0, 0, 0, 0.45)",color:"#FFFFFF",font:"16px/24px sans-serif",cursor:"pointer"}),t.addEventListener("click",e),t}firstBlockAfter(e,t){return Array.from(e.children).find(e=>e.hasAttribute(Kt)&&Number(e.getAttribute(Kt))>t)??null}remove(e){const t=this.blocks.get(e);t&&(this.blocks.delete(e),t.observer?.disconnect(),this.deps.unmount(t.container),t.host.remove())}findContainer(e,t){const{code:n,css_selector:o}=e;if(!o)return this.logSkip(n,t,`${Ut} Embedded "${n}" has no css_selector; skipping`),null;try{const e=document.querySelector(o);return e||this.logSkip(n,t,`${Ut} Embedded "${n}": nothing matches "${o}" on this page; skipping`),e}catch(e){return this.logSkip(n,t,`${Ut} Embedded "${n}": invalid css_selector "${o}"; skipping`,e),null}}logSkip(e,t,...n){if("auto"===t){if(this.autoSkipLogged.has(e))return;this.autoSkipLogged.add(e)}un.debug(...n)}reportShown(e,t){const{code:n}=e.popup;this.deps.recordVisit(e),un.debug(`${Ut} Embedded "${n}" rendered (trigger: ${t})`),this.deps.dispatchShown(n,t)}watchFirstView(e,t,n){if(this.viewed.has(e.popup.code))return null;if("function"!=typeof IntersectionObserver)return this.reportViewed(e.popup.code,t),null;const o=new IntersectionObserver(n=>{n.some(e=>e.isIntersecting)&&(o.disconnect(),this.reportViewed(e.popup.code,t))});return o.observe(n),o}reportViewed(e,t){this.viewed.has(e)||(this.viewed.add(e),this.deps.recordImpression(e),this.deps.recordFormViews(e,t))}}function Eo(e,t){e.addEventListener("click",e=>{const n=e.target instanceof Element?e.target.closest("a, button"):null;n&&!n.hasAttribute(kn)&&(n.hasAttribute(wn)||t())})}async function Mo(e,t){const n=function(e){const t=[];for(const n of e.pages)if(Array.isArray(n?.contents))for(const e of n.contents)if(Array.isArray(e?.slots))for(const n of At(e.slots))"products"===n.type&&t.push(n);return t}(e).filter(e=>e.hideWhenEmpty);return(await Promise.all(n.map(e=>zn(t,e)))).every(e=>e.length>0)}const Ao={not_determined:"DEFAULT",granted_explicit:"GRANTED",denied:"DENIED",unsupported:"UNSUPPORTED"},$o=new Set(Object.values(Ao));function Io(e,t){const n=t.push_permission_status?.toUpperCase();return!n||!$o.has(n)||function(e){if("function"==typeof e.getPushPermissionStatus)try{return Ao[e.getPushPermissionStatus()]}catch{return}}(e)===n}const Fo=e=>{(0,fn.render)(null,e)},Ro=e=>"SCROLL"===e.trigger_type;function To(){const{scrollY:e,innerHeight:t}=window,{scrollHeight:n}=document.scrollingElement??document.documentElement;return n<=t||e+t>=n-1?100:(e+t/2)/n*100}function _o(){const{pathname:e}=window.location;try{return decodeURIComponent(e)}catch{return e}}class qo{constructor(e){var t;this.isRecurringVisitor=!1,this.entries=new Map,this.contentEntries=new Map,this.placementEntries=new Map,this.placementSeq=new Map,this.placementCounter=0,this.dismissedPlacements=new Set,this.shownPlacements=new Set,this.placementsActive=!1,this.queue=[],this.visible=null,this.drainTimeoutId=null,this.autoShowEnabled=!0,this.colorScheme="auto",this.isNavigationSubscribed=!1,this.openPopupsCount=0,this.bodyOverflowBeforeLock=null,this.readyPromise=new Promise(e=>{this.readyResolve=e}),this.pw=e,this.submitHandlers={onSubmitChoice:dn(e),onSubmitRating:pn(e),onRequestSubscribe:hn(e),products:(t=e.recommendations,{load:async e=>{const n=e.fallbackStrategy??"none",o={limit:e.limit,block:e.key};return(await t.fetch({...o,strategy:e.strategy,fallback:n}).catch(i=>{if("none"===n||n===e.strategy)throw i;return un.error(i,`${Ut} products slot "${e.key}": strategy "${e.strategy}" failed, trying "${n}"`),t.fetch({...o,strategy:n,fallback:"none"})})).items.map(e=>({id:e.id,title:e.title,price:e.price,currency:e.currency||void 0,image:e.image_url||void 0,url:e.url}))},onClick:(e,n)=>{t.trackClick({block:n.key,strategy:n.strategy,productId:e.id}).catch(t=>{un.error(t,`${Ut} Failed to track a click on product "${e.id}" in slot "${n.key}"`)})}})},this.embedded=new Po({matchesPage:e=>this.checkSoftCondition(e),render:(e,t,n)=>{this.listenForInteractions(e,n),((e,t,n,o="auto",i,r)=>{(0,fn.render)((0,mn.jsx)(xo,{params:t,colorScheme:o,onSubmitForm:So,onSubmitFormValues:n.onSubmitFormValues,onSubmitChoice:n.onSubmitChoice,onSubmitRating:n.onSubmitRating,onRequestSubscribe:n.onRequestSubscribe,products:n.products,onRequestRemove:i,onRequestClose:r,logger:Co}),e)})(e,t,this.handlersFor(n),this.colorScheme,()=>this.embedded.removeWhere(e=>e===n),n.placement?.dismissible?()=>this.dismissPlacement(n):void 0)},unmount:Fo,recordVisit:e=>this.recordVisit(e),recordImpression:e=>this.recordImpression(e),recordFormViews:(e,t)=>this.recordSubscriptionFormViews(e,t),dispatchShown:(e,t)=>this.pw.dispatchEvent("show-web-popup",{code:e,trigger:t}),dismiss:e=>this.dismissPlacement(e)}),e.moduleRegistry.webPopups=this}async run(){const{pw:e}=this;try{if(!1===e.initParams.webPopups?.enable)return void un.info(`${Ut} switched off by webPopups.enable, skipping`);this.autoShowEnabled=!1!==e.initParams.webPopups?.autoShow,this.colorScheme=e.initParams.webPopups?.colorScheme??"auto";const t=await e.data.getFeatures(),n=!1!==t?.popup_forms?.enabled,o=this.acceptPlacements();if(this.placementsActive=this.placementsAllowed()&&(!0===t?.web_placements?.enabled||o.length>0),!n&&!this.placementsActive)return void un.debug(`${Ut} application has no active popup forms, skipping automatic display`);await e.api.ensureDeviceRegistered(),this.isRecurringVisitor=await e.data.getIsRecurringVisitor();const i=n?await e.api.getPopupForms():[];un.debug(`${Ut} Received ${i.length} popup(s) from server:`,i.map(e=>e.code)),i.forEach((e,t)=>{this.entries.set(e.code,this.createEntry("campaign",e,t))}),await Promise.allSettled(Array.from(this.entries.values()).map(async e=>{e.passedStrongConditions=this.checkStrongCondition(e.popup),e.passedFrequency=await this.checkCanBeShownByFrequencyCondition(e.popup).catch(()=>!1),this.shouldPrefetchContent(e)&&await this.ensureContent(e)}));const r=this.loadedCodes();un.debug(`${Ut} ${r.length} popup(s) passed strong conditions and loaded:`,r),this.subscribeToNavigation(),this.subscribeToPushPermission(),this.renderForCurrentPage(),this.placementsActive&&await this.pullPlacements(o),await e.data.setIsRecurringVisitor(!0)}finally{this.readyResolve(),e.dispatchEvent("web-popups-ready",{})}}async show(e){await this.readyPromise;const t=this.entries.get(e)??this.getContentEntry(e),n="campaign"===t.kind&&jo(t.popup);if(!n&&this.visible?.code===e)return!0;if(!Io(this.pw,t.popup))return un.debug(`${Ut} show("${e}"): the visitor's push permission does not match the campaign`),!1;const o=await this.ensureContent(t);return o?"content"===t.kind&&Wt(o)?(un.error(new Error("Web popup form needs a campaign"),`${Ut} show("${e}"): a form content is shown by a campaign only`),!1):t.productsEmpty?(un.debug(`${Ut} show("${e}"): its products block has nothing to show`),!1):n?this.embedded.show(t,o):this.visible?.code===e||!!this.checkNotExpired(t)&&(this.visible&&(un.debug(`${Ut} show("${e}") preempting "${this.visible.code}"`),this.visible.close("preempted")),this.detachFromAutoPipeline(t),this.present(t,"api"),!0):(un.error(new Error("Web popup content unavailable"),`${Ut} show("${e}"): content unavailable`),!1)}hide(e){return!!this.visible&&((void 0===e||this.visible.code===e)&&(this.visible.close("api"),!0))}hideAll(){const e=this.hide();return this.entries.forEach(e=>{"waiting"!==e.state&&"queued"!==e.state||(this.detachFromAutoPipeline(e),e.state="done")}),this.cancelScheduledDrain(),e}isVisible(e){return!!this.visible&&(void 0===e||this.visible.code===e)}getVisibleCode(){return this.visible?.code??null}getAvailableCodes(){return Array.from(this.entries.keys())}getState(){const e=[];return this.entries.forEach((t,n)=>{"waiting"===t.state&&e.push(n)}),{visible:this.getVisibleCode(),queued:[...this.queue],waiting:e,available:this.getAvailableCodes()}}placementsAllowed(){return!1!==this.pw.initParams.webPlacements?.enable}acceptPlacements(){const{pw:e}=this;return this.placementsAllowed()&&"function"==typeof e.takeWebPlacements?(e.webPlacementsSink=e=>{this.receivePlacements(e).catch(e=>{un.error(e,`${Ut} Failed to render journey placements`)})},e.takeWebPlacements()):[]}async receivePlacements(e){await this.readyPromise,this.placementsActive=!0,this.subscribeToNavigation(),await this.syncPlacements(e,!1)}async pullPlacements(e=[]){let t;try{t=await this.pw.api.getWebPlacements()}catch(t){return un.error(t,`${Ut} Failed to load journey placements`),void await this.syncPlacements(e,!1)}await this.syncPlacements([...t,...e],!0)}async syncPlacements(e,t){const n=Date.now(),o=e.filter(e=>e.hash&&e.content_code&&!this.dismissedPlacements.has(e.hash)&&!Oo(e,n));if(t){const e=new Set(o.map(e=>e.hash));this.placementEntries.forEach((t,n)=>{e.has(n)||!jo(t.popup)&&"visible"===t.state||this.dropPlacement(t)})}o.forEach(e=>{if(this.placementEntries.has(e.hash))return;const t=this.createEntry("placement",function(e){return{code:e.hash,popup_form_content_code:e.content_code,device_type:"ALL",visitors_type:"ALL",matching_pages:[],delay:0,frequency:"EVERY_VISIT",trigger_type:"API",kind:"WEB_PLACEMENT_KIND_EMBEDDED"===e.kind?"EMBEDDED":"POPUP",css_selector:e.css_selector}}(e),-1);t.placement=e,this.placementEntries.set(e.hash,t),this.placementCounter+=1,this.placementSeq.set(e.hash,this.placementCounter),this.scheduleExpiry(t,n)}),await this.renderPlacements()}async renderPlacements(){const e=Array.from(this.placementEntries.values()).filter(e=>"done"!==e.state);await Promise.all(e.map(async e=>{const t=await this.ensureContent(e);t&&!Wt(t)||(t&&un.error(new Error("Web popup form needs a campaign"),`${Ut} placement "${e.popup.code}": a form content is shown by a campaign only`),e.state="done")}));const t=e.filter(e=>"done"!==e.state&&e.content&&!e.productsEmpty);this.renderPlacementBlocks(t.filter(e=>jo(e.popup))),this.queuePlacementPopup(t.filter(e=>!jo(e.popup)))}renderPlacementBlocks(e){const t=new Map;e.forEach(e=>{const n=e.popup.css_selector??"",o=t.get(n);o&&!this.placementBeats(e,o)||t.set(n,e)});const n=new Set(t.values());this.embedded.removeWhere(e=>"placement"===e.kind&&!n.has(e)),n.forEach(e=>{this.embedded.show(e,e.content)})}queuePlacementPopup(e){const t=e.some(e=>"queued"===e.state||"visible"===e.state),n=e.filter(e=>"idle"===e.state);if(t||0===n.length)return;const o=n.reduce((e,t)=>this.placementBeats(t,e)?t:e);o.state="queued",this.insertIntoQueue(o),this.drain()}placementBeats(e,t){const n=Lo(e.placement)-Lo(t.placement);return 0!==n?n>0:(this.placementSeq.get(e.popup.code)??0)>(this.placementSeq.get(t.popup.code)??0)}scheduleExpiry(e,t){const n=Do(e.placement);null===n||n-t>2**31-1||window.setTimeout(()=>{"visible"!==e.state&&this.dropPlacement(e)},n-t)}dropPlacement(e){this.embedded.removeWhere(t=>t===e),this.detachFromAutoPipeline(e),e.state="done",this.placementEntries.delete(e.popup.code)}dismissPlacement(e){this.dismissedPlacements.add(e.popup.code),this.dropPlacement(e),this.trackPlacement(e.popup.code,"WEB_PLACEMENT_ACTION_DISMISS")}onPlacementsNavigate(){this.placementsActive&&this.pullPlacements().catch(e=>{un.error(e,`${Ut} Failed to refresh journey placements`)})}trackPlacement(e,t){if("WEB_PLACEMENT_ACTION_SHOW"===t){if(this.shownPlacements.has(e))return;this.shownPlacements.add(e)}"function"==typeof this.pw.api.trackWebPlacement&&this.pw.api.trackWebPlacement(e,t).catch(n=>{un.error(n,`${Ut} Failed to record ${t} for placement "${e}"`)})}entryByCode(e){return this.entries.get(e)??this.placementEntries.get(e)}createEntry(e,t,n){return{kind:e,popup:t,order:n,state:"idle",content:null,loading:null,productsEmpty:!1,passedStrongConditions:!1,passedFrequency:!1,timeoutId:null,stopScrollWatch:null,visitRecorded:!1}}getContentEntry(e){let t=this.contentEntries.get(e);return t||(t=this.createEntry("content",{code:e,popup_form_content_code:e,device_type:"ALL",visitors_type:"ALL",matching_pages:[],delay:0,frequency:"EVERY_VISIT",trigger_type:"API"},-1),this.contentEntries.set(e,t)),t}ensureContent(e){return e.content?Promise.resolve(e.content):(e.loading||(e.loading=this.loadContent(e.popup).then(async t=>(e.productsEmpty=!!t&&!await Mo(t,this.submitHandlers.products),e.content=t,t)).catch(t=>(un.error(t,`${Ut} Failed to load web popup "${e.popup.code}"`),null)).finally(()=>{e.content||(e.loading=null)})),e.loading)}async loadContent(e){const t=(e=>{const t=nt(e);return t?0===Rt(t.params).length?null:t.params:null})((await this.pw.api.getPopupFormContent(e.popup_form_content_code)).json);return t||(un.error(new Error("Unsupported popup content format"),`${Ut} Web popup "${e.code}" content is not a supported {version, params} popup; skipping`),null)}shouldPrefetchContent(e){return e.passedStrongConditions&&(jo(e.popup)||e.passedFrequency)}loadedCodes(){const e=[];return this.entries.forEach((t,n)=>{t.content&&e.push(n)}),e}renderForCurrentPage(){this.releaseUnmatchedPending();const e=[];this.entries.forEach((t,n)=>{this.canAutoDisplay(t)&&(this.arm(t),e.push(n))}),un.debug(`${Ut} ${e.length} popup(s) selected for display on "${_o()}":`,e),this.drain(),this.embedded.syncWithPage(this.entries.values(),e=>this.isAutoEligible(e))}canAutoDisplay(e){return!jo(e.popup)&&"idle"===e.state&&this.isAutoEligible(e)&&e.passedFrequency&&this.checkNotExpired(e)}isAutoEligible(e){return this.autoShowEnabled&&e.passedStrongConditions&&this.isAutoTrigger(e.popup)&&null!==e.content&&!e.productsEmpty&&this.checkSoftCondition(e.popup)&&Io(this.pw,e.popup)}isStillEligible(e){return!Oo(e.placement,Date.now())&&this.checkSoftCondition(e.popup)&&Io(this.pw,e.popup)&&this.checkNotExpired(e)}isAutoTrigger(e){const t=e.trigger_type;return!t||"PAGE_LOAD"===t||"SCROLL"===t}arm(e){e.state="waiting",this.recordVisit(e),Ro(e.popup)?this.armScrollDepth(e):this.armDelay(e)}armDelay(e){const{popup:t}=e;un.debug(`${Ut} Popup "${t.code}" armed for display in ${t.delay}s`),e.timeoutId=window.setTimeout(()=>{e.timeoutId=null,this.enqueueArmed(e,"delay elapsed")},1e3*t.delay)}armScrollDepth(e){const{popup:t}=e,n=function(e){const t=e.scroll_depth;return"number"!=typeof t||Number.isNaN(t)?0:Math.min(Math.max(t,0),100)}(t);un.debug(`${Ut} Popup "${t.code}" armed for display at ${n}% scroll depth`),e.stopScrollWatch=function(e,t){if(To()>=e)return t(),null;let n=null;const o="function"==typeof ResizeObserver?new ResizeObserver(s):null,i=()=>{window.removeEventListener("scroll",s),window.removeEventListener("resize",s),o?.disconnect(),null!==n&&(window.cancelAnimationFrame(n),n=null)},r=()=>{n=null,To()>=e&&(i(),t())};function s(){null===n&&(n=window.requestAnimationFrame(r))}return window.addEventListener("scroll",s,{passive:!0}),window.addEventListener("resize",s),o?.observe(document.documentElement),i}(n,()=>{e.stopScrollWatch=null,e.timeoutId=window.setTimeout(()=>{e.timeoutId=null,this.enqueueArmed(e,"scroll depth reached")},0)})}enqueueArmed(e,t){const{code:n}=e.popup;e.state="queued",this.insertIntoQueue(e),un.debug(`${Ut} Popup "${n}" ${t}; queued at position ${this.queue.indexOf(n)+1} of ${this.queue.length}`),this.drain()}recordVisit(e){e.visitRecorded||"campaign"!==e.kind||(e.visitRecorded=!0,this.pw.api.recordPopupFormEvent(e.popup.code,1).catch(t=>{un.error(t,`${Ut} Failed to record web popup visit event for "${e.popup.code}"`)}))}insertIntoQueue(e){const t=Bo(e.popup),n=this.queue.findIndex(n=>{const o=this.entryByCode(n);return!!o&&(Bo(o.popup)!==t?Bo(o.popup)>t:o.order>e.order)});-1!==n?this.queue.splice(n,0,e.popup.code):this.queue.push(e.popup.code)}releaseUnmatchedPending(){this.entries.forEach(e=>{"waiting"!==e.state&&"queued"!==e.state||this.isStillEligible(e)||(this.detachFromAutoPipeline(e),e.state="idle",un.debug(`${Ut} Released popup "${e.popup.code}": page or push permission no longer matches, or its countdown passed`))})}detachFromAutoPipeline(e){null!==e.timeoutId&&(window.clearTimeout(e.timeoutId),e.timeoutId=null),null!==e.stopScrollWatch&&(e.stopScrollWatch(),e.stopScrollWatch=null);const t=this.queue.indexOf(e.popup.code);-1!==t&&this.queue.splice(t,1)}drain(){if(this.visible||null!==this.drainTimeoutId)return;const e=this.queue.shift();if(void 0===e)return;const t=this.entryByCode(e);if(t&&"queued"===t.state){if(!this.isStillEligible(t))return t.state="idle",void this.drain();if(!t.content)return t.state="done",void this.drain();un.debug(`${Ut} Display slot free; showing "${e}"`),this.present(t,"auto")}else this.drain()}scheduleDrain(){null===this.drainTimeoutId&&(this.drainTimeoutId=window.setTimeout(()=>{this.drainTimeoutId=null,this.drain()},400))}cancelScheduledDrain(){null!==this.drainTimeoutId&&(window.clearTimeout(this.drainTimeoutId),this.drainTimeoutId=null)}present(e,t){this.cancelScheduledDrain();const{popup:n,content:o}=e;if(!o)return void(e.state="done");const i=document.createElement("div");i.id=`${Ht}-${n.code}`,i.style.position="fixed",i.style.inset="0",i.style.zIndex=String(2147483647),i.style.pointerEvents="none",document.body.appendChild(i);const r=i.attachShadow({mode:"open"}),s=document.createElement("div");r.appendChild(s),this.listenForInteractions(s,e);const a=!!o.overlay;a&&this.lockBodyScroll();let c=!1;const l=t=>{c||(c=!0,a&&this.unlockBodyScroll(),Fo(s),i.remove(),this.visible?.code===n.code&&(this.visible=null),e.state="done",this.pw.dispatchEvent("hide-web-popup",{code:n.code,reason:t}),"placement"===e.kind&&"user"===t&&this.trackPlacement(n.code,"WEB_PLACEMENT_ACTION_DISMISS"),this.scheduleDrain())};this.visible={code:n.code,host:i,modal:a,close:l},e.state="visible",((e,t,n,o,i="auto")=>{(0,fn.render)((0,mn.jsx)(vo,{params:t,mode:"live",colorScheme:i,onRequestClose:n,onSubmitForm:So,onSubmitFormValues:o.onSubmitFormValues,onSubmitChoice:o.onSubmitChoice,onSubmitRating:o.onSubmitRating,onRequestSubscribe:o.onRequestSubscribe,products:o.products,logger:Co}),e)})(s,o,()=>l("user"),this.handlersFor(e),this.colorScheme),this.recordSubscriptionFormViews(n.code,o),un.debug(`${Ut} Popup "${n.code}" shown (trigger: ${t})`),"campaign"===e.kind&&(this.recordVisit(e),this.markAsShown(n).catch(e=>{un.error(e,`${Ut} Failed to mark web popup "${n.code}" as shown`)})),"placement"===e.kind&&this.trackPlacement(n.code,"WEB_PLACEMENT_ACTION_SHOW"),this.pw.dispatchEvent("show-web-popup",{code:n.code,trigger:t})}handlersFor(e){return{...this.submitHandlers,onSubmitFormValues:(t=this.pw,n=e.popup.code,async e=>{try{const o=await t.api.submitPopupForm(n,e);if("OK"===o.result)return"ok";if("INVALID_EMAIL"===o.result)return"invalid-email";throw new Error(`Unexpected submitPopupForm result "${o.result}"`)}catch(e){throw un.error(e,`Failed to submit the form of web campaign "${n}"`),e}})};var t,n}recordSubscriptionFormViews(e,t){const n=function(e){const t=new Set;for(const n of e.pages)if(Array.isArray(n?.contents))for(const e of n.contents)if(Array.isArray(e?.slots))for(const n of e.slots)"object"==typeof n&&null!==n&&"email-subscription-form"===n.type&&"string"==typeof n.formCode&&n.formCode&&t.add(n.formCode);return[...t]}(t);0!==n.length&&this.pw.data.getHwid().then(e=>n.forEach(t=>((e,t)=>{fetch(wo(e,"/view"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,userId:t,hwid:t})}).catch(t=>{un.error(t,`Failed to record subscription form view for "${e}"`)})})(t,e))).catch(t=>{un.error(t,`${Ut} Failed to record subscription form views for web popup "${e}"`)})}lockBodyScroll(){0===this.openPopupsCount&&(this.bodyOverflowBeforeLock=document.body.style.overflow,document.body.style.overflow="hidden"),this.openPopupsCount+=1}unlockBodyScroll(){this.openPopupsCount=Math.max(0,this.openPopupsCount-1),0===this.openPopupsCount&&null!==this.bodyOverflowBeforeLock&&(document.body.style.overflow=this.bodyOverflowBeforeLock,this.bodyOverflowBeforeLock=null)}subscribeToNavigation(){if(this.isNavigationSubscribed)return;this.isNavigationSubscribed=!0;const e=()=>{this.renderForCurrentPage(),this.onPlacementsNavigate()},t=window.navigation;if(t&&"function"==typeof t.addEventListener)return void t.addEventListener("currententrychange",e);window.addEventListener("popstate",e),window.addEventListener("hashchange",e);let n=window.location.href;window.setInterval(()=>{window.location.href!==n&&(n=window.location.href,e())},500)}subscribeToPushPermission(){const e=()=>this.releaseByPushPermission();"function"!=typeof this.pw.addSdkEventHandler?this.pw.addEventHandler("change-permission",e):this.pw.addSdkEventHandler("change-permission",e)}releaseByPushPermission(){this.releaseUnmatchedPending(),this.embedded.removeWhere(e=>!Io(this.pw,e.popup))}checkStrongCondition(e){return this.checkCanBeShownByDeviceTypeCondition(e)&&this.checkCanBeShownByVisitorsTypeCondition(e)}checkSoftCondition(e){return this.checkCanBeShownByMatchingPagesCondition(e)}checkNotExpired(e){return!e.content||(!function(e,t){for(const n of e.pages)if(Array.isArray(n?.contents))for(const e of n.contents)if(Array.isArray(e?.slots))for(const n of e.slots){if("object"!=typeof n||null===n)continue;if("timer"!==n.type||"hide-popup"!==n.onExpire)continue;if("string"!=typeof n.endTime)continue;const e="string"==typeof n.timezone?n.timezone:"",o=Ue(n.endTime,e);if(null!==o&&o<=t)return!0}return!1}(e.content,Date.now())||(un.debug(`${Ut} Popup "${e.popup.code}" not shown: its countdown has passed`),!1))}checkCanBeShownByDeviceTypeCondition(e){const{device_type:t}=e,n=this.pw.platformChecker.formFactor;return"ALL"===t||t===n}async checkCanBeShownByFrequencyCondition(e){const{frequency:t,code:n}=e;if("ONCE"===t){return!(await this.pw.data.getShownWebPopups()).includes(n)}return"ONCE_PER_SESSION"!==t||null===sessionStorage.getItem(this.getSessionStorageKey(n))}checkCanBeShownByMatchingPagesCondition(e){const{matching_pages:t,matching_page_rules:n,excluded_pages:o}=e,i=_o();return n&&n.length>0?n.some(e=>this.matchPageRule(i,e)):t&&t.length>0?t.some(e=>Boolean(e)&&e===i):!(o&&o.length>0)||!o.some(e=>this.matchPageRule(i,e))}matchPageRule(e,t){if(!t.path)return!1;switch(t.operator){case"EQUALS":return e===t.path;case"STARTS_WITH":return e.startsWith(t.path);default:return!1}}checkCanBeShownByVisitorsTypeCondition(e){const{visitors_type:t}=e;return"NEW"===t?!this.isRecurringVisitor:"RECURRING"!==t||this.isRecurringVisitor}recordImpression(e){this.placementEntries.has(e)?this.trackPlacement(e,"WEB_PLACEMENT_ACTION_SHOW"):this.recordPopupShownEvent(e)}recordPopupShownEvent(e){this.pw.api.recordPopupFormEvent(e,2).catch(t=>{un.error(t,`${Ut} Failed to record web popup shown event for "${e}"`)})}listenForInteractions(e,t){"placement"!==t.kind?"campaign"===t.kind&&Eo(e,()=>{this.pw.api.recordPopupFormEvent(t.popup.code,3).catch(e=>{un.error(e,`${Ut} Failed to record web popup interaction for "${t.popup.code}"`)})}):Eo(e,()=>{"done"!==t.state&&this.trackPlacement(t.popup.code,"WEB_PLACEMENT_ACTION_CLICK")})}async markAsShown(e){this.recordPopupShownEvent(e.code);const{frequency:t,code:n}=e;"ONCE"!==t?"ONCE_PER_SESSION"===t&&sessionStorage.setItem(this.getSessionStorageKey(n),"1"):await this.pw.data.addShownWebPopup(n)}getSessionStorageKey(e){return`${Ht}.shown.${e}`}}const No={WEB_PLACEMENT_PRIORITY_LOW:1,WEB_PLACEMENT_PRIORITY_MEDIUM:2,WEB_PLACEMENT_PRIORITY_HIGH:3};function Lo(e){return No[e?.priority??""]??No.WEB_PLACEMENT_PRIORITY_MEDIUM}function Do(e){const t=e?.expires_at?Date.parse(e.expires_at):NaN;return Number.isNaN(t)?null:t}function Oo(e,t){const n=Do(e);return null!==n&&n<=t}function Bo(e){return Ro(e)?0:e.delay}return s})());
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("preact"),require("preact/compat"),require("preact/jsx-runtime"));else if("function"==typeof define&&define.amd)define(["preact","preact/compat","preact/jsx-runtime"],t);else{var n="object"==typeof exports?t(require("preact"),require("preact/compat"),require("preact/jsx-runtime")):t(e.preact,e.preactCompat,e.jsxRuntime);for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(this,(e,t,n)=>(()=>{"use strict";var o={524(t){t.exports=e},873(e){e.exports=t},247(e){e.exports=n}};const i={};function r(e){const t=i[e];if(void 0!==t)return t.exports;const n=i[e]={exports:{}};return o[e](n,n.exports,r),n.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{Object.defineProperties(e,{[Symbol.toStringTag]:{value:"Module"},__esModule:{value:!0}})};let s={};r.r(s),r.d(s,{WebPopupsWidget:()=>Yo});const a=/^(https?:|mailto:|tel:)/i,c="#101828",l="#667085",u="#FFFFFF",d="#FFFFFF",p="#2970FF",h=c,m=l,f="#FFFFFF",g={h1:{fontSize:24,fontWeight:600,lineHeight:1.25},h2:{fontSize:18,fontWeight:600,lineHeight:1.3},h3:{fontSize:16,fontWeight:600,lineHeight:1.35},body:{fontSize:14,fontWeight:"normal",lineHeight:1.5},caption:{fontSize:12,fontWeight:"normal",lineHeight:1.4},eyebrow:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",lineHeight:1.4},icon:{fontSize:24,lineHeight:1.2}},y={h1:1,h2:1,h3:1,icon:1,eyebrow:.8,body:.9,caption:.75};function b(e,t,n){return n?function(e,t){if(t>=1)return e;const n=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.exec(e)?.[1];if(!n)return e;const o=3===n.length?n.split("").map(e=>e+e).join(""):n,[i,r,s]=[0,2,4].map(e=>parseInt(o.slice(e,e+2),16));return`rgba(${i}, ${r}, ${s}, ${t})`}(t.textInverse,y[e]??1):"icon"!==e?"caption"===e||"eyebrow"===e?t.textSecondary:t.text:void 0}const v=["h1","h2","h3","icon"];function w(e){return"glyph"===e.type?"heading":"text"!==e.type?"action":v.includes(e.variant)?"heading":"text"}const k="8px 0 4px";function x(e,t){return{display:"block",boxSizing:"border-box",width:"100%",padding:"10px 25px",borderRadius:6,fontSize:14,fontWeight:600,fontFamily:"inherit",lineHeight:1.5,textAlign:"center",textDecoration:"none",cursor:"pointer",..."secondary"===e?{backgroundColor:t.surface,color:t.accent,border:`1px solid ${t.accent}`}:{backgroundColor:t.accent,color:t.onAccent,border:"none"}}}function S(e,t=e.border){return{display:"block",boxSizing:"border-box",width:"100%",padding:"10px 12px",borderRadius:6,fontSize:14,fontFamily:"inherit",lineHeight:1.5,backgroundColor:e.surface,color:e.surfaceText,border:`1px solid ${t}`,outline:"none"}}const C="Subscribe",E="Thanks for subscribing!",j="Please check your inbox and confirm your email.",P="Save",M="Thanks! Your choice is saved.",$="Shop now",A=4,I="Send",F="Thanks for the feedback!";const R="Something went wrong. Please try again.",T=/^\S+@\S+\.\S+$/,_="Enter a valid email",L="Required",q="Required",N="Please accept the privacy policy",D="Submit",O=R,B="\n@keyframes pw-vpopup-fade { from { opacity: 0; } }\n@keyframes pw-vpopup-slide { from { opacity: 0; translate: 0 28px; } }\n@keyframes pw-vpopup-overlay { from { opacity: 0; } }\n@keyframes pw-vpopup-page { from { opacity: 0; } }\n",W={bell:"M6 10a6 6 0 0 1 12 0c0 4 1.5 5.5 2 6H4c.5-.5 2-2 2-6M10 20a2 2 0 0 0 4 0",gift:"M3 11h18v9a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1zM2.5 7h19v4h-19zM12 7v14M12 7c-1 0-3-.2-3.5-1a2 2 0 0 1 3.5-1 2 2 0 0 1 3.5 1c-.5.8-2.5 1-3.5 1z",cart:"M2 4h2.2l2.4 11.2A2 2 0 0 0 8.6 17H19M6 7h15l-2.2 7.5H8M10.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M19.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0",chart:"M3 21h18M7 21V11M12 21V6M17 21v-8",lock:"M5 11h14v10H5zM8 11V8a4 4 0 0 1 8 0v3",calendar:"M4 6h16v15H4zM4 10h16M9 3v4M15 3v4",check:"M4 13l5 5L20 6",star:"M12 3l2.9 5.9 6.5.9-4.7 4.6 1.1 6.5-5.8-3.1-5.8 3.1 1.1-6.5L2.6 9.8l6.5-.9z",clock:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0M12 7v5l4 2",tag:"M20.6 13.4l-7.2 7.2a2 2 0 0 1-2.8 0l-7-7A2 2 0 0 1 3 12.2V5a2 2 0 0 1 2-2h7.2a2 2 0 0 1 1.4.6l7 7a2 2 0 0 1 0 2.8zM9 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0",mail:"M3 6h18v12H3zM3 7l9 6 9-6",phone:"M7 2h10a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1M10 19h4",download:"M12 3v12M7 11l5 5 5-5M4 20h16",play:"M8 5l12 7-12 7z",shield:"M12 3l8 3v6c0 5-3.4 8.6-8 10-4.6-1.4-8-5-8-10V6z",sparkle:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM18 15l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1L15 18l2.1-.9z",percent:"M19 5L5 19M8.5 8.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0M20.5 15.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0",truck:"M2 7h12v10H2zM14 10h4l3 3v4h-7M8.5 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M20 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0",ticket:"M4 7h16v4a2 2 0 0 0 0 4v3H4v-3a2 2 0 0 0 0-4zM14 7v12",user:"M20 21a8 8 0 0 0-16 0M16 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0"},z=Object.keys(W),V=[24,32,48],H=["Vertical","Horizontal","Columns","Rows"],U=["normal","reverse"],K=["start","center","end","stretch"],Y=["start","center","end","space-between"],G=["left","center","right"],Z=["default","inverse"],J=2e3,Q={px:J,"%":100,em:125,rem:125},X=/^(\d{1,4}(?:\.\d+)?)(px|%|em|rem)$/,ee={px:J,"%":100,fr:100},te=/^(\d{1,4}(?:\.\d+)?)(px|%|fr)$/,ne=["auto","min-content","max-content"];function oe(e,t){return t.includes(e)?e:void 0}function ie(e){if("number"==typeof e&&Number.isFinite(e))return Math.min(Math.max(e,0),J);if("string"!=typeof e)return;const t=X.exec(e.trim());if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),Q[o])}${o}`}const re=["top","right","bottom","left"];function se(e){if(ne.includes(e))return e;const t=te.exec(e);if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),ee[o])}${o}`}function ae(e){return"string"==typeof e&&e.length>0?e:void 0}function ce(e){const t={},n=ie(e.gap);void 0!==n&&(t.gap=n);const o=function(e){const t=ie(e);if(void 0!==t)return t;if("object"!=typeof e||null===e)return;const n={};for(const t of re){const o=ie(e[t]);void 0!==o&&(n[t]=o)}return Object.keys(n).length>0?n:void 0}(e.padding);void 0!==o&&(t.padding=o);const i=oe(e.alignItems,K);i&&(t.alignItems=i);const r=oe(e.justifyContent,Y);r&&(t.justifyContent=r);const s=oe(e.alignContent,Y);s&&(t.alignContent=s);const a=ae(e.backgroundImage);a&&(t.backgroundImage=a);const c=function(e){if("number"==typeof e)return Number.isInteger(e)&&e>=1&&e<=12?e:void 0;if("string"!=typeof e)return;const t=e.trim().split(/\s+/);if(t.length<1||t.length>12)return;const n=t.map(se);return n.every(e=>void 0!==e)?n.join(" "):void 0}(e.sizes);return void 0!==c&&(t.sizes=c),t}function le(e,t,n){if(t>10||n.nodes<=0)return null;if("object"!=typeof e||null===e)return null;n.nodes-=1;const o=e,i="object"==typeof o.props&&null!==o.props?o.props:{};if("Content"===o.type){const e=ae(i.content);if(!e)return null;const t={type:"Content",props:{content:e}},n=oe(i.align,G);n&&(t.props.align=n);const o=oe(i.tone,Z);return o&&"default"!==o&&(t.props.tone=o),t}if("Image"===o.type){const e=ae(i.image);if(!e)return null;return{type:"Image",props:{image:e}}}if(!Array.isArray(o.children))return null;const r=oe(o.type,H)??"Vertical",s=[];for(const e of o.children){const o=le(e,t+1,n);o&&s.push(o)}const a=ce(i);return"reverse"===oe(i.order,U)&&(s.reverse(),"string"==typeof a.sizes&&(a.sizes=a.sizes.split(" ").reverse().join(" "))),{type:r,props:a,children:s}}function ue(e){return le(e,0,{nodes:100})}const de=/^[a-zA-Z][a-zA-Z0-9-]*$/,pe=/^\$([a-zA-Z][a-zA-Z0-9-]*)$/;function he(e,t){return e.includes("$")?e.split(/(\s+)/).map(e=>{const n=pe.exec(e)?.[1];return void 0!==n&&Object.prototype.hasOwnProperty.call(t,n)?t[n]:e}).join(""):e}function me(e,t){return"object"!=typeof e||null===e||0===Object.keys(t).length?e:ge(e,t,0)}const fe=new Set(["content","image","backgroundImage"]);function ge(e,t,n){if(n>10||"object"!=typeof e||null===e)return e;const o=e,i={...o};if("object"==typeof o.props&&null!==o.props){const e={...o.props};for(const[n,o]of Object.entries(e))if(!fe.has(n))if("string"==typeof o)e[n]=he(o,t);else if("object"==typeof o&&null!==o&&!Array.isArray(o)){const i={...o};for(const[e,n]of Object.entries(i))"string"==typeof n&&(i[e]=he(n,t));e[n]=i}i.props=e}return Array.isArray(o.children)&&(i.children=o.children.map(e=>ge(e,t,n+1))),i}function ye(e){return"number"==typeof e?`${e}px`:e}function be(e,t){if("string"==typeof e)return e;return`repeat(${"number"==typeof e?e:Math.max(t,1)}, 1fr)`}function ve(e=0){if(!(e>0))return null;const t=`rgba(16, 24, 40, ${Math.min(e,1)})`;return`linear-gradient(${t}, ${t})`}function we(e,t=0){const n=`url(${JSON.stringify(e)})`,o=ve(t);return{backgroundImage:o?`${o}, ${n}`:n,backgroundSize:"cover",backgroundPosition:"center"}}function ke(e,t,n=0){const o=e.props??{},i={display:"grid",minWidth:0};return"Horizontal"===e.type&&(i.gridAutoFlow="column"),"Columns"===e.type&&(i.gridTemplateColumns=be(o.sizes,e.children.length)),"Rows"===e.type&&(i.gridTemplateRows=be(o.sizes,e.children.length)),void 0!==o.gap&&(i.gap=ye(o.gap)),void 0!==o.padding&&(i.padding=function(e){if("number"==typeof e||"string"==typeof e)return ye(e);const t=e=>void 0===e?"0":ye(e);return`${t(e.top)} ${t(e.right)} ${t(e.bottom)} ${t(e.left)}`}(o.padding)),o.alignItems&&(i.alignItems=o.alignItems),o.justifyContent&&(i.justifyContent=o.justifyContent),o.alignContent&&(i.alignContent=o.alignContent),t&&Object.assign(i,we(t,n)),i}const xe=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function Se(e){const t=xe.exec(e.trim())?.[1];if(!t)return null;const n=3===t.length?t.split("").map(e=>e+e).join(""):t;return[0,2,4].map(e=>parseInt(n.slice(e,e+2),16))}function Ce([e,t,n]){return`#${[e,t,n].map(e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")).join("")}`}function Ee(e,t,n){let o=n;return o<0&&(o+=1),o>1&&(o-=1),o<1/6?e+6*(t-e)*o:o<.5?t:o<2/3?e+(t-e)*(2/3-o)*6:e}function je(e){return e>.5?.07+.86*(1-e):e}function Pe(e){return e<.5?.93-e*((.93-.5)/.5):e}function Me(e,t){const n=Se(e);if(!n)return e;const[o,i,r]=function([e,t,n]){const[o,i,r]=[e/255,t/255,n/255],s=Math.max(o,i,r),a=Math.min(o,i,r),c=(s+a)/2;if(s===a)return[0,0,c];const l=s-a;let u;return u=s===o?(i-r)/l+(i<r?6:0):s===i?(r-o)/l+2:(o-i)/l+4,[u/6,c>.5?l/(2-s-a):l/(s+a),c]}(n);return Ce(function([e,t,n]){if(0===t){const e=255*n;return[e,e,e]}const o=n<.5?n*(1+t):n+t-n*t,i=2*n-o;return[255*Ee(i,o,e+1/3),255*Ee(i,o,e),255*Ee(i,o,e-1/3)]}([o,i,"fold"===t?je(r):Pe(r)]))}function $e(e,t,n){const o=Se(e),i=Se(t);return o&&i?Ce(o.map((e,t)=>e+(i[t]-e)*n)):e}function Ae(e,t){const n=Se(e);if(!n||t>=1)return e;const[o,i,r]=n;return`rgba(${o}, ${i}, ${r}, ${t})`}function Ie(e){const t=Se(e);if(!t)return!1;const[n,o,i]=t;return(.299*n+.587*o+.114*i)/255>.6}function Fe(e){return{background:Me(e.background,"fold"),accent:e.accent,text:Me(e.text,"lift"),textSecondary:Me(e.textSecondary,"lift"),textInverse:e.textInverse}}function Re(e,t){return"light"===t?{surface:d,surfaceText:c,border:"#D0D5DD",onAccent:u,error:"#D92D20",chromeIcon:l}:{surface:$e(e.background,e.text,.08),surfaceText:e.text,border:$e(e.background,e.text,.24),onAccent:Ie(e.accent)?c:u,error:"#FDA29B",chromeIcon:e.textSecondary}}function Te(e){return!0===e.dark?.enabled}function _e(e,t="light"){return"dark"===t&&Te(e)?"dark":"light"}function Le(e,t="light"){const n=_e(e,t),o="dark"===n?(i=e.colors,r=e.dark,{...Fe(i),...r?.colors??{}}):e.colors;var i,r;return{...o,scheme:n,...Re(o,n)}}function qe(e,t="light"){return"dark"===t&&e.srcDark?e.srcDark:e.src}function Ne(e,t="light"){return"light"===_e(e,t)?{overlay:e.overlay,boxShadow:e.boxShadow}:{overlay:e.dark?.overlay??e.overlay,boxShadow:e.dark?.boxShadow??e.boxShadow}}const De=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?$/,Oe=new Map;function Be(e){const t=Oe.get(e);if(t)return t;try{const t=new Intl.DateTimeFormat("en-US",{timeZone:e,hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"});return Oe.set(e,t),t}catch{return null}}function We(e){return!e||null!==Be(e)}function ze(e,t){const n=t.formatToParts(new Date(e)),o=e=>Number(n.find(t=>t.type===e)?.value??"0");return Date.UTC(o("year"),o("month")-1,o("day"),o("hour")%24,o("minute"),o("second"))-e}const Ve=864e5;const He=new Map;function Ue(e,t){const n=`${e}|${t}`,o=He.get(n);if(void 0!==o)return o;const i=function(e,t){const n=De.exec((e||"").trim());if(!n)return null;const[,o,i,r,s,a,c]=n.map(Number),l=Number.isNaN(c)?0:c;if(i<1||i>12||r<1||r>31)return null;if(s>23||a>59||l>59)return null;const u=Date.UTC(o,i-1,r,s,a,l),d=new Date(u);if(d.getUTCMonth()!==i-1||d.getUTCDate()!==r)return null;if(!t)return u;const p=Be(t);if(!p)return null;const h=function(e,t){const n=[];for(const o of[e-Ve,e,e+Ve]){const e=ze(o,t);n.includes(e)||n.push(e)}return n}(u,p),m=h.filter(e=>ze(u-e,p)===e).map(e=>u-e);return m.length>0?Math.min(...m):u-Math.min(...h)}(e,t);return He.size>100&&He.clear(),He.set(n,i),i}const Ke={en:{days:"Days",hours:"Hours",minutes:"Minutes",seconds:"Seconds"},ru:{days:"Дни",hours:"Часы",minutes:"Минуты",seconds:"Секунды"},de:{days:"Tage",hours:"Stunden",minutes:"Minuten",seconds:"Sekunden"},es:{days:"Días",hours:"Horas",minutes:"Minutos",seconds:"Segundos"},fr:{days:"Jours",hours:"Heures",minutes:"Minutes",seconds:"Secondes"},pt:{days:"Dias",hours:"Horas",minutes:"Minutos",seconds:"Segundos"},ja:{days:"日",hours:"時間",minutes:"分",seconds:"秒"},ko:{days:"일",hours:"시간",minutes:"분",seconds:"초"},zh:{days:"天",hours:"小时",minutes:"分",seconds:"秒"},hi:{days:"दिन",hours:"घंटे",minutes:"मिनट",seconds:"सेकंड"},bn:{days:"দিন",hours:"ঘণ্টা",minutes:"মিনিট",seconds:"সেকেন্ড"},ar:{days:"أيام",hours:"ساعات",minutes:"دقائق",seconds:"ثوان"},he:{days:"ימים",hours:"שעות",minutes:"דקות",seconds:"שניות"},th:{days:"วัน",hours:"ชั่วโมง",minutes:"นาที",seconds:"วินาที"}};function Ye(e){const t=(e||"").trim();if(t)return t.startsWith("#")||t.startsWith("/")||t.startsWith("?")||a.test(t)?t:void 0}function Ge(e){return"_self"===e?{target:"_self"}:{target:"_blank",rel:"noreferrer"}}function Ze(e,t,n){const o="granted"===t?e.onGranted:e.onDenied;return"href"===o?.type&&function(e,t){const n="string"==typeof e.url?Ye(e.url):void 0;if(!n)return void t?.warn("Subscribe button: the link to open after the answer is empty or unsafe, it was not opened");if("_self"===e.target)return void window.location.assign(n);window.open(n,"_blank","noopener,noreferrer")}(o,n),"page"===o?.type?{page:o.page}:"granted"===t||"close"===o?.type?"close":"stay"}const Je=new Set(["STRONG","B","EM","I","U","BR","A"]);function Qe(e,t,n){for(const o of Array.from(e.childNodes)){if(3===o.nodeType){t.appendChild(n.createTextNode(o.textContent??""));continue}if(1!==o.nodeType)continue;const e=o;if(!Je.has(e.tagName)){Qe(e,t,n);continue}const i=n.createElement(e.tagName.toLowerCase());if("A"===e.tagName){const t=Ye(e.getAttribute("href")??void 0);t&&i.setAttribute("href",t);const{target:n,rel:o}=Ge(e.getAttribute("target"));i.setAttribute("target",n),o&&i.setAttribute("rel",o)}t.appendChild(i),Qe(e,i,n)}}function Xe(e){if(!e.includes("<"))return e;const t=(new DOMParser).parseFromString(e,"text/html"),n=t.createElement("div");return Qe(t.body,n,t),n.innerHTML}function et(e){return"string"==typeof e&&e?e:void 0}function tt(e,t){const n=e.dark;if("object"!=typeof n||null===n)return;const o=n,i="object"==typeof o.colors&&null!==o.colors?o.colors:{},r=Fe(t),s=function(e){if("object"!=typeof e||null===e)return;const t=e,n=et(t.color);if(!n)return;return{color:n,opacity:"number"==typeof t.opacity&&Number.isFinite(t.opacity)?Math.max(0,Math.min(1,t.opacity)):1}}(o.overlay);return{enabled:!0===o.enabled,colors:{background:et(i.background)??r.background,accent:et(i.accent)??r.accent,text:et(i.text)??r.text,textSecondary:et(i.textSecondary)??r.textSecondary,textInverse:et(i.textInverse)??r.textInverse},...s?{overlay:s}:{},...et(o.boxShadow)?{boxShadow:o.boxShadow}:{}}}function nt(e){let t;try{t=JSON.parse(e)}catch{return null}if("object"!=typeof t||null===t)return null;const n=t;if(2!==n.version)return null;const o=n.params;if("object"!=typeof o||null===o)return null;if(!Array.isArray(o.pages)||0===o.pages.length)return null;const i=function(e){const t="object"==typeof e.colors&&null!==e.colors?e.colors:{};return{background:et(t.background)??et(e.background)??d,accent:et(t.accent)??et(e.accent)??p,text:et(t.text)??h,textSecondary:et(t.textSecondary)??m,textInverse:et(t.textInverse)??f}}(o),r=tt(o,i);return{version:2,params:{...o,colors:i,...r?{dark:r}:{}}}}const ot=["cover","contain"];function it(e){if("object"!=typeof e||null===e)return;const t=e,n=Ye("string"==typeof t.src?t.src:void 0);return n?{src:n,...!0===t.controls?{controls:!0}:{},...!1===t.loop?{loop:!1}:{}}:void 0}function rt(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=20)break;if("object"!=typeof n||null===n)continue;if("string"!=typeof n.key||!n.key)continue;if("string"!=typeof n.src)continue;const e=it(n.video);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",src:n.src,..."string"==typeof n.srcDark&&n.srcDark?{srcDark:n.srcDark}:{},...e?{video:e}:{},..."string"==typeof n.mediaId&&n.mediaId?{mediaId:n.mediaId}:{},..."string"==typeof n.mediaIdDark&&n.mediaIdDark?{mediaIdDark:n.mediaIdDark}:{},...ot.includes(n.fit)?{fit:n.fit}:{},..."number"==typeof n.blur&&Number.isFinite(n.blur)&&n.blur>0?{blur:Math.min(n.blur,100)}:{},..."number"==typeof n.dim&&Number.isFinite(n.dim)&&n.dim>0?{dim:Math.min(n.dim,1)}:{}})}return t}const st=["px","%","em","rem","fr"];function at(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}function ct(e){if("object"!=typeof e||null===e)return;const t=e;if("text"===t.kind)return{kind:"text"};if("length"===t.kind||"percent"===t.kind){const e=at(t.min),n=at(t.max),o="length"===t.kind&&Array.isArray(t.units)?t.units.filter(e=>st.includes(e)):[],i="length"===t.kind?function(e){if("object"!=typeof e||null===e)return;const t={};for(const n of st){const o=e[n];if("object"!=typeof o||null===o)continue;const i=at(o.min),r=at(o.max);void 0===i&&void 0===r||(t[n]={...void 0!==i?{min:i}:{},...void 0!==r?{max:r}:{}})}return Object.keys(t).length>0?t:void 0}(t.ranges):void 0;return{kind:t.kind,...void 0!==e?{min:e}:{},...void 0!==n?{max:n}:{},...o.length>0?{units:o}:{},...i?{ranges:i}:{}}}if("select"===t.kind&&Array.isArray(t.options)){const e=[];for(const n of t.options){if(e.length>=20)break;"object"==typeof n&&null!==n&&("string"!=typeof n.value||n.value.length>64||e.push({value:n.value,label:"string"==typeof n.label?n.label:n.value}))}if(e.length>0)return{kind:"select",options:e}}}function lt(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=20)break;if("object"!=typeof n||null===n)continue;if("string"!=typeof n.key||!de.test(n.key))continue;if("string"!=typeof n.value||n.value.length>64||n.value.includes("$"))continue;if(t.some(e=>e.key===n.key))continue;const e=ct(n.control);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",value:n.value,...e?{control:e}:{}})}return t}function ut(e){return Object.fromEntries(e.map(e=>[e.key,e.value]))}const dt=["email","firstName","lastName","phone","custom"],pt=["primary","secondary"];function ht(e){const t=[];if(Array.isArray(e))for(const n of e){if(t.length>=10)break;"object"==typeof n&&null!==n&&("string"==typeof n.key&&n.key&&dt.includes(n.kind)&&(t.some(e=>e.key===n.key)||t.push({key:n.key,kind:n.kind,label:"string"==typeof n.label?n.label:"",placeholder:"string"==typeof n.placeholder?n.placeholder:"",required:"email"===n.kind||!0===n.required,..."custom"===n.kind&&"string"==typeof n.tag&&n.tag?{tag:n.tag}:{}})))}if(!t.some(e=>"email"===e.kind)){let e="field-email";for(;t.some(t=>t.key===e);)e=`${e}-1`;t.unshift({key:e,kind:"email",label:"Email",placeholder:"",required:!0})}return t.slice(0,10)}const mt=["checkbox","chips"],ft=["viewed","bestsellers_30d","also_bought","cart"];function gt(e){return ft.includes(e)?e:void 0}const yt=["row","grid"],bt=["nps","stars","thumbs"],vt=["instant","button"],wt=["keep","hide-popup","page"],kt=/^[a-z]{2}$/i,xt=/^#[0-9a-fA-F]{6}$/,St=500;function Ct(e,t=120){return"string"==typeof e?e.trim().slice(0,t):""}function Et(e,t,n=120){return Ct(e,n)||t}function jt(e){const t=Ct(e,8);return kt.test(t)?t.toLowerCase():""}function Pt(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=12)break;if("object"!=typeof n||null===n)continue;const e=Ct(n.value);if(!e)continue;if(t.some(t=>t.value===e))continue;const o=Ct(n.tagValue);t.push({value:e,label:Et(n.label,e),...o?{tagValue:o}:{}})}return t}function Mt(e,t){const n=e=>{const n=at(e);return void 0===n||n<=0?0:Math.min(Math.floor(n),t)},o=n(e.min),i=n(e.max);return{min:o,max:i>0?Math.max(o,i):0}}function $t(e){const t=[];for(const n of e){if(t.length>=50)break;if("object"==typeof n&&null!==n&&("string"==typeof n.key&&n.key))if("text"!==n.type)if("button"!==n.type){if("timer"===n.type){const e=Ct(n.timezone,64),o=We(e)?e:"",i=Ct(n.endTime,32);if(null===Ue(i,o))continue;const r=Ct(n.expirePage),s=wt.includes(n.onExpire)?n.onExpire:"keep",a="page"!==s||r?s:"keep";t.push({type:"timer",key:n.key,endTime:i,timezone:o,language:jt(n.language),showLabels:!1!==n.showLabels,onExpire:a,..."page"===a?{expirePage:r}:{}});continue}if("choice"===n.type){const e=Pt(n.options),{min:o,max:i}=Mt(n,e.length);t.push({type:"choice",key:n.key,control:mt.includes(n.control)?n.control:"checkbox",tagName:Ct(n.tagName),options:e,min:o,max:i,submitLabel:Et(n.submitLabel,P),submitVariant:pt.includes(n.submitVariant)?n.submitVariant:"primary",successMessage:Et(n.successMessage,M,St)});continue}if("rating"===n.type){const e="object"==typeof n.labels&&null!==n.labels?n.labels:{};t.push({type:"rating",key:n.key,scale:bt.includes(n.scale)?n.scale:"stars",labels:{low:Ct(e.low),high:Ct(e.high)},submitMode:vt.includes(n.submitMode)?n.submitMode:"instant",submitLabel:Et(n.submitLabel,I),eventName:Ct(n.eventName),successMessage:Et(n.successMessage,F,St)});continue}if("glyph"!==n.type){if("products"===n.type){const e="object"==typeof n.fields&&null!==n.fields?n.fields:{},o=Number.isFinite(n.limit)?Math.round(n.limit):A,i=gt(n.strategy)??"bestsellers_30d",r=gt(n.fallbackStrategy);t.push({type:"products",key:n.key,strategy:i,...r&&r!==i?{fallbackStrategy:r}:{},limit:Math.min(Math.max(o,1),12),layout:yt.includes(n.layout)?n.layout:"row",fields:{title:!1!==e.title,price:!1!==e.price,image:!1!==e.image,cta:!1!==e.cta},ctaText:Ct(n.ctaText),hideWhenEmpty:!0===n.hideWhenEmpty});continue}"email-input"!==n.type?"tag-input"!==n.type?"consent"!==n.type?"submit"!==n.type?"email-subscription-form"===n.type&&t.push({type:"email-subscription-form",key:n.key,formCode:"string"==typeof n.formCode?n.formCode:"",fields:ht(n.fields),submitLabel:"string"==typeof n.submitLabel&&n.submitLabel?n.submitLabel:C,submitVariant:pt.includes(n.submitVariant)?n.submitVariant:"primary",..."object"==typeof n.privacy&&null!==n.privacy&&"string"==typeof n.privacy.checkboxLabel?{privacy:{checkboxLabel:n.privacy.checkboxLabel,url:"string"==typeof n.privacy.url?n.privacy.url:"",linkLabel:"string"==typeof n.privacy.linkLabel?n.privacy.linkLabel:""}}:{},successMessage:"string"==typeof n.successMessage&&n.successMessage?n.successMessage:E,confirmEmailMessage:"string"==typeof n.confirmEmailMessage&&n.confirmEmailMessage?n.confirmEmailMessage:j}):t.push({type:"submit",key:n.key,variant:pt.includes(n.variant)?n.variant:"primary",label:Et(n.label,D),errorMessage:Et(n.errorMessage,O,St)}):t.push({type:"consent",key:n.key,checkboxLabel:Ct(n.checkboxLabel,St),linkLabel:Ct(n.linkLabel),url:Ct(n.url,St),requiredMessage:Et(n.requiredMessage,N)}):t.push({type:"tag-input",key:n.key,tagName:Ct(n.tagName),label:Ct(n.label),placeholder:Ct(n.placeholder),required:!0===n.required,requiredMessage:Et(n.requiredMessage,q)}):t.push({type:"email-input",key:n.key,label:Ct(n.label),placeholder:Ct(n.placeholder),invalidMessage:Et(n.invalidMessage,_),requiredMessage:Et(n.requiredMessage,L)})}else{if(!z.includes(n.name))continue;t.push({type:"glyph",key:n.key,name:n.name,size:V.includes(n.size)?n.size:V[0],color:"string"==typeof n.color&&xt.test(n.color)?n.color:""})}}else"object"==typeof n.action&&null!==n.action&&"string"==typeof n.action.type&&t.push(n);else"string"==typeof n.html&&t.push(n)}return t}function At(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(t.length>=20)break;"object"==typeof n&&null!==n&&("string"==typeof n.key&&n.key&&Array.isArray(n.slots)&&t.push({key:n.key,label:"string"==typeof n.label?n.label:"",slots:$t(n.slots)}))}return t}function It(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.min(e,2e3):void 0}function Ft(e,t,n){if(null===e)return;let o;return o="stretch"===e?"stretch":It(e)??("stretch"===t?"stretch":It(t)),"width"===n&&"stretch"===o?void 0:o}function Rt(e){const t=[];for(const n of e.pages){const o=lt(n.values),i=ue(me(n.layout,ut(o)));if(!i)continue;const r=Ft(n.width,e.width,"width"),s=Ft(n.height,e.height,"height");t.push({key:n.key,layout:i,images:rt(n.images),contents:At(n.contents),...void 0!==r?{width:r}:{},...void 0!==s?{height:s}:{},..."success"===n.role?{role:"success"}:{}})}return t}function Tt(e,t){return t.find(t=>t.key===e.startPage)??t[0]}function _t(e){return`calc(100% - ${2*e.offset}px)`}function Lt(e){return Array.isArray(e?.slots)?{...e,slots:e.slots.filter(e=>!function(e){const t=e;return"button"===t?.type&&"close"===t.action?.type}(e))}:e}function qt(e){return Array.isArray(e?.contents)?{...e,contents:e.contents.map(Lt)}:e}const Nt=new Set(["email-input","tag-input","consent"]),Dt=new Set([...Nt,"submit"]);function Ot(e){return Nt.has(e.type)}function Bt(e,t){return`${e}/${t}`}function Wt(e){return Rt(e).some(e=>e.contents.some(e=>e.slots.some(e=>Dt.has(e.type))))}function zt(e,t){const{slot:n}=e;if("consent"===n.type)return t.checks[e.id]?void 0:n.requiredMessage;const o=(t.texts[e.id]??"").trim();return"tag-input"===n.type?n.required&&!o?n.requiredMessage:void 0:o?T.test(o)?void 0:n.invalidMessage:n.requiredMessage}function Vt(e,t){const n={};for(const o of e){const e=zt(o,t);e&&(n[o.id]=e)}return n}const Ht=e=>"CLICK"===e.trigger_type;function Ut(e,t){return function(e){const t="function"==typeof e.composedPath?e.composedPath():[];if(t.length>0)return t.filter(e=>e instanceof Element);const n=[];for(let t=e.target instanceof Element?e.target:null;t;t=t.parentElement)n.push(t);return n}(e).some(e=>e.matches(t))}const Kt="pushwoosh-web-popups",Yt="[WebPopups]",Gt="data-pushwoosh-embedded-order",Zt="keyValue",Jt="messages",Qt="inboxMessages";function Xt(e,t){return function(n){n.objectStoreNames.contains(e)||t(n)}}const en=[Xt(Zt,function(e){e.createObjectStore(Zt,{keyPath:"key"})}),Xt("log",function(e){const t=e.createObjectStore("log",{keyPath:"id",autoIncrement:!0});t.createIndex("environment","environment",{unique:!1}),t.createIndex("date","date",{unique:!1}),t.createIndex("type","type",{unique:!1})}),Xt(Jt,function(e){e.createObjectStore(Jt,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),Xt(Qt,function(e){const t="status",n=e.createObjectStore(Qt,{keyPath:"inbox_id",autoIncrement:!1});n.createIndex(t,t,{unique:!1,multiEntry:!0}),n.createIndex("rt","rt",{unique:!1,multiEntry:!0})})];class tn{get all(){return en}}class nn{constructor(e,t=new tn){this.db=e,this.migrationsBuilder=t}applyMigrations(){this.applyMigrationsPack(this.migrationsBuilder.all)}applyMigrationsPack(e){e.forEach(e=>{e(this.db)})}}function on(e,t){console.info("onversionchange",t),e.close()}let rn;function sn(e){return(rn||(rn=new Promise((e,t)=>{const n=indexedDB.open("PUSHWOOSH_SDK_STORE",7);n.onsuccess=n=>{const o=n.target.result;o.onversionchange=on.bind(null,o,t),e(o)},n.onerror=()=>t(n.error),n.onupgradeneeded=e=>{const n=e.target.result;n.onversionchange=on.bind(null,n,t),new nn(n).applyMigrations()}})),rn).then(t=>new Promise((n,o)=>e(t,n,o)))}class an{_add(e){return sn((t,n,o)=>{const i=t.transaction([this.name],"readwrite").objectStore(this.name).add(e);i.onsuccess=()=>{n(e)},i.onerror=()=>{o(i.error)}}).then(e=>this.getAll().then(t=>{if(Array.isArray(t)){const n=t.map(e=>e.id).sort((e,t)=>e==t?0:e<t?1:-1);if(n.length>this.maxItems)return Promise.all(n.slice(this.maxItems).map(e=>this.delete(e))).then(()=>e)}return e}))}delete(e){return sn((t,n,o)=>{const i=t.transaction([this.name],"readwrite").objectStore(this.name).delete(e);i.onsuccess=()=>{n(i.result)},i.onerror=()=>{o(i.error)}})}getAll(){return sn((e,t,n)=>{const o=[],i=e.transaction(this.name).objectStore(this.name).openCursor();i.onsuccess=e=>{const n=e.target.result;n?(n.value&&o.push(n.value),n.continue()):t(o)},i.onerror=()=>{n(i.error)}})}}cn=Zt;var cn;const ln=new class extends an{constructor(){super(...arguments),this.name="log",this.maxItems=100,this.environment="undefined"!=typeof self&&self.registration?"worker":"browser"}add(e,t,n){const o={type:e,environment:this.environment,message:`${t}`,date:new Date};return t instanceof Error&&(o.stack=t.stack),n&&(o.additional=n),this._add(o)}},un=(new class extends an{constructor(){super(...arguments),this.name=Jt,this.maxItems=25}add(e){return this._add({...e,date:new Date})}},{error:1,info:2,debug:3});let dn=3;const pn={setLevel(e){un[e]||(e="error"),dn=un[e]},write(e,t,n){return"error"===e?this.error(t):this.info(t),ln.add(e,t,n)}};function hn(e){return async({slotKey:t,tagName:n,values:o})=>{try{await e.api.setTags({[n]:{operation:"append",value:o}})}catch(e){throw pn.error(e,`Failed to write web popup choice "${t}" to tag "${n}"`),e}}}function mn(e){return async({slotKey:t,eventName:n,score:o,scale:i})=>{try{await e.api.postEvent(n,{score:o,scale:i,slotKey:t})}catch(e){throw pn.error(e,`Failed to post web popup rating "${t}" as event "${n}"`),e}}}function fn(e){return async()=>{try{await e.subscribe()}catch(e){pn.error(e,"Failed to subscribe from a web popup")}return e.driver?.getPermission()??"default"}}Object.keys(un).forEach(e=>{const t=un[e];pn[e]=(...n)=>{t<=dn&&(console.groupCollapsed(e),console.info("",...n),console.trace("trace"),console.groupEnd())}});var gn=r(247),yn=r(524),bn=r(873);const vn="(prefers-color-scheme: dark)";function wn(){return"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia(vn).matches}function kn(e,t){const[n,o]=(0,bn.useState)(()=>"auto"===e&&t&&wn()),i=[e,t],[r,s]=(0,bn.useState)(null);return(null===r||i.some((e,t)=>e!==r[t]))&&(s(i),"auto"===e&&t&&o(wn())),(0,bn.useEffect)(()=>{if("auto"!==e||!t||"undefined"==typeof window||"function"!=typeof window.matchMedia)return;const n=window.matchMedia(vn),i=e=>o(e.matches);return n.addEventListener("change",i),()=>n.removeEventListener("change",i)},[e,t]),"auto"!==e?e:n?"dark":"light"}const xn="data-pw-web-popup-inline",Sn="data-pw-close",Cn="data-pw-submit",En={width:"100%"},jn=`[${xn}] img { max-height: 360px; object-fit: cover; }`,Pn=(0,bn.createContext)({pageKey:"",texts:{},checks:{},errors:{},phase:"idle",setText:()=>{},setCheck:()=>{},submit:()=>{},turnPage:(e,t)=>t(e),advance:()=>{}});function Mn(e,t){return t in e?Object.fromEntries(Object.entries(e).filter(([e])=>e!==t)):e}function $n(e,t,n,o){const i=(0,bn.useMemo)(()=>Rt(e),[e]),r=(0,bn.useMemo)(()=>function(e){const t=[];for(const n of e)for(const e of n.contents)for(const o of e.slots)Ot(o)&&t.push({id:Bt(n.key,o.key),pageKey:n.key,slot:o});return t}(i),[i]),[s,a]=(0,bn.useState)({}),[c,l]=(0,bn.useState)({}),[u,d]=(0,bn.useState)({}),[p,h]=(0,bn.useState)("idle"),m=e=>i.findIndex(t=>t.key===e),f=()=>{const e=Vt(r.filter(e=>e.pageKey===t),{texts:s,checks:c});return d(e),0===Object.keys(e).length},g=()=>{o&&"submitting"!==p&&((()=>{const e=Vt(r,{texts:s,checks:c});d(e);const t=r.find(t=>t.id in e);return t&&n?.(t.pageKey),!t})()?(h("submitting"),Promise.resolve().then(()=>o(function(e,t){const n={tags:{},policyAccepted:!0};for(const o of e){const{slot:e}=o;if("consent"===e.type){n.policyAccepted=n.policyAccepted&&!0===t.checks[o.id];continue}const i=(t.texts[o.id]??"").trim();"email-input"!==e.type?i&&e.tagName&&(n.tags[e.tagName]=i):n.email=i}return n}(r,{texts:s,checks:c}))).then(e=>{if(h("idle"),"invalid-email"===e)return void(()=>{const e=r.find(e=>"email-input"===e.slot.type);"email-input"===e?.slot.type&&(d({[e.id]:e.slot.invalidMessage}),n?.(e.pageKey))})();const t=i.find(e=>"success"===e.role);t&&n?.(t.key)},()=>h("error"))):h("idle"))};return{pageKey:t,texts:s,checks:c,errors:u,phase:p,setText:(e,t)=>{a(n=>({...n,[e]:t})),d(t=>Mn(t,e))},setCheck:(e,t)=>{l(n=>({...n,[e]:t})),d(t=>Mn(t,e))},submit:g,turnPage:(e,n)=>{if("submitting"===p)return;const r=m(e),s=r>m(t);o&&s?"success"===i[r].role?g():f()&&n(e):n(e)},advance:()=>{if(!o||"submitting"===p)return;const e=i[m(t)+1];e&&"success"!==e.role?f()&&n?.(e.key):g()}}}const An={padding:"4px 0",textAlign:"left"};function In({inverse:e,colors:t}){const n=b("caption",t,e);return{...g.caption,...n?{color:n}:{}}}function Fn(e){return{fontSize:12,lineHeight:1.4,color:e.error,paddingTop:2}}function Rn(e){return{...In(e),paddingBottom:4}}function Tn({slotKey:e,label:t,placeholder:n,inputType:o,autoComplete:i,look:r}){const s=(0,bn.useContext)(Pn),[a,c]=(0,bn.useState)(!1),l=Bt(s.pageKey,e),u=s.errors[l];let d;return u?d=r.colors.error:a&&(d=r.colors.accent),(0,gn.jsxs)("div",{style:An,children:[t&&(0,gn.jsx)("div",{style:Rn(r),children:t}),(0,gn.jsx)("input",{type:o,autoComplete:i,placeholder:n||void 0,value:s.texts[l]??"",disabled:"submitting"===s.phase,style:S(r.colors,d),onFocus:()=>c(!0),onBlur:()=>c(!1),onChange:e=>s.setText(l,e.currentTarget.value),onKeyDown:e=>{"Enter"===e.key&&s.advance()}}),u&&(0,gn.jsx)("div",{style:Fn(r.colors),children:u})]})}function _n({slot:e,...t}){return(0,gn.jsx)(Tn,{slotKey:e.key,label:e.label,placeholder:e.placeholder,inputType:"email",autoComplete:"email",look:t})}function Ln({slot:e,...t}){return(0,gn.jsx)(Tn,{slotKey:e.key,label:e.label,placeholder:e.placeholder,inputType:"text",look:t})}const qn={margin:"2px 0 0",flexShrink:0};function Nn(e){return{...In(e),display:"flex",alignItems:"flex-start",gap:8,cursor:"pointer"}}function Dn({slot:e,...t}){const n=(0,bn.useContext)(Pn),o=Bt(n.pageKey,e.key),i=n.errors[o],r=Ye(e.url);return(0,gn.jsxs)("div",{style:An,children:[(0,gn.jsxs)("label",{style:Nn(t),children:[(0,gn.jsx)("input",{type:"checkbox",checked:!0===n.checks[o],disabled:"submitting"===n.phase,style:qn,onChange:e=>n.setCheck(o,e.currentTarget.checked)}),(0,gn.jsxs)("span",{children:[e.checkboxLabel,r&&(0,gn.jsxs)(gn.Fragment,{children:[" ",(0,gn.jsx)("a",{href:r,...Ge(void 0),style:(s=t.colors,{color:s.accent}),children:e.linkLabel||e.url})]})]})]}),i&&(0,gn.jsx)("div",{style:Fn(t.colors),children:i})]});var s}const On={padding:k};function Bn(e,t,n){return{...x(e,t),...n?{opacity:.6,cursor:"default"}:{}}}function Wn({slot:e,align:t,colors:n}){const o=(0,bn.useContext)(Pn),i="submitting"===o.phase;return(0,gn.jsxs)("div",{style:On,children:[(0,gn.jsx)("button",{type:"button",[Cn]:"",disabled:i,style:Bn(e.variant,n,i),onClick:o.submit,children:e.label}),"error"===o.phase&&(0,gn.jsx)("div",{style:{...Fn(n),textAlign:t},children:e.errorMessage})]})}const zn=(0,bn.createContext)(void 0),Vn=new WeakMap;function Hn(e,t,n=Date.now()){let o=Vn.get(e);o||(o=new Map,Vn.set(e,o));const i=`${t.key}|${t.strategy}|${t.fallbackStrategy??""}|${t.limit}`,r=o.get(i);if(r&&n-r.at<6e4)return r.items;const s={at:n,items:Promise.resolve([])};return s.items=Promise.resolve().then(()=>e.load(t)).then(e=>Array.isArray(e)?e.slice(0,t.limit):[]).catch(()=>(o.get(i)===s&&o.delete(i),[])),o.set(i,s),s.items}function Un(e,t){if(!t)return String(e);try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(e)}catch{return`${e} ${t}`}}function Kn({product:e,slot:t,colors:n,inverse:o,onClick:i}){const r=Ye(e.url),s=Ye(e.image),a=b("body",n,o),c=b("caption",n,o),l={display:"flex",flexDirection:"column",gap:6,minWidth:120,color:"inherit",textDecoration:"none",..."row"===t.layout?{flex:"0 0 120px"}:{}},u=(0,gn.jsxs)(gn.Fragment,{children:[t.fields.image?(0,gn.jsx)("div",{style:{aspectRatio:"1 / 1",borderRadius:6,backgroundColor:n.surface,border:`1px solid ${n.border}`,...s?{backgroundImage:`url("${s.replace(/"/g,"%22")}")`,backgroundSize:"cover",backgroundPosition:"center"}:{}}}):null,t.fields.title?(0,gn.jsx)("div",{style:{...g.body,...a?{color:a}:{}},children:e.title}):null,t.fields.price&&void 0!==e.price?(0,gn.jsx)("div",{style:{...g.caption,...c?{color:c}:{}},children:Un(e.price,e.currency)}):null,t.fields.cta?(0,gn.jsx)("span",{style:{...x("secondary",n),padding:"6px 10px",fontSize:13},children:t.ctaText||$}):null]});return r?(0,gn.jsx)("a",{href:r,...Ge("_self"),style:l,onClick:i,children:u}):(0,gn.jsx)("div",{style:l,children:u})}function Yn({slot:e,inverse:t,colors:n,mode:o}){const i=(0,bn.useContext)(zn),[r,s]=(0,bn.useState)(null),a=`${e.key}|${e.strategy}|${e.fallbackStrategy??""}|${e.limit}`;if((0,bn.useEffect)(()=>{if(!i)return;let t=!1;return Hn(i,e).then(e=>{t||s(e)}),()=>{t=!0}},[i,a]),!i&&"live"===o)return null;const c=i?r:(l=Math.min(e.limit,3),Array.from({length:l},(e,t)=>({id:`placeholder-${t}`,title:"Product name",url:""})));var l;if(!c||0===c.length)return null;const u="grid"===e.layout?{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(120px, 1fr))",gap:12}:{display:"flex",gap:12,overflowX:"auto"};return(0,gn.jsx)("div",{style:{padding:"4px 0"},"data-pw-products":e.key,children:(0,gn.jsx)("div",{style:u,children:c.map(r=>(0,gn.jsx)(Kn,{product:r,slot:e,colors:n,inverse:t,onClick:"live"===o&&i?.onClick?()=>i.onClick?.(r,e):void 0},r.id))})})}const Gn=(0,bn.createContext)({answered:!1,markAnswered:()=>{}});const Zn={none:void 0,fade:"pw-vpopup-fade 0.35s ease-out backwards",slide:"pw-vpopup-slide 0.35s ease-out backwards"};function Jn({slot:e,align:t,inverse:n,colors:o}){const i={...g[e.variant],textAlign:e.align??t},r=b(e.variant,o,n);return r&&(i.color=r),(0,gn.jsx)("div",{style:i,dangerouslySetInnerHTML:{__html:Xe(e.html)}})}function Qn({slot:e,colors:t,logger:n,onRequestClose:o,onPageChange:i,onRequestSubscribe:r,onSubscribeClose:s}){const a=(0,bn.useContext)(Pn),c=(0,bn.useContext)(Gn),[l,u]=(0,bn.useState)("idle"),d=x(e.variant,t),p={};if("close"===e.action.type)return(0,gn.jsx)("div",{style:p,children:(0,gn.jsx)("button",{type:"button",style:d,onClick:o,children:e.label})});if("page"===e.action.type){const t=e.action.page;return(0,gn.jsx)("div",{style:p,children:(0,gn.jsx)("button",{type:"button",style:d,onClick:()=>a.turnPage(t,i),children:e.label})})}if("subscribe"===e.action.type){const{action:t}=e,o="idle"!==l||c.answered,a=()=>{r&&!o&&(u("asking"),r().then(e=>{if("default"===e)return void u("idle");c.markAnswered();const o=Ze(t,e,n);"close"!==o?(u(e),"stay"!==o&&i(o.page)):s?.()}).catch(()=>u("idle")))};return(0,gn.jsx)("div",{style:p,children:(0,gn.jsx)("button",{type:"button",disabled:o,style:{...d,...o?{opacity:.7}:{}},onClick:a,children:e.label})})}const h=Ye(e.action.url);return h?(0,gn.jsx)("div",{style:p,children:(0,gn.jsx)("a",{href:h,...Ge(e.action.target),style:d,children:e.label})}):(0,gn.jsx)("div",{style:p,children:(0,gn.jsx)("button",{type:"button",style:d,children:e.label})})}function Xn({message:e,align:t,inverse:n,colors:o}){const i=b("body",o,n);return(0,gn.jsx)("div",{style:{...g.body,padding:"4px 0",textAlign:t,...i?{color:i}:{}},children:e})}const eo={email:"email",phone:"tel"},to={email:"email",firstName:"given-name",lastName:"family-name",phone:"tel"},no="__privacy";function oo({slot:e,align:t,inverse:n,colors:o,onSubmitForm:i}){const[r,s]=(0,bn.useState)({}),[a,c]=(0,bn.useState)(!1),[l,u]=(0,bn.useState)(null),[d,p]=(0,bn.useState)({}),[h,m]=(0,bn.useState)("idle"),f=b("caption",o,n),y={...g.caption,...f?{color:f}:{}},v={fontSize:12,lineHeight:1.4,color:o.error,paddingTop:2};if("success"===h||"confirm"===h)return(0,gn.jsx)(Xn,{message:"confirm"===h?e.confirmEmailMessage:e.successMessage,align:t,inverse:n,colors:o});const w="submitting"===h,C=e.privacy?Ye(e.privacy.url):void 0,E={...x(e.submitVariant,o),...w?{opacity:.6,cursor:"default"}:{}};return(0,gn.jsxs)("form",{noValidate:!0,style:{margin:0,textAlign:"left"},onSubmit:t=>{t.preventDefault(),(()=>{if(!i||!e.formCode||"submitting"===h)return;const t={};for(const n of e.fields){const e=(r[n.key]??"").trim();n.required&&!e?t[n.key]="Required":"email"===n.kind&&e&&!T.test(e)&&(t[n.key]="Enter a valid email")}if(e.privacy&&!a&&(t[no]="Please accept the privacy policy"),p(t),Object.keys(t).length>0)return;const n={email:"",policyAccepted:!e.privacy||a},o={};for(const t of e.fields){const e=(r[t.key]??"").trim();e&&("email"===t.kind?n.email=n.email||e:"firstName"===t.kind?n.firstName=e:"lastName"===t.kind?n.lastName=e:"phone"===t.kind?n.phone=e:o[t.tag||t.key]=e)}Object.keys(o).length>0&&(n.customFields=o),m("submitting"),Promise.resolve().then(()=>i(e.formCode,n)).then(e=>m("confirm-email"===e?"confirm":"success"),()=>m("error"))})()},children:[e.fields.map(e=>{const t=d[e.key];let n;return t?n=o.error:l===e.key&&(n=o.accent),(0,gn.jsxs)("div",{style:{padding:"4px 0"},children:[e.label&&(0,gn.jsx)("div",{style:{...y,paddingBottom:4},children:e.label}),(0,gn.jsx)("input",{type:eo[e.kind]??"text",autoComplete:to[e.kind],placeholder:e.placeholder||void 0,value:r[e.key]??"",disabled:w,style:S(o,n),onFocus:()=>u(e.key),onBlur:()=>u(t=>t===e.key?null:t),onChange:t=>{return n=e.key,o=t.currentTarget.value,s(e=>({...e,[n]:o})),void p(e=>e[n]?Object.fromEntries(Object.entries(e).filter(([e])=>e!==n)):e);var n,o}}),t&&(0,gn.jsx)("div",{style:v,children:t})]},e.key)}),e.privacy&&(0,gn.jsxs)("div",{style:{padding:"4px 0"},children:[(0,gn.jsxs)("label",{style:{...y,display:"flex",alignItems:"flex-start",gap:8,cursor:"pointer"},children:[(0,gn.jsx)("input",{type:"checkbox",checked:a,disabled:w,style:{margin:"2px 0 0",flexShrink:0},onChange:e=>{c(e.currentTarget.checked),p(e=>e[no]?Object.fromEntries(Object.entries(e).filter(([e])=>e!==no)):e)}}),(0,gn.jsxs)("span",{children:[e.privacy.checkboxLabel,C&&(0,gn.jsxs)(gn.Fragment,{children:[" ",(0,gn.jsx)("a",{href:C,...Ge(void 0),style:{color:o.accent},children:e.privacy.linkLabel||e.privacy.url})]})]})]}),d[no]&&(0,gn.jsx)("div",{style:v,children:d[no]})]}),(0,gn.jsx)("div",{style:{padding:k},children:(0,gn.jsx)("button",{type:"submit",disabled:w,style:E,children:e.submitLabel})}),"error"===h&&(0,gn.jsx)("div",{style:{...v,textAlign:t},children:R})]})}function io({value:e,label:t,digitStyle:n,labelStyle:o}){return(0,gn.jsxs)("div",{style:{minWidth:44},children:[(0,gn.jsx)("div",{style:n,children:String(e).padStart(2,"0")}),t?(0,gn.jsx)("div",{style:o,children:t}):null]})}function ro({slot:e,align:t,inverse:n,colors:o,mode:i,onRequestClose:r,onPageChange:s}){const[a,c]=(0,bn.useState)(()=>Date.now()),l=function(e,t,n){const o=Ue(e,t),i=null===o?0:Math.max(0,o-n),r=Math.floor(i/1e3);return{total:i,days:Math.floor(r/86400),hours:Math.floor(r/3600)%24,minutes:Math.floor(r/60)%60,seconds:r%60}}(e.endTime,e.timezone,a),u=0===l.total;(0,bn.useEffect)(()=>{if("live"!==i||u)return;const e=setInterval(()=>c(Date.now()),1e3);return()=>clearInterval(e)},[i,u,e.endTime,e.timezone]),(0,bn.useEffect)(()=>{"live"===i&&u&&("hide-popup"===e.onExpire?r?.():"page"===e.onExpire&&e.expirePage&&s(e.expirePage))},[i,u,e.onExpire,e.expirePage,r,s]);const d=b("h2",o,n),p=b("caption",o,n),h={fontSize:28,fontWeight:700,lineHeight:1.2,fontVariantNumeric:"tabular-nums",...d?{color:d}:{}},m={...g.caption,...p?{color:p}:{}},f=(y=e.language,Ke[y]??Ke.en);var y;const v=[{value:l.days,label:f.days},{value:l.hours,label:f.hours},{value:l.minutes,label:f.minutes},{value:l.seconds,label:f.seconds}];return(0,gn.jsx)("div",{style:{padding:"4px 0",textAlign:t},children:(0,gn.jsx)("div",{style:{display:"inline-flex",gap:12,textAlign:"center"},children:v.map(t=>(0,gn.jsx)(io,{value:t.value,label:e.showLabels?t.label:"",digitStyle:h,labelStyle:m},t.label||t.value))})})}function so({slot:e,align:t,inverse:n,colors:o,onSubmitChoice:i}){const[r,s]=(0,bn.useState)([]),[a,c]=(0,bn.useState)("idle"),[l,u]=(0,bn.useState)("");if("success"===a)return(0,gn.jsx)(Xn,{message:e.successMessage,align:t,inverse:n,colors:o});const d=t=>{u(""),s(n=>n.includes(t)?n.filter(e=>e!==t):e.max>0&&n.length>=e.max?(u(`Pick up to ${e.max}`),n):[...n,t])},p="submitting"===a,h=b("body",o,n),m={...g.body,...h?{color:h}:{}};return(0,gn.jsxs)("div",{style:{padding:"4px 0"},children:["chips"===e.control?(0,gn.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,justifyContent:"center"===t?"center":"flex-start"},children:e.options.map(e=>{return(0,gn.jsx)("button",{type:"button","aria-pressed":r.includes(e.value),style:(t=r.includes(e.value),{padding:"6px 14px",borderRadius:999,border:`1px solid ${o.accent}`,backgroundColor:t?o.accent:"transparent",color:t?o.onAccent:o.accent,fontFamily:"inherit",fontSize:14,lineHeight:1.4,cursor:"pointer"}),onClick:()=>d(e.value),children:e.label},e.value);var t})}):(0,gn.jsx)("div",{style:{display:"grid",gap:6},children:e.options.map(e=>(0,gn.jsxs)("label",{style:{...m,display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[(0,gn.jsx)("input",{type:"checkbox",checked:r.includes(e.value),onChange:()=>d(e.value),style:{accentColor:o.accent,width:16,height:16,margin:0}}),e.label]},e.value))}),l?(0,gn.jsx)("div",{style:{...g.caption,color:o.error,paddingTop:4},children:l}):null,"error"===a?(0,gn.jsx)("div",{style:{...g.caption,color:o.error,paddingTop:4},children:R}):null,(0,gn.jsx)("div",{style:{padding:k},children:(0,gn.jsx)("button",{type:"button",style:{...x(e.submitVariant,o),...p?{opacity:.7}:{}},onClick:()=>{if(!i||!e.tagName||"submitting"===a)return;const t=Math.max(e.min,1);if(r.length<t)return void u(1===t?"Pick at least one":`Pick at least ${t}`);const n=e.options.filter(e=>r.includes(e.value)).map(e=>e.tagValue||e.value);u(""),c("submitting"),Promise.resolve().then(()=>i({slotKey:e.key,tagName:e.tagName,values:n})).then(()=>c("success"),()=>c("error"))},children:e.submitLabel})})]})}function ao({score:e,scale:t,selected:n,colors:o,onPick:i}){const r={display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,border:`1px solid ${o.accent}`,backgroundColor:n?o.accent:"transparent",color:n?o.onAccent:o.accent,fontFamily:"inherit",fontSize:14,lineHeight:1,cursor:"pointer"};if("nps"===t)return(0,gn.jsx)("button",{type:"button","aria-label":`Rate ${e}`,"aria-pressed":n,style:{...r,width:30,height:32,borderRadius:6},onClick:i,children:e});const s="thumbs"===t;let a=`Rate ${e}`;return s&&(a=1===e?"Thumbs up":"Thumbs down"),(0,gn.jsx)("button",{type:"button","aria-label":a,"aria-pressed":n,style:{...r,width:s?44:34,height:s?40:34,borderRadius:s?8:6},onClick:i,children:(0,gn.jsx)("svg",{width:s?22:20,height:s?22:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,gn.jsx)("path",{d:s?"M8 21V10l3.5-7A2 2 0 0 1 14 5v5h4.5a2 2 0 0 1 2 2.4l-1.3 6A2 2 0 0 1 17.2 21zM8 10H3.5v11H8":W.star,...s&&0===e?{transform:"rotate(180 12 12)"}:{}})})})}function co({slot:e,align:t,inverse:n,colors:o,onSubmitRating:i}){const[r,s]=(0,bn.useState)(null),[a,c]=(0,bn.useState)("idle");if("success"===a)return(0,gn.jsx)(Xn,{message:e.successMessage,align:t,inverse:n,colors:o});const l=t=>{i&&e.eventName&&"submitting"!==a&&(c("submitting"),Promise.resolve().then(()=>i({slotKey:e.key,eventName:e.eventName,score:t,scale:e.scale})).then(()=>c("success"),()=>c("error")))},u="nps"===(d=e.scale)?[0,1,2,3,4,5,6,7,8,9,10]:"stars"===d?[1,2,3,4,5]:[0,1];var d;const p=b("caption",o,n),h={...g.caption,...p?{color:p}:{}},m=t=>"stars"===e.scale?null!==r&&t<=r:r===t;return(0,gn.jsxs)("div",{style:{padding:"4px 0"},children:[(0,gn.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6,justifyContent:"center"===t?"center":"flex-start"},children:u.map(t=>(0,gn.jsx)(ao,{score:t,scale:e.scale,selected:m(t),colors:o,onPick:()=>(t=>{"submitting"!==a&&(s(t),"instant"===e.submitMode&&l(t))})(t)},t))}),e.labels.low||e.labels.high?(0,gn.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:8,paddingTop:4},children:[(0,gn.jsx)("span",{style:h,children:e.labels.low}),(0,gn.jsx)("span",{style:h,children:e.labels.high})]}):null,"error"===a?(0,gn.jsx)("div",{style:{...g.caption,color:o.error,paddingTop:4},children:R}):null,"button"===e.submitMode?(0,gn.jsx)("div",{style:{padding:k},children:(0,gn.jsx)("button",{type:"button",style:{...x("primary",o),..."submitting"===a?{opacity:.7}:{}},onClick:()=>null===r?void 0:l(r),children:e.submitLabel})}):null]})}function lo({slot:e,align:t,inverse:n,colors:o}){const i=e.color||(n?o.textInverse:o.accent);return(0,gn.jsx)("div",{style:{padding:"4px 0",textAlign:t,lineHeight:0},children:(0,gn.jsx)("svg",{width:e.size,height:e.size,viewBox:"0 0 24 24",fill:"none",stroke:i,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{display:"inline-block"},children:(0,gn.jsx)("path",{d:W[e.name]})})})}function uo({slot:e,align:t,inverse:n,colors:o,mode:i="live",onRequestClose:r,onPageChange:s,onSubmitForm:a,onSubmitChoice:c,onSubmitRating:l,onRequestSubscribe:u,onSubscribeClose:d,logger:p}){const h=s??(()=>{});switch(e.type){case"text":return(0,gn.jsx)(Jn,{slot:e,align:t,inverse:n,colors:o});case"button":return(0,gn.jsx)(Qn,{slot:e,colors:o,onRequestClose:r,onPageChange:h,onRequestSubscribe:u,onSubscribeClose:d,logger:p});case"email-subscription-form":return(0,gn.jsx)(oo,{slot:e,align:t,inverse:n,colors:o,onSubmitForm:a});case"timer":return(0,gn.jsx)(ro,{slot:e,align:t,inverse:n,colors:o,mode:i,onRequestClose:r,onPageChange:h});case"choice":return(0,gn.jsx)(so,{slot:e,align:t,inverse:n,colors:o,onSubmitChoice:c});case"rating":return(0,gn.jsx)(co,{slot:e,align:t,inverse:n,colors:o,onSubmitRating:l});case"glyph":return(0,gn.jsx)(lo,{slot:e,align:t,inverse:n,colors:o});case"products":return(0,gn.jsx)(Yn,{slot:e,inverse:n,colors:o,mode:i});case"email-input":return(0,gn.jsx)(_n,{slot:e,inverse:n,colors:o});case"tag-input":return(0,gn.jsx)(Ln,{slot:e,inverse:n,colors:o});case"consent":return(0,gn.jsx)(Dn,{slot:e,inverse:n,colors:o});case"submit":return(0,gn.jsx)(Wn,{slot:e,align:t,colors:o})}}function po({node:e,page:t,colors:n,mode:o,leaf:i,onRequestClose:r,onPageChange:s,onSubmitForm:a,onSubmitChoice:c,onSubmitRating:l,onRequestSubscribe:u,onSubscribeClose:d,logger:p}){const h=t.contents.find(t=>t.key===e.props.content);if(!h)return null;if(i?.renderZone)return(0,gn.jsx)("div",{style:{minWidth:0},children:i.renderZone(h,e)});const m=e.props.align??"left",f="inverse"===e.props.tone;return(0,gn.jsx)("div",{style:{minWidth:0},children:h.slots.map((e,t)=>{const i=h.slots[t-1],g=i?(y=w(i),"action"===(b=w(e))?"action"===y?6:16:"text"===b&&"heading"===y?4:8):0;var y,b;return(0,gn.jsx)("div",{style:g?{marginTop:g}:void 0,children:(0,gn.jsx)(uo,{slot:e,align:m,inverse:f,colors:n,mode:o,onRequestClose:r,onPageChange:s,onSubmitForm:a,onSubmitChoice:c,onSubmitRating:l,onRequestSubscribe:u,onSubscribeClose:d,logger:p})},e.key)})})}function ho(e){return e?.video?Ye(e.video.src):void 0}function mo({image:e,poster:t,src:n,style:o,mode:i}){return(0,gn.jsx)("video",{src:n,poster:t||void 0,style:o,autoPlay:"live"===i,muted:!0,playsInline:!0,preload:"metadata",loop:!1!==e.video?.loop,controls:!0===e.video?.controls})}function fo({node:e,page:t,leaf:n,mode:o,scheme:i}){const r=t.images.find(t=>t.key===e.props.image);if(!r)return null;if(n?.renderImage)return(0,gn.jsx)(gn.Fragment,{children:n.renderImage(r,e)});const s=ho(r),a=qe(r,i);if(!a&&!s)return null;const c={display:"block",width:"100%",minWidth:0};return r.fit?(c.height="100%",c.objectFit=r.fit):c.height="auto",r.blur&&(c.filter=`blur(${r.blur}px)`),s?(0,gn.jsx)(mo,{image:r,poster:a,src:s,style:c,mode:o}):(0,gn.jsx)("img",{src:a,alt:"",style:c})}function go({style:e,outer:t,inner:n,layer:o,children:i}){const{backgroundColor:r,...s}=e;return(0,gn.jsxs)("div",{style:{display:"grid",minWidth:0,backgroundColor:r,...t},children:[o,(0,gn.jsx)("div",{style:{...s,...n},children:i})]})}function yo({node:e,page:t,colors:n,mode:o,scheme:i,leaf:r,onRequestClose:s,onPageChange:a,onSubmitForm:c,onSubmitChoice:l,onSubmitRating:u,onRequestSubscribe:d,onSubscribeClose:p,logger:h}){if("Content"===e.type)return(0,gn.jsx)(po,{node:e,page:t,colors:n,mode:o,scheme:i,leaf:r,onRequestClose:s,onPageChange:a,onSubmitForm:c,onSubmitChoice:l,onSubmitRating:u,onRequestSubscribe:d,onSubscribeClose:p,logger:h});if("Image"===e.type)return(0,gn.jsx)(fo,{node:e,page:t,leaf:r,mode:o,scheme:i});const m=e.props?.backgroundImage,f=m?t.images.find(e=>e.key===m):void 0,g=f?.blur??0,y=f?.dim??0,b=ho(f),v=f?qe(f,i):void 0,w=ke(e,g>0||b?void 0:v||void 0,y);m&&(w.backgroundColor="#1D2939");const k=e.children.map((e,m)=>(0,gn.jsx)(yo,{node:e,page:t,colors:n,mode:o,scheme:i,leaf:r,onRequestClose:s,onPageChange:a,onSubmitForm:c,onSubmitChoice:l,onSubmitRating:u,onRequestSubscribe:d,onSubscribeClose:p,logger:h},m));if(b&&f){const e=ve(y);return(0,gn.jsx)(go,{style:w,outer:{position:"relative",overflow:"hidden",...v?we(v):{}},inner:{position:"relative",...e?{backgroundImage:e}:{}},layer:(0,gn.jsx)(mo,{image:f,poster:v??"",src:b,mode:o,style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",...g>0?{filter:`blur(${g}px)`}:{}}}),children:k})}return g>0?(0,gn.jsx)(go,{style:w,outer:v?we(v,y):void 0,inner:{backdropFilter:`blur(${g}px)`,WebkitBackdropFilter:`blur(${g}px)`},children:k}):(0,gn.jsx)("div",{style:w,children:k})}function bo({page:e,params:t,mode:n="live",colorScheme:o="light",leafRenderers:i,animatePage:r=!1,onRequestClose:s,onPageChange:a,onSubmitForm:c,onSubmitFormValues:l,onSubmitChoice:u,onSubmitRating:d,products:p,onRequestSubscribe:h,onSubscribeClose:m,logger:f}){const g=$n(t,e.key,a,l),y=function(){const[e,t]=(0,bn.useState)(!1);return(0,bn.useMemo)(()=>({answered:e,markAnswered:()=>t(!0)}),[e])}(),b=Le(t,o),v=Ne(t,o),w={position:"relative",boxSizing:"border-box",overflow:"hidden",backgroundColor:b.background,colorScheme:b.scheme,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',color:b.text,borderRadius:t.borderRadius>0?t.borderRadius:void 0,boxShadow:v.boxShadow&&"none"!==v.boxShadow?v.boxShadow:void 0,transition:"height 300ms ease"};e.height&&(w.height="stretch"===e.height?"100%":e.height,w.overflowY="auto");const k={...r?{animation:"pw-vpopup-page 300ms ease-out backwards"}:{},..."stretch"===e.height?{display:"grid",minHeight:"100%"}:{}};return(0,gn.jsx)("div",{style:w,children:(0,gn.jsx)(Pn.Provider,{value:g,children:(0,gn.jsx)(zn.Provider,{value:p,children:(0,gn.jsx)(Gn.Provider,{value:y,children:(0,gn.jsx)("div",{style:k,children:(0,gn.jsx)(yo,{node:e.layout,page:e,colors:b,mode:n,scheme:b.scheme,leaf:i,onRequestClose:s,onPageChange:a??(()=>{}),onSubmitForm:c,onSubmitChoice:u,onSubmitRating:d,onRequestSubscribe:h,onSubscribeClose:m,logger:f})},e.key)})})})})}function vo({colors:e,onRequestClose:t}){return(0,gn.jsx)("button",{type:"button","aria-label":"Close",[Sn]:"",onClick:t,style:{position:"absolute",top:10,right:10,width:24,height:24,padding:0,border:"none",borderRadius:"50%",background:Ae(e.surface,.92),boxShadow:"0 1px 3px rgba(16, 24, 40, 0.25)",color:e.chromeIcon,fontSize:13,lineHeight:1,cursor:"pointer"},children:"✕"})}function wo(e,t,n){const{placement:o}=e,i={position:"fixed",boxSizing:"border-box",maxWidth:_t(o),maxHeight:_t(o),pointerEvents:"auto"};if(t){i.width=t;const e=o.h;"left"===e?i.left=o.offset:"right"===e?i.right=o.offset:i.left="50%"}else i.left=o.offset,i.right=o.offset;"stretch"===n?(i.top=o.offset,i.bottom=o.offset):"top"===o.v?i.top=o.offset:"bottom"===o.v?i.bottom=o.offset:i.top="50%";const r=t&&"center"===o.h?"-50%":"0",s="middle"===o.v&&"stretch"!==n?"-50%":"0";"0"===r&&"0"===s||(i.transform=`translate(${r}, ${s})`);const a=Zn[e.animation];return a&&(i.animation=a),i.transition="width 300ms ease",i}function ko({params:e,mode:t="live",colorScheme:n="auto",onRequestClose:o,onSubmitForm:i,onSubmitFormValues:r,onSubmitChoice:s,onSubmitRating:a,products:c,onRequestSubscribe:l,logger:u,leafRenderers:d}){const[p,h]=(0,bn.useState)(null);(0,bn.useEffect)(()=>{Rt(e).forEach(e=>e.images.forEach(({src:e,srcDark:t})=>{[e,t].forEach(e=>{e&&((new Image).src=e)})}))},[e]);const m=kn(n,Te(e)),f=Rt(e);if(0===f.length)return null;const g=f.find(e=>e.key===p)??Tt(e,f),y=null!==p;if("preview"===t)return(0,gn.jsxs)("div",{style:{position:"relative",width:g.width??"100%",transition:"width 300ms ease"},children:[(0,gn.jsx)("style",{children:B}),(0,gn.jsx)(bo,{page:g,params:e,mode:t,colorScheme:m,leafRenderers:d,animatePage:y,onRequestClose:o,onPageChange:h,onSubmitForm:i,onSubmitFormValues:r,onSubmitChoice:s,onSubmitRating:a,products:c,onRequestSubscribe:l,onSubscribeClose:o,logger:u})]});const{overlay:b}=Ne(e,m);return(0,gn.jsxs)(gn.Fragment,{children:[(0,gn.jsx)("style",{children:B}),b&&(0,gn.jsx)("div",{style:{position:"fixed",inset:0,backgroundColor:b.color,opacity:b.opacity,animation:"pw-vpopup-overlay 0.2s ease-out backwards",pointerEvents:"auto"},onClick:o}),(0,gn.jsxs)("div",{style:wo(e,g.width,g.height),children:[(0,gn.jsx)(bo,{page:g,params:e,mode:t,colorScheme:m,leafRenderers:d,animatePage:y,onRequestClose:o,onPageChange:h,onSubmitForm:i,onSubmitFormValues:r,onSubmitChoice:s,onSubmitRating:a,products:c,onRequestSubscribe:l,onSubscribeClose:o,logger:u}),(0,gn.jsx)(vo,{colors:Le(e,m),onRequestClose:o})]})]})}function xo({params:e,mode:t="live",colorScheme:n="auto",logger:o,onSubmitForm:i,onSubmitFormValues:r,onSubmitChoice:s,onSubmitRating:a,products:c,onRequestSubscribe:l,onRequestRemove:u,onRequestClose:d}){const[p,h]=(0,bn.useState)(null),m=(0,bn.useMemo)(()=>d?e:function(e){return Array.isArray(e?.pages)?{...e,pages:e.pages.map(qt)}:e}(e),[e,d]),f=kn(n,Te(m)),g=Rt(m);if(0===g.length)return null;const y=g.find(e=>e.key===p)??Tt(m,g);return(0,gn.jsxs)("div",{[xn]:"",style:En,children:[(0,gn.jsx)("style",{children:jn}),(0,gn.jsx)(bo,{page:y,params:m,mode:t,colorScheme:f,onRequestClose:d,onPageChange:h,onSubmitForm:i,onSubmitFormValues:r,onSubmitChoice:s,onSubmitRating:a,products:c,onRequestSubscribe:l,onSubscribeClose:u,logger:o})]})}const So={SUBMIT_FORM_RESULT_SUBSCRIBED:"subscribed",SUBMIT_FORM_RESULT_CONFIRM_EMAIL:"confirm-email",SUBMIT_FORM_RESULT_ALREADY_SUBSCRIBED:"already-subscribed"},Co=(e,t)=>`https://subscription-form.svc-nue.pushwoosh.com/api/v1/forms/code/${encodeURIComponent(e)}${t}`,Eo=async(e,t)=>{try{const n=await fetch(Co(e,"/submit"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,userId:t.email})});if(!n.ok)throw new Error(`Subscription form submit failed: HTTP ${n.status}`);const o=await n.json(),i=So[o.result??""];if(!i)throw new Error(`Subscription form submit failed: unexpected result "${o.result}"`);return i}catch(t){throw pn.error(t,`Failed to submit subscription form "${e}"`),t}},jo={warn:e=>pn.error(Yt,e)},Po=e=>"EMBEDDED"===e.kind;class Mo{constructor(e){this.blocks=new Map,this.viewed=new Set,this.autoSkipLogged=new Set,this.deps=e}syncWithPage(e,t){for(const n of e){if(!Po(n.popup))continue;const{code:e}=n.popup;!1===this.blocks.get(e)?.host.isConnected&&this.remove(e),"api"!==this.blocks.get(e)?.trigger&&(this.deps.matchesPage(n.popup)?n.content&&t(n)&&this.place(n,n.content,"auto"):this.remove(e))}}show(e,t){return this.place(e,t,"api")}removeWhere(e){for(const[t,n]of[...this.blocks])e(n.entry)&&this.remove(t)}place(e,t,n){const{popup:o}=e,i=this.findContainer(o,n);if(!i)return this.remove(o.code),!1;const r=this.blocks.get(o.code);if(r?.element===i&&r.host.isConnected)return"api"===n&&(r.trigger="api"),!0;this.remove(o.code);const s=document.createElement("div");s.id=`${Kt}-embedded-${o.code}`,s.setAttribute(Gt,String(e.order)),s.style.width=e.placement?.width||"100%",i.insertBefore(s,this.firstBlockAfter(i,e.order));const a=s.attachShadow({mode:"open"}),c=document.createElement("div");return a.appendChild(c),e.placement?.dismissible&&(s.style.position="relative",a.appendChild(this.createDismissButton(()=>this.deps.dismiss(e)))),this.deps.render(c,t,e),this.blocks.set(o.code,{entry:e,element:i,host:s,container:c,trigger:n,observer:this.watchFirstView(e,t,s)}),this.reportShown(e,n),!0}createDismissButton(e){const t=document.createElement("button");return t.type="button",t.textContent="×",t.setAttribute("aria-label","Close"),t.setAttribute("data-pushwoosh-placement-dismiss",""),Object.assign(t.style,{position:"absolute",top:"8px",right:"8px",width:"24px",height:"24px",padding:"0",border:"none",borderRadius:"50%",background:"rgba(0, 0, 0, 0.45)",color:"#FFFFFF",font:"16px/24px sans-serif",cursor:"pointer"}),t.addEventListener("click",e),t}firstBlockAfter(e,t){return Array.from(e.children).find(e=>e.hasAttribute(Gt)&&Number(e.getAttribute(Gt))>t)??null}remove(e){const t=this.blocks.get(e);t&&(this.blocks.delete(e),t.observer?.disconnect(),this.deps.unmount(t.container),t.host.remove())}findContainer(e,t){const{code:n,css_selector:o}=e;if(!o)return this.logSkip(n,t,`${Yt} Embedded "${n}" has no css_selector; skipping`),null;try{const e=document.querySelector(o);return e||this.logSkip(n,t,`${Yt} Embedded "${n}": nothing matches "${o}" on this page; skipping`),e}catch(e){return this.logSkip(n,t,`${Yt} Embedded "${n}": invalid css_selector "${o}"; skipping`,e),null}}logSkip(e,t,...n){if("auto"===t){if(this.autoSkipLogged.has(e))return;this.autoSkipLogged.add(e)}pn.debug(...n)}reportShown(e,t){const{code:n}=e.popup;this.deps.recordVisit(e),pn.debug(`${Yt} Embedded "${n}" rendered (trigger: ${t})`),this.deps.dispatchShown(n,t)}watchFirstView(e,t,n){if(this.viewed.has(e.popup.code))return null;if("function"!=typeof IntersectionObserver)return this.reportViewed(e.popup.code,t),null;const o=new IntersectionObserver(n=>{n.some(e=>e.isIntersecting)&&(o.disconnect(),this.reportViewed(e.popup.code,t))});return o.observe(n),o}reportViewed(e,t){this.viewed.has(e)||(this.viewed.add(e),this.deps.recordImpression(e),this.deps.recordFormViews(e,t))}}const $o=["touchstart","touchmove","touchend"],Ao=["pointerdown","touchstart","keydown"],Io="__pwExitIntent",Fo=e=>"EXIT_INTENT"===e.trigger_type,Ro=e=>"object"==typeof e&&null!==e?e:null,To=e=>Io in(Ro(e)??{});function _o(e){const t=t=>{null===t.relatedTarget&&t.clientY<=0&&e()};return document.addEventListener("mouseout",t),()=>document.removeEventListener("mouseout",t)}function Lo(e){let t=!1;const n=()=>{"hidden"!==document.visibilityState?t&&e():t=!0};return document.addEventListener("visibilitychange",n),()=>document.removeEventListener("visibilitychange",n)}function qo(e){let t=window.scrollY,n=Date.now(),o=Number.NEGATIVE_INFINITY;const i=()=>{o=Date.now()},r=()=>{const i=window.scrollY,r=Date.now(),s=(t-i)/Math.max(r-n,1);t=i,n=r;r-o<=1e3&&s>=1.5&&i<=1*window.innerHeight&&e()};return $o.forEach(e=>window.addEventListener(e,i,{capture:!0,passive:!0})),window.addEventListener("scroll",r,{passive:!0}),()=>{$o.forEach(e=>window.removeEventListener(e,i,!0)),window.removeEventListener("scroll",r)}}function No(e){let t=null,n=!1;const o=()=>{if(r(),!To(window.history.state)){const e={...Ro(window.history.state),[Io]:!0};window.history.pushState(e,"",window.location.href)}t=window.location.href,n=!0},i=o=>{const i=n&&window.location.href===t&&!To(o.state);n=To(o.state),i&&(t=null,e()||window.history.back())};function r(){Ao.forEach(e=>window.removeEventListener(e,o,!0))}return Ao.forEach(e=>window.addEventListener(e,o,{capture:!0,passive:!0})),window.addEventListener("popstate",i),()=>{r(),window.removeEventListener("popstate",i),null!==t&&To(window.history.state)&&window.history.back()}}function Do(e,t){e.addEventListener("click",e=>{const n=e.target instanceof Element?e.target.closest("a, button"):null;n&&!n.hasAttribute(Sn)&&(n.hasAttribute(Cn)||t())})}async function Oo(e,t){const n=function(e){const t=[];for(const n of e.pages)if(Array.isArray(n?.contents))for(const e of n.contents)if(Array.isArray(e?.slots))for(const n of $t(e.slots))"products"===n.type&&t.push(n);return t}(e).filter(e=>e.hideWhenEmpty);return(await Promise.all(n.map(e=>Hn(t,e)))).every(e=>e.length>0)}const Bo={not_determined:"DEFAULT",granted_explicit:"GRANTED",denied:"DENIED",unsupported:"UNSUPPORTED"},Wo=new Set(Object.values(Bo));function zo(e,t){const n=t.push_permission_status?.toUpperCase();return!n||!Wo.has(n)||function(e){if("function"==typeof e.getPushPermissionStatus)try{return Bo[e.getPushPermissionStatus()]}catch{return}}(e)===n}const Vo=e=>{(0,yn.render)(null,e)},Ho=e=>"SCROLL"===e.trigger_type;function Uo(){const{scrollY:e,innerHeight:t}=window,{scrollHeight:n}=document.scrollingElement??document.documentElement;return n<=t||e+t>=n-1?100:(e+t/2)/n*100}function Ko(){const{pathname:e}=window.location;try{return decodeURIComponent(e)}catch{return e}}class Yo{constructor(e){var t;this.isRecurringVisitor=!1,this.entries=new Map,this.contentEntries=new Map,this.placementEntries=new Map,this.placementSeq=new Map,this.placementCounter=0,this.dismissedPlacements=new Set,this.shownPlacements=new Set,this.placementsActive=!1,this.queue=[],this.visible=null,this.drainTimeoutId=null,this.autoShowEnabled=!0,this.colorScheme="auto",this.isNavigationSubscribed=!1,this.stopClickWatch=null,this.badClickSelectors=new Set,this.openPopupsCount=0,this.bodyOverflowBeforeLock=null,this.readyPromise=new Promise(e=>{this.readyResolve=e}),this.pw=e,this.submitHandlers={onSubmitChoice:hn(e),onSubmitRating:mn(e),onRequestSubscribe:fn(e),products:(t=e.recommendations,{load:async e=>{const n=e.fallbackStrategy??"none",o={limit:e.limit,block:e.key};return(await t.fetch({...o,strategy:e.strategy,fallback:n}).catch(i=>{if("none"===n||n===e.strategy)throw i;return pn.error(i,`${Yt} products slot "${e.key}": strategy "${e.strategy}" failed, trying "${n}"`),t.fetch({...o,strategy:n,fallback:"none"})})).items.map(e=>({id:e.id,title:e.title,price:e.price,currency:e.currency||void 0,image:e.image_url||void 0,url:e.url}))},onClick:(e,n)=>{t.trackClick({block:n.key,strategy:n.strategy,productId:e.id}).catch(t=>{pn.error(t,`${Yt} Failed to track a click on product "${e.id}" in slot "${n.key}"`)})}})},this.embedded=new Mo({matchesPage:e=>this.checkSoftCondition(e),render:(e,t,n)=>{this.listenForInteractions(e,n),((e,t,n,o="auto",i,r)=>{(0,yn.render)((0,gn.jsx)(xo,{params:t,colorScheme:o,onSubmitForm:Eo,onSubmitFormValues:n.onSubmitFormValues,onSubmitChoice:n.onSubmitChoice,onSubmitRating:n.onSubmitRating,onRequestSubscribe:n.onRequestSubscribe,products:n.products,onRequestRemove:i,onRequestClose:r,logger:jo}),e)})(e,t,this.handlersFor(n),this.colorScheme,()=>this.embedded.removeWhere(e=>e===n),n.placement?.dismissible?()=>this.dismissPlacement(n):void 0)},unmount:Vo,recordVisit:e=>this.recordVisit(e),recordImpression:e=>this.recordImpression(e),recordFormViews:(e,t)=>this.recordSubscriptionFormViews(e,t),dispatchShown:(e,t)=>this.pw.dispatchEvent("show-web-popup",{code:e,trigger:t}),dismiss:e=>this.dismissPlacement(e)}),e.moduleRegistry.webPopups=this}async run(){const{pw:e}=this;try{if(!1===e.initParams.webPopups?.enable)return void pn.info(`${Yt} switched off by webPopups.enable, skipping`);this.autoShowEnabled=!1!==e.initParams.webPopups?.autoShow,this.colorScheme=e.initParams.webPopups?.colorScheme??"auto";const t=await e.data.getFeatures(),n=!1!==t?.popup_forms?.enabled,o=this.acceptPlacements();if(this.placementsActive=this.placementsAllowed()&&(!0===t?.web_placements?.enabled||o.length>0),!n&&!this.placementsActive)return void pn.debug(`${Yt} application has no active popup forms, skipping automatic display`);await e.api.ensureDeviceRegistered(),this.isRecurringVisitor=await e.data.getIsRecurringVisitor();const i=n?await e.api.getPopupForms():[];pn.debug(`${Yt} Received ${i.length} popup(s) from server:`,i.map(e=>e.code)),i.forEach((e,t)=>{this.entries.set(e.code,this.createEntry("campaign",e,t))}),await Promise.allSettled(Array.from(this.entries.values()).map(async e=>{e.passedStrongConditions=this.checkStrongCondition(e.popup),e.passedFrequency=await this.checkCanBeShownByFrequencyCondition(e.popup).catch(()=>!1),this.shouldPrefetchContent(e)&&await this.ensureContent(e)}));const r=this.loadedCodes();pn.debug(`${Yt} ${r.length} popup(s) passed strong conditions and loaded:`,r),this.subscribeToNavigation(),this.subscribeToPushPermission(),this.renderForCurrentPage(),this.watchClickTriggers(),this.placementsActive&&await this.pullPlacements(o),await e.data.setIsRecurringVisitor(!0)}finally{this.readyResolve(),e.dispatchEvent("web-popups-ready",{})}}async show(e){await this.readyPromise;const t=this.entries.get(e)??this.getContentEntry(e),n="campaign"===t.kind&&Po(t.popup);if(!n&&this.visible?.code===e)return!0;if(!zo(this.pw,t.popup))return pn.debug(`${Yt} show("${e}"): the visitor's push permission does not match the campaign`),!1;const o=await this.ensureContent(t);return o?"content"===t.kind&&Wt(o)?(pn.error(new Error("Web popup form needs a campaign"),`${Yt} show("${e}"): a form content is shown by a campaign only`),!1):t.productsEmpty?(pn.debug(`${Yt} show("${e}"): its products block has nothing to show`),!1):n?this.embedded.show(t,o):this.visible?.code===e||!!this.checkNotExpired(t)&&(this.visible&&(pn.debug(`${Yt} show("${e}") preempting "${this.visible.code}"`),this.visible.close("preempted")),this.detachFromAutoPipeline(t),this.present(t,"api"),!0):(pn.error(new Error("Web popup content unavailable"),`${Yt} show("${e}"): content unavailable`),!1)}hide(e){return!!this.visible&&((void 0===e||this.visible.code===e)&&(this.visible.close("api"),!0))}hideAll(){const e=this.hide();return this.entries.forEach(e=>{"waiting"!==e.state&&"queued"!==e.state||(this.detachFromAutoPipeline(e),e.state="done")}),this.cancelScheduledDrain(),e}isVisible(e){return!!this.visible&&(void 0===e||this.visible.code===e)}getVisibleCode(){return this.visible?.code??null}getAvailableCodes(){return Array.from(this.entries.keys())}getState(){const e=[];return this.entries.forEach((t,n)=>{"waiting"===t.state&&e.push(n)}),{visible:this.getVisibleCode(),queued:[...this.queue],waiting:e,available:this.getAvailableCodes()}}placementsAllowed(){return!1!==this.pw.initParams.webPlacements?.enable}acceptPlacements(){const{pw:e}=this;return this.placementsAllowed()&&"function"==typeof e.takeWebPlacements?(e.webPlacementsSink=e=>{this.receivePlacements(e).catch(e=>{pn.error(e,`${Yt} Failed to render journey placements`)})},e.takeWebPlacements()):[]}async receivePlacements(e){await this.readyPromise,this.placementsActive=!0,this.subscribeToNavigation(),await this.syncPlacements(e,!1)}async pullPlacements(e=[]){let t;try{t=await this.pw.api.getWebPlacements()}catch(t){return pn.error(t,`${Yt} Failed to load journey placements`),void await this.syncPlacements(e,!1)}await this.syncPlacements([...t,...e],!0)}async syncPlacements(e,t){const n=Date.now(),o=e.filter(e=>e.hash&&e.content_code&&!this.dismissedPlacements.has(e.hash)&&!Qo(e,n));if(t){const e=new Set(o.map(e=>e.hash));this.placementEntries.forEach((t,n)=>{e.has(n)||!Po(t.popup)&&"visible"===t.state||this.dropPlacement(t)})}o.forEach(e=>{if(this.placementEntries.has(e.hash))return;const t=this.createEntry("placement",function(e){return{code:e.hash,popup_form_content_code:e.content_code,device_type:"ALL",visitors_type:"ALL",matching_pages:[],delay:0,frequency:"EVERY_VISIT",trigger_type:"API",kind:"WEB_PLACEMENT_KIND_EMBEDDED"===e.kind?"EMBEDDED":"POPUP",css_selector:e.css_selector}}(e),-1);t.placement=e,this.placementEntries.set(e.hash,t),this.placementCounter+=1,this.placementSeq.set(e.hash,this.placementCounter),this.scheduleExpiry(t,n)}),await this.renderPlacements()}async renderPlacements(){const e=Array.from(this.placementEntries.values()).filter(e=>"done"!==e.state);await Promise.all(e.map(async e=>{const t=await this.ensureContent(e);t&&!Wt(t)||(t&&pn.error(new Error("Web popup form needs a campaign"),`${Yt} placement "${e.popup.code}": a form content is shown by a campaign only`),e.state="done")}));const t=e.filter(e=>"done"!==e.state&&e.content&&!e.productsEmpty);this.renderPlacementBlocks(t.filter(e=>Po(e.popup))),this.queuePlacementPopup(t.filter(e=>!Po(e.popup)))}renderPlacementBlocks(e){const t=new Map;e.forEach(e=>{const n=e.popup.css_selector??"",o=t.get(n);o&&!this.placementBeats(e,o)||t.set(n,e)});const n=new Set(t.values());this.embedded.removeWhere(e=>"placement"===e.kind&&!n.has(e)),n.forEach(e=>{this.embedded.show(e,e.content)})}queuePlacementPopup(e){const t=e.some(e=>"queued"===e.state||"visible"===e.state),n=e.filter(e=>"idle"===e.state);if(t||0===n.length)return;const o=n.reduce((e,t)=>this.placementBeats(t,e)?t:e);o.state="queued",this.insertIntoQueue(o),this.drain()}placementBeats(e,t){const n=Zo(e.placement)-Zo(t.placement);return 0!==n?n>0:(this.placementSeq.get(e.popup.code)??0)>(this.placementSeq.get(t.popup.code)??0)}scheduleExpiry(e,t){const n=Jo(e.placement);null===n||n-t>2**31-1||window.setTimeout(()=>{"visible"!==e.state&&this.dropPlacement(e)},n-t)}dropPlacement(e){this.embedded.removeWhere(t=>t===e),this.detachFromAutoPipeline(e),e.state="done",this.placementEntries.delete(e.popup.code)}dismissPlacement(e){this.dismissedPlacements.add(e.popup.code),this.dropPlacement(e),this.trackPlacement(e.popup.code,"WEB_PLACEMENT_ACTION_DISMISS")}onPlacementsNavigate(){this.placementsActive&&this.pullPlacements().catch(e=>{pn.error(e,`${Yt} Failed to refresh journey placements`)})}trackPlacement(e,t){if("WEB_PLACEMENT_ACTION_SHOW"===t){if(this.shownPlacements.has(e))return;this.shownPlacements.add(e)}"function"==typeof this.pw.api.trackWebPlacement&&this.pw.api.trackWebPlacement(e,t).catch(n=>{pn.error(n,`${Yt} Failed to record ${t} for placement "${e}"`)})}entryByCode(e){return this.entries.get(e)??this.placementEntries.get(e)}createEntry(e,t,n){return{kind:e,popup:t,order:n,state:"idle",content:null,loading:null,productsEmpty:!1,passedStrongConditions:!1,passedFrequency:!1,timeoutId:null,stopTriggerWatch:null,visitRecorded:!1}}getContentEntry(e){let t=this.contentEntries.get(e);return t||(t=this.createEntry("content",{code:e,popup_form_content_code:e,device_type:"ALL",visitors_type:"ALL",matching_pages:[],delay:0,frequency:"EVERY_VISIT",trigger_type:"API"},-1),this.contentEntries.set(e,t)),t}ensureContent(e){return e.content?Promise.resolve(e.content):(e.loading||(e.loading=this.loadContent(e.popup).then(async t=>(e.productsEmpty=!!t&&!await Oo(t,this.submitHandlers.products),e.content=t,t)).catch(t=>(pn.error(t,`${Yt} Failed to load web popup "${e.popup.code}"`),null)).finally(()=>{e.content||(e.loading=null)})),e.loading)}async loadContent(e){const t=(e=>{const t=nt(e);return t?0===Rt(t.params).length?null:t.params:null})((await this.pw.api.getPopupFormContent(e.popup_form_content_code)).json);return t||(pn.error(new Error("Unsupported popup content format"),`${Yt} Web popup "${e.code}" content is not a supported {version, params} popup; skipping`),null)}shouldPrefetchContent(e){return e.passedStrongConditions&&(Po(e.popup)||e.passedFrequency)}loadedCodes(){const e=[];return this.entries.forEach((t,n)=>{t.content&&e.push(n)}),e}renderForCurrentPage(){this.releaseUnmatchedPending();const e=[];this.entries.forEach((t,n)=>{this.canAutoDisplay(t)&&(this.arm(t),e.push(n))}),pn.debug(`${Yt} ${e.length} popup(s) selected for display on "${Ko()}":`,e),this.drain(),this.embedded.syncWithPage(this.entries.values(),e=>this.isAutoEligible(e))}canAutoDisplay(e){return!Po(e.popup)&&"idle"===e.state&&this.isAutoEligible(e)&&e.passedFrequency&&this.checkNotExpired(e)}isAutoEligible(e){return this.isAutoTrigger(e.popup)&&this.passesDisplayConditions(e)}passesDisplayConditions(e){return this.autoShowEnabled&&e.passedStrongConditions&&null!==e.content&&!e.productsEmpty&&this.checkSoftCondition(e.popup)&&zo(this.pw,e.popup)}isStillEligible(e){return!Qo(e.placement,Date.now())&&this.checkSoftCondition(e.popup)&&zo(this.pw,e.popup)&&this.checkNotExpired(e)}isAutoTrigger(e){const t=e.trigger_type;return!t||"PAGE_LOAD"===t||"SCROLL"===t||"EXIT_INTENT"===t}watchClickTriggers(){var e;Array.from(this.entries.values()).some(e=>"campaign"===e.kind&&Ht(e.popup))&&!this.stopClickWatch&&(this.stopClickWatch=(e=e=>this.onTriggerClick(e),document.addEventListener("click",e,!0),()=>document.removeEventListener("click",e,!0)))}onTriggerClick(e){if(this.visible)return;const t=Array.from(this.entries.values()).find(t=>this.isClickTarget(t,e));t&&(e.preventDefault(),pn.debug(`${Yt} Popup "${t.popup.code}" element clicked`),this.present(t,"auto"))}isClickTarget(e,t){const{popup:n}=e,o=n.css_selector??"";if("campaign"!==e.kind||!Ht(n)||!o||Po(n))return!1;if(!this.passesDisplayConditions(e)||!this.checkNotExpired(e))return!1;try{return Ut(t,o)}catch(e){return this.badClickSelectors.has(n.code)||(this.badClickSelectors.add(n.code),pn.debug(`${Yt} Popup "${n.code}": invalid css_selector "${o}"; its clicks are ignored`,e)),!1}}arm(e){e.state="waiting",this.recordVisit(e),Ho(e.popup)?this.armScrollDepth(e):Fo(e.popup)?this.armExitIntent(e):this.armDelay(e)}armDelay(e){const{popup:t}=e;pn.debug(`${Yt} Popup "${t.code}" armed for display in ${t.delay}s`),e.timeoutId=window.setTimeout(()=>{e.timeoutId=null,this.enqueueArmed(e,"delay elapsed")},1e3*t.delay)}armScrollDepth(e){const{popup:t}=e,n=function(e){const t=e.scroll_depth;return"number"!=typeof t||Number.isNaN(t)?0:Math.min(Math.max(t,0),100)}(t);pn.debug(`${Yt} Popup "${t.code}" armed for display at ${n}% scroll depth`),e.stopTriggerWatch=function(e,t){if(Uo()>=e)return t(),null;let n=null;const o="function"==typeof ResizeObserver?new ResizeObserver(s):null,i=()=>{window.removeEventListener("scroll",s),window.removeEventListener("resize",s),o?.disconnect(),null!==n&&(window.cancelAnimationFrame(n),n=null)},r=()=>{n=null,Uo()>=e&&(i(),t())};function s(){null===n&&(n=window.requestAnimationFrame(r))}return window.addEventListener("scroll",s,{passive:!0}),window.addEventListener("resize",s),o?.observe(document.documentElement),i}(n,()=>{e.stopTriggerWatch=null,e.timeoutId=window.setTimeout(()=>{e.timeoutId=null,this.enqueueArmed(e,"scroll depth reached")},0)})}armExitIntent(e){const{popup:t}=e,n="MOBILE"===this.pw.platformChecker.formFactor?"MOBILE":"DESKTOP";pn.debug(`${Yt} Popup "${t.code}" armed for display on exit intent (${n})`),e.stopTriggerWatch=function(e,t){let n=[];const o=()=>{n.forEach(e=>e()),n=[]},i=()=>(o(),t());return n="MOBILE"===e?[Lo(i),qo(i),No(i)]:[_o(i)],o}(n,()=>(e.stopTriggerWatch=null,this.enqueueArmed(e,"exit intent"),"visible"===e.state))}enqueueArmed(e,t){const{code:n}=e.popup;e.state="queued",this.insertIntoQueue(e),pn.debug(`${Yt} Popup "${n}" ${t}; queued at position ${this.queue.indexOf(n)+1} of ${this.queue.length}`),this.drain()}recordVisit(e){e.visitRecorded||"campaign"!==e.kind||(e.visitRecorded=!0,this.pw.api.recordPopupFormEvent(e.popup.code,1).catch(t=>{pn.error(t,`${Yt} Failed to record web popup visit event for "${e.popup.code}"`)}))}insertIntoQueue(e){const t=Xo(e.popup),n=this.queue.findIndex(n=>{const o=this.entryByCode(n);return!!o&&(Xo(o.popup)!==t?Xo(o.popup)>t:o.order>e.order)});-1!==n?this.queue.splice(n,0,e.popup.code):this.queue.push(e.popup.code)}releaseUnmatchedPending(){this.entries.forEach(e=>{"waiting"!==e.state&&"queued"!==e.state||this.isStillEligible(e)||(this.detachFromAutoPipeline(e),e.state="idle",pn.debug(`${Yt} Released popup "${e.popup.code}": page or push permission no longer matches, or its countdown passed`))})}detachFromAutoPipeline(e){null!==e.timeoutId&&(window.clearTimeout(e.timeoutId),e.timeoutId=null),null!==e.stopTriggerWatch&&(e.stopTriggerWatch(),e.stopTriggerWatch=null);const t=this.queue.indexOf(e.popup.code);-1!==t&&this.queue.splice(t,1)}drain(){if(this.visible||null!==this.drainTimeoutId)return;const e=this.queue.shift();if(void 0===e)return;const t=this.entryByCode(e);if(t&&"queued"===t.state){if(!this.isStillEligible(t))return t.state="idle",void this.drain();if(!t.content)return t.state="done",void this.drain();pn.debug(`${Yt} Display slot free; showing "${e}"`),this.present(t,"auto")}else this.drain()}scheduleDrain(){null===this.drainTimeoutId&&(this.drainTimeoutId=window.setTimeout(()=>{this.drainTimeoutId=null,this.drain()},400))}cancelScheduledDrain(){null!==this.drainTimeoutId&&(window.clearTimeout(this.drainTimeoutId),this.drainTimeoutId=null)}present(e,t){this.cancelScheduledDrain();const{popup:n,content:o}=e;if(!o)return void(e.state="done");const i=document.createElement("div");i.id=`${Kt}-${n.code}`,i.style.position="fixed",i.style.inset="0",i.style.zIndex=String(2147483647),i.style.pointerEvents="none",document.body.appendChild(i);const r=i.attachShadow({mode:"open"}),s=document.createElement("div");r.appendChild(s),this.listenForInteractions(s,e);const a=!!o.overlay;a&&this.lockBodyScroll();let c=!1;const l=t=>{c||(c=!0,a&&this.unlockBodyScroll(),Vo(s),i.remove(),this.visible?.code===n.code&&(this.visible=null),e.state="done",this.pw.dispatchEvent("hide-web-popup",{code:n.code,reason:t}),"placement"===e.kind&&"user"===t&&this.trackPlacement(n.code,"WEB_PLACEMENT_ACTION_DISMISS"),this.scheduleDrain())};this.visible={code:n.code,host:i,modal:a,close:l},e.state="visible",((e,t,n,o,i="auto")=>{(0,yn.render)((0,gn.jsx)(ko,{params:t,mode:"live",colorScheme:i,onRequestClose:n,onSubmitForm:Eo,onSubmitFormValues:o.onSubmitFormValues,onSubmitChoice:o.onSubmitChoice,onSubmitRating:o.onSubmitRating,onRequestSubscribe:o.onRequestSubscribe,products:o.products,logger:jo}),e)})(s,o,()=>l("user"),this.handlersFor(e),this.colorScheme),this.recordSubscriptionFormViews(n.code,o),pn.debug(`${Yt} Popup "${n.code}" shown (trigger: ${t})`),"campaign"===e.kind&&(this.recordVisit(e),this.markAsShown(n).catch(e=>{pn.error(e,`${Yt} Failed to mark web popup "${n.code}" as shown`)})),"placement"===e.kind&&this.trackPlacement(n.code,"WEB_PLACEMENT_ACTION_SHOW"),this.pw.dispatchEvent("show-web-popup",{code:n.code,trigger:t})}handlersFor(e){return{...this.submitHandlers,onSubmitFormValues:(t=this.pw,n=e.popup.code,async e=>{try{const o=await t.api.submitPopupForm(n,e);if("OK"===o.result)return"ok";if("INVALID_EMAIL"===o.result)return"invalid-email";throw new Error(`Unexpected submitPopupForm result "${o.result}"`)}catch(e){throw pn.error(e,`Failed to submit the form of web campaign "${n}"`),e}})};var t,n}recordSubscriptionFormViews(e,t){const n=function(e){const t=new Set;for(const n of e.pages)if(Array.isArray(n?.contents))for(const e of n.contents)if(Array.isArray(e?.slots))for(const n of e.slots)"object"==typeof n&&null!==n&&"email-subscription-form"===n.type&&"string"==typeof n.formCode&&n.formCode&&t.add(n.formCode);return[...t]}(t);0!==n.length&&this.pw.data.getHwid().then(e=>n.forEach(t=>((e,t)=>{fetch(Co(e,"/view"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,userId:t,hwid:t})}).catch(t=>{pn.error(t,`Failed to record subscription form view for "${e}"`)})})(t,e))).catch(t=>{pn.error(t,`${Yt} Failed to record subscription form views for web popup "${e}"`)})}lockBodyScroll(){0===this.openPopupsCount&&(this.bodyOverflowBeforeLock=document.body.style.overflow,document.body.style.overflow="hidden"),this.openPopupsCount+=1}unlockBodyScroll(){this.openPopupsCount=Math.max(0,this.openPopupsCount-1),0===this.openPopupsCount&&null!==this.bodyOverflowBeforeLock&&(document.body.style.overflow=this.bodyOverflowBeforeLock,this.bodyOverflowBeforeLock=null)}subscribeToNavigation(){if(this.isNavigationSubscribed)return;this.isNavigationSubscribed=!0;const e=()=>{this.renderForCurrentPage(),this.onPlacementsNavigate()},t=window.navigation;if(t&&"function"==typeof t.addEventListener)return void t.addEventListener("currententrychange",e);window.addEventListener("popstate",e),window.addEventListener("hashchange",e);let n=window.location.href;window.setInterval(()=>{window.location.href!==n&&(n=window.location.href,e())},500)}subscribeToPushPermission(){const e=()=>this.releaseByPushPermission();"function"!=typeof this.pw.addSdkEventHandler?this.pw.addEventHandler("change-permission",e):this.pw.addSdkEventHandler("change-permission",e)}releaseByPushPermission(){this.releaseUnmatchedPending(),this.embedded.removeWhere(e=>!zo(this.pw,e.popup))}checkStrongCondition(e){return this.checkCanBeShownByDeviceTypeCondition(e)&&this.checkCanBeShownByVisitorsTypeCondition(e)}checkSoftCondition(e){return this.checkCanBeShownByMatchingPagesCondition(e)}checkNotExpired(e){return!e.content||(!function(e,t){for(const n of e.pages)if(Array.isArray(n?.contents))for(const e of n.contents)if(Array.isArray(e?.slots))for(const n of e.slots){if("object"!=typeof n||null===n)continue;if("timer"!==n.type||"hide-popup"!==n.onExpire)continue;if("string"!=typeof n.endTime)continue;const e="string"==typeof n.timezone?n.timezone:"",o=Ue(n.endTime,e);if(null!==o&&o<=t)return!0}return!1}(e.content,Date.now())||(pn.debug(`${Yt} Popup "${e.popup.code}" not shown: its countdown has passed`),!1))}checkCanBeShownByDeviceTypeCondition(e){const{device_type:t}=e,n=this.pw.platformChecker.formFactor;return"ALL"===t||t===n}async checkCanBeShownByFrequencyCondition(e){const{frequency:t,code:n}=e;if(Ht(e))return!0;if("ONCE"===t){return!(await this.pw.data.getShownWebPopups()).includes(n)}return"ONCE_PER_SESSION"!==t||null===sessionStorage.getItem(this.getSessionStorageKey(n))}checkCanBeShownByMatchingPagesCondition(e){const{matching_pages:t,matching_page_rules:n,excluded_pages:o}=e,i=Ko();return n&&n.length>0?n.some(e=>this.matchPageRule(i,e)):t&&t.length>0?t.some(e=>Boolean(e)&&e===i):!(o&&o.length>0)||!o.some(e=>this.matchPageRule(i,e))}matchPageRule(e,t){if(!t.path)return!1;switch(t.operator){case"EQUALS":return e===t.path;case"STARTS_WITH":return e.startsWith(t.path);default:return!1}}checkCanBeShownByVisitorsTypeCondition(e){const{visitors_type:t}=e;return"NEW"===t?!this.isRecurringVisitor:"RECURRING"!==t||this.isRecurringVisitor}recordImpression(e){this.placementEntries.has(e)?this.trackPlacement(e,"WEB_PLACEMENT_ACTION_SHOW"):this.recordPopupShownEvent(e)}recordPopupShownEvent(e){this.pw.api.recordPopupFormEvent(e,2).catch(t=>{pn.error(t,`${Yt} Failed to record web popup shown event for "${e}"`)})}listenForInteractions(e,t){"placement"!==t.kind?"campaign"===t.kind&&Do(e,()=>{this.pw.api.recordPopupFormEvent(t.popup.code,3).catch(e=>{pn.error(e,`${Yt} Failed to record web popup interaction for "${t.popup.code}"`)})}):Do(e,()=>{"done"!==t.state&&this.trackPlacement(t.popup.code,"WEB_PLACEMENT_ACTION_CLICK")})}async markAsShown(e){this.recordPopupShownEvent(e.code);const{frequency:t,code:n}=e;Ht(e)||("ONCE"!==t?"ONCE_PER_SESSION"===t&&sessionStorage.setItem(this.getSessionStorageKey(n),"1"):await this.pw.data.addShownWebPopup(n))}getSessionStorageKey(e){return`${Kt}.shown.${e}`}}const Go={WEB_PLACEMENT_PRIORITY_LOW:1,WEB_PLACEMENT_PRIORITY_MEDIUM:2,WEB_PLACEMENT_PRIORITY_HIGH:3};function Zo(e){return Go[e?.priority??""]??Go.WEB_PLACEMENT_PRIORITY_MEDIUM}function Jo(e){const t=e?.expires_at?Date.parse(e.expires_at):NaN;return Number.isNaN(t)?null:t}function Qo(e,t){const n=Jo(e);return null!==n&&n<=t}function Xo(e){return Ho(e)||Fo(e)?0:e.delay}return s})());
2
2
  //# sourceMappingURL=widget-web-popups.js.map