web-push-notifications 3.69.0 → 3.71.0

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();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(this,()=>(()=>{"use strict";const e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};e.r(t),e.d(t,{WebPopupsWidget:()=>xr});const n=/^(https?:|mailto:|tel:)/i,o="#101828",r="#667085",i="#FFFFFF",s="#FFFFFF",a="#2970FF",l=o,c=r,u="#FFFFFF",d={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}},p={h1:1,h2:1,h3:1,icon:1,eyebrow:.8,body:.9,caption:.75};function f(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,[r,i,s]=[0,2,4].map(e=>parseInt(o.slice(e,e+2),16));return`rgba(${r}, ${i}, ${s}, ${t})`}(t.textInverse,p[e]??1):"icon"!==e?"caption"===e||"eyebrow"===e?t.textSecondary:t.text:void 0}const _=["h1","h2","h3","icon"];function h(e){return"glyph"===e.type?"heading":"text"!==e.type?"action":_.includes(e.variant)?"heading":"text"}const m="8px 0 4px";function y(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 g(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 v="Subscribe",b="Thanks for subscribing!",k="Please check your inbox and confirm your email.",w="Save",S="Thanks! Your choice is saved.",x="Send",C="Thanks for the feedback!";const E="Something went wrong. Please try again.",M="\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",P={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"},$=Object.keys(P),R=[24,32,48],A=["Vertical","Horizontal","Columns","Rows"],I=["normal","reverse"],F=["start","center","end","stretch"],N=["start","center","end","space-between"],T=["left","center","right"],j=["default","inverse"],O=2e3,L={px:O,"%":100,em:125,rem:125},H=/^(\d{1,4}(?:\.\d+)?)(px|%|em|rem)$/,z={px:O,"%":100,fr:100},D=/^(\d{1,4}(?:\.\d+)?)(px|%|fr)$/,U=["auto","min-content","max-content"];function W(e,t){return t.includes(e)?e:void 0}function q(e){if("number"==typeof e&&Number.isFinite(e))return Math.min(Math.max(e,0),O);if("string"!=typeof e)return;const t=H.exec(e.trim());if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),L[o])}${o}`}const B=["top","right","bottom","left"];function V(e){if(U.includes(e))return e;const t=D.exec(e);if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),z[o])}${o}`}function K(e){return"string"==typeof e&&e.length>0?e:void 0}function Z(e){const t={},n=q(e.gap);void 0!==n&&(t.gap=n);const o=function(e){const t=q(e);if(void 0!==t)return t;if("object"!=typeof e||null===e)return;const n={};for(const t of B){const o=q(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 r=W(e.alignItems,F);r&&(t.alignItems=r);const i=W(e.justifyContent,N);i&&(t.justifyContent=i);const s=W(e.alignContent,N);s&&(t.alignContent=s);const a=K(e.backgroundImage);a&&(t.backgroundImage=a);const l=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(V);return n.every(e=>void 0!==e)?n.join(" "):void 0}(e.sizes);return void 0!==l&&(t.sizes=l),t}function J(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,r="object"==typeof o.props&&null!==o.props?o.props:{};if("Content"===o.type){const e=K(r.content);if(!e)return null;const t={type:"Content",props:{content:e}},n=W(r.align,T);n&&(t.props.align=n);const o=W(r.tone,j);return o&&"default"!==o&&(t.props.tone=o),t}if("Image"===o.type){const e=K(r.image);if(!e)return null;return{type:"Image",props:{image:e}}}if(!Array.isArray(o.children))return null;const i=W(o.type,A)??"Vertical",s=[];for(const e of o.children){const o=J(e,t+1,n);o&&s.push(o)}const a=Z(r);return"reverse"===W(r.order,I)&&(s.reverse(),"string"==typeof a.sizes&&(a.sizes=a.sizes.split(" ").reverse().join(" "))),{type:i,props:a,children:s}}function Y(e){return J(e,0,{nodes:100})}const G=/^[a-zA-Z][a-zA-Z0-9-]*$/,Q=/^\$([a-zA-Z][a-zA-Z0-9-]*)$/;function X(e,t){return e.includes("$")?e.split(/(\s+)/).map(e=>{const n=Q.exec(e)?.[1];return void 0!==n&&Object.prototype.hasOwnProperty.call(t,n)?t[n]:e}).join(""):e}function ee(e,t){return"object"!=typeof e||null===e||0===Object.keys(t).length?e:ne(e,t,0)}const te=new Set(["content","image","backgroundImage"]);function ne(e,t,n){if(n>10||"object"!=typeof e||null===e)return e;const o=e,r={...o};if("object"==typeof o.props&&null!==o.props){const e={...o.props};for(const[n,o]of Object.entries(e))if(!te.has(n))if("string"==typeof o)e[n]=X(o,t);else if("object"==typeof o&&null!==o&&!Array.isArray(o)){const r={...o};for(const[e,n]of Object.entries(r))"string"==typeof n&&(r[e]=X(n,t));e[n]=r}r.props=e}return Array.isArray(o.children)&&(r.children=o.children.map(e=>ne(e,t,n+1))),r}function oe(e){return"number"==typeof e?`${e}px`:e}function re(e,t){if("string"==typeof e)return e;return`repeat(${"number"==typeof e?e:Math.max(t,1)}, 1fr)`}function ie(e=0){if(!(e>0))return null;const t=`rgba(16, 24, 40, ${Math.min(e,1)})`;return`linear-gradient(${t}, ${t})`}function se(e,t=0){const n=`url(${JSON.stringify(e)})`,o=ie(t);return{backgroundImage:o?`${o}, ${n}`:n,backgroundSize:"cover",backgroundPosition:"center"}}function ae(e,t,n=0){const o=e.props??{},r={display:"grid",minWidth:0};return"Horizontal"===e.type&&(r.gridAutoFlow="column"),"Columns"===e.type&&(r.gridTemplateColumns=re(o.sizes,e.children.length)),"Rows"===e.type&&(r.gridTemplateRows=re(o.sizes,e.children.length)),void 0!==o.gap&&(r.gap=oe(o.gap)),void 0!==o.padding&&(r.padding=function(e){if("number"==typeof e||"string"==typeof e)return oe(e);const t=e=>void 0===e?"0":oe(e);return`${t(e.top)} ${t(e.right)} ${t(e.bottom)} ${t(e.left)}`}(o.padding)),o.alignItems&&(r.alignItems=o.alignItems),o.justifyContent&&(r.justifyContent=o.justifyContent),o.alignContent&&(r.alignContent=o.alignContent),t&&Object.assign(r,se(t,n)),r}const le=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function ce(e){const t=le.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 ue([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 de(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 fe(e){return e<.5?.93-e*((.93-.5)/.5):e}function _e(e,t){const n=ce(e);if(!n)return e;const[o,r,i]=function([e,t,n]){const[o,r,i]=[e/255,t/255,n/255],s=Math.max(o,r,i),a=Math.min(o,r,i),l=(s+a)/2;if(s===a)return[0,0,l];const c=s-a;let u;return u=s===o?(r-i)/c+(r<i?6:0):s===r?(i-o)/c+2:(o-r)/c+4,[u/6,l>.5?c/(2-s-a):c/(s+a),l]}(n);return ue(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,r=2*n-o;return[255*de(r,o,e+1/3),255*de(r,o,e),255*de(r,o,e-1/3)]}([o,r,"fold"===t?pe(i):fe(i)]))}function he(e,t,n){const o=ce(e),r=ce(t);return o&&r?ue(o.map((e,t)=>e+(r[t]-e)*n)):e}function me(e,t){const n=ce(e);if(!n||t>=1)return e;const[o,r,i]=n;return`rgba(${o}, ${r}, ${i}, ${t})`}function ye(e){const t=ce(e);if(!t)return!1;const[n,o,r]=t;return(.299*n+.587*o+.114*r)/255>.6}function ge(e){return{background:_e(e.background,"fold"),accent:e.accent,text:_e(e.text,"lift"),textSecondary:_e(e.textSecondary,"lift"),textInverse:e.textInverse}}function ve(e,t){return"light"===t?{surface:s,surfaceText:o,border:"#D0D5DD",onAccent:i,error:"#D92D20",chromeIcon:r}:{surface:he(e.background,e.text,.08),surfaceText:e.text,border:he(e.background,e.text,.24),onAccent:ye(e.accent)?o:i,error:"#FDA29B",chromeIcon:e.textSecondary}}function be(e){return!0===e.dark?.enabled}function ke(e,t="light"){const n="dark"===t&&be(e)?"dark":"light",o="dark"===n?(r=e.colors,i=e.dark,{...ge(r),...i?.colors??{}}):e.colors;var r,i;return{...o,scheme:n,...ve(o,n)}}const we=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?$/,Se=new Map;function xe(e){const t=Se.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 Se.set(e,t),t}catch{return null}}function Ce(e){return!e||null!==xe(e)}function Ee(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 Me=864e5;const Pe=new Map;function $e(e,t){const n=`${e}|${t}`,o=Pe.get(n);if(void 0!==o)return o;const r=function(e,t){const n=we.exec((e||"").trim());if(!n)return null;const[,o,r,i,s,a,l]=n.map(Number),c=Number.isNaN(l)?0:l;if(r<1||r>12||i<1||i>31)return null;if(s>23||a>59||c>59)return null;const u=Date.UTC(o,r-1,i,s,a,c),d=new Date(u);if(d.getUTCMonth()!==r-1||d.getUTCDate()!==i)return null;if(!t)return u;const p=xe(t);if(!p)return null;const f=function(e,t){const n=[];for(const o of[e-Me,e,e+Me]){const e=Ee(o,t);n.includes(e)||n.push(e)}return n}(u,p),_=f.filter(e=>Ee(u-e,p)===e).map(e=>u-e);return _.length>0?Math.min(..._):u-Math.min(...f)}(e,t);return Pe.size>100&&Pe.clear(),Pe.set(n,r),r}const Re={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 Ae(e){const t=(e||"").trim();if(t)return t.startsWith("#")||t.startsWith("/")||t.startsWith("?")||n.test(t)?t:void 0}function Ie(e){return"_self"===e?{target:"_self"}:{target:"_blank",rel:"noreferrer"}}const Fe=new Set(["STRONG","B","EM","I","U","BR","A"]);function Ne(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(!Fe.has(e.tagName)){Ne(e,t,n);continue}const r=n.createElement(e.tagName.toLowerCase());if("A"===e.tagName){const t=Ae(e.getAttribute("href")??void 0);t&&r.setAttribute("href",t);const{target:n,rel:o}=Ie(e.getAttribute("target"));r.setAttribute("target",n),o&&r.setAttribute("rel",o)}t.appendChild(r),Ne(e,r,n)}}function Te(e){if(!e.includes("<"))return e;const t=(new DOMParser).parseFromString(e,"text/html"),n=t.createElement("div");return Ne(t.body,n,t),n.innerHTML}function je(e){return"string"==typeof e&&e?e:void 0}function Oe(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 r=function(e){const t="object"==typeof e.colors&&null!==e.colors?e.colors:{};return{background:je(t.background)??je(e.background)??s,accent:je(t.accent)??je(e.accent)??a,text:je(t.text)??l,textSecondary:je(t.textSecondary)??c,textInverse:je(t.textInverse)??u}}(o),i=function(e,t){const n=e.dark;if("object"!=typeof n||null===n)return;const o=n,r="object"==typeof o.colors&&null!==o.colors?o.colors:{},i=ge(t);return{enabled:!0===o.enabled,colors:{background:je(r.background)??i.background,accent:je(r.accent)??i.accent,text:je(r.text)??i.text,textSecondary:je(r.textSecondary)??i.textSecondary,textInverse:je(r.textInverse)??i.textInverse}}}(o,r);return{version:2,params:{...o,colors:r,...i?{dark:i}:{}}}}const Le=["cover","contain"];function He(e){if("object"!=typeof e||null===e)return;const t=e,n=Ae("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 ze(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=He(n.video);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",src:n.src,...e?{video:e}:{},..."string"==typeof n.mediaId&&n.mediaId?{mediaId:n.mediaId}:{},...Le.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 De=["px","%","em","rem","fr"];function Ue(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}function We(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=Ue(t.min),n=Ue(t.max),o="length"===t.kind&&Array.isArray(t.units)?t.units.filter(e=>De.includes(e)):[],r="length"===t.kind?function(e){if("object"!=typeof e||null===e)return;const t={};for(const n of De){const o=e[n];if("object"!=typeof o||null===o)continue;const r=Ue(o.min),i=Ue(o.max);void 0===r&&void 0===i||(t[n]={...void 0!==r?{min:r}:{},...void 0!==i?{max:i}:{}})}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}:{},...r?{ranges:r}:{}}}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 qe(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||!G.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=We(n.control);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",value:n.value,...e?{control:e}:{}})}return t}function Be(e){return Object.fromEntries(e.map(e=>[e.key,e.value]))}const Ve=["email","firstName","lastName","phone","custom"],Ke=["primary","secondary"];function Ze(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&&Ve.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 Je=["checkbox","chips"],Ye=["nps","stars","thumbs"],Ge=["instant","button"],Qe=["keep","hide-popup","page"],Xe=/^[a-z]{2}$/i,et=/^#[0-9a-fA-F]{6}$/;function tt(e,t=120){return"string"==typeof e?e.trim().slice(0,t):""}function nt(e,t,n=120){return tt(e,n)||t}function ot(e){const t=tt(e,8);return Xe.test(t)?t.toLowerCase():""}function rt(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=tt(n.value);if(!e)continue;if(t.some(t=>t.value===e))continue;const o=tt(n.tagValue);t.push({value:e,label:nt(n.label,e),...o?{tagValue:o}:{}})}return t}function it(e,t){const n=e=>{const n=Ue(e);return void 0===n||n<=0?0:Math.min(Math.floor(n),t)},o=n(e.min),r=n(e.max);return{min:o,max:r>0?Math.max(o,r):0}}function st(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=tt(n.timezone,64),o=Ce(e)?e:"",r=tt(n.endTime,32);if(null===$e(r,o))continue;const i=tt(n.expirePage),s=Qe.includes(n.onExpire)?n.onExpire:"keep",a="page"!==s||i?s:"keep";t.push({type:"timer",key:n.key,endTime:r,timezone:o,language:ot(n.language),showLabels:!1!==n.showLabels,onExpire:a,..."page"===a?{expirePage:i}:{}});continue}if("choice"===n.type){const e=rt(n.options),{min:o,max:r}=it(n,e.length);t.push({type:"choice",key:n.key,control:Je.includes(n.control)?n.control:"checkbox",tagName:tt(n.tagName),options:e,min:o,max:r,submitLabel:nt(n.submitLabel,w),submitVariant:Ke.includes(n.submitVariant)?n.submitVariant:"primary",successMessage:nt(n.successMessage,S,500)});continue}if("rating"===n.type){const e="object"==typeof n.labels&&null!==n.labels?n.labels:{};t.push({type:"rating",key:n.key,scale:Ye.includes(n.scale)?n.scale:"stars",labels:{low:tt(e.low),high:tt(e.high)},submitMode:Ge.includes(n.submitMode)?n.submitMode:"instant",submitLabel:nt(n.submitLabel,x),eventName:tt(n.eventName),successMessage:nt(n.successMessage,C,500)});continue}if("glyph"!==n.type)"email-subscription-form"===n.type&&t.push({type:"email-subscription-form",key:n.key,formCode:"string"==typeof n.formCode?n.formCode:"",fields:Ze(n.fields),submitLabel:"string"==typeof n.submitLabel&&n.submitLabel?n.submitLabel:v,submitVariant:Ke.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:b,confirmEmailMessage:"string"==typeof n.confirmEmailMessage&&n.confirmEmailMessage?n.confirmEmailMessage:k});else{if(!$.includes(n.name))continue;t.push({type:"glyph",key:n.key,name:n.name,size:R.includes(n.size)?n.size:R[0],color:"string"==typeof n.color&&et.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:st(n.slots)}))}return t}function lt(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.min(e,2e3):void 0}function ct(e,t,n){if(null===e)return;let o;return o="stretch"===e?"stretch":lt(e)??("stretch"===t?"stretch":lt(t)),"width"===n&&"stretch"===o?void 0:o}function ut(e){const t=[];for(const n of e.pages){const o=qe(n.values),r=Y(ee(n.layout,Be(o)));if(!r)continue;const i=ct(n.width,e.width,"width"),s=ct(n.height,e.height,"height");t.push({key:n.key,layout:r,images:ze(n.images),contents:at(n.contents),...void 0!==i?{width:i}:{},...void 0!==s?{height:s}:{}})}return t}function dt(e){return`calc(100% - ${2*e.offset}px)`}const pt="pushwoosh-web-popups",ft="[WebPopups]",_t="keyValue",ht="messages",mt="inboxMessages";function yt(e,t){return function(n){n.objectStoreNames.contains(e)||t(n)}}const gt=[yt(_t,function(e){e.createObjectStore(_t,{keyPath:"key"})}),yt("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})}),yt(ht,function(e){e.createObjectStore(ht,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),yt(mt,function(e){const t="status",n=e.createObjectStore(mt,{keyPath:"inbox_id",autoIncrement:!1});n.createIndex(t,t,{unique:!1,multiEntry:!0}),n.createIndex("rt","rt",{unique:!1,multiEntry:!0})})];class vt{get all(){return gt}}class bt{constructor(e,t=new vt){this.db=e,this.migrationsBuilder=t}applyMigrations(){this.applyMigrationsPack(this.migrationsBuilder.all)}applyMigrationsPack(e){e.forEach(e=>{e(this.db)})}}function kt(e,t){console.info("onversionchange",t),e.close()}let wt;function St(e){return(wt||(wt=new Promise((e,t)=>{const n=indexedDB.open("PUSHWOOSH_SDK_STORE",7);n.onsuccess=n=>{const o=n.target.result;o.onversionchange=kt.bind(null,o,t),e(o)},n.onerror=()=>t(n.error),n.onupgradeneeded=e=>{const n=e.target.result;n.onversionchange=kt.bind(null,n,t),new bt(n).applyMigrations()}})),wt).then(t=>new Promise((n,o)=>e(t,n,o)))}class xt{_add(e){return St((t,n,o)=>{const r=t.transaction([this.name],"readwrite").objectStore(this.name).add(e);r.onsuccess=()=>{n(e)},r.onerror=()=>{o(r.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 St((t,n,o)=>{const r=t.transaction([this.name],"readwrite").objectStore(this.name).delete(e);r.onsuccess=()=>{n(r.result)},r.onerror=()=>{o(r.error)}})}getAll(){return St((e,t,n)=>{const o=[],r=e.transaction(this.name).objectStore(this.name).openCursor();r.onsuccess=e=>{const n=e.target.result;n?(n.value&&o.push(n.value),n.continue()):t(o)},r.onerror=()=>{n(r.error)}})}}Ct=_t;var Ct;const Et=new class extends xt{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)}},Mt=(new class extends xt{constructor(){super(...arguments),this.name=ht,this.maxItems=25}add(e){return this._add({...e,date:new Date})}},{error:1,info:2,debug:3});let Pt=3;const $t={setLevel(e){Mt[e]||(e="error"),Pt=Mt[e]},write(e,t,n){return"error"===e?this.error(t):this.info(t),Et.add(e,t,n)}};function Rt(e){return async({slotKey:t,tagName:n,values:o})=>{try{await e.api.setTags({[n]:{operation:"append",value:o}})}catch(e){throw $t.error(e,`Failed to write web popup choice "${t}" to tag "${n}"`),e}}}function At(e){return async({slotKey:t,eventName:n,score:o,scale:r})=>{try{await e.api.postEvent(n,{score:o,scale:r,slotKey:t})}catch(e){throw $t.error(e,`Failed to post web popup rating "${t}" as event "${n}"`),e}}}Object.keys(Mt).forEach(e=>{const t=Mt[e];$t[e]=(...n)=>{t<=Pt&&(console.groupCollapsed(e),console.info("",...n),console.trace("trace"),console.groupEnd())}});var It,Ft,Nt,Tt,jt,Ot,Lt,Ht,zt,Dt,Ut,Wt,qt,Bt,Vt,Kt={},Zt=[],Jt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Yt=Array.isArray;function Gt(e,t){for(var n in t)e[n]=t[n];return e}function Qt(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Xt(e,t,n){var o,r,i,s={};for(i in t)"key"==i?o=t[i]:"ref"==i?r=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?It.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return en(e,s,o,r,null)}function en(e,t,n,o,r){var i={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Nt,__i:-1,__u:0};return null==r&&null!=Ft.vnode&&Ft.vnode(i),i}function tn(e){return e.children}function nn(e,t){this.props=e,this.context=t}function on(e,t){if(null==t)return e.__?on(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?on(e):null}function rn(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],r=[],i=Gt({},t);i.__v=t.__v+1,Ft.vnode&&Ft.vnode(i),yn(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??on(t),!!(32&t.__u),r),i.__v=t.__v,i.__.__k[i.__i]=i,vn(o,i,r),t.__e=t.__=null,i.__e!=n&&sn(i)}}function sn(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some(function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e}),sn(e)}function an(e){(!e.__d&&(e.__d=!0)&&Tt.push(e)&&!ln.__r++||jt!=Ft.debounceRendering)&&((jt=Ft.debounceRendering)||Ot)(ln)}function ln(){try{for(var e,t=1;Tt.length;)Tt.length>t&&Tt.sort(Lt),e=Tt.shift(),t=Tt.length,rn(e)}finally{Tt.length=ln.__r=0}}function cn(e,t,n,o,r,i,s,a,l,c,u){var d,p,f,_,h,m,y=o&&o.__k||Zt,g=t.length;for(l=un(n,t,y,l,g),d=0;d<g;d++)null!=(f=n.__k[d])&&(p=-1!=f.__i&&y[f.__i]||Kt,f.__i=d,m=yn(e,f,p,r,i,s,a,l,c,u),_=f.__e,f.ref&&p.ref!=f.ref&&(p.ref&&wn(p.ref,null,f),u.push(f.ref,f.__c||_,f)),null==h&&null!=_&&(h=_),4&f.__u?(l=dn(f,l,e),p.__e&&(p.__e=null)):"function"==typeof f.type&&void 0!==m?l=m:_&&(l=_.nextSibling),f.__u&=-7);return n.__e=h,l}function un(e,t,n,o,r){var i,s,a,l,c,u=n.length,d=u,p=0;for(e.__k=new Array(r),i=0;i<r;i++)null!=(s=t[i])&&"boolean"!=typeof s&&"function"!=typeof s?("string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?s=e.__k[i]=en(null,s,null,null,null):Yt(s)?s=e.__k[i]=en(tn,{children:s},null,null,null):void 0===s.constructor&&s.__b>0?s=e.__k[i]=en(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[i]=s,l=i+p,s.__=e,s.__b=e.__b+1,a=null,-1!=(c=s.__i=fn(s,n,l,d))&&(d--,(a=n[c])&&(a.__u|=2)),null==a||null==a.__v?(-1==c&&(r>u?p--:r<u&&p++),"function"!=typeof s.type&&(s.__u|=4)):c!=l&&(c==l-1?p--:c==l+1?p++:(c>l?p--:p++,s.__u|=4))):e.__k[i]=null;if(d)for(i=0;i<u;i++)null!=(a=n[i])&&!(2&a.__u)&&(a.__e==o&&(o=on(a)),Sn(a,a));return o}function dn(e,t,n){var o,r;if("function"==typeof e.type){for(o=e.__k,r=0;o&&r<o.length;r++)o[r]&&(o[r].__=e,t=dn(o[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=on(e)),t=n.insertBefore(e.__e,t||null));do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function pn(e,t){return t=t||[],null==e||"boolean"==typeof e||(Yt(e)?e.some(function(e){pn(e,t)}):t.push(e)),t}function fn(e,t,n,o){var r,i,s,a=e.key,l=e.type,c=t[n],u=null!=c&&!(2&c.__u);if(null===c&&null==a||u&&a==c.key&&l==c.type)return n;if(o>(u?1:0))for(r=n-1,i=n+1;r>=0||i<t.length;)if(null!=(c=t[s=r>=0?r--:i++])&&!(2&c.__u)&&a==c.key&&l==c.type)return s;return-1}function _n(e,t,n){"-"==t[0]?e.setProperty(t,n??""):e[t]=null==n?"":"number"!=typeof n||Jt.test(t)?n:n+"px"}function hn(e,t,n,o,r){var i,s;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof o&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||_n(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||_n(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(Ut,"$1")),s=t.toLowerCase(),t=s in e||"onFocusOut"==t||"onFocusIn"==t?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n[Dt]=o[Dt]:(n[Dt]=Wt,e.addEventListener(t,i?Bt:qt,i)):e.removeEventListener(t,i?Bt:qt,i);else{if("http://www.w3.org/2000/svg"==r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=n??"";break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function mn(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t[zt])t[zt]=Wt++;else if(t[zt]<n[Dt])return;return n(Ft.event?Ft.event(t):t)}}}function yn(e,t,n,o,r,i,s,a,l,c){var u,d,p,f,_,h,m,y,g,v,b,k,w,S,x,C,E=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),i=[a=t.__e=n.__e]),(u=Ft.__b)&&u(t);e:if("function"==typeof E){d=s.length;try{if(g=t.props,v=E.prototype&&E.prototype.render,b=(u=E.contextType)&&o[u.__c],k=u?b?b.props.value:u.__:o,n.__c?y=(p=t.__c=n.__c).__=p.__E:(v?t.__c=p=new E(g,k):(t.__c=p=new nn(g,k),p.constructor=E,p.render=xn),b&&b.sub(p),p.state||(p.state={}),p.__n=o,f=p.__d=!0,p.__h=[],p._sb=[]),v&&null==p.__s&&(p.__s=p.state),v&&null!=E.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=Gt({},p.__s)),Gt(p.__s,E.getDerivedStateFromProps(g,p.__s))),_=p.props,h=p.state,p.__v=t,f)v&&null==E.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),v&&null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(v&&null==E.getDerivedStateFromProps&&g!==_&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(g,k),t.__v==n.__v||!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(g,p.__s,k)){t.__v!=n.__v&&(p.props=g,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),Zt.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&s.push(p),a=on(n);break e}null!=p.componentWillUpdate&&p.componentWillUpdate(g,p.__s,k),v&&null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(_,h,m)})}if(p.context=k,p.props=g,p.__P=e,p.__e=!1,w=Ft.__r,S=0,v)p.state=p.__s,p.__d=!1,w&&w(t),u=p.render(p.props,p.state,p.context),Zt.push.apply(p.__h,p._sb),p._sb=[];else do{p.__d=!1,w&&w(t),u=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++S<25);p.state=p.__s,null!=p.getChildContext&&(o=Gt(Gt({},o),p.getChildContext())),v&&!f&&null!=p.getSnapshotBeforeUpdate&&(m=p.getSnapshotBeforeUpdate(_,h)),x=null!=u&&u.type===tn&&null==u.key?bn(u.props.children):u,a=cn(e,Yt(x)?x:[x],t,n,o,r,i,s,a,l,c),p.base=t.__e,t.__u&=-161,p.__h.length&&s.push(p),y&&(p.__E=p.__=null)}catch(e){if(s.length=d,t.__v=null,l||null!=i){if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=i&&(i[i.indexOf(a)]=null),t.__e=a}else if(null!=i)for(C=i.length;C--;)Qt(i[C])}else t.__e=n.__e;null==t.__k&&(t.__k=n.__k||[]),e.then||gn(t),Ft.__e(e,t,n)}}else null==i&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):a=t.__e=kn(n.__e,t,n,o,r,i,s,l,c);return(u=Ft.diffed)&&u(t),128&t.__u?void 0:a}function gn(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(gn))}function vn(e,t,n){for(var o=0;o<n.length;o++)wn(n[o],n[++o],n[++o]);Ft.__c&&Ft.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Ft.__e(e,t.__v)}})}function bn(e){return"object"!=typeof e||null==e||e.__b>0?e:Yt(e)?e.map(bn):void 0!==e.constructor?null:Gt({},e)}function kn(e,t,n,o,r,i,s,a,l){var c,u,d,p,f,_,h,m=n.props||Kt,y=t.props,g=t.type;if("svg"==g?r="http://www.w3.org/2000/svg":"math"==g?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),null!=i)for(c=0;c<i.length;c++)if((f=i[c])&&"setAttribute"in f==!!g&&(g?f.localName==g:3==f.nodeType)){e=f,i[c]=null;break}if(null==e){if(null==g)return document.createTextNode(y);e=document.createElementNS(r,g,y.is&&y),a&&(Ft.__m&&Ft.__m(t,i),a=!1),i=null}if(null==g)m===y||a&&e.data==y||(e.data=y);else{if(i="textarea"==g&&null!=y.defaultValue?null:i&&It.call(e.childNodes),!a&&null!=i)for(m={},c=0;c<e.attributes.length;c++)m[(f=e.attributes[c]).name]=f.value;for(c in m)f=m[c],"dangerouslySetInnerHTML"==c?d=f:"children"==c||c in y||"value"==c&&"defaultValue"in y||"checked"==c&&"defaultChecked"in y||hn(e,c,null,f,r);for(c in y)f=y[c],"children"==c?p=f:"dangerouslySetInnerHTML"==c?u=f:"value"==c?_=f:"checked"==c?h=f:a&&"function"!=typeof f||m[c]===f||hn(e,c,f,m[c],r);if(u)a||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=""),cn("template"==t.type?e.content:e,Yt(p)?p:[p],t,n,o,"foreignObject"==g?"http://www.w3.org/1999/xhtml":r,i,s,i?i[0]:n.__k&&on(n,0),a,l),null!=i)for(c=i.length;c--;)Qt(i[c]);a&&"textarea"!=g||(c="value","progress"==g&&null==_?e.removeAttribute("value"):null!=_&&(_!==e[c]||"progress"==g&&!_||"option"==g&&_!=m[c])&&hn(e,c,_,m[c],r),c="checked",null!=h&&h!=e[c]&&hn(e,c,h,m[c],r))}return e}function wn(e,t,n){try{if("function"==typeof e){var o="function"==typeof e.__u;o&&e.__u(),o&&null==t||(e.__u=e(t))}else e.current=t}catch(e){Ft.__e(e,n)}}function Sn(e,t,n){var o,r;if(Ft.unmount&&Ft.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||wn(o,null,t)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){Ft.__e(e,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&Sn(o[r],t,n||"function"!=typeof e.type);n||Qt(e.__e),e.__c=e.__=e.__e=void 0}function xn(e,t,n){return this.constructor(e,n)}function Cn(e,t,n){var o,r,i,s;t==document&&(t=document.documentElement),Ft.__&&Ft.__(e,t),r=(o="function"==typeof n)?null:n&&n.__k||t.__k,i=[],s=[],yn(t,e=(!o&&n||t).__k=Xt(tn,null,[e]),r||Kt,Kt,t.namespaceURI,!o&&n?[n]:r?null:t.firstChild?It.call(t.childNodes):null,i,!o&&n?n:r?r.__e:t.firstChild,o,s),vn(i,e,s),e.props.children=null}function En(e,t){Cn(e,t,En)}function Mn(e,t,n){var o,r,i,s,a=Gt({},e.props);for(i in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)"key"==i?o=t[i]:"ref"==i?r=t[i]:a[i]=void 0===t[i]&&null!=s?s[i]:t[i];return arguments.length>2&&(a.children=arguments.length>3?It.call(arguments,2):n),en(e.type,a,o||e.key,r||e.ref,null)}It=Zt.slice,Ft={__e:function(e,t,n,o){for(var r,i,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&null!=i.getDerivedStateFromError&&(r.setState(i.getDerivedStateFromError(e)),s=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,o||{}),s=r.__d),s)return r.__E=r}catch(t){e=t}throw e}},Nt=0,nn.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=Gt({},this.state),"function"==typeof e&&(e=e(Gt({},n),this.props)),e&&Gt(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),an(this))},nn.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),an(this))},nn.prototype.render=tn,Tt=[],Ot="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Lt=function(e,t){return e.__v.__b-t.__v.__b},ln.__r=0,Ht=Math.random().toString(8),zt="__d"+Ht,Dt="__a"+Ht,Ut=/(PointerCapture)$|Capture$/i,Wt=0,qt=mn(!1),Bt=mn(!0),Vt=0;var Pn=0;Array.isArray;function $n(e,t,n,o,r,i){t||(t={});var s,a,l=t;if("ref"in l)for(a in l={},t)"ref"==a?s=t[a]:l[a]=t[a];var c={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Pn,__i:-1,__u:0,__source:r,__self:i};if("function"==typeof e&&(s=e.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return Ft.vnode&&Ft.vnode(c),c}var Rn,An,In,Fn,Nn=0,Tn=[],jn=Ft,On=jn.__b,Ln=jn.__r,Hn=jn.diffed,zn=jn.__c,Dn=jn.unmount,Un=jn.__;function Wn(e,t){jn.__h&&jn.__h(An,e,Nn||t),Nn=0;var n=An.__H||(An.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function qn(e){return Nn=1,Bn(ao,e)}function Bn(e,t,n){var o=Wn(Rn++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):ao(void 0,t),function(e){var t=o.__N?o.__N[0]:o.__[0],n=o.t(t,e);t!==n&&(o.__N=[n,o.__[1]],o.__c.setState({}))}],o.__c=An,!An.__f)){var r=function(e,t,n){if(!o.__c.__H)return!0;var r=!1,s=o.__c.props!==e;if(o.__c.__H.__.some(function(e){if(e.__N){r=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),i){var a=i.call(this,e,t,n);return r?a||s:a}return!r||s};An.__f=!0;var i=An.shouldComponentUpdate,s=An.componentWillUpdate;An.componentWillUpdate=function(e,t,n){if(this.__e){var o=i;i=void 0,r(e,t,n),i=o}s&&s.call(this,e,t,n)},An.shouldComponentUpdate=r}return o.__N||o.__}function Vn(e,t){var n=Wn(Rn++,3);!jn.__s&&so(n.__H,t)&&(n.__=e,n.u=t,An.__H.__h.push(n))}function Kn(e,t){var n=Wn(Rn++,4);!jn.__s&&so(n.__H,t)&&(n.__=e,n.u=t,An.__h.push(n))}function Zn(e){return Nn=5,Yn(function(){return{current:e}},[])}function Jn(e,t,n){Nn=6,Kn(function(){if("function"==typeof e){var n=e(t());return function(){e(null),n&&"function"==typeof n&&n()}}if(e)return e.current=t(),function(){return e.current=null}},null==n?n:n.concat(e))}function Yn(e,t){var n=Wn(Rn++,7);return so(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Gn(e,t){return Nn=8,Yn(function(){return e},t)}function Qn(e){var t=An.context[e.__c],n=Wn(Rn++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(An)),t.props.value):e.__}function Xn(e,t){jn.useDebugValue&&jn.useDebugValue(t?t(e):e)}function eo(){var e=Wn(Rn++,11);if(!e.__){for(var t=An.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function to(){for(var e;e=Tn.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ro),t.__h.some(io),t.__h=[]}catch(n){t.__h=[],jn.__e(n,e.__v)}}}jn.__b=function(e){An=null,On&&On(e)},jn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Un&&Un(e,t)},jn.__r=function(e){Ln&&Ln(e),Rn=0;var t=(An=e.__c).__H;t&&(In===An?(t.__h=[],An.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(ro),t.__h.some(io),t.__h=[],Rn=0)),In=An},jn.diffed=function(e){Hn&&Hn(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Tn.push(t)&&Fn===jn.requestAnimationFrame||((Fn=jn.requestAnimationFrame)||oo)(to)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),In=An=null},jn.__c=function(e,t){t.some(function(e){try{e.__h.some(ro),e.__h=e.__h.filter(function(e){return!e.__||io(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],jn.__e(n,e.__v)}}),zn&&zn(e,t)},jn.unmount=function(e){Dn&&Dn(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{ro(e)}catch(e){t=e}}),n.__H=void 0,t&&jn.__e(t,n.__v))};var no="function"==typeof requestAnimationFrame;function oo(e){var t,n=function(){clearTimeout(o),no&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);no&&(t=requestAnimationFrame(n))}function ro(e){var t=An,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),An=t}function io(e){var t=An;e.__c=e.__(),An=t}function so(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function ao(e,t){return"function"==typeof t?t(e):t}function lo(e,t){for(var n in t)e[n]=t[n];return e}function co(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var o in t)if("__source"!==o&&e[o]!==t[o])return!0;return!1}function uo(e,t){var n=t(),o=qn({t:{__:n,u:t}}),r=o[0].t,i=o[1];return Kn(function(){r.__=n,r.u=t,po(r)&&i({t:r})},[e,n,t]),Vn(function(){return po(r)&&i({t:r}),e(function(){po(r)&&i({t:r})})},[e]),n}function po(e){try{return!((t=e.__)===(n=e.u())&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}var t,n}function fo(e){e()}function _o(e){return e}function ho(){return[!1,fo]}var mo=Kn;function yo(e,t){this.props=e,this.context=t}(yo.prototype=new nn).isPureReactComponent=!0,yo.prototype.shouldComponentUpdate=function(e,t){return co(this.props,e)||co(this.state,t)};var go=Ft.__b;Ft.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),go&&go(e)};var vo="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var bo=function(e,t){return null==e?null:pn(pn(e).map(t))},ko={map:bo,forEach:bo,count:function(e){return e?pn(e).length:0},only:function(e){var t=pn(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:pn},wo=Ft.__e;Ft.__e=function(e,t,n,o){if(e.then)for(var r,i=t;i=i.__;)if((r=i.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k||[]),r.__c(e,t);wo(e,t,n,o)};var So=Ft.unmount;function xo(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),e.__c.__H=null),null!=(e=lo({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return xo(e,t,n)})),e}function Co(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return Co(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Eo(){this.__u=0,this.o=null,this.__b=null}function Mo(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Po(){this.i=null,this.l=null}Ft.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),So&&So(e)},(Eo.prototype=new nn).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var r=Mo(o.__v),i=!1,s=function(){i||o.__z||(i=!0,n.__R=null,r?r(l):l())};n.__R=s;var a=n.__P;n.__P=null;var l=function(){if(! --o.__u){if(o.state.__a){var e=o.state.__a;o.__v.__k[0]=Co(e,e.__c.__P,e.__c.__O)}var t;for(o.setState({__a:o.__b=null});t=o.o.pop();)t.__P=a,t.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(s,s)},Eo.prototype.componentWillUnmount=function(){this.o=[]},Eo.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=xo(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&Xt(tn,null,e.fallback);return r&&(r.__u&=-33),[Xt(tn,null,t.__a?null:e.children),r]};var $o=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function Ro(e){return this.getChildContext=function(){return e.context},e.children}function Ao(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){Cn(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var o=t.__v;null!==o&&!o.__m&&null!==o.__;)o=o.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:o.__m},contains:function(){return!0},namespaceURI:n.namespaceURI,insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}Cn(Xt(Ro,{context:t.context},e.__v),t.v)}(Po.prototype=new nn).__a=function(e){var t=this,n=Mo(t.__v),o=t.l.get(e);return o[0]++,function(r){var i=function(){t.props.revealOrder?(o.push(r),$o(t,e,o)):r()};n?n(i):i()}},Po.prototype.render=function(e){this.i=null,this.l=new Map;var t=pn(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Po.prototype.componentDidUpdate=Po.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){$o(e,n,t)})};var Io="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,Fo=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,No=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,To=/[A-Z0-9]/g,jo="undefined"!=typeof document,Oo=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};nn.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(nn.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Lo=Ft.event;Ft.event=function(e){return Lo&&(e=Lo(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Ho,zo={configurable:!0,get:function(){return this.class}},Do=Ft.vnode;Ft.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,o={},r=-1==n.indexOf("-");for(var i in t){var s=t[i];if(!("value"===i&&"defaultValue"in t&&null==s||jo&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var a=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===s?s="":"translate"===a&&"no"===s?s=!1:"o"===a[0]&&"n"===a[1]?"ondoubleclick"===a?i="ondblclick":"onchange"!==a||"input"!==n&&"textarea"!==n||Oo(t.type)?"onfocus"===a?i="onfocusin":"onblur"===a?i="onfocusout":No.test(i)&&(i=a):a=i="oninput":r&&Fo.test(i)?i=i.replace(To,"-$&").toLowerCase():null===s&&(s=void 0),"oninput"===a&&o[i=a]&&(i="oninputCapture"),o[i]=s}}"select"==n&&(o.multiple&&Array.isArray(o.value)&&(o.value=pn(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),null!=o.defaultValue&&(o.value=pn(t.children).forEach(function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value}))),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",zo)):t.className&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=Io,Do&&Do(e)};var Uo=Ft.__r;Ft.__r=function(e){Uo&&Uo(e),Ho=e.__c};var Wo=Ft.diffed;Ft.diffed=function(e){Wo&&Wo(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),Ho=null};var qo={ReactCurrentDispatcher:{current:{readContext:function(e){return Ho.__n[e.__c].props.value},useCallback:Gn,useContext:Qn,useDebugValue:Xn,useDeferredValue:_o,useEffect:Vn,useId:eo,useImperativeHandle:Jn,useInsertionEffect:mo,useLayoutEffect:Kn,useMemo:Yn,useReducer:Bn,useRef:Zn,useState:qn,useSyncExternalStore:uo,useTransition:ho}}};function Bo(e){return!!e&&e.$$typeof===Io}var Vo={useState:qn,useId:eo,useReducer:Bn,useEffect:Vn,useLayoutEffect:Kn,useInsertionEffect:mo,useTransition:ho,useDeferredValue:_o,useSyncExternalStore:uo,startTransition:fo,useRef:Zn,useImperativeHandle:Jn,useMemo:Yn,useCallback:Gn,useContext:Qn,useDebugValue:Xn,version:"18.3.1",Children:ko,render:function(e,t,n){return null==t.__k&&(t.textContent=""),Cn(e,t),"function"==typeof n&&n(),e?e.__c:null},hydrate:function(e,t,n){return En(e,t),"function"==typeof n&&n(),e?e.__c:null},unmountComponentAtNode:function(e){return!!e.__k&&(Cn(null,e),!0)},createPortal:function(e,t){var n=Xt(Ao,{__v:e,h:t});return n.containerInfo=t,n},createElement:Xt,createContext:function(e){function t(e){var n,o;return this.getChildContext||(n=new Set,(o={})[t.__c]=this,this.getChildContext=function(){return o},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,an(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+Vt++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t},createFactory:function(e){return Xt.bind(null,e)},cloneElement:function(e){return Bo(e)?Mn.apply(null,arguments):e},createRef:function(){return{current:null}},Fragment:tn,isValidElement:Bo,isElement:Bo,isFragment:function(e){return Bo(e)&&e.type===tn},isMemo:function(e){return!!e&&"string"==typeof e.displayName&&0==e.displayName.indexOf("Memo(")},findDOMNode:function(e){return e&&(e.base||1===e.nodeType&&e)||null},Component:nn,PureComponent:yo,memo:function(e,t){function n(e){var n=this.props.ref;return n!=e.ref&&n&&("function"==typeof n?n(null):n.current=null),t?!t(this.props,e)||n!=e.ref:co(this.props,e)}function o(t){return this.shouldComponentUpdate=n,Xt(e,t)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.__f=o.prototype.isReactComponent=!0,o.type=e,o},forwardRef:function(e){function t(t){var n=lo({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=vo,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t},flushSync:function(e,t){var n,o=Ft.debounceRendering;Ft.debounceRendering=function(e){n=e};try{var r=e(t);return n&&n(),r}finally{Ft.debounceRendering=o}},unstable_batchedUpdates:function(e,t){return e(t)},StrictMode:tn,Suspense:Eo,SuspenseList:Po,lazy:function(e){var t,n,o,r=null;function i(i){if(t||(t=e()).then(function(e){e&&(r=e.default||e),o=!0},function(e){n=e,o=!0}),n)throw n;if(!o)throw t;return r?Xt(r,i):null}return i.displayName="Lazy",i.__f=!0,i},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:qo};const Ko={none:void 0,fade:"pw-vpopup-fade 0.35s ease-out backwards",slide:"pw-vpopup-slide 0.35s ease-out backwards"};function Zo({slot:e,align:t,inverse:n,colors:o}){const r={...d[e.variant],textAlign:e.align??t},i=f(e.variant,o,n);return i&&(r.color=i),Vo.createElement("div",{style:r,dangerouslySetInnerHTML:{__html:Te(e.html)}})}function Jo({slot:e,colors:t,onRequestClose:n,onPageChange:o}){const r=y(e.variant,t),i={};if("close"===e.action.type)return Vo.createElement("div",{style:i},Vo.createElement("button",{type:"button",style:r,onClick:n},e.label));if("page"===e.action.type){const t=e.action.page;return Vo.createElement("div",{style:i},Vo.createElement("button",{type:"button",style:r,onClick:()=>o(t)},e.label))}const s=Ae(e.action.url);return s?Vo.createElement("div",{style:i},Vo.createElement("a",{href:s,...Ie(e.action.target),style:r},e.label)):Vo.createElement("div",{style:i},Vo.createElement("button",{type:"button",style:r},e.label))}function Yo({message:e,align:t,inverse:n,colors:o}){const r=f("body",o,n);return Vo.createElement("div",{style:{...d.body,padding:"4px 0",textAlign:t,...r?{color:r}:{}}},e)}const Go=/^\S+@\S+\.\S+$/,Qo={email:"email",phone:"tel"},Xo={email:"email",firstName:"given-name",lastName:"family-name",phone:"tel"},er="__privacy";function tr({slot:e,align:t,inverse:n,colors:o,onSubmitForm:r}){const[i,s]=qn({}),[a,l]=qn(!1),[c,u]=qn(null),[p,_]=qn({}),[h,v]=qn("idle"),b=f("caption",o,n),k={...d.caption,...b?{color:b}:{}},w={fontSize:12,lineHeight:1.4,color:o.error,paddingTop:2};if("success"===h||"confirm"===h)return Vo.createElement(Yo,{message:"confirm"===h?e.confirmEmailMessage:e.successMessage,align:t,inverse:n,colors:o});const S="submitting"===h,x=e.privacy?Ae(e.privacy.url):void 0,C={...y(e.submitVariant,o),...S?{opacity:.6,cursor:"default"}:{}};return Vo.createElement("form",{noValidate:!0,style:{margin:0,textAlign:"left"},onSubmit:t=>{t.preventDefault(),(()=>{if(!r||!e.formCode||"submitting"===h)return;const t={};for(const n of e.fields){const e=(i[n.key]??"").trim();n.required&&!e?t[n.key]="Required":"email"===n.kind&&e&&!Go.test(e)&&(t[n.key]="Enter a valid email")}if(e.privacy&&!a&&(t[er]="Please accept the privacy policy"),_(t),Object.keys(t).length>0)return;const n={email:"",policyAccepted:!e.privacy||a},o={};for(const t of e.fields){const e=(i[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),v("submitting"),Promise.resolve().then(()=>r(e.formCode,n)).then(e=>v("confirm-email"===e?"confirm":"success"),()=>v("error"))})()}},e.fields.map(e=>{const t=p[e.key];let n;return t?n=o.error:c===e.key&&(n=o.accent),Vo.createElement("div",{key:e.key,style:{padding:"4px 0"}},e.label&&Vo.createElement("div",{style:{...k,paddingBottom:4}},e.label),Vo.createElement("input",{type:Qo[e.kind]??"text",autoComplete:Xo[e.kind],placeholder:e.placeholder||void 0,value:i[e.key]??"",disabled:S,style:g(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 _(e=>e[n]?Object.fromEntries(Object.entries(e).filter(([e])=>e!==n)):e);var n,o}}),t&&Vo.createElement("div",{style:w},t))}),e.privacy&&Vo.createElement("div",{style:{padding:"4px 0"}},Vo.createElement("label",{style:{...k,display:"flex",alignItems:"flex-start",gap:8,cursor:"pointer"}},Vo.createElement("input",{type:"checkbox",checked:a,disabled:S,style:{margin:"2px 0 0",flexShrink:0},onChange:e=>{l(e.currentTarget.checked),_(e=>e[er]?Object.fromEntries(Object.entries(e).filter(([e])=>e!==er)):e)}}),Vo.createElement("span",null,e.privacy.checkboxLabel,x&&Vo.createElement(Vo.Fragment,null," ",Vo.createElement("a",{href:x,...Ie(void 0),style:{color:o.accent}},e.privacy.linkLabel||e.privacy.url)))),p[er]&&Vo.createElement("div",{style:w},p[er])),Vo.createElement("div",{style:{padding:m}},Vo.createElement("button",{type:"submit",disabled:S,style:C},e.submitLabel)),"error"===h&&Vo.createElement("div",{style:{...w,textAlign:t}},E))}function nr({value:e,label:t,digitStyle:n,labelStyle:o}){return Vo.createElement("div",{style:{minWidth:44}},Vo.createElement("div",{style:n},String(e).padStart(2,"0")),t?Vo.createElement("div",{style:o},t):null)}function or({slot:e,align:t,inverse:n,colors:o,mode:r,onRequestClose:i,onPageChange:s}){const[a,l]=qn(()=>Date.now()),c=function(e,t,n){const o=$e(e,t),r=null===o?0:Math.max(0,o-n),i=Math.floor(r/1e3);return{total:r,days:Math.floor(i/86400),hours:Math.floor(i/3600)%24,minutes:Math.floor(i/60)%60,seconds:i%60}}(e.endTime,e.timezone,a),u=0===c.total;Vn(()=>{if("live"!==r||u)return;const e=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(e)},[r,u,e.endTime,e.timezone]),Vn(()=>{"live"===r&&u&&("hide-popup"===e.onExpire?i?.():"page"===e.onExpire&&e.expirePage&&s(e.expirePage))},[r,u,e.onExpire,e.expirePage,i,s]);const p=f("h2",o,n),_=f("caption",o,n),h={fontSize:28,fontWeight:700,lineHeight:1.2,fontVariantNumeric:"tabular-nums",...p?{color:p}:{}},m={...d.caption,..._?{color:_}:{}},y=(g=e.language,Re[g]??Re.en);var g;const v=[{value:c.days,label:y.days},{value:c.hours,label:y.hours},{value:c.minutes,label:y.minutes},{value:c.seconds,label:y.seconds}];return Vo.createElement("div",{style:{padding:"4px 0",textAlign:t}},Vo.createElement("div",{style:{display:"inline-flex",gap:12,textAlign:"center"}},v.map(t=>Vo.createElement(nr,{key:t.label||t.value,value:t.value,label:e.showLabels?t.label:"",digitStyle:h,labelStyle:m}))))}function rr({slot:e,align:t,inverse:n,colors:o,onSubmitChoice:r}){const[i,s]=qn([]),[a,l]=qn("idle"),[c,u]=qn("");if("success"===a)return Vo.createElement(Yo,{message:e.successMessage,align:t,inverse:n,colors:o});const p=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])},_="submitting"===a,h=f("body",o,n),g={...d.body,...h?{color:h}:{}};return Vo.createElement("div",{style:{padding:"4px 0"}},"chips"===e.control?Vo.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:8,justifyContent:"center"===t?"center":"flex-start"}},e.options.map(e=>{return Vo.createElement("button",{key:e.value,type:"button","aria-pressed":i.includes(e.value),style:(t=i.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:()=>p(e.value)},e.label);var t})):Vo.createElement("div",{style:{display:"grid",gap:6}},e.options.map(e=>Vo.createElement("label",{key:e.value,style:{...g,display:"flex",alignItems:"center",gap:8,cursor:"pointer"}},Vo.createElement("input",{type:"checkbox",checked:i.includes(e.value),onChange:()=>p(e.value),style:{accentColor:o.accent,width:16,height:16,margin:0}}),e.label))),c?Vo.createElement("div",{style:{...d.caption,color:o.error,paddingTop:4}},c):null,"error"===a?Vo.createElement("div",{style:{...d.caption,color:o.error,paddingTop:4}},E):null,Vo.createElement("div",{style:{padding:m}},Vo.createElement("button",{type:"button",style:{...y(e.submitVariant,o),..._?{opacity:.7}:{}},onClick:()=>{if(!r||!e.tagName||"submitting"===a)return;const t=Math.max(e.min,1);if(i.length<t)return void u(1===t?"Pick at least one":`Pick at least ${t}`);const n=e.options.filter(e=>i.includes(e.value)).map(e=>e.tagValue||e.value);u(""),l("submitting"),Promise.resolve().then(()=>r({slotKey:e.key,tagName:e.tagName,values:n})).then(()=>l("success"),()=>l("error"))}},e.submitLabel)))}function ir({score:e,scale:t,selected:n,colors:o,onPick:r}){const i={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 Vo.createElement("button",{type:"button","aria-label":`Rate ${e}`,"aria-pressed":n,style:{...i,width:30,height:32,borderRadius:6},onClick:r},e);const s="thumbs"===t;let a=`Rate ${e}`;return s&&(a=1===e?"Thumbs up":"Thumbs down"),Vo.createElement("button",{type:"button","aria-label":a,"aria-pressed":n,style:{...i,width:s?44:34,height:s?40:34,borderRadius:s?8:6},onClick:r},Vo.createElement("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"},Vo.createElement("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":P.star,...s&&0===e?{transform:"rotate(180 12 12)"}:{}})))}function sr({slot:e,align:t,inverse:n,colors:o,onSubmitRating:r}){const[i,s]=qn(null),[a,l]=qn("idle");if("success"===a)return Vo.createElement(Yo,{message:e.successMessage,align:t,inverse:n,colors:o});const c=t=>{r&&e.eventName&&"submitting"!==a&&(l("submitting"),Promise.resolve().then(()=>r({slotKey:e.key,eventName:e.eventName,score:t,scale:e.scale})).then(()=>l("success"),()=>l("error")))},u="nps"===(p=e.scale)?[0,1,2,3,4,5,6,7,8,9,10]:"stars"===p?[1,2,3,4,5]:[0,1];var p;const _=f("caption",o,n),h={...d.caption,..._?{color:_}:{}},g=t=>"stars"===e.scale?null!==i&&t<=i:i===t;return Vo.createElement("div",{style:{padding:"4px 0"}},Vo.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:6,justifyContent:"center"===t?"center":"flex-start"}},u.map(t=>Vo.createElement(ir,{key:t,score:t,scale:e.scale,selected:g(t),colors:o,onPick:()=>(t=>{"submitting"!==a&&(s(t),"instant"===e.submitMode&&c(t))})(t)}))),e.labels.low||e.labels.high?Vo.createElement("div",{style:{display:"flex",justifyContent:"space-between",gap:8,paddingTop:4}},Vo.createElement("span",{style:h},e.labels.low),Vo.createElement("span",{style:h},e.labels.high)):null,"error"===a?Vo.createElement("div",{style:{...d.caption,color:o.error,paddingTop:4}},E):null,"button"===e.submitMode?Vo.createElement("div",{style:{padding:m}},Vo.createElement("button",{type:"button",style:{...y("primary",o),..."submitting"===a?{opacity:.7}:{}},onClick:()=>null===i?void 0:c(i)},e.submitLabel)):null)}function ar({slot:e,align:t,inverse:n,colors:o}){const r=e.color||(n?o.textInverse:o.accent);return Vo.createElement("div",{style:{padding:"4px 0",textAlign:t,lineHeight:0}},Vo.createElement("svg",{width:e.size,height:e.size,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{display:"inline-block"}},Vo.createElement("path",{d:P[e.name]})))}function lr({slot:e,align:t,inverse:n,colors:o,mode:r="live",onRequestClose:i,onPageChange:s,onSubmitForm:a,onSubmitChoice:l,onSubmitRating:c}){const u=s??(()=>{});switch(e.type){case"text":return Vo.createElement(Zo,{slot:e,align:t,inverse:n,colors:o});case"button":return Vo.createElement(Jo,{slot:e,colors:o,onRequestClose:i,onPageChange:u});case"email-subscription-form":return Vo.createElement(tr,{slot:e,align:t,inverse:n,colors:o,onSubmitForm:a});case"timer":return Vo.createElement(or,{slot:e,align:t,inverse:n,colors:o,mode:r,onRequestClose:i,onPageChange:u});case"choice":return Vo.createElement(rr,{slot:e,align:t,inverse:n,colors:o,onSubmitChoice:l});case"rating":return Vo.createElement(sr,{slot:e,align:t,inverse:n,colors:o,onSubmitRating:c});case"glyph":return Vo.createElement(ar,{slot:e,align:t,inverse:n,colors:o})}}function cr({node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:a,onSubmitChoice:l,onSubmitRating:c}){const u=t.contents.find(t=>t.key===e.props.content);if(!u)return null;if(r?.renderZone)return Vo.createElement("div",{style:{minWidth:0}},r.renderZone(u,e));const d=e.props.align??"left",p="inverse"===e.props.tone;return Vo.createElement("div",{style:{minWidth:0}},u.slots.map((e,t)=>{const r=u.slots[t-1],f=r?(_=h(r),"action"===(m=h(e))?"action"===_?6:16:"text"===m&&"heading"===_?4:8):0;var _,m;return Vo.createElement("div",{key:e.key,style:f?{marginTop:f}:void 0},Vo.createElement(lr,{slot:e,align:d,inverse:p,colors:n,mode:o,onRequestClose:i,onPageChange:s,onSubmitForm:a,onSubmitChoice:l,onSubmitRating:c}))}))}function ur(e){return e?.video?Ae(e.video.src):void 0}function dr({image:e,src:t,style:n,mode:o}){return Vo.createElement("video",{src:t,poster:e.src||void 0,style:n,autoPlay:"live"===o,muted:!0,playsInline:!0,preload:"metadata",loop:!1!==e.video?.loop,controls:!0===e.video?.controls})}function pr({node:e,page:t,leaf:n,mode:o}){const r=t.images.find(t=>t.key===e.props.image);if(!r)return null;if(n?.renderImage)return Vo.createElement(Vo.Fragment,null,n.renderImage(r,e));const i=ur(r);if(!r.src&&!i)return null;const s={display:"block",width:"100%",minWidth:0};return r.fit?(s.height="100%",s.objectFit=r.fit):s.height="auto",r.blur&&(s.filter=`blur(${r.blur}px)`),i?Vo.createElement(dr,{image:r,src:i,style:s,mode:o}):Vo.createElement("img",{src:r.src,alt:"",style:s})}function fr({style:e,outer:t,inner:n,layer:o,children:r}){const{backgroundColor:i,...s}=e;return Vo.createElement("div",{style:{display:"grid",minWidth:0,backgroundColor:i,...t}},o,Vo.createElement("div",{style:{...s,...n}},r))}function _r({node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:a,onSubmitChoice:l,onSubmitRating:c}){if("Content"===e.type)return Vo.createElement(cr,{node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:a,onSubmitChoice:l,onSubmitRating:c});if("Image"===e.type)return Vo.createElement(pr,{node:e,page:t,leaf:r,mode:o});const u=e.props?.backgroundImage,d=u?t.images.find(e=>e.key===u):void 0,p=d?.blur??0,f=d?.dim??0,_=ur(d),h=ae(e,p>0||_?void 0:d?.src||void 0,f);u&&(h.backgroundColor="#1D2939");const m=e.children.map((e,u)=>Vo.createElement(_r,{key:u,node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:a,onSubmitChoice:l,onSubmitRating:c}));if(_&&d){const e=ie(f);return Vo.createElement(fr,{style:h,outer:{position:"relative",overflow:"hidden",...d.src?se(d.src):{}},inner:{position:"relative",...e?{backgroundImage:e}:{}},layer:Vo.createElement(dr,{image:d,src:_,mode:o,style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",...p>0?{filter:`blur(${p}px)`}:{}}})},m)}return p>0?Vo.createElement(fr,{style:h,outer:d?.src?se(d.src,f):void 0,inner:{backdropFilter:`blur(${p}px)`,WebkitBackdropFilter:`blur(${p}px)`}},m):Vo.createElement("div",{style:h},m)}function hr({page:e,params:t,mode:n="live",colorScheme:o="light",leafRenderers:r,animatePage:i=!1,onRequestClose:s,onPageChange:a,onSubmitForm:l,onSubmitChoice:c,onSubmitRating:u}){const d=ke(t,o),p={position:"relative",boxSizing:"border-box",overflow:"hidden",backgroundColor:d.background,colorScheme:d.scheme,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',color:d.text,borderRadius:t.borderRadius>0?t.borderRadius:void 0,boxShadow:t.boxShadow&&"none"!==t.boxShadow?t.boxShadow:void 0,transition:"height 300ms ease"};e.height&&(p.height="stretch"===e.height?"100%":e.height,p.overflowY="auto");const f={...i?{animation:"pw-vpopup-page 300ms ease-out backwards"}:{},..."stretch"===e.height?{display:"grid",minHeight:"100%"}:{}};return Vo.createElement("div",{style:p},Vo.createElement("div",{key:e.key,style:f},Vo.createElement(_r,{node:e.layout,page:e,colors:d,mode:n,leaf:r,onRequestClose:s,onPageChange:a??(()=>{}),onSubmitForm:l,onSubmitChoice:c,onSubmitRating:u})))}function mr({colors:e,onRequestClose:t}){return Vo.createElement("button",{type:"button","aria-label":"Close",onClick:t,style:{position:"absolute",top:10,right:10,width:24,height:24,padding:0,border:"none",borderRadius:"50%",background:me(e.surface,.92),boxShadow:"0 1px 3px rgba(16, 24, 40, 0.25)",color:e.chromeIcon,fontSize:13,lineHeight:1,cursor:"pointer"}},"✕")}function yr(e,t,n){const{placement:o}=e,r={position:"fixed",boxSizing:"border-box",maxWidth:dt(o),maxHeight:dt(o),pointerEvents:"auto"};if(t){r.width=t;const e=o.h;"left"===e?r.left=o.offset:"right"===e?r.right=o.offset:r.left="50%"}else r.left=o.offset,r.right=o.offset;"stretch"===n?(r.top=o.offset,r.bottom=o.offset):"top"===o.v?r.top=o.offset:"bottom"===o.v?r.bottom=o.offset:r.top="50%";const i=t&&"center"===o.h?"-50%":"0",s="middle"===o.v&&"stretch"!==n?"-50%":"0";"0"===i&&"0"===s||(r.transform=`translate(${i}, ${s})`);const a=Ko[e.animation];return a&&(r.animation=a),r.transition="width 300ms ease",r}const gr="(prefers-color-scheme: dark)";function vr(e,t){const[n,o]=qn(()=>"auto"===e&&t&&"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia(gr).matches);return Vn(()=>{if("auto"!==e||!t||"undefined"==typeof window||"function"!=typeof window.matchMedia)return;const n=window.matchMedia(gr),r=e=>o(e.matches);return o(n.matches),n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[e,t]),"auto"!==e?e:n?"dark":"light"}function br({params:e,mode:t="live",colorScheme:n="auto",onRequestClose:o,onSubmitForm:r,onSubmitChoice:i,onSubmitRating:s,leafRenderers:a}){const[l,c]=qn(null);Vn(()=>{ut(e).forEach(e=>e.images.forEach(({src:e})=>{e&&((new Image).src=e)}))},[e]);const u=vr(n,be(e)),d=ut(e);if(0===d.length)return null;const p=d.find(e=>e.key===l)??function(e,t){return t.find(t=>t.key===e.startPage)??t[0]}(e,d),f=null!==l;if("preview"===t)return Vo.createElement("div",{style:{position:"relative",width:p.width??"100%",transition:"width 300ms ease"}},Vo.createElement("style",null,M),Vo.createElement(hr,{page:p,params:e,mode:t,colorScheme:u,leafRenderers:a,animatePage:f,onRequestClose:o,onPageChange:c,onSubmitForm:r,onSubmitChoice:i,onSubmitRating:s}));const _=e.overlay;return Vo.createElement(Vo.Fragment,null,Vo.createElement("style",null,M),_&&Vo.createElement("div",{style:{position:"fixed",inset:0,backgroundColor:_.color,opacity:_.opacity,animation:"pw-vpopup-overlay 0.2s ease-out backwards",pointerEvents:"auto"},onClick:o}),Vo.createElement("div",{style:yr(e,p.width,p.height)},Vo.createElement(hr,{page:p,params:e,mode:t,colorScheme:u,leafRenderers:a,animatePage:f,onRequestClose:o,onPageChange:c,onSubmitForm:r,onSubmitChoice:i,onSubmitRating:s}),Vo.createElement(mr,{colors:ke(e,u),onRequestClose:o})))}const kr={SUBMIT_FORM_RESULT_SUBSCRIBED:"subscribed",SUBMIT_FORM_RESULT_CONFIRM_EMAIL:"confirm-email",SUBMIT_FORM_RESULT_ALREADY_SUBSCRIBED:"already-subscribed"},wr=(e,t)=>`https://subscription-form.svc-nue.pushwoosh.com/api/v1/forms/code/${encodeURIComponent(e)}${t}`,Sr=async(e,t)=>{try{const n=await fetch(wr(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(),r=kr[o.result??""];if(!r)throw new Error(`Subscription form submit failed: unexpected result "${o.result}"`);return r}catch(t){throw $t.error(t,`Failed to submit subscription form "${e}"`),t}};class xr{constructor(e){this.isRecurringVisitor=!1,this.entries=new Map,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:Rt(e),onSubmitRating:At(e)},e.moduleRegistry.webPopups=this}async run(){const{pw:e}=this;try{this.autoShowEnabled=!1!==e.initParams.webPopups?.autoShow,this.colorScheme=e.initParams.webPopups?.colorScheme??"auto",await e.api.ensureDeviceRegistered(),this.isRecurringVisitor=await e.data.getIsRecurringVisitor();const t=await e.api.getPopupForms();$t.debug(`${ft} Received ${t.length} popup(s) from server:`,t.map(e=>e.code)),t.forEach((e,t)=>{this.entries.set(e.code,{popup:e,order:t,state:"idle",content:null,loading:null,passedStrongConditions:!1,timeoutId:null,visitRecorded:!1})}),await Promise.allSettled(Array.from(this.entries.values()).map(async e=>{e.passedStrongConditions=await this.checkStrongCondition(e.popup),e.passedStrongConditions&&await this.ensureContent(e)}));const n=this.loadedCodes();$t.debug(`${ft} ${n.length} popup(s) passed strong conditions and loaded:`,n),this.subscribeToNavigation(),this.renderForCurrentPage(),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);if(!t)return $t.error(new Error("Unknown web popup code"),`${ft} show("${e}"): no such popup`),!1;if(this.visible?.code===e)return!0;return await this.ensureContent(t)?this.visible?.code===e||!!this.checkNotExpired(t)&&(this.visible&&($t.debug(`${ft} show("${e}") preempting "${this.visible.code}"`),this.visible.close("preempted")),this.detachFromAutoPipeline(t),this.present(t,"api"),!0):($t.error(new Error("Web popup content unavailable"),`${ft} 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()}}ensureContent(e){return e.content?Promise.resolve(e.content):(e.loading||(e.loading=this.loadContent(e.popup).then(t=>(e.content=t,t)).catch(t=>($t.error(t,`${ft} 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=Oe(e);return t?0===ut(t.params).length?null:t.params:null})((await this.pw.api.getPopupFormContent(e.popup_form_content_code)).json);return t||($t.error(new Error("Unsupported popup content format"),`${ft} Web popup "${e.code}" content is not a supported {version, params} popup; skipping`),null)}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.armDelay(t),e.push(n))}),$t.debug(`${ft} ${e.length} popup(s) selected for display on "${window.location.pathname}":`,e),this.drain()}canAutoDisplay(e){return this.autoShowEnabled&&"idle"===e.state&&e.passedStrongConditions&&this.isAutoTrigger(e.popup)&&null!==e.content&&this.checkSoftCondition(e.popup)&&this.checkNotExpired(e)}isAutoTrigger(e){const t=e.trigger_type;return!t||"PAGE_LOAD"===t}armDelay(e){const{popup:t}=e;$t.debug(`${ft} Popup "${t.code}" armed for display in ${t.delay}s`),e.state="waiting",this.recordVisit(e),e.timeoutId=window.setTimeout(()=>{e.timeoutId=null,e.state="queued",this.insertIntoQueue(e),$t.debug(`${ft} Popup "${t.code}" delay elapsed; queued at position ${this.queue.indexOf(t.code)+1} of ${this.queue.length}`),this.drain()},1e3*t.delay)}recordVisit(e){e.visitRecorded||(e.visitRecorded=!0,this.pw.api.recordPopupFormEvent(e.popup.code,1).catch(t=>{$t.error(t,`${ft} Failed to record web popup visit event for "${e.popup.code}"`)}))}insertIntoQueue(e){const t=this.queue.findIndex(t=>{const n=this.entries.get(t);return!!n&&(n.popup.delay!==e.popup.delay?n.popup.delay>e.popup.delay:n.order>e.order)});-1!==t?this.queue.splice(t,0,e.popup.code):this.queue.push(e.popup.code)}releaseUnmatchedPending(){this.entries.forEach(e=>{"waiting"!==e.state&&"queued"!==e.state||this.checkSoftCondition(e.popup)&&this.checkNotExpired(e)||(this.detachFromAutoPipeline(e),e.state="idle",$t.debug(`${ft} Released popup "${e.popup.code}": page no longer matches, or its countdown passed`))})}detachFromAutoPipeline(e){null!==e.timeoutId&&(window.clearTimeout(e.timeoutId),e.timeoutId=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.entries.get(e);if(t&&"queued"===t.state){if(!this.checkSoftCondition(t.popup)||!this.checkNotExpired(t))return t.state="idle",void this.drain();if(!t.content)return t.state="done",void this.drain();$t.debug(`${ft} 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 r=document.createElement("div");r.id=`${pt}-${n.code}`,r.style.position="fixed",r.style.inset="0",r.style.zIndex=String(2147483647),r.style.pointerEvents="none",document.body.appendChild(r);const i=r.attachShadow({mode:"open"}),s=document.createElement("div");i.appendChild(s);const a=!!o.overlay;a&&this.lockBodyScroll();let l=!1;const c=t=>{l||(l=!0,a&&this.unlockBodyScroll(),(e=>{Cn(null,e)})(s),r.remove(),this.visible?.code===n.code&&(this.visible=null),e.state="done",this.pw.dispatchEvent("hide-web-popup",{code:n.code,reason:t}),this.scheduleDrain())};this.visible={code:n.code,host:r,modal:a,close:c},e.state="visible",((e,t,n,o,r="auto")=>{Cn($n(br,{params:t,mode:"live",colorScheme:r,onRequestClose:n,onSubmitForm:Sr,onSubmitChoice:o.onSubmitChoice,onSubmitRating:o.onSubmitRating}),e)})(s,o,()=>c("user"),this.submitHandlers,this.colorScheme);const u=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]}(o);u.length>0&&this.pw.data.getHwid().then(e=>u.forEach(t=>((e,t)=>{fetch(wr(e,"/view"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,userId:t,hwid:t})}).catch(t=>{$t.error(t,`Failed to record subscription form view for "${e}"`)})})(t,e))).catch(e=>{$t.error(e,`${ft} Failed to record subscription form views for web popup "${n.code}"`)}),$t.debug(`${ft} Popup "${n.code}" shown (trigger: ${t})`),this.recordVisit(e),this.markAsShown(n).catch(e=>{$t.error(e,`${ft} Failed to mark web popup "${n.code}" as shown`)}),this.pw.dispatchEvent("show-web-popup",{code:n.code,trigger:t})}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(),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)}async checkStrongCondition(e){return(await Promise.all([this.checkCanBeShownByDeviceTypeCondition(e),this.checkCanBeShownByFrequencyCondition(e),this.checkCanBeShownByVisitorsTypeCondition(e)])).every(e=>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=$e(n.endTime,e);if(null!==o&&o<=t)return!0}return!1}(e.content,Date.now())||($t.debug(`${ft} 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,r=window.location.pathname;return n&&n.length>0?n.some(e=>this.matchPageRule(r,e)):t&&t.length>0?t.includes(r):!(o&&o.length>0)||!o.some(e=>this.matchPageRule(r,e))}matchPageRule(e,t){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}async markAsShown(e){this.pw.api.recordPopupFormEvent(e.code,2).catch(t=>{$t.error(t,`${ft} Failed to record web popup shown event for "${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`${pt}.shown.${e}`}}return t})());
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(this,()=>(()=>{"use strict";const e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};e.r(t),e.d(t,{WebPopupsWidget:()=>Pr});const n=/^(https?:|mailto:|tel:)/i,o="#101828",r="#667085",i="#FFFFFF",s="#FFFFFF",a="#2970FF",l=o,c=r,u="#FFFFFF",d={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}},p={h1:1,h2:1,h3:1,icon:1,eyebrow:.8,body:.9,caption:.75};function f(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,[r,i,s]=[0,2,4].map(e=>parseInt(o.slice(e,e+2),16));return`rgba(${r}, ${i}, ${s}, ${t})`}(t.textInverse,p[e]??1):"icon"!==e?"caption"===e||"eyebrow"===e?t.textSecondary:t.text:void 0}const h=["h1","h2","h3","icon"];function _(e){return"glyph"===e.type?"heading":"text"!==e.type?"action":h.includes(e.variant)?"heading":"text"}const m="8px 0 4px";function y(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 g(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 v="Subscribe",b="Thanks for subscribing!",k="Please check your inbox and confirm your email.",w="Save",S="Thanks! Your choice is saved.",x="Send",C="Thanks for the feedback!";const E="Something went wrong. Please try again.",M="\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",P={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"},$=Object.keys(P),R=[24,32,48],I=["Vertical","Horizontal","Columns","Rows"],A=["normal","reverse"],F=["start","center","end","stretch"],N=["start","center","end","space-between"],T=["left","center","right"],j=["default","inverse"],D=2e3,O={px:D,"%":100,em:125,rem:125},L=/^(\d{1,4}(?:\.\d+)?)(px|%|em|rem)$/,H={px:D,"%":100,fr:100},z=/^(\d{1,4}(?:\.\d+)?)(px|%|fr)$/,U=["auto","min-content","max-content"];function W(e,t){return t.includes(e)?e:void 0}function q(e){if("number"==typeof e&&Number.isFinite(e))return Math.min(Math.max(e,0),D);if("string"!=typeof e)return;const t=L.exec(e.trim());if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),O[o])}${o}`}const B=["top","right","bottom","left"];function V(e){if(U.includes(e))return e;const t=z.exec(e);if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),H[o])}${o}`}function K(e){return"string"==typeof e&&e.length>0?e:void 0}function Z(e){const t={},n=q(e.gap);void 0!==n&&(t.gap=n);const o=function(e){const t=q(e);if(void 0!==t)return t;if("object"!=typeof e||null===e)return;const n={};for(const t of B){const o=q(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 r=W(e.alignItems,F);r&&(t.alignItems=r);const i=W(e.justifyContent,N);i&&(t.justifyContent=i);const s=W(e.alignContent,N);s&&(t.alignContent=s);const a=K(e.backgroundImage);a&&(t.backgroundImage=a);const l=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(V);return n.every(e=>void 0!==e)?n.join(" "):void 0}(e.sizes);return void 0!==l&&(t.sizes=l),t}function J(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,r="object"==typeof o.props&&null!==o.props?o.props:{};if("Content"===o.type){const e=K(r.content);if(!e)return null;const t={type:"Content",props:{content:e}},n=W(r.align,T);n&&(t.props.align=n);const o=W(r.tone,j);return o&&"default"!==o&&(t.props.tone=o),t}if("Image"===o.type){const e=K(r.image);if(!e)return null;return{type:"Image",props:{image:e}}}if(!Array.isArray(o.children))return null;const i=W(o.type,I)??"Vertical",s=[];for(const e of o.children){const o=J(e,t+1,n);o&&s.push(o)}const a=Z(r);return"reverse"===W(r.order,A)&&(s.reverse(),"string"==typeof a.sizes&&(a.sizes=a.sizes.split(" ").reverse().join(" "))),{type:i,props:a,children:s}}function Y(e){return J(e,0,{nodes:100})}const G=/^[a-zA-Z][a-zA-Z0-9-]*$/,Q=/^\$([a-zA-Z][a-zA-Z0-9-]*)$/;function X(e,t){return e.includes("$")?e.split(/(\s+)/).map(e=>{const n=Q.exec(e)?.[1];return void 0!==n&&Object.prototype.hasOwnProperty.call(t,n)?t[n]:e}).join(""):e}function ee(e,t){return"object"!=typeof e||null===e||0===Object.keys(t).length?e:ne(e,t,0)}const te=new Set(["content","image","backgroundImage"]);function ne(e,t,n){if(n>10||"object"!=typeof e||null===e)return e;const o=e,r={...o};if("object"==typeof o.props&&null!==o.props){const e={...o.props};for(const[n,o]of Object.entries(e))if(!te.has(n))if("string"==typeof o)e[n]=X(o,t);else if("object"==typeof o&&null!==o&&!Array.isArray(o)){const r={...o};for(const[e,n]of Object.entries(r))"string"==typeof n&&(r[e]=X(n,t));e[n]=r}r.props=e}return Array.isArray(o.children)&&(r.children=o.children.map(e=>ne(e,t,n+1))),r}function oe(e){return"number"==typeof e?`${e}px`:e}function re(e,t){if("string"==typeof e)return e;return`repeat(${"number"==typeof e?e:Math.max(t,1)}, 1fr)`}function ie(e=0){if(!(e>0))return null;const t=`rgba(16, 24, 40, ${Math.min(e,1)})`;return`linear-gradient(${t}, ${t})`}function se(e,t=0){const n=`url(${JSON.stringify(e)})`,o=ie(t);return{backgroundImage:o?`${o}, ${n}`:n,backgroundSize:"cover",backgroundPosition:"center"}}function ae(e,t,n=0){const o=e.props??{},r={display:"grid",minWidth:0};return"Horizontal"===e.type&&(r.gridAutoFlow="column"),"Columns"===e.type&&(r.gridTemplateColumns=re(o.sizes,e.children.length)),"Rows"===e.type&&(r.gridTemplateRows=re(o.sizes,e.children.length)),void 0!==o.gap&&(r.gap=oe(o.gap)),void 0!==o.padding&&(r.padding=function(e){if("number"==typeof e||"string"==typeof e)return oe(e);const t=e=>void 0===e?"0":oe(e);return`${t(e.top)} ${t(e.right)} ${t(e.bottom)} ${t(e.left)}`}(o.padding)),o.alignItems&&(r.alignItems=o.alignItems),o.justifyContent&&(r.justifyContent=o.justifyContent),o.alignContent&&(r.alignContent=o.alignContent),t&&Object.assign(r,se(t,n)),r}const le=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function ce(e){const t=le.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 ue([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 de(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 fe(e){return e<.5?.93-e*((.93-.5)/.5):e}function he(e,t){const n=ce(e);if(!n)return e;const[o,r,i]=function([e,t,n]){const[o,r,i]=[e/255,t/255,n/255],s=Math.max(o,r,i),a=Math.min(o,r,i),l=(s+a)/2;if(s===a)return[0,0,l];const c=s-a;let u;return u=s===o?(r-i)/c+(r<i?6:0):s===r?(i-o)/c+2:(o-r)/c+4,[u/6,l>.5?c/(2-s-a):c/(s+a),l]}(n);return ue(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,r=2*n-o;return[255*de(r,o,e+1/3),255*de(r,o,e),255*de(r,o,e-1/3)]}([o,r,"fold"===t?pe(i):fe(i)]))}function _e(e,t,n){const o=ce(e),r=ce(t);return o&&r?ue(o.map((e,t)=>e+(r[t]-e)*n)):e}function me(e,t){const n=ce(e);if(!n||t>=1)return e;const[o,r,i]=n;return`rgba(${o}, ${r}, ${i}, ${t})`}function ye(e){const t=ce(e);if(!t)return!1;const[n,o,r]=t;return(.299*n+.587*o+.114*r)/255>.6}function ge(e){return{background:he(e.background,"fold"),accent:e.accent,text:he(e.text,"lift"),textSecondary:he(e.textSecondary,"lift"),textInverse:e.textInverse}}function ve(e,t){return"light"===t?{surface:s,surfaceText:o,border:"#D0D5DD",onAccent:i,error:"#D92D20",chromeIcon:r}:{surface:_e(e.background,e.text,.08),surfaceText:e.text,border:_e(e.background,e.text,.24),onAccent:ye(e.accent)?o:i,error:"#FDA29B",chromeIcon:e.textSecondary}}function be(e){return!0===e.dark?.enabled}function ke(e,t="light"){return"dark"===t&&be(e)?"dark":"light"}function we(e,t="light"){const n=ke(e,t),o="dark"===n?(r=e.colors,i=e.dark,{...ge(r),...i?.colors??{}}):e.colors;var r,i;return{...o,scheme:n,...ve(o,n)}}function Se(e,t="light"){return"dark"===t&&e.srcDark?e.srcDark:e.src}function xe(e,t="light"){return"light"===ke(e,t)?{overlay:e.overlay,boxShadow:e.boxShadow}:{overlay:e.dark?.overlay??e.overlay,boxShadow:e.dark?.boxShadow??e.boxShadow}}const Ce=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?$/,Ee=new Map;function Me(e){const t=Ee.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 Ee.set(e,t),t}catch{return null}}function Pe(e){return!e||null!==Me(e)}function $e(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 Re=864e5;const Ie=new Map;function Ae(e,t){const n=`${e}|${t}`,o=Ie.get(n);if(void 0!==o)return o;const r=function(e,t){const n=Ce.exec((e||"").trim());if(!n)return null;const[,o,r,i,s,a,l]=n.map(Number),c=Number.isNaN(l)?0:l;if(r<1||r>12||i<1||i>31)return null;if(s>23||a>59||c>59)return null;const u=Date.UTC(o,r-1,i,s,a,c),d=new Date(u);if(d.getUTCMonth()!==r-1||d.getUTCDate()!==i)return null;if(!t)return u;const p=Me(t);if(!p)return null;const f=function(e,t){const n=[];for(const o of[e-Re,e,e+Re]){const e=$e(o,t);n.includes(e)||n.push(e)}return n}(u,p),h=f.filter(e=>$e(u-e,p)===e).map(e=>u-e);return h.length>0?Math.min(...h):u-Math.min(...f)}(e,t);return Ie.size>100&&Ie.clear(),Ie.set(n,r),r}const Fe={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 Ne(e){const t=(e||"").trim();if(t)return t.startsWith("#")||t.startsWith("/")||t.startsWith("?")||n.test(t)?t:void 0}function Te(e){return"_self"===e?{target:"_self"}:{target:"_blank",rel:"noreferrer"}}const je=new Set(["STRONG","B","EM","I","U","BR","A"]);function De(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)){De(e,t,n);continue}const r=n.createElement(e.tagName.toLowerCase());if("A"===e.tagName){const t=Ne(e.getAttribute("href")??void 0);t&&r.setAttribute("href",t);const{target:n,rel:o}=Te(e.getAttribute("target"));r.setAttribute("target",n),o&&r.setAttribute("rel",o)}t.appendChild(r),De(e,r,n)}}function Oe(e){if(!e.includes("<"))return e;const t=(new DOMParser).parseFromString(e,"text/html"),n=t.createElement("div");return De(t.body,n,t),n.innerHTML}function Le(e){return"string"==typeof e&&e?e:void 0}function He(e,t){const n=e.dark;if("object"!=typeof n||null===n)return;const o=n,r="object"==typeof o.colors&&null!==o.colors?o.colors:{},i=ge(t),s=function(e){if("object"!=typeof e||null===e)return;const t=e,n=Le(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:Le(r.background)??i.background,accent:Le(r.accent)??i.accent,text:Le(r.text)??i.text,textSecondary:Le(r.textSecondary)??i.textSecondary,textInverse:Le(r.textInverse)??i.textInverse},...s?{overlay:s}:{},...Le(o.boxShadow)?{boxShadow:o.boxShadow}:{}}}function ze(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 r=function(e){const t="object"==typeof e.colors&&null!==e.colors?e.colors:{};return{background:Le(t.background)??Le(e.background)??s,accent:Le(t.accent)??Le(e.accent)??a,text:Le(t.text)??l,textSecondary:Le(t.textSecondary)??c,textInverse:Le(t.textInverse)??u}}(o),i=He(o,r);return{version:2,params:{...o,colors:r,...i?{dark:i}:{}}}}const Ue=["cover","contain"];function We(e){if("object"!=typeof e||null===e)return;const t=e,n=Ne("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 qe(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=We(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}:{},...Ue.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 Be=["px","%","em","rem","fr"];function Ve(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}function Ke(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=Ve(t.min),n=Ve(t.max),o="length"===t.kind&&Array.isArray(t.units)?t.units.filter(e=>Be.includes(e)):[],r="length"===t.kind?function(e){if("object"!=typeof e||null===e)return;const t={};for(const n of Be){const o=e[n];if("object"!=typeof o||null===o)continue;const r=Ve(o.min),i=Ve(o.max);void 0===r&&void 0===i||(t[n]={...void 0!==r?{min:r}:{},...void 0!==i?{max:i}:{}})}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}:{},...r?{ranges:r}:{}}}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 Ze(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||!G.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=Ke(n.control);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",value:n.value,...e?{control:e}:{}})}return t}function Je(e){return Object.fromEntries(e.map(e=>[e.key,e.value]))}const Ye=["email","firstName","lastName","phone","custom"],Ge=["primary","secondary"];function Qe(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&&Ye.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 Xe=["checkbox","chips"],et=["nps","stars","thumbs"],tt=["instant","button"],nt=["keep","hide-popup","page"],ot=/^[a-z]{2}$/i,rt=/^#[0-9a-fA-F]{6}$/;function it(e,t=120){return"string"==typeof e?e.trim().slice(0,t):""}function st(e,t,n=120){return it(e,n)||t}function at(e){const t=it(e,8);return ot.test(t)?t.toLowerCase():""}function lt(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=it(n.value);if(!e)continue;if(t.some(t=>t.value===e))continue;const o=it(n.tagValue);t.push({value:e,label:st(n.label,e),...o?{tagValue:o}:{}})}return t}function ct(e,t){const n=e=>{const n=Ve(e);return void 0===n||n<=0?0:Math.min(Math.floor(n),t)},o=n(e.min),r=n(e.max);return{min:o,max:r>0?Math.max(o,r):0}}function ut(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=it(n.timezone,64),o=Pe(e)?e:"",r=it(n.endTime,32);if(null===Ae(r,o))continue;const i=it(n.expirePage),s=nt.includes(n.onExpire)?n.onExpire:"keep",a="page"!==s||i?s:"keep";t.push({type:"timer",key:n.key,endTime:r,timezone:o,language:at(n.language),showLabels:!1!==n.showLabels,onExpire:a,..."page"===a?{expirePage:i}:{}});continue}if("choice"===n.type){const e=lt(n.options),{min:o,max:r}=ct(n,e.length);t.push({type:"choice",key:n.key,control:Xe.includes(n.control)?n.control:"checkbox",tagName:it(n.tagName),options:e,min:o,max:r,submitLabel:st(n.submitLabel,w),submitVariant:Ge.includes(n.submitVariant)?n.submitVariant:"primary",successMessage:st(n.successMessage,S,500)});continue}if("rating"===n.type){const e="object"==typeof n.labels&&null!==n.labels?n.labels:{};t.push({type:"rating",key:n.key,scale:et.includes(n.scale)?n.scale:"stars",labels:{low:it(e.low),high:it(e.high)},submitMode:tt.includes(n.submitMode)?n.submitMode:"instant",submitLabel:st(n.submitLabel,x),eventName:it(n.eventName),successMessage:st(n.successMessage,C,500)});continue}if("glyph"!==n.type)"email-subscription-form"===n.type&&t.push({type:"email-subscription-form",key:n.key,formCode:"string"==typeof n.formCode?n.formCode:"",fields:Qe(n.fields),submitLabel:"string"==typeof n.submitLabel&&n.submitLabel?n.submitLabel:v,submitVariant:Ge.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:b,confirmEmailMessage:"string"==typeof n.confirmEmailMessage&&n.confirmEmailMessage?n.confirmEmailMessage:k});else{if(!$.includes(n.name))continue;t.push({type:"glyph",key:n.key,name:n.name,size:R.includes(n.size)?n.size:R[0],color:"string"==typeof n.color&&rt.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 dt(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:ut(n.slots)}))}return t}function pt(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":pt(e)??("stretch"===t?"stretch":pt(t)),"width"===n&&"stretch"===o?void 0:o}function ht(e){const t=[];for(const n of e.pages){const o=Ze(n.values),r=Y(ee(n.layout,Je(o)));if(!r)continue;const i=ft(n.width,e.width,"width"),s=ft(n.height,e.height,"height");t.push({key:n.key,layout:r,images:qe(n.images),contents:dt(n.contents),...void 0!==i?{width:i}:{},...void 0!==s?{height:s}:{}})}return t}function _t(e){return`calc(100% - ${2*e.offset}px)`}const mt="pushwoosh-web-popups",yt="[WebPopups]",gt="keyValue",vt="messages",bt="inboxMessages";function kt(e,t){return function(n){n.objectStoreNames.contains(e)||t(n)}}const wt=[kt(gt,function(e){e.createObjectStore(gt,{keyPath:"key"})}),kt("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})}),kt(vt,function(e){e.createObjectStore(vt,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),kt(bt,function(e){const t="status",n=e.createObjectStore(bt,{keyPath:"inbox_id",autoIncrement:!1});n.createIndex(t,t,{unique:!1,multiEntry:!0}),n.createIndex("rt","rt",{unique:!1,multiEntry:!0})})];class St{get all(){return wt}}class xt{constructor(e,t=new St){this.db=e,this.migrationsBuilder=t}applyMigrations(){this.applyMigrationsPack(this.migrationsBuilder.all)}applyMigrationsPack(e){e.forEach(e=>{e(this.db)})}}function Ct(e,t){console.info("onversionchange",t),e.close()}let Et;function Mt(e){return(Et||(Et=new Promise((e,t)=>{const n=indexedDB.open("PUSHWOOSH_SDK_STORE",7);n.onsuccess=n=>{const o=n.target.result;o.onversionchange=Ct.bind(null,o,t),e(o)},n.onerror=()=>t(n.error),n.onupgradeneeded=e=>{const n=e.target.result;n.onversionchange=Ct.bind(null,n,t),new xt(n).applyMigrations()}})),Et).then(t=>new Promise((n,o)=>e(t,n,o)))}class Pt{_add(e){return Mt((t,n,o)=>{const r=t.transaction([this.name],"readwrite").objectStore(this.name).add(e);r.onsuccess=()=>{n(e)},r.onerror=()=>{o(r.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 Mt((t,n,o)=>{const r=t.transaction([this.name],"readwrite").objectStore(this.name).delete(e);r.onsuccess=()=>{n(r.result)},r.onerror=()=>{o(r.error)}})}getAll(){return Mt((e,t,n)=>{const o=[],r=e.transaction(this.name).objectStore(this.name).openCursor();r.onsuccess=e=>{const n=e.target.result;n?(n.value&&o.push(n.value),n.continue()):t(o)},r.onerror=()=>{n(r.error)}})}}$t=gt;var $t;const Rt=new class extends Pt{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)}},It=(new class extends Pt{constructor(){super(...arguments),this.name=vt,this.maxItems=25}add(e){return this._add({...e,date:new Date})}},{error:1,info:2,debug:3});let At=3;const Ft={setLevel(e){It[e]||(e="error"),At=It[e]},write(e,t,n){return"error"===e?this.error(t):this.info(t),Rt.add(e,t,n)}};function Nt(e){return async({slotKey:t,tagName:n,values:o})=>{try{await e.api.setTags({[n]:{operation:"append",value:o}})}catch(e){throw Ft.error(e,`Failed to write web popup choice "${t}" to tag "${n}"`),e}}}function Tt(e){return async({slotKey:t,eventName:n,score:o,scale:r})=>{try{await e.api.postEvent(n,{score:o,scale:r,slotKey:t})}catch(e){throw Ft.error(e,`Failed to post web popup rating "${t}" as event "${n}"`),e}}}Object.keys(It).forEach(e=>{const t=It[e];Ft[e]=(...n)=>{t<=At&&(console.groupCollapsed(e),console.info("",...n),console.trace("trace"),console.groupEnd())}});var jt,Dt,Ot,Lt,Ht,zt,Ut,Wt,qt,Bt,Vt,Kt,Zt,Jt,Yt,Gt={},Qt=[],Xt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,en=Array.isArray;function tn(e,t){for(var n in t)e[n]=t[n];return e}function nn(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function on(e,t,n){var o,r,i,s={};for(i in t)"key"==i?o=t[i]:"ref"==i?r=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?jt.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return rn(e,s,o,r,null)}function rn(e,t,n,o,r){var i={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Ot,__i:-1,__u:0};return null==r&&null!=Dt.vnode&&Dt.vnode(i),i}function sn(e){return e.children}function an(e,t){this.props=e,this.context=t}function ln(e,t){if(null==t)return e.__?ln(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?ln(e):null}function cn(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],r=[],i=tn({},t);i.__v=t.__v+1,Dt.vnode&&Dt.vnode(i),kn(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??ln(t),!!(32&t.__u),r),i.__v=t.__v,i.__.__k[i.__i]=i,Sn(o,i,r),t.__e=t.__=null,i.__e!=n&&un(i)}}function un(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some(function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e}),un(e)}function dn(e){(!e.__d&&(e.__d=!0)&&Lt.push(e)&&!pn.__r++||Ht!=Dt.debounceRendering)&&((Ht=Dt.debounceRendering)||zt)(pn)}function pn(){try{for(var e,t=1;Lt.length;)Lt.length>t&&Lt.sort(Ut),e=Lt.shift(),t=Lt.length,cn(e)}finally{Lt.length=pn.__r=0}}function fn(e,t,n,o,r,i,s,a,l,c,u){var d,p,f,h,_,m,y=o&&o.__k||Qt,g=t.length;for(l=hn(n,t,y,l,g),d=0;d<g;d++)null!=(f=n.__k[d])&&(p=-1!=f.__i&&y[f.__i]||Gt,f.__i=d,m=kn(e,f,p,r,i,s,a,l,c,u),h=f.__e,f.ref&&p.ref!=f.ref&&(p.ref&&En(p.ref,null,f),u.push(f.ref,f.__c||h,f)),null==_&&null!=h&&(_=h),4&f.__u?(l=_n(f,l,e),p.__e&&(p.__e=null)):"function"==typeof f.type&&void 0!==m?l=m:h&&(l=h.nextSibling),f.__u&=-7);return n.__e=_,l}function hn(e,t,n,o,r){var i,s,a,l,c,u=n.length,d=u,p=0;for(e.__k=new Array(r),i=0;i<r;i++)null!=(s=t[i])&&"boolean"!=typeof s&&"function"!=typeof s?("string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?s=e.__k[i]=rn(null,s,null,null,null):en(s)?s=e.__k[i]=rn(sn,{children:s},null,null,null):void 0===s.constructor&&s.__b>0?s=e.__k[i]=rn(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[i]=s,l=i+p,s.__=e,s.__b=e.__b+1,a=null,-1!=(c=s.__i=yn(s,n,l,d))&&(d--,(a=n[c])&&(a.__u|=2)),null==a||null==a.__v?(-1==c&&(r>u?p--:r<u&&p++),"function"!=typeof s.type&&(s.__u|=4)):c!=l&&(c==l-1?p--:c==l+1?p++:(c>l?p--:p++,s.__u|=4))):e.__k[i]=null;if(d)for(i=0;i<u;i++)null!=(a=n[i])&&!(2&a.__u)&&(a.__e==o&&(o=ln(a)),Mn(a,a));return o}function _n(e,t,n){var o,r;if("function"==typeof e.type){for(o=e.__k,r=0;o&&r<o.length;r++)o[r]&&(o[r].__=e,t=_n(o[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=ln(e)),t=n.insertBefore(e.__e,t||null));do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function mn(e,t){return t=t||[],null==e||"boolean"==typeof e||(en(e)?e.some(function(e){mn(e,t)}):t.push(e)),t}function yn(e,t,n,o){var r,i,s,a=e.key,l=e.type,c=t[n],u=null!=c&&!(2&c.__u);if(null===c&&null==a||u&&a==c.key&&l==c.type)return n;if(o>(u?1:0))for(r=n-1,i=n+1;r>=0||i<t.length;)if(null!=(c=t[s=r>=0?r--:i++])&&!(2&c.__u)&&a==c.key&&l==c.type)return s;return-1}function gn(e,t,n){"-"==t[0]?e.setProperty(t,n??""):e[t]=null==n?"":"number"!=typeof n||Xt.test(t)?n:n+"px"}function vn(e,t,n,o,r){var i,s;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof o&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||gn(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||gn(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(Vt,"$1")),s=t.toLowerCase(),t=s in e||"onFocusOut"==t||"onFocusIn"==t?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n[Bt]=o[Bt]:(n[Bt]=Kt,e.addEventListener(t,i?Jt:Zt,i)):e.removeEventListener(t,i?Jt:Zt,i);else{if("http://www.w3.org/2000/svg"==r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=n??"";break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function bn(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t[qt])t[qt]=Kt++;else if(t[qt]<n[Bt])return;return n(Dt.event?Dt.event(t):t)}}}function kn(e,t,n,o,r,i,s,a,l,c){var u,d,p,f,h,_,m,y,g,v,b,k,w,S,x,C,E=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),i=[a=t.__e=n.__e]),(u=Dt.__b)&&u(t);e:if("function"==typeof E){d=s.length;try{if(g=t.props,v=E.prototype&&E.prototype.render,b=(u=E.contextType)&&o[u.__c],k=u?b?b.props.value:u.__:o,n.__c?y=(p=t.__c=n.__c).__=p.__E:(v?t.__c=p=new E(g,k):(t.__c=p=new an(g,k),p.constructor=E,p.render=Pn),b&&b.sub(p),p.state||(p.state={}),p.__n=o,f=p.__d=!0,p.__h=[],p._sb=[]),v&&null==p.__s&&(p.__s=p.state),v&&null!=E.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=tn({},p.__s)),tn(p.__s,E.getDerivedStateFromProps(g,p.__s))),h=p.props,_=p.state,p.__v=t,f)v&&null==E.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),v&&null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(v&&null==E.getDerivedStateFromProps&&g!==h&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(g,k),t.__v==n.__v||!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(g,p.__s,k)){t.__v!=n.__v&&(p.props=g,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),Qt.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&s.push(p),a=ln(n);break e}null!=p.componentWillUpdate&&p.componentWillUpdate(g,p.__s,k),v&&null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(h,_,m)})}if(p.context=k,p.props=g,p.__P=e,p.__e=!1,w=Dt.__r,S=0,v)p.state=p.__s,p.__d=!1,w&&w(t),u=p.render(p.props,p.state,p.context),Qt.push.apply(p.__h,p._sb),p._sb=[];else do{p.__d=!1,w&&w(t),u=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++S<25);p.state=p.__s,null!=p.getChildContext&&(o=tn(tn({},o),p.getChildContext())),v&&!f&&null!=p.getSnapshotBeforeUpdate&&(m=p.getSnapshotBeforeUpdate(h,_)),x=null!=u&&u.type===sn&&null==u.key?xn(u.props.children):u,a=fn(e,en(x)?x:[x],t,n,o,r,i,s,a,l,c),p.base=t.__e,t.__u&=-161,p.__h.length&&s.push(p),y&&(p.__E=p.__=null)}catch(e){if(s.length=d,t.__v=null,l||null!=i){if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=i&&(i[i.indexOf(a)]=null),t.__e=a}else if(null!=i)for(C=i.length;C--;)nn(i[C])}else t.__e=n.__e;null==t.__k&&(t.__k=n.__k||[]),e.then||wn(t),Dt.__e(e,t,n)}}else null==i&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):a=t.__e=Cn(n.__e,t,n,o,r,i,s,l,c);return(u=Dt.diffed)&&u(t),128&t.__u?void 0:a}function wn(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(wn))}function Sn(e,t,n){for(var o=0;o<n.length;o++)En(n[o],n[++o],n[++o]);Dt.__c&&Dt.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Dt.__e(e,t.__v)}})}function xn(e){return"object"!=typeof e||null==e||e.__b>0?e:en(e)?e.map(xn):void 0!==e.constructor?null:tn({},e)}function Cn(e,t,n,o,r,i,s,a,l){var c,u,d,p,f,h,_,m=n.props||Gt,y=t.props,g=t.type;if("svg"==g?r="http://www.w3.org/2000/svg":"math"==g?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),null!=i)for(c=0;c<i.length;c++)if((f=i[c])&&"setAttribute"in f==!!g&&(g?f.localName==g:3==f.nodeType)){e=f,i[c]=null;break}if(null==e){if(null==g)return document.createTextNode(y);e=document.createElementNS(r,g,y.is&&y),a&&(Dt.__m&&Dt.__m(t,i),a=!1),i=null}if(null==g)m===y||a&&e.data==y||(e.data=y);else{if(i="textarea"==g&&null!=y.defaultValue?null:i&&jt.call(e.childNodes),!a&&null!=i)for(m={},c=0;c<e.attributes.length;c++)m[(f=e.attributes[c]).name]=f.value;for(c in m)f=m[c],"dangerouslySetInnerHTML"==c?d=f:"children"==c||c in y||"value"==c&&"defaultValue"in y||"checked"==c&&"defaultChecked"in y||vn(e,c,null,f,r);for(c in y)f=y[c],"children"==c?p=f:"dangerouslySetInnerHTML"==c?u=f:"value"==c?h=f:"checked"==c?_=f:a&&"function"!=typeof f||m[c]===f||vn(e,c,f,m[c],r);if(u)a||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=""),fn("template"==t.type?e.content:e,en(p)?p:[p],t,n,o,"foreignObject"==g?"http://www.w3.org/1999/xhtml":r,i,s,i?i[0]:n.__k&&ln(n,0),a,l),null!=i)for(c=i.length;c--;)nn(i[c]);a&&"textarea"!=g||(c="value","progress"==g&&null==h?e.removeAttribute("value"):null!=h&&(h!==e[c]||"progress"==g&&!h||"option"==g&&h!=m[c])&&vn(e,c,h,m[c],r),c="checked",null!=_&&_!=e[c]&&vn(e,c,_,m[c],r))}return e}function En(e,t,n){try{if("function"==typeof e){var o="function"==typeof e.__u;o&&e.__u(),o&&null==t||(e.__u=e(t))}else e.current=t}catch(e){Dt.__e(e,n)}}function Mn(e,t,n){var o,r;if(Dt.unmount&&Dt.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||En(o,null,t)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){Dt.__e(e,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&Mn(o[r],t,n||"function"!=typeof e.type);n||nn(e.__e),e.__c=e.__=e.__e=void 0}function Pn(e,t,n){return this.constructor(e,n)}function $n(e,t,n){var o,r,i,s;t==document&&(t=document.documentElement),Dt.__&&Dt.__(e,t),r=(o="function"==typeof n)?null:n&&n.__k||t.__k,i=[],s=[],kn(t,e=(!o&&n||t).__k=on(sn,null,[e]),r||Gt,Gt,t.namespaceURI,!o&&n?[n]:r?null:t.firstChild?jt.call(t.childNodes):null,i,!o&&n?n:r?r.__e:t.firstChild,o,s),Sn(i,e,s),e.props.children=null}function Rn(e,t){$n(e,t,Rn)}function In(e,t,n){var o,r,i,s,a=tn({},e.props);for(i in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)"key"==i?o=t[i]:"ref"==i?r=t[i]:a[i]=void 0===t[i]&&null!=s?s[i]:t[i];return arguments.length>2&&(a.children=arguments.length>3?jt.call(arguments,2):n),rn(e.type,a,o||e.key,r||e.ref,null)}jt=Qt.slice,Dt={__e:function(e,t,n,o){for(var r,i,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&null!=i.getDerivedStateFromError&&(r.setState(i.getDerivedStateFromError(e)),s=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,o||{}),s=r.__d),s)return r.__E=r}catch(t){e=t}throw e}},Ot=0,an.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=tn({},this.state),"function"==typeof e&&(e=e(tn({},n),this.props)),e&&tn(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),dn(this))},an.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),dn(this))},an.prototype.render=sn,Lt=[],zt="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ut=function(e,t){return e.__v.__b-t.__v.__b},pn.__r=0,Wt=Math.random().toString(8),qt="__d"+Wt,Bt="__a"+Wt,Vt=/(PointerCapture)$|Capture$/i,Kt=0,Zt=bn(!1),Jt=bn(!0),Yt=0;var An=0;Array.isArray;function Fn(e,t,n,o,r,i){t||(t={});var s,a,l=t;if("ref"in l)for(a in l={},t)"ref"==a?s=t[a]:l[a]=t[a];var c={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--An,__i:-1,__u:0,__source:r,__self:i};if("function"==typeof e&&(s=e.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return Dt.vnode&&Dt.vnode(c),c}var Nn,Tn,jn,Dn,On=0,Ln=[],Hn=Dt,zn=Hn.__b,Un=Hn.__r,Wn=Hn.diffed,qn=Hn.__c,Bn=Hn.unmount,Vn=Hn.__;function Kn(e,t){Hn.__h&&Hn.__h(Tn,e,On||t),On=0;var n=Tn.__H||(Tn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Zn(e){return On=1,Jn(po,e)}function Jn(e,t,n){var o=Kn(Nn++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):po(void 0,t),function(e){var t=o.__N?o.__N[0]:o.__[0],n=o.t(t,e);t!==n&&(o.__N=[n,o.__[1]],o.__c.setState({}))}],o.__c=Tn,!Tn.__f)){var r=function(e,t,n){if(!o.__c.__H)return!0;var r=!1,s=o.__c.props!==e;if(o.__c.__H.__.some(function(e){if(e.__N){r=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),i){var a=i.call(this,e,t,n);return r?a||s:a}return!r||s};Tn.__f=!0;var i=Tn.shouldComponentUpdate,s=Tn.componentWillUpdate;Tn.componentWillUpdate=function(e,t,n){if(this.__e){var o=i;i=void 0,r(e,t,n),i=o}s&&s.call(this,e,t,n)},Tn.shouldComponentUpdate=r}return o.__N||o.__}function Yn(e,t){var n=Kn(Nn++,3);!Hn.__s&&uo(n.__H,t)&&(n.__=e,n.u=t,Tn.__H.__h.push(n))}function Gn(e,t){var n=Kn(Nn++,4);!Hn.__s&&uo(n.__H,t)&&(n.__=e,n.u=t,Tn.__h.push(n))}function Qn(e){return On=5,eo(function(){return{current:e}},[])}function Xn(e,t,n){On=6,Gn(function(){if("function"==typeof e){var n=e(t());return function(){e(null),n&&"function"==typeof n&&n()}}if(e)return e.current=t(),function(){return e.current=null}},null==n?n:n.concat(e))}function eo(e,t){var n=Kn(Nn++,7);return uo(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function to(e,t){return On=8,eo(function(){return e},t)}function no(e){var t=Tn.context[e.__c],n=Kn(Nn++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(Tn)),t.props.value):e.__}function oo(e,t){Hn.useDebugValue&&Hn.useDebugValue(t?t(e):e)}function ro(){var e=Kn(Nn++,11);if(!e.__){for(var t=Tn.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function io(){for(var e;e=Ln.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(lo),t.__h.some(co),t.__h=[]}catch(n){t.__h=[],Hn.__e(n,e.__v)}}}Hn.__b=function(e){Tn=null,zn&&zn(e)},Hn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Vn&&Vn(e,t)},Hn.__r=function(e){Un&&Un(e),Nn=0;var t=(Tn=e.__c).__H;t&&(jn===Tn?(t.__h=[],Tn.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(lo),t.__h.some(co),t.__h=[],Nn=0)),jn=Tn},Hn.diffed=function(e){Wn&&Wn(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Ln.push(t)&&Dn===Hn.requestAnimationFrame||((Dn=Hn.requestAnimationFrame)||ao)(io)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),jn=Tn=null},Hn.__c=function(e,t){t.some(function(e){try{e.__h.some(lo),e.__h=e.__h.filter(function(e){return!e.__||co(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],Hn.__e(n,e.__v)}}),qn&&qn(e,t)},Hn.unmount=function(e){Bn&&Bn(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{lo(e)}catch(e){t=e}}),n.__H=void 0,t&&Hn.__e(t,n.__v))};var so="function"==typeof requestAnimationFrame;function ao(e){var t,n=function(){clearTimeout(o),so&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);so&&(t=requestAnimationFrame(n))}function lo(e){var t=Tn,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),Tn=t}function co(e){var t=Tn;e.__c=e.__(),Tn=t}function uo(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function po(e,t){return"function"==typeof t?t(e):t}function fo(e,t){for(var n in t)e[n]=t[n];return e}function ho(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var o in t)if("__source"!==o&&e[o]!==t[o])return!0;return!1}function _o(e,t){var n=t(),o=Zn({t:{__:n,u:t}}),r=o[0].t,i=o[1];return Gn(function(){r.__=n,r.u=t,mo(r)&&i({t:r})},[e,n,t]),Yn(function(){return mo(r)&&i({t:r}),e(function(){mo(r)&&i({t:r})})},[e]),n}function mo(e){try{return!((t=e.__)===(n=e.u())&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}var t,n}function yo(e){e()}function go(e){return e}function vo(){return[!1,yo]}var bo=Gn;function ko(e,t){this.props=e,this.context=t}(ko.prototype=new an).isPureReactComponent=!0,ko.prototype.shouldComponentUpdate=function(e,t){return ho(this.props,e)||ho(this.state,t)};var wo=Dt.__b;Dt.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),wo&&wo(e)};var So="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var xo=function(e,t){return null==e?null:mn(mn(e).map(t))},Co={map:xo,forEach:xo,count:function(e){return e?mn(e).length:0},only:function(e){var t=mn(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:mn},Eo=Dt.__e;Dt.__e=function(e,t,n,o){if(e.then)for(var r,i=t;i=i.__;)if((r=i.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k||[]),r.__c(e,t);Eo(e,t,n,o)};var Mo=Dt.unmount;function Po(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),e.__c.__H=null),null!=(e=fo({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return Po(e,t,n)})),e}function $o(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return $o(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Ro(){this.__u=0,this.o=null,this.__b=null}function Io(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Ao(){this.i=null,this.l=null}Dt.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Mo&&Mo(e)},(Ro.prototype=new an).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var r=Io(o.__v),i=!1,s=function(){i||o.__z||(i=!0,n.__R=null,r?r(l):l())};n.__R=s;var a=n.__P;n.__P=null;var l=function(){if(! --o.__u){if(o.state.__a){var e=o.state.__a;o.__v.__k[0]=$o(e,e.__c.__P,e.__c.__O)}var t;for(o.setState({__a:o.__b=null});t=o.o.pop();)t.__P=a,t.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(s,s)},Ro.prototype.componentWillUnmount=function(){this.o=[]},Ro.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=Po(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&on(sn,null,e.fallback);return r&&(r.__u&=-33),[on(sn,null,t.__a?null:e.children),r]};var Fo=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function No(e){return this.getChildContext=function(){return e.context},e.children}function To(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){$n(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var o=t.__v;null!==o&&!o.__m&&null!==o.__;)o=o.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:o.__m},contains:function(){return!0},namespaceURI:n.namespaceURI,insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}$n(on(No,{context:t.context},e.__v),t.v)}(Ao.prototype=new an).__a=function(e){var t=this,n=Io(t.__v),o=t.l.get(e);return o[0]++,function(r){var i=function(){t.props.revealOrder?(o.push(r),Fo(t,e,o)):r()};n?n(i):i()}},Ao.prototype.render=function(e){this.i=null,this.l=new Map;var t=mn(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Ao.prototype.componentDidUpdate=Ao.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Fo(e,n,t)})};var jo="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,Do=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Oo=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Lo=/[A-Z0-9]/g,Ho="undefined"!=typeof document,zo=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};an.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(an.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Uo=Dt.event;Dt.event=function(e){return Uo&&(e=Uo(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Wo,qo={configurable:!0,get:function(){return this.class}},Bo=Dt.vnode;Dt.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,o={},r=-1==n.indexOf("-");for(var i in t){var s=t[i];if(!("value"===i&&"defaultValue"in t&&null==s||Ho&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var a=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===s?s="":"translate"===a&&"no"===s?s=!1:"o"===a[0]&&"n"===a[1]?"ondoubleclick"===a?i="ondblclick":"onchange"!==a||"input"!==n&&"textarea"!==n||zo(t.type)?"onfocus"===a?i="onfocusin":"onblur"===a?i="onfocusout":Oo.test(i)&&(i=a):a=i="oninput":r&&Do.test(i)?i=i.replace(Lo,"-$&").toLowerCase():null===s&&(s=void 0),"oninput"===a&&o[i=a]&&(i="oninputCapture"),o[i]=s}}"select"==n&&(o.multiple&&Array.isArray(o.value)&&(o.value=mn(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),null!=o.defaultValue&&(o.value=mn(t.children).forEach(function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value}))),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",qo)):t.className&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=jo,Bo&&Bo(e)};var Vo=Dt.__r;Dt.__r=function(e){Vo&&Vo(e),Wo=e.__c};var Ko=Dt.diffed;Dt.diffed=function(e){Ko&&Ko(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),Wo=null};var Zo={ReactCurrentDispatcher:{current:{readContext:function(e){return Wo.__n[e.__c].props.value},useCallback:to,useContext:no,useDebugValue:oo,useDeferredValue:go,useEffect:Yn,useId:ro,useImperativeHandle:Xn,useInsertionEffect:bo,useLayoutEffect:Gn,useMemo:eo,useReducer:Jn,useRef:Qn,useState:Zn,useSyncExternalStore:_o,useTransition:vo}}};function Jo(e){return!!e&&e.$$typeof===jo}var Yo={useState:Zn,useId:ro,useReducer:Jn,useEffect:Yn,useLayoutEffect:Gn,useInsertionEffect:bo,useTransition:vo,useDeferredValue:go,useSyncExternalStore:_o,startTransition:yo,useRef:Qn,useImperativeHandle:Xn,useMemo:eo,useCallback:to,useContext:no,useDebugValue:oo,version:"18.3.1",Children:Co,render:function(e,t,n){return null==t.__k&&(t.textContent=""),$n(e,t),"function"==typeof n&&n(),e?e.__c:null},hydrate:function(e,t,n){return Rn(e,t),"function"==typeof n&&n(),e?e.__c:null},unmountComponentAtNode:function(e){return!!e.__k&&($n(null,e),!0)},createPortal:function(e,t){var n=on(To,{__v:e,h:t});return n.containerInfo=t,n},createElement:on,createContext:function(e){function t(e){var n,o;return this.getChildContext||(n=new Set,(o={})[t.__c]=this,this.getChildContext=function(){return o},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,dn(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+Yt++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t},createFactory:function(e){return on.bind(null,e)},cloneElement:function(e){return Jo(e)?In.apply(null,arguments):e},createRef:function(){return{current:null}},Fragment:sn,isValidElement:Jo,isElement:Jo,isFragment:function(e){return Jo(e)&&e.type===sn},isMemo:function(e){return!!e&&"string"==typeof e.displayName&&0==e.displayName.indexOf("Memo(")},findDOMNode:function(e){return e&&(e.base||1===e.nodeType&&e)||null},Component:an,PureComponent:ko,memo:function(e,t){function n(e){var n=this.props.ref;return n!=e.ref&&n&&("function"==typeof n?n(null):n.current=null),t?!t(this.props,e)||n!=e.ref:ho(this.props,e)}function o(t){return this.shouldComponentUpdate=n,on(e,t)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.__f=o.prototype.isReactComponent=!0,o.type=e,o},forwardRef:function(e){function t(t){var n=fo({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=So,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t},flushSync:function(e,t){var n,o=Dt.debounceRendering;Dt.debounceRendering=function(e){n=e};try{var r=e(t);return n&&n(),r}finally{Dt.debounceRendering=o}},unstable_batchedUpdates:function(e,t){return e(t)},StrictMode:sn,Suspense:Ro,SuspenseList:Ao,lazy:function(e){var t,n,o,r=null;function i(i){if(t||(t=e()).then(function(e){e&&(r=e.default||e),o=!0},function(e){n=e,o=!0}),n)throw n;if(!o)throw t;return r?on(r,i):null}return i.displayName="Lazy",i.__f=!0,i},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Zo};const Go={none:void 0,fade:"pw-vpopup-fade 0.35s ease-out backwards",slide:"pw-vpopup-slide 0.35s ease-out backwards"};function Qo({slot:e,align:t,inverse:n,colors:o}){const r={...d[e.variant],textAlign:e.align??t},i=f(e.variant,o,n);return i&&(r.color=i),Yo.createElement("div",{style:r,dangerouslySetInnerHTML:{__html:Oe(e.html)}})}function Xo({slot:e,colors:t,onRequestClose:n,onPageChange:o}){const r=y(e.variant,t),i={};if("close"===e.action.type)return Yo.createElement("div",{style:i},Yo.createElement("button",{type:"button",style:r,onClick:n},e.label));if("page"===e.action.type){const t=e.action.page;return Yo.createElement("div",{style:i},Yo.createElement("button",{type:"button",style:r,onClick:()=>o(t)},e.label))}const s=Ne(e.action.url);return s?Yo.createElement("div",{style:i},Yo.createElement("a",{href:s,...Te(e.action.target),style:r},e.label)):Yo.createElement("div",{style:i},Yo.createElement("button",{type:"button",style:r},e.label))}function er({message:e,align:t,inverse:n,colors:o}){const r=f("body",o,n);return Yo.createElement("div",{style:{...d.body,padding:"4px 0",textAlign:t,...r?{color:r}:{}}},e)}const tr=/^\S+@\S+\.\S+$/,nr={email:"email",phone:"tel"},or={email:"email",firstName:"given-name",lastName:"family-name",phone:"tel"},rr="__privacy";function ir({slot:e,align:t,inverse:n,colors:o,onSubmitForm:r}){const[i,s]=Zn({}),[a,l]=Zn(!1),[c,u]=Zn(null),[p,h]=Zn({}),[_,v]=Zn("idle"),b=f("caption",o,n),k={...d.caption,...b?{color:b}:{}},w={fontSize:12,lineHeight:1.4,color:o.error,paddingTop:2};if("success"===_||"confirm"===_)return Yo.createElement(er,{message:"confirm"===_?e.confirmEmailMessage:e.successMessage,align:t,inverse:n,colors:o});const S="submitting"===_,x=e.privacy?Ne(e.privacy.url):void 0,C={...y(e.submitVariant,o),...S?{opacity:.6,cursor:"default"}:{}};return Yo.createElement("form",{noValidate:!0,style:{margin:0,textAlign:"left"},onSubmit:t=>{t.preventDefault(),(()=>{if(!r||!e.formCode||"submitting"===_)return;const t={};for(const n of e.fields){const e=(i[n.key]??"").trim();n.required&&!e?t[n.key]="Required":"email"===n.kind&&e&&!tr.test(e)&&(t[n.key]="Enter a valid email")}if(e.privacy&&!a&&(t[rr]="Please accept the privacy policy"),h(t),Object.keys(t).length>0)return;const n={email:"",policyAccepted:!e.privacy||a},o={};for(const t of e.fields){const e=(i[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),v("submitting"),Promise.resolve().then(()=>r(e.formCode,n)).then(e=>v("confirm-email"===e?"confirm":"success"),()=>v("error"))})()}},e.fields.map(e=>{const t=p[e.key];let n;return t?n=o.error:c===e.key&&(n=o.accent),Yo.createElement("div",{key:e.key,style:{padding:"4px 0"}},e.label&&Yo.createElement("div",{style:{...k,paddingBottom:4}},e.label),Yo.createElement("input",{type:nr[e.kind]??"text",autoComplete:or[e.kind],placeholder:e.placeholder||void 0,value:i[e.key]??"",disabled:S,style:g(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 h(e=>e[n]?Object.fromEntries(Object.entries(e).filter(([e])=>e!==n)):e);var n,o}}),t&&Yo.createElement("div",{style:w},t))}),e.privacy&&Yo.createElement("div",{style:{padding:"4px 0"}},Yo.createElement("label",{style:{...k,display:"flex",alignItems:"flex-start",gap:8,cursor:"pointer"}},Yo.createElement("input",{type:"checkbox",checked:a,disabled:S,style:{margin:"2px 0 0",flexShrink:0},onChange:e=>{l(e.currentTarget.checked),h(e=>e[rr]?Object.fromEntries(Object.entries(e).filter(([e])=>e!==rr)):e)}}),Yo.createElement("span",null,e.privacy.checkboxLabel,x&&Yo.createElement(Yo.Fragment,null," ",Yo.createElement("a",{href:x,...Te(void 0),style:{color:o.accent}},e.privacy.linkLabel||e.privacy.url)))),p[rr]&&Yo.createElement("div",{style:w},p[rr])),Yo.createElement("div",{style:{padding:m}},Yo.createElement("button",{type:"submit",disabled:S,style:C},e.submitLabel)),"error"===_&&Yo.createElement("div",{style:{...w,textAlign:t}},E))}function sr({value:e,label:t,digitStyle:n,labelStyle:o}){return Yo.createElement("div",{style:{minWidth:44}},Yo.createElement("div",{style:n},String(e).padStart(2,"0")),t?Yo.createElement("div",{style:o},t):null)}function ar({slot:e,align:t,inverse:n,colors:o,mode:r,onRequestClose:i,onPageChange:s}){const[a,l]=Zn(()=>Date.now()),c=function(e,t,n){const o=Ae(e,t),r=null===o?0:Math.max(0,o-n),i=Math.floor(r/1e3);return{total:r,days:Math.floor(i/86400),hours:Math.floor(i/3600)%24,minutes:Math.floor(i/60)%60,seconds:i%60}}(e.endTime,e.timezone,a),u=0===c.total;Yn(()=>{if("live"!==r||u)return;const e=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(e)},[r,u,e.endTime,e.timezone]),Yn(()=>{"live"===r&&u&&("hide-popup"===e.onExpire?i?.():"page"===e.onExpire&&e.expirePage&&s(e.expirePage))},[r,u,e.onExpire,e.expirePage,i,s]);const p=f("h2",o,n),h=f("caption",o,n),_={fontSize:28,fontWeight:700,lineHeight:1.2,fontVariantNumeric:"tabular-nums",...p?{color:p}:{}},m={...d.caption,...h?{color:h}:{}},y=(g=e.language,Fe[g]??Fe.en);var g;const v=[{value:c.days,label:y.days},{value:c.hours,label:y.hours},{value:c.minutes,label:y.minutes},{value:c.seconds,label:y.seconds}];return Yo.createElement("div",{style:{padding:"4px 0",textAlign:t}},Yo.createElement("div",{style:{display:"inline-flex",gap:12,textAlign:"center"}},v.map(t=>Yo.createElement(sr,{key:t.label||t.value,value:t.value,label:e.showLabels?t.label:"",digitStyle:_,labelStyle:m}))))}function lr({slot:e,align:t,inverse:n,colors:o,onSubmitChoice:r}){const[i,s]=Zn([]),[a,l]=Zn("idle"),[c,u]=Zn("");if("success"===a)return Yo.createElement(er,{message:e.successMessage,align:t,inverse:n,colors:o});const p=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])},h="submitting"===a,_=f("body",o,n),g={...d.body,..._?{color:_}:{}};return Yo.createElement("div",{style:{padding:"4px 0"}},"chips"===e.control?Yo.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:8,justifyContent:"center"===t?"center":"flex-start"}},e.options.map(e=>{return Yo.createElement("button",{key:e.value,type:"button","aria-pressed":i.includes(e.value),style:(t=i.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:()=>p(e.value)},e.label);var t})):Yo.createElement("div",{style:{display:"grid",gap:6}},e.options.map(e=>Yo.createElement("label",{key:e.value,style:{...g,display:"flex",alignItems:"center",gap:8,cursor:"pointer"}},Yo.createElement("input",{type:"checkbox",checked:i.includes(e.value),onChange:()=>p(e.value),style:{accentColor:o.accent,width:16,height:16,margin:0}}),e.label))),c?Yo.createElement("div",{style:{...d.caption,color:o.error,paddingTop:4}},c):null,"error"===a?Yo.createElement("div",{style:{...d.caption,color:o.error,paddingTop:4}},E):null,Yo.createElement("div",{style:{padding:m}},Yo.createElement("button",{type:"button",style:{...y(e.submitVariant,o),...h?{opacity:.7}:{}},onClick:()=>{if(!r||!e.tagName||"submitting"===a)return;const t=Math.max(e.min,1);if(i.length<t)return void u(1===t?"Pick at least one":`Pick at least ${t}`);const n=e.options.filter(e=>i.includes(e.value)).map(e=>e.tagValue||e.value);u(""),l("submitting"),Promise.resolve().then(()=>r({slotKey:e.key,tagName:e.tagName,values:n})).then(()=>l("success"),()=>l("error"))}},e.submitLabel)))}function cr({score:e,scale:t,selected:n,colors:o,onPick:r}){const i={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 Yo.createElement("button",{type:"button","aria-label":`Rate ${e}`,"aria-pressed":n,style:{...i,width:30,height:32,borderRadius:6},onClick:r},e);const s="thumbs"===t;let a=`Rate ${e}`;return s&&(a=1===e?"Thumbs up":"Thumbs down"),Yo.createElement("button",{type:"button","aria-label":a,"aria-pressed":n,style:{...i,width:s?44:34,height:s?40:34,borderRadius:s?8:6},onClick:r},Yo.createElement("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"},Yo.createElement("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":P.star,...s&&0===e?{transform:"rotate(180 12 12)"}:{}})))}function ur({slot:e,align:t,inverse:n,colors:o,onSubmitRating:r}){const[i,s]=Zn(null),[a,l]=Zn("idle");if("success"===a)return Yo.createElement(er,{message:e.successMessage,align:t,inverse:n,colors:o});const c=t=>{r&&e.eventName&&"submitting"!==a&&(l("submitting"),Promise.resolve().then(()=>r({slotKey:e.key,eventName:e.eventName,score:t,scale:e.scale})).then(()=>l("success"),()=>l("error")))},u="nps"===(p=e.scale)?[0,1,2,3,4,5,6,7,8,9,10]:"stars"===p?[1,2,3,4,5]:[0,1];var p;const h=f("caption",o,n),_={...d.caption,...h?{color:h}:{}},g=t=>"stars"===e.scale?null!==i&&t<=i:i===t;return Yo.createElement("div",{style:{padding:"4px 0"}},Yo.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:6,justifyContent:"center"===t?"center":"flex-start"}},u.map(t=>Yo.createElement(cr,{key:t,score:t,scale:e.scale,selected:g(t),colors:o,onPick:()=>(t=>{"submitting"!==a&&(s(t),"instant"===e.submitMode&&c(t))})(t)}))),e.labels.low||e.labels.high?Yo.createElement("div",{style:{display:"flex",justifyContent:"space-between",gap:8,paddingTop:4}},Yo.createElement("span",{style:_},e.labels.low),Yo.createElement("span",{style:_},e.labels.high)):null,"error"===a?Yo.createElement("div",{style:{...d.caption,color:o.error,paddingTop:4}},E):null,"button"===e.submitMode?Yo.createElement("div",{style:{padding:m}},Yo.createElement("button",{type:"button",style:{...y("primary",o),..."submitting"===a?{opacity:.7}:{}},onClick:()=>null===i?void 0:c(i)},e.submitLabel)):null)}function dr({slot:e,align:t,inverse:n,colors:o}){const r=e.color||(n?o.textInverse:o.accent);return Yo.createElement("div",{style:{padding:"4px 0",textAlign:t,lineHeight:0}},Yo.createElement("svg",{width:e.size,height:e.size,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{display:"inline-block"}},Yo.createElement("path",{d:P[e.name]})))}function pr({slot:e,align:t,inverse:n,colors:o,mode:r="live",onRequestClose:i,onPageChange:s,onSubmitForm:a,onSubmitChoice:l,onSubmitRating:c}){const u=s??(()=>{});switch(e.type){case"text":return Yo.createElement(Qo,{slot:e,align:t,inverse:n,colors:o});case"button":return Yo.createElement(Xo,{slot:e,colors:o,onRequestClose:i,onPageChange:u});case"email-subscription-form":return Yo.createElement(ir,{slot:e,align:t,inverse:n,colors:o,onSubmitForm:a});case"timer":return Yo.createElement(ar,{slot:e,align:t,inverse:n,colors:o,mode:r,onRequestClose:i,onPageChange:u});case"choice":return Yo.createElement(lr,{slot:e,align:t,inverse:n,colors:o,onSubmitChoice:l});case"rating":return Yo.createElement(ur,{slot:e,align:t,inverse:n,colors:o,onSubmitRating:c});case"glyph":return Yo.createElement(dr,{slot:e,align:t,inverse:n,colors:o})}}function fr({node:e,page:t,colors:n,mode:o,leaf:r,onRequestClose:i,onPageChange:s,onSubmitForm:a,onSubmitChoice:l,onSubmitRating:c}){const u=t.contents.find(t=>t.key===e.props.content);if(!u)return null;if(r?.renderZone)return Yo.createElement("div",{style:{minWidth:0}},r.renderZone(u,e));const d=e.props.align??"left",p="inverse"===e.props.tone;return Yo.createElement("div",{style:{minWidth:0}},u.slots.map((e,t)=>{const r=u.slots[t-1],f=r?(h=_(r),"action"===(m=_(e))?"action"===h?6:16:"text"===m&&"heading"===h?4:8):0;var h,m;return Yo.createElement("div",{key:e.key,style:f?{marginTop:f}:void 0},Yo.createElement(pr,{slot:e,align:d,inverse:p,colors:n,mode:o,onRequestClose:i,onPageChange:s,onSubmitForm:a,onSubmitChoice:l,onSubmitRating:c}))}))}function hr(e){return e?.video?Ne(e.video.src):void 0}function _r({image:e,poster:t,src:n,style:o,mode:r}){return Yo.createElement("video",{src:n,poster:t||void 0,style:o,autoPlay:"live"===r,muted:!0,playsInline:!0,preload:"metadata",loop:!1!==e.video?.loop,controls:!0===e.video?.controls})}function mr({node:e,page:t,leaf:n,mode:o,scheme:r}){const i=t.images.find(t=>t.key===e.props.image);if(!i)return null;if(n?.renderImage)return Yo.createElement(Yo.Fragment,null,n.renderImage(i,e));const s=hr(i),a=Se(i,r);if(!a&&!s)return null;const l={display:"block",width:"100%",minWidth:0};return i.fit?(l.height="100%",l.objectFit=i.fit):l.height="auto",i.blur&&(l.filter=`blur(${i.blur}px)`),s?Yo.createElement(_r,{image:i,poster:a,src:s,style:l,mode:o}):Yo.createElement("img",{src:a,alt:"",style:l})}function yr({style:e,outer:t,inner:n,layer:o,children:r}){const{backgroundColor:i,...s}=e;return Yo.createElement("div",{style:{display:"grid",minWidth:0,backgroundColor:i,...t}},o,Yo.createElement("div",{style:{...s,...n}},r))}function gr({node:e,page:t,colors:n,mode:o,scheme:r,leaf:i,onRequestClose:s,onPageChange:a,onSubmitForm:l,onSubmitChoice:c,onSubmitRating:u}){if("Content"===e.type)return Yo.createElement(fr,{node:e,page:t,colors:n,mode:o,scheme:r,leaf:i,onRequestClose:s,onPageChange:a,onSubmitForm:l,onSubmitChoice:c,onSubmitRating:u});if("Image"===e.type)return Yo.createElement(mr,{node:e,page:t,leaf:i,mode:o,scheme:r});const d=e.props?.backgroundImage,p=d?t.images.find(e=>e.key===d):void 0,f=p?.blur??0,h=p?.dim??0,_=hr(p),m=p?Se(p,r):void 0,y=ae(e,f>0||_?void 0:m||void 0,h);d&&(y.backgroundColor="#1D2939");const g=e.children.map((e,d)=>Yo.createElement(gr,{key:d,node:e,page:t,colors:n,mode:o,scheme:r,leaf:i,onRequestClose:s,onPageChange:a,onSubmitForm:l,onSubmitChoice:c,onSubmitRating:u}));if(_&&p){const e=ie(h);return Yo.createElement(yr,{style:y,outer:{position:"relative",overflow:"hidden",...m?se(m):{}},inner:{position:"relative",...e?{backgroundImage:e}:{}},layer:Yo.createElement(_r,{image:p,poster:m??"",src:_,mode:o,style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",...f>0?{filter:`blur(${f}px)`}:{}}})},g)}return f>0?Yo.createElement(yr,{style:y,outer:m?se(m,h):void 0,inner:{backdropFilter:`blur(${f}px)`,WebkitBackdropFilter:`blur(${f}px)`}},g):Yo.createElement("div",{style:y},g)}function vr({page:e,params:t,mode:n="live",colorScheme:o="light",leafRenderers:r,animatePage:i=!1,onRequestClose:s,onPageChange:a,onSubmitForm:l,onSubmitChoice:c,onSubmitRating:u}){const d=we(t,o),p=xe(t,o),f={position:"relative",boxSizing:"border-box",overflow:"hidden",backgroundColor:d.background,colorScheme:d.scheme,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',color:d.text,borderRadius:t.borderRadius>0?t.borderRadius:void 0,boxShadow:p.boxShadow&&"none"!==p.boxShadow?p.boxShadow:void 0,transition:"height 300ms ease"};e.height&&(f.height="stretch"===e.height?"100%":e.height,f.overflowY="auto");const h={...i?{animation:"pw-vpopup-page 300ms ease-out backwards"}:{},..."stretch"===e.height?{display:"grid",minHeight:"100%"}:{}};return Yo.createElement("div",{style:f},Yo.createElement("div",{key:e.key,style:h},Yo.createElement(gr,{node:e.layout,page:e,colors:d,mode:n,scheme:d.scheme,leaf:r,onRequestClose:s,onPageChange:a??(()=>{}),onSubmitForm:l,onSubmitChoice:c,onSubmitRating:u})))}function br({colors:e,onRequestClose:t}){return Yo.createElement("button",{type:"button","aria-label":"Close",onClick:t,style:{position:"absolute",top:10,right:10,width:24,height:24,padding:0,border:"none",borderRadius:"50%",background:me(e.surface,.92),boxShadow:"0 1px 3px rgba(16, 24, 40, 0.25)",color:e.chromeIcon,fontSize:13,lineHeight:1,cursor:"pointer"}},"✕")}function kr(e,t,n){const{placement:o}=e,r={position:"fixed",boxSizing:"border-box",maxWidth:_t(o),maxHeight:_t(o),pointerEvents:"auto"};if(t){r.width=t;const e=o.h;"left"===e?r.left=o.offset:"right"===e?r.right=o.offset:r.left="50%"}else r.left=o.offset,r.right=o.offset;"stretch"===n?(r.top=o.offset,r.bottom=o.offset):"top"===o.v?r.top=o.offset:"bottom"===o.v?r.bottom=o.offset:r.top="50%";const i=t&&"center"===o.h?"-50%":"0",s="middle"===o.v&&"stretch"!==n?"-50%":"0";"0"===i&&"0"===s||(r.transform=`translate(${i}, ${s})`);const a=Go[e.animation];return a&&(r.animation=a),r.transition="width 300ms ease",r}const wr="(prefers-color-scheme: dark)";function Sr(e,t){const[n,o]=Zn(()=>"auto"===e&&t&&"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia(wr).matches);return Yn(()=>{if("auto"!==e||!t||"undefined"==typeof window||"function"!=typeof window.matchMedia)return;const n=window.matchMedia(wr),r=e=>o(e.matches);return o(n.matches),n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[e,t]),"auto"!==e?e:n?"dark":"light"}function xr({params:e,mode:t="live",colorScheme:n="auto",onRequestClose:o,onSubmitForm:r,onSubmitChoice:i,onSubmitRating:s,leafRenderers:a}){const[l,c]=Zn(null);Yn(()=>{ht(e).forEach(e=>e.images.forEach(({src:e,srcDark:t})=>{[e,t].forEach(e=>{e&&((new Image).src=e)})}))},[e]);const u=Sr(n,be(e)),d=ht(e);if(0===d.length)return null;const p=d.find(e=>e.key===l)??function(e,t){return t.find(t=>t.key===e.startPage)??t[0]}(e,d),f=null!==l;if("preview"===t)return Yo.createElement("div",{style:{position:"relative",width:p.width??"100%",transition:"width 300ms ease"}},Yo.createElement("style",null,M),Yo.createElement(vr,{page:p,params:e,mode:t,colorScheme:u,leafRenderers:a,animatePage:f,onRequestClose:o,onPageChange:c,onSubmitForm:r,onSubmitChoice:i,onSubmitRating:s}));const{overlay:h}=xe(e,u);return Yo.createElement(Yo.Fragment,null,Yo.createElement("style",null,M),h&&Yo.createElement("div",{style:{position:"fixed",inset:0,backgroundColor:h.color,opacity:h.opacity,animation:"pw-vpopup-overlay 0.2s ease-out backwards",pointerEvents:"auto"},onClick:o}),Yo.createElement("div",{style:kr(e,p.width,p.height)},Yo.createElement(vr,{page:p,params:e,mode:t,colorScheme:u,leafRenderers:a,animatePage:f,onRequestClose:o,onPageChange:c,onSubmitForm:r,onSubmitChoice:i,onSubmitRating:s}),Yo.createElement(br,{colors:we(e,u),onRequestClose:o})))}const Cr={SUBMIT_FORM_RESULT_SUBSCRIBED:"subscribed",SUBMIT_FORM_RESULT_CONFIRM_EMAIL:"confirm-email",SUBMIT_FORM_RESULT_ALREADY_SUBSCRIBED:"already-subscribed"},Er=(e,t)=>`https://subscription-form.svc-nue.pushwoosh.com/api/v1/forms/code/${encodeURIComponent(e)}${t}`,Mr=async(e,t)=>{try{const n=await fetch(Er(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(),r=Cr[o.result??""];if(!r)throw new Error(`Subscription form submit failed: unexpected result "${o.result}"`);return r}catch(t){throw Ft.error(t,`Failed to submit subscription form "${e}"`),t}};class Pr{constructor(e){this.isRecurringVisitor=!1,this.entries=new Map,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:Nt(e),onSubmitRating:Tt(e)},e.moduleRegistry.webPopups=this}async run(){const{pw:e}=this;try{this.autoShowEnabled=!1!==e.initParams.webPopups?.autoShow,this.colorScheme=e.initParams.webPopups?.colorScheme??"auto";const t=await e.data.getFeatures();if(!1===t?.popup_forms?.enabled)return void Ft.debug(`${yt} application has no active popup forms, skipping`);await e.api.ensureDeviceRegistered(),this.isRecurringVisitor=await e.data.getIsRecurringVisitor();const n=await e.api.getPopupForms();Ft.debug(`${yt} Received ${n.length} popup(s) from server:`,n.map(e=>e.code)),n.forEach((e,t)=>{this.entries.set(e.code,{popup:e,order:t,state:"idle",content:null,loading:null,passedStrongConditions:!1,timeoutId:null,visitRecorded:!1})}),await Promise.allSettled(Array.from(this.entries.values()).map(async e=>{e.passedStrongConditions=await this.checkStrongCondition(e.popup),e.passedStrongConditions&&await this.ensureContent(e)}));const o=this.loadedCodes();Ft.debug(`${yt} ${o.length} popup(s) passed strong conditions and loaded:`,o),this.subscribeToNavigation(),this.renderForCurrentPage(),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);if(!t)return Ft.error(new Error("Unknown web popup code"),`${yt} show("${e}"): no such popup`),!1;if(this.visible?.code===e)return!0;return await this.ensureContent(t)?this.visible?.code===e||!!this.checkNotExpired(t)&&(this.visible&&(Ft.debug(`${yt} show("${e}") preempting "${this.visible.code}"`),this.visible.close("preempted")),this.detachFromAutoPipeline(t),this.present(t,"api"),!0):(Ft.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()}}ensureContent(e){return e.content?Promise.resolve(e.content):(e.loading||(e.loading=this.loadContent(e.popup).then(t=>(e.content=t,t)).catch(t=>(Ft.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=ze(e);return t?0===ht(t.params).length?null:t.params:null})((await this.pw.api.getPopupFormContent(e.popup_form_content_code)).json);return t||(Ft.error(new Error("Unsupported popup content format"),`${yt} Web popup "${e.code}" content is not a supported {version, params} popup; skipping`),null)}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.armDelay(t),e.push(n))}),Ft.debug(`${yt} ${e.length} popup(s) selected for display on "${window.location.pathname}":`,e),this.drain()}canAutoDisplay(e){return this.autoShowEnabled&&"idle"===e.state&&e.passedStrongConditions&&this.isAutoTrigger(e.popup)&&null!==e.content&&this.checkSoftCondition(e.popup)&&this.checkNotExpired(e)}isAutoTrigger(e){const t=e.trigger_type;return!t||"PAGE_LOAD"===t}armDelay(e){const{popup:t}=e;Ft.debug(`${yt} Popup "${t.code}" armed for display in ${t.delay}s`),e.state="waiting",this.recordVisit(e),e.timeoutId=window.setTimeout(()=>{e.timeoutId=null,e.state="queued",this.insertIntoQueue(e),Ft.debug(`${yt} Popup "${t.code}" delay elapsed; queued at position ${this.queue.indexOf(t.code)+1} of ${this.queue.length}`),this.drain()},1e3*t.delay)}recordVisit(e){e.visitRecorded||(e.visitRecorded=!0,this.pw.api.recordPopupFormEvent(e.popup.code,1).catch(t=>{Ft.error(t,`${yt} Failed to record web popup visit event for "${e.popup.code}"`)}))}insertIntoQueue(e){const t=this.queue.findIndex(t=>{const n=this.entries.get(t);return!!n&&(n.popup.delay!==e.popup.delay?n.popup.delay>e.popup.delay:n.order>e.order)});-1!==t?this.queue.splice(t,0,e.popup.code):this.queue.push(e.popup.code)}releaseUnmatchedPending(){this.entries.forEach(e=>{"waiting"!==e.state&&"queued"!==e.state||this.checkSoftCondition(e.popup)&&this.checkNotExpired(e)||(this.detachFromAutoPipeline(e),e.state="idle",Ft.debug(`${yt} Released popup "${e.popup.code}": page no longer matches, or its countdown passed`))})}detachFromAutoPipeline(e){null!==e.timeoutId&&(window.clearTimeout(e.timeoutId),e.timeoutId=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.entries.get(e);if(t&&"queued"===t.state){if(!this.checkSoftCondition(t.popup)||!this.checkNotExpired(t))return t.state="idle",void this.drain();if(!t.content)return t.state="done",void this.drain();Ft.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 r=document.createElement("div");r.id=`${mt}-${n.code}`,r.style.position="fixed",r.style.inset="0",r.style.zIndex=String(2147483647),r.style.pointerEvents="none",document.body.appendChild(r);const i=r.attachShadow({mode:"open"}),s=document.createElement("div");i.appendChild(s);const a=!!o.overlay;a&&this.lockBodyScroll();let l=!1;const c=t=>{l||(l=!0,a&&this.unlockBodyScroll(),(e=>{$n(null,e)})(s),r.remove(),this.visible?.code===n.code&&(this.visible=null),e.state="done",this.pw.dispatchEvent("hide-web-popup",{code:n.code,reason:t}),this.scheduleDrain())};this.visible={code:n.code,host:r,modal:a,close:c},e.state="visible",((e,t,n,o,r="auto")=>{$n(Fn(xr,{params:t,mode:"live",colorScheme:r,onRequestClose:n,onSubmitForm:Mr,onSubmitChoice:o.onSubmitChoice,onSubmitRating:o.onSubmitRating}),e)})(s,o,()=>c("user"),this.submitHandlers,this.colorScheme);const u=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]}(o);u.length>0&&this.pw.data.getHwid().then(e=>u.forEach(t=>((e,t)=>{fetch(Er(e,"/view"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,userId:t,hwid:t})}).catch(t=>{Ft.error(t,`Failed to record subscription form view for "${e}"`)})})(t,e))).catch(e=>{Ft.error(e,`${yt} Failed to record subscription form views for web popup "${n.code}"`)}),Ft.debug(`${yt} Popup "${n.code}" shown (trigger: ${t})`),this.recordVisit(e),this.markAsShown(n).catch(e=>{Ft.error(e,`${yt} Failed to mark web popup "${n.code}" as shown`)}),this.pw.dispatchEvent("show-web-popup",{code:n.code,trigger:t})}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(),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)}async checkStrongCondition(e){return(await Promise.all([this.checkCanBeShownByDeviceTypeCondition(e),this.checkCanBeShownByFrequencyCondition(e),this.checkCanBeShownByVisitorsTypeCondition(e)])).every(e=>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=Ae(n.endTime,e);if(null!==o&&o<=t)return!0}return!1}(e.content,Date.now())||(Ft.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("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,r=window.location.pathname;return n&&n.length>0?n.some(e=>this.matchPageRule(r,e)):t&&t.length>0?t.includes(r):!(o&&o.length>0)||!o.some(e=>this.matchPageRule(r,e))}matchPageRule(e,t){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}async markAsShown(e){this.pw.api.recordPopupFormEvent(e.code,2).catch(t=>{Ft.error(t,`${yt} Failed to record web popup shown event for "${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`${mt}.shown.${e}`}}return t})());
2
2
  //# sourceMappingURL=widget-web-popups.js.map