web-push-notifications 3.62.5 → 3.62.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/npm.js +1 -1
- package/package.json +2 -2
- package/pushwoosh-web-notifications.d.ts +1 -0
- package/pushwoosh-widget-inbox.d.ts +1 -0
- package/pushwoosh-widget-subscribe-popup.d.ts +1 -0
- package/pushwoosh-widget-subscription-button.d.ts +1 -0
- package/pushwoosh-widget-subscription-prompt.d.ts +1 -0
- package/pushwoosh-widget-web-popups.d.ts +1 -0
- package/service-worker.js +1 -1
- package/widget-web-popups.js +1 -1
- package/widget-web-popups.js.map +1 -1
package/widget-web-popups.js
CHANGED
|
@@ -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)=>{if(Array.isArray(n))for(var o=0;o<n.length;){var r=n[o++],i=n[o++];e.o(t,r)?0===i&&o++:0===i?Object.defineProperty(t,r,{enumerable:!0,value:n[o++]}):Object.defineProperty(t,r,{enumerable:!0,get:i})}else for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};e.r(t),e.d(t,{WebPopupsWidget:()=>Zn});const n="pushwoosh-web-popups";var o,r,i,u,l,s,c,a,_,f,p,d,h,m,y,v={},g=[],b=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,k=Array.isArray;function w(e,t){for(var n in t)e[n]=t[n];return e}function C(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function S(e,t,n){var r,i,u,l={};for(u in t)"key"==u?r=t[u]:"ref"==u?i=t[u]:l[u]=t[u];if(arguments.length>2&&(l.children=arguments.length>3?o.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(u in e.defaultProps)void 0===l[u]&&(l[u]=e.defaultProps[u]);return x(e,l,r,i,null)}function x(e,t,n,o,u){var l={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:u??++i,__i:-1,__u:0};return null==u&&null!=r.vnode&&r.vnode(l),l}function E(e){return e.children}function P(e,t){this.props=e,this.context=t}function F(e,t){if(null==t)return e.__?F(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?F(e):null}function N(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],i=[],u=w({},t);u.__v=t.__v+1,r.vnode&&r.vnode(u),B(e.__P,u,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??F(t),!!(32&t.__u),i),u.__v=t.__v,u.__.__k[u.__i]=u,z(o,u,i),t.__e=t.__=null,u.__e!=n&&R(u)}}function R(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}),R(e)}function A(e){(!e.__d&&(e.__d=!0)&&u.push(e)&&!I.__r++||l!=r.debounceRendering)&&((l=r.debounceRendering)||s)(I)}function I(){try{for(var e,t=1;u.length;)u.length>t&&u.sort(c),e=u.shift(),t=u.length,N(e)}finally{u.length=I.__r=0}}function O(e,t,n,o,r,i,u,l,s,c,a){var _,f,p,d,h,m,y,b=o&&o.__k||g,k=t.length;for(s=j(n,t,b,s,k),_=0;_<k;_++)null!=(p=n.__k[_])&&(f=-1!=p.__i&&b[p.__i]||v,p.__i=_,m=B(e,p,f,r,i,u,l,s,c,a),d=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&V(f.ref,null,p),a.push(p.ref,p.__c||d,p)),null==h&&null!=d&&(h=d),(y=!!(4&p.__u))||f.__k===p.__k?(s=$(p,s,e,y),y&&f.__e&&(f.__e=null)):"function"==typeof p.type&&void 0!==m?s=m:d&&(s=d.nextSibling),p.__u&=-7);return n.__e=h,s}function j(e,t,n,o,r){var i,u,l,s,c,a=n.length,_=a,f=0;for(e.__k=new Array(r),i=0;i<r;i++)null!=(u=t[i])&&"boolean"!=typeof u&&"function"!=typeof u?("string"==typeof u||"number"==typeof u||"bigint"==typeof u||u.constructor==String?u=e.__k[i]=x(null,u,null,null,null):k(u)?u=e.__k[i]=x(E,{children:u},null,null,null):void 0===u.constructor&&u.__b>0?u=e.__k[i]=x(u.type,u.props,u.key,u.ref?u.ref:null,u.__v):e.__k[i]=u,s=i+f,u.__=e,u.__b=e.__b+1,l=null,-1!=(c=u.__i=M(u,n,s,_))&&(_--,(l=n[c])&&(l.__u|=2)),null==l||null==l.__v?(-1==c&&(r>a?f--:r<a&&f++),"function"!=typeof u.type&&(u.__u|=4)):c!=s&&(c==s-1?f--:c==s+1?f++:(c>s?f--:f++,u.__u|=4))):e.__k[i]=null;if(_)for(i=0;i<a;i++)null!=(l=n[i])&&!(2&l.__u)&&(l.__e==o&&(o=F(l)),Z(l,l));return o}function $(e,t,n,o){var r,i;if("function"==typeof e.type){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=$(r[i],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=F(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function T(e,t){return t=t||[],null==e||"boolean"==typeof e||(k(e)?e.some(function(e){T(e,t)}):t.push(e)),t}function M(e,t,n,o){var r,i,u,l=e.key,s=e.type,c=t[n],a=null!=c&&!(2&c.__u);if(null===c&&null==l||a&&l==c.key&&s==c.type)return n;if(o>(a?1:0))for(r=n-1,i=n+1;r>=0||i<t.length;)if(null!=(c=t[u=r>=0?r--:i++])&&!(2&c.__u)&&l==c.key&&s==c.type)return u;return-1}function H(e,t,n){"-"==t[0]?e.setProperty(t,n??""):e[t]=null==n?"":"number"!=typeof n||b.test(t)?n:n+"px"}function W(e,t,n,o,r){var i,u;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||H(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||H(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(p,"$1")),u=t.toLowerCase(),t=u in e||"onFocusOut"==t||"onFocusIn"==t?u.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n[f]=o[f]:(n[f]=d,e.addEventListener(t,i?m:h,i)):e.removeEventListener(t,i?m:h,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 U(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t[_])t[_]=d++;else if(t[_]<n[f])return;return n(r.event?r.event(t):t)}}}function B(e,t,n,o,i,u,l,s,c,a){var _,f,p,d,h,m,y,v,b,S,x,F,N,R,A,I,j=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(c=!!(32&n.__u),u=[s=t.__e=n.__e]),(_=r.__b)&&_(t);e:if("function"==typeof j){f=l.length;try{if(b=t.props,S=j.prototype&&j.prototype.render,x=(_=j.contextType)&&o[_.__c],F=_?x?x.props.value:_.__:o,n.__c?v=(p=t.__c=n.__c).__=p.__E:(S?t.__c=p=new j(b,F):(t.__c=p=new P(b,F),p.constructor=j,p.render=K),x&&x.sub(p),p.state||(p.state={}),p.__n=o,d=p.__d=!0,p.__h=[],p._sb=[]),S&&null==p.__s&&(p.__s=p.state),S&&null!=j.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=w({},p.__s)),w(p.__s,j.getDerivedStateFromProps(b,p.__s))),h=p.props,m=p.state,p.__v=t,d)S&&null==j.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),S&&null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(S&&null==j.getDerivedStateFromProps&&b!==h&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(b,F),t.__v==n.__v||!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(b,p.__s,F)){t.__v!=n.__v&&(p.props=b,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),g.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&l.push(p);break e}null!=p.componentWillUpdate&&p.componentWillUpdate(b,p.__s,F),S&&null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(h,m,y)})}if(p.context=F,p.props=b,p.__P=e,p.__e=!1,N=r.__r,R=0,S)p.state=p.__s,p.__d=!1,N&&N(t),_=p.render(p.props,p.state,p.context),g.push.apply(p.__h,p._sb),p._sb=[];else do{p.__d=!1,N&&N(t),_=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++R<25);p.state=p.__s,null!=p.getChildContext&&(o=w(w({},o),p.getChildContext())),S&&!d&&null!=p.getSnapshotBeforeUpdate&&(y=p.getSnapshotBeforeUpdate(h,m)),A=null!=_&&_.type===E&&null==_.key?L(_.props.children):_,s=O(e,k(A)?A:[A],t,n,o,i,u,l,s,c,a),p.base=t.__e,t.__u&=-161,p.__h.length&&l.push(p),v&&(p.__E=p.__=null)}catch(e){if(l.length=f,t.__v=null,c||null!=u){if(e.then){for(t.__u|=c?160:128;s&&8==s.nodeType&&s.nextSibling;)s=s.nextSibling;null!=u&&(u[u.indexOf(s)]=null),t.__e=s}else if(null!=u)for(I=u.length;I--;)C(u[I])}else t.__e=n.__e;null==t.__k&&(t.__k=n.__k||[]),e.then||D(t),r.__e(e,t,n)}}else null==u&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=q(n.__e,t,n,o,i,u,l,c,a);return(_=r.diffed)&&_(t),128&t.__u?void 0:s}function D(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(D))}function z(e,t,n){for(var o=0;o<n.length;o++)V(n[o],n[++o],n[++o]);r.__c&&r.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){r.__e(e,t.__v)}})}function L(e){return"object"!=typeof e||null==e||e.__b>0?e:k(e)?e.map(L):void 0!==e.constructor?null:w({},e)}function q(e,t,n,i,u,l,s,c,a){var _,f,p,d,h,m,y,g=n.props||v,b=t.props,w=t.type;if("svg"==w?u="http://www.w3.org/2000/svg":"math"==w?u="http://www.w3.org/1998/Math/MathML":u||(u="http://www.w3.org/1999/xhtml"),null!=l)for(_=0;_<l.length;_++)if((h=l[_])&&"setAttribute"in h==!!w&&(w?h.localName==w:3==h.nodeType)){e=h,l[_]=null;break}if(null==e){if(null==w)return document.createTextNode(b);e=document.createElementNS(u,w,b.is&&b),c&&(r.__m&&r.__m(t,l),c=!1),l=null}if(null==w)g===b||c&&e.data==b||(e.data=b);else{if(l="textarea"==w&&null!=b.defaultValue?null:l&&o.call(e.childNodes),!c&&null!=l)for(g={},_=0;_<e.attributes.length;_++)g[(h=e.attributes[_]).name]=h.value;for(_ in g)h=g[_],"dangerouslySetInnerHTML"==_?p=h:"children"==_||_ in b||"value"==_&&"defaultValue"in b||"checked"==_&&"defaultChecked"in b||W(e,_,null,h,u);for(_ in b)h=b[_],"children"==_?d=h:"dangerouslySetInnerHTML"==_?f=h:"value"==_?m=h:"checked"==_?y=h:c&&"function"!=typeof h||g[_]===h||W(e,_,h,g[_],u);if(f)c||p&&(f.__html==p.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(p&&(e.innerHTML=""),O("template"==t.type?e.content:e,k(d)?d:[d],t,n,i,"foreignObject"==w?"http://www.w3.org/1999/xhtml":u,l,s,l?l[0]:n.__k&&F(n,0),c,a),null!=l)for(_=l.length;_--;)C(l[_]);c&&"textarea"!=w||(_="value","progress"==w&&null==m?e.removeAttribute("value"):null!=m&&(m!==e[_]||"progress"==w&&!m||"option"==w&&m!=g[_])&&W(e,_,m,g[_],u),_="checked",null!=y&&y!=e[_]&&W(e,_,y,g[_],u))}return e}function V(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){r.__e(e,n)}}function Z(e,t,n){var o,i;if(r.unmount&&r.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||V(o,null,t)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){r.__e(e,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&Z(o[i],t,n||"function"!=typeof e.type);n||C(e.__e),e.__c=e.__=e.__e=void 0}function K(e,t,n){return this.constructor(e,n)}function G(e,t,n){var i,u,l,s;t==document&&(t=document.documentElement),r.__&&r.__(e,t),u=(i="function"==typeof n)?null:n&&n.__k||t.__k,l=[],s=[],B(t,e=(!i&&n||t).__k=S(E,null,[e]),u||v,v,t.namespaceURI,!i&&n?[n]:u?null:t.firstChild?o.call(t.childNodes):null,l,!i&&n?n:u?u.__e:t.firstChild,i,s),z(l,e,s),e.props.children=null}function J(e,t){G(e,t,J)}function Q(e,t,n){var r,i,u,l,s=w({},e.props);for(u in e.type&&e.type.defaultProps&&(l=e.type.defaultProps),t)"key"==u?r=t[u]:"ref"==u?i=t[u]:s[u]=void 0===t[u]&&null!=l?l[u]:t[u];return arguments.length>2&&(s.children=arguments.length>3?o.call(arguments,2):n),x(e.type,s,r||e.key,i||e.ref,null)}o=g.slice,r={__e:function(e,t,n,o){for(var r,i,u;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&null!=i.getDerivedStateFromError&&(r.setState(i.getDerivedStateFromError(e)),u=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,o||{}),u=r.__d),u)return r.__E=r}catch(t){e=t}throw e}},i=0,P.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=w({},this.state),"function"==typeof e&&(e=e(w({},n),this.props)),e&&w(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),A(this))},P.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),A(this))},P.prototype.render=E,u=[],s="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,c=function(e,t){return e.__v.__b-t.__v.__b},I.__r=0,a=Math.random().toString(8),_="__d"+a,f="__a"+a,p=/(PointerCapture)$|Capture$/i,d=0,h=U(!1),m=U(!0),y=0;var Y=0;Array.isArray;function X(e,t,n,o,i,u){t||(t={});var l,s,c=t;if("ref"in c)for(s in c={},t)"ref"==s?l=t[s]:c[s]=t[s];var a={type:e,props:c,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Y,__i:-1,__u:0,__source:i,__self:u};if("function"==typeof e&&(l=e.defaultProps))for(s in l)void 0===c[s]&&(c[s]=l[s]);return r.vnode&&r.vnode(a),a}const ee=/^(https?:|mailto:|tel:)/i,te="#FFFFFF",ne="#2970FF",oe="#101828",re="#667085",ie="#FFFFFF",ue={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}},le={h1:1,h2:1,h3:1,icon:1,eyebrow:.8,body:.9,caption:.75};function se(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,u]=[0,2,4].map(e=>parseInt(o.slice(e,e+2),16));return`rgba(${r}, ${i}, ${u}, ${t})`}(t.textInverse,le[e]??1):"icon"!==e?"caption"===e||"eyebrow"===e?t.textSecondary:t.text:void 0}const ce=["Vertical","Horizontal","Columns","Rows"],ae=["normal","reverse"],_e=["start","center","end","stretch"],fe=["start","center","end","space-between"],pe=["left","center","right"],de=["default","inverse"],he=2e3,me={px:he,"%":100,em:125,rem:125},ye=/^(\d{1,4}(?:\.\d+)?)(px|%|em|rem)$/,ve={px:he,"%":100,fr:100},ge=/^(\d{1,4}(?:\.\d+)?)(px|%|fr)$/,be=["auto","min-content","max-content"];function ke(e,t){return t.includes(e)?e:void 0}function we(e){if("number"==typeof e&&Number.isFinite(e))return Math.min(Math.max(e,0),he);if("string"!=typeof e)return;const t=ye.exec(e.trim());if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),me[o])}${o}`}const Ce=["top","right","bottom","left"];function Se(e){if(be.includes(e))return e;const t=ge.exec(e);if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),ve[o])}${o}`}function xe(e){return"string"==typeof e&&e.length>0?e:void 0}function Ee(e){const t={},n=we(e.gap);void 0!==n&&(t.gap=n);const o=function(e){const t=we(e);if(void 0!==t)return t;if("object"!=typeof e||null===e)return;const n={};for(const t of Ce){const o=we(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=ke(e.alignItems,_e);r&&(t.alignItems=r);const i=ke(e.justifyContent,fe);i&&(t.justifyContent=i);const u=xe(e.backgroundImage);u&&(t.backgroundImage=u);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(Se);return n.every(e=>void 0!==e)?n.join(" "):void 0}(e.sizes);return void 0!==l&&(t.sizes=l),t}function Pe(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=xe(r.content);if(!e)return null;const t={type:"Content",props:{content:e}},n=ke(r.align,pe);n&&(t.props.align=n);const o=ke(r.tone,de);return o&&"default"!==o&&(t.props.tone=o),t}if("Image"===o.type){const e=xe(r.image);if(!e)return null;return{type:"Image",props:{image:e}}}if(!Array.isArray(o.children))return null;const i=ke(o.type,ce)??"Vertical",u=[];for(const e of o.children){const o=Pe(e,t+1,n);o&&u.push(o)}const l=Ee(r);return"reverse"===ke(r.order,ae)&&(u.reverse(),"string"==typeof l.sizes&&(l.sizes=l.sizes.split(" ").reverse().join(" "))),{type:i,props:l,children:u}}function Fe(e){return Pe(e,0,{nodes:100})}const Ne=/^[a-zA-Z][a-zA-Z0-9-]*$/,Re=/^\$([a-zA-Z][a-zA-Z0-9-]*)$/;function Ae(e,t){return e.includes("$")?e.split(/(\s+)/).map(e=>{const n=Re.exec(e)?.[1];return void 0!==n&&Object.prototype.hasOwnProperty.call(t,n)?t[n]:e}).join(""):e}function Ie(e,t){return"object"!=typeof e||null===e||0===Object.keys(t).length?e:je(e,t,0)}const Oe=new Set(["content","image","backgroundImage"]);function je(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(!Oe.has(n))if("string"==typeof o)e[n]=Ae(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]=Ae(n,t));e[n]=r}r.props=e}return Array.isArray(o.children)&&(r.children=o.children.map(e=>je(e,t,n+1))),r}function $e(e){return"number"==typeof e?`${e}px`:e}function Te(e,t){if("string"==typeof e)return e;return`repeat(${"number"==typeof e?e:Math.max(t,1)}, 1fr)`}function Me(e,t=0){const n=`url(${JSON.stringify(e)})`,o=t>0?`rgba(16, 24, 40, ${Math.min(t,1)})`:null;return{backgroundImage:o?`linear-gradient(${o}, ${o}), ${n}`:n,backgroundSize:"cover",backgroundPosition:"center"}}function He(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=Te(o.sizes,e.children.length)),"Rows"===e.type&&(r.gridTemplateRows=Te(o.sizes,e.children.length)),void 0!==o.gap&&(r.gap=$e(o.gap)),void 0!==o.padding&&(r.padding=function(e){if("number"==typeof e||"string"==typeof e)return $e(e);const t=e=>void 0===e?"0":$e(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),t&&Object.assign(r,Me(t,n)),r}function We(e){const t=(e||"").trim();if(t)return t.startsWith("#")||t.startsWith("/")||t.startsWith("?")||ee.test(t)?t:void 0}const Ue=new Set(["STRONG","B","EM","I","U","BR","A"]);function Be(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(!Ue.has(e.tagName)){Be(e,t,n);continue}const r=n.createElement(e.tagName.toLowerCase());if("A"===e.tagName){const t=We(e.getAttribute("href")??void 0);t&&r.setAttribute("href",t),r.setAttribute("target","_blank"),r.setAttribute("rel","noreferrer")}t.appendChild(r),Be(e,r,n)}}function De(e){if(!e.includes("<"))return e;const t=(new DOMParser).parseFromString(e,"text/html"),n=t.createElement("div");return Be(t.body,n,t),n.innerHTML}function ze(e){return"string"==typeof e&&e?e:void 0}function Le(e){const t="object"==typeof e.colors&&null!==e.colors?e.colors:{};return{background:ze(t.background)??ze(e.background)??te,accent:ze(t.accent)??ze(e.accent)??ne,text:ze(t.text)??oe,textSecondary:ze(t.textSecondary)??re,textInverse:ze(t.textInverse)??ie}}const qe=["cover","contain"];function Ve(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&&"string"==typeof n.src&&t.push({key:n.key,label:"string"==typeof n.label?n.label:"",src:n.src,...qe.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 Ze=["px","%","em","rem","fr"];function Ke(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}function Ge(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=Ke(t.min),n=Ke(t.max),o="length"===t.kind&&Array.isArray(t.units)?t.units.filter(e=>Ze.includes(e)):[];return{kind:t.kind,...void 0!==e?{min:e}:{},...void 0!==n?{max:n}:{},...o.length>0?{units:o}:{}}}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 Je(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||!Ne.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=Ge(n.control);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",value:n.value,...e?{control:e}:{}})}return t}function Qe(e){return Object.fromEntries(e.map(e=>[e.key,e.value]))}function Ye(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:n.slots.slice(0,50)}))}return t}function Xe(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.min(e,2e3):void 0}function et(e,t){if(null!==e)return Xe(e)??Xe(t)}function tt(e){const t=[];for(const n of e.pages){const o=Je(n.values),r=Fe(Ie(n.layout,Qe(o)));if(!r)continue;const i=et(n.width,e.width),u=et(n.height,e.height);t.push({key:n.key,layout:r,images:Ve(n.images),contents:Ye(n.contents),...void 0!==i?{width:i}:{},...void 0!==u?{height:u}:{}})}return t}function nt(e){return`calc(100% - ${2*e.offset}px)`}var ot,rt,it,ut,lt=0,st=[],ct=r,at=ct.__b,_t=ct.__r,ft=ct.diffed,pt=ct.__c,dt=ct.unmount,ht=ct.__;function mt(e,t){ct.__h&&ct.__h(rt,e,lt||t),lt=0;var n=rt.__H||(rt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function yt(e){return lt=1,vt(jt,e)}function vt(e,t,n){var o=mt(ot++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):jt(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=rt,!rt.__f)){var r=function(e,t,n){if(!o.__c.__H)return!0;var r=!1,u=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]&&(u=!0)}}),i){var l=i.call(this,e,t,n);return r?l||u:l}return!r||u};rt.__f=!0;var i=rt.shouldComponentUpdate,u=rt.componentWillUpdate;rt.componentWillUpdate=function(e,t,n){if(this.__e){var o=i;i=void 0,r(e,t,n),i=o}u&&u.call(this,e,t,n)},rt.shouldComponentUpdate=r}return o.__N||o.__}function gt(e,t){var n=mt(ot++,3);!ct.__s&&Ot(n.__H,t)&&(n.__=e,n.u=t,rt.__H.__h.push(n))}function bt(e,t){var n=mt(ot++,4);!ct.__s&&Ot(n.__H,t)&&(n.__=e,n.u=t,rt.__h.push(n))}function kt(e){return lt=5,Ct(function(){return{current:e}},[])}function wt(e,t,n){lt=6,bt(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 Ct(e,t){var n=mt(ot++,7);return Ot(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function St(e,t){return lt=8,Ct(function(){return e},t)}function xt(e){var t=rt.context[e.__c],n=mt(ot++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(rt)),t.props.value):e.__}function Et(e,t){ct.useDebugValue&&ct.useDebugValue(t?t(e):e)}function Pt(){var e=mt(ot++,11);if(!e.__){for(var t=rt.__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 Ft(){for(var e;e=st.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(At),t.__h.some(It),t.__h=[]}catch(n){t.__h=[],ct.__e(n,e.__v)}}}ct.__b=function(e){rt=null,at&&at(e)},ct.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ht&&ht(e,t)},ct.__r=function(e){_t&&_t(e),ot=0;var t=(rt=e.__c).__H;t&&(it===rt?(t.__h=[],rt.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(At),t.__h.some(It),t.__h=[],ot=0)),it=rt},ct.diffed=function(e){ft&&ft(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==st.push(t)&&ut===ct.requestAnimationFrame||((ut=ct.requestAnimationFrame)||Rt)(Ft)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),it=rt=null},ct.__c=function(e,t){t.some(function(e){try{e.__h.some(At),e.__h=e.__h.filter(function(e){return!e.__||It(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],ct.__e(n,e.__v)}}),pt&&pt(e,t)},ct.unmount=function(e){dt&&dt(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{At(e)}catch(e){t=e}}),n.__H=void 0,t&&ct.__e(t,n.__v))};var Nt="function"==typeof requestAnimationFrame;function Rt(e){var t,n=function(){clearTimeout(o),Nt&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Nt&&(t=requestAnimationFrame(n))}function At(e){var t=rt,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),rt=t}function It(e){var t=rt;e.__c=e.__(),rt=t}function Ot(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function jt(e,t){return"function"==typeof t?t(e):t}function $t(e,t){for(var n in t)e[n]=t[n];return e}function Tt(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 Mt(e,t){var n=t(),o=yt({t:{__:n,u:t}}),r=o[0].t,i=o[1];return bt(function(){r.__=n,r.u=t,Ht(r)&&i({t:r})},[e,n,t]),gt(function(){return Ht(r)&&i({t:r}),e(function(){Ht(r)&&i({t:r})})},[e]),n}function Ht(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 Wt(e){e()}function Ut(e){return e}function Bt(){return[!1,Wt]}var Dt=bt;function zt(e,t){this.props=e,this.context=t}(zt.prototype=new P).isPureReactComponent=!0,zt.prototype.shouldComponentUpdate=function(e,t){return Tt(this.props,e)||Tt(this.state,t)};var Lt=r.__b;r.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Lt&&Lt(e)};var qt="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var Vt=function(e,t){return null==e?null:T(T(e).map(t))},Zt={map:Vt,forEach:Vt,count:function(e){return e?T(e).length:0},only:function(e){var t=T(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:T},Kt=r.__e;r.__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);Kt(e,t,n,o)};var Gt=r.unmount;function Jt(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=$t({},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 Jt(e,t,n)})),e}function Qt(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return Qt(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 Yt(){this.__u=0,this.o=null,this.__b=null}function Xt(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function en(){this.i=null,this.l=null}r.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Gt&&Gt(e)},(Yt.prototype=new P).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var r=Xt(o.__v),i=!1,u=function(){i||o.__z||(i=!0,n.__R=null,r?r(s):s())};n.__R=u;var l=n.__P;n.__P=null;var s=function(){if(! --o.__u){if(o.state.__a){var e=o.state.__a;o.__v.__k[0]=Qt(e,e.__c.__P,e.__c.__O)}var t;for(o.setState({__a:o.__b=null});t=o.o.pop();)t.__P=l,t.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(u,u)},Yt.prototype.componentWillUnmount=function(){this.o=[]},Yt.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]=Jt(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&S(E,null,e.fallback);return r&&(r.__u&=-33),[S(E,null,t.__a?null:e.children),r]};var tn=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 nn(e){return this.getChildContext=function(){return e.context},e.children}function on(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){G(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)}}}G(S(nn,{context:t.context},e.__v),t.v)}(en.prototype=new P).__a=function(e){var t=this,n=Xt(t.__v),o=t.l.get(e);return o[0]++,function(r){var i=function(){t.props.revealOrder?(o.push(r),tn(t,e,o)):r()};n?n(i):i()}},en.prototype.render=function(e){this.i=null,this.l=new Map;var t=T(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},en.prototype.componentDidUpdate=en.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){tn(e,n,t)})};var rn="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,un=/^(?: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]/,ln=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,sn=/[A-Z0-9]/g,cn="undefined"!=typeof document,an=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};P.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(P.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var _n=r.event;r.event=function(e){return _n&&(e=_n(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var fn,pn={configurable:!0,get:function(){return this.class}},dn=r.vnode;r.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 u=t[i];if(!("value"===i&&"defaultValue"in t&&null==u||cn&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var l=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===u?u="":"translate"===l&&"no"===u?u=!1:"o"===l[0]&&"n"===l[1]?"ondoubleclick"===l?i="ondblclick":"onchange"!==l||"input"!==n&&"textarea"!==n||an(t.type)?"onfocus"===l?i="onfocusin":"onblur"===l?i="onfocusout":ln.test(i)&&(i=l):l=i="oninput":r&&un.test(i)?i=i.replace(sn,"-$&").toLowerCase():null===u&&(u=void 0),"oninput"===l&&o[i=l]&&(i="oninputCapture"),o[i]=u}}"select"==n&&(o.multiple&&Array.isArray(o.value)&&(o.value=T(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),null!=o.defaultValue&&(o.value=T(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",pn)):t.className&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=rn,dn&&dn(e)};var hn=r.__r;r.__r=function(e){hn&&hn(e),fn=e.__c};var mn=r.diffed;r.diffed=function(e){mn&&mn(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),fn=null};var yn={ReactCurrentDispatcher:{current:{readContext:function(e){return fn.__n[e.__c].props.value},useCallback:St,useContext:xt,useDebugValue:Et,useDeferredValue:Ut,useEffect:gt,useId:Pt,useImperativeHandle:wt,useInsertionEffect:Dt,useLayoutEffect:bt,useMemo:Ct,useReducer:vt,useRef:kt,useState:yt,useSyncExternalStore:Mt,useTransition:Bt}}};function vn(e){return!!e&&e.$$typeof===rn}var gn={useState:yt,useId:Pt,useReducer:vt,useEffect:gt,useLayoutEffect:bt,useInsertionEffect:Dt,useTransition:Bt,useDeferredValue:Ut,useSyncExternalStore:Mt,startTransition:Wt,useRef:kt,useImperativeHandle:wt,useMemo:Ct,useCallback:St,useContext:xt,useDebugValue:Et,version:"18.3.1",Children:Zt,render:function(e,t,n){return null==t.__k&&(t.textContent=""),G(e,t),"function"==typeof n&&n(),e?e.__c:null},hydrate:function(e,t,n){return J(e,t),"function"==typeof n&&n(),e?e.__c:null},unmountComponentAtNode:function(e){return!!e.__k&&(G(null,e),!0)},createPortal:function(e,t){var n=S(on,{__v:e,h:t});return n.containerInfo=t,n},createElement:S,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,A(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"+y++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t},createFactory:function(e){return S.bind(null,e)},cloneElement:function(e){return vn(e)?Q.apply(null,arguments):e},createRef:function(){return{current:null}},Fragment:E,isValidElement:vn,isElement:vn,isFragment:function(e){return vn(e)&&e.type===E},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:P,PureComponent:zt,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:Tt(this.props,e)}function o(t){return this.shouldComponentUpdate=n,S(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=$t({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=qt,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t},flushSync:function(e,t){var n=r.debounceRendering;r.debounceRendering=function(e){return e()};var o=e(t);return r.debounceRendering=n,o},unstable_batchedUpdates:function(e,t){return e(t)},StrictMode:E,Suspense:Yt,SuspenseList:en,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?S(r,i):null}return i.displayName="Lazy",i.__f=!0,i},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:yn};const bn={none:void 0,fade:"pw-vpopup-fade 0.35s ease-out backwards",slide:"pw-vpopup-slide 0.35s ease-out backwards"};function kn({slot:e,align:t,inverse:n,colors:o}){const r={...ue[e.variant],textAlign:e.align??t,padding:"4px 0"},i=se(e.variant,o,n);return i&&(r.color=i),gn.createElement("div",{style:r,dangerouslySetInnerHTML:{__html:De(e.html)}})}function wn({slot:e,accent:t,onRequestClose:n,onPageChange:o}){const r={display:"block",boxSizing:"border-box",width:"100%",padding:"10px 25px",borderRadius:3,fontSize:14,fontWeight:600,fontFamily:"inherit",lineHeight:1.5,textAlign:"center",textDecoration:"none",cursor:"pointer",..."secondary"===e.variant?{backgroundColor:"#FFFFFF",color:t,border:`1px solid ${t}`}:{backgroundColor:t,color:"#FFFFFF",border:"none"}},i={padding:"8px 0 4px"};if("close"===e.action.type)return gn.createElement("div",{style:i},gn.createElement("button",{type:"button",style:r,onClick:n},e.label));if("page"===e.action.type){const t=e.action.page;return gn.createElement("div",{style:i},gn.createElement("button",{type:"button",style:r,onClick:()=>o(t)},e.label))}const u=We(e.action.url);return u?gn.createElement("div",{style:i},gn.createElement("a",{href:u,target:"_blank",rel:"noreferrer",style:r},e.label)):gn.createElement("div",{style:i},gn.createElement("button",{type:"button",style:r},e.label))}function Cn({node:e,page:t,colors:n,onRequestClose:o,onPageChange:r}){const i=t.contents.find(t=>t.key===e.props.content);if(!i)return null;const u=e.props.align??"left",l="inverse"===e.props.tone;return gn.createElement("div",{style:{minWidth:0}},i.slots.map(e=>"text"===e.type?gn.createElement(kn,{key:e.key,slot:e,align:u,inverse:l,colors:n}):gn.createElement(wn,{key:e.key,slot:e,accent:n.accent,onRequestClose:o,onPageChange:r})))}function Sn({node:e,page:t}){const n=t.images.find(t=>t.key===e.props.image);if(!n?.src)return null;const o={display:"block",width:"100%",minWidth:0};return n.fit?(o.height="100%",o.objectFit=n.fit):o.height="auto",n.blur&&(o.filter=`blur(${n.blur}px)`),gn.createElement("img",{src:n.src,alt:"",style:o})}function xn({node:e,page:t,colors:n,onRequestClose:o,onPageChange:r}){if("Content"===e.type)return gn.createElement(Cn,{node:e,page:t,colors:n,onRequestClose:o,onPageChange:r});if("Image"===e.type)return gn.createElement(Sn,{node:e,page:t});const i=e.props?.backgroundImage,u=i?t.images.find(e=>e.key===i):void 0,l=u?.blur??0,s=u?.dim??0,c=He(e,l>0?void 0:u?.src||void 0,s);i&&(c.backgroundColor="#1D2939");const a=e.children.map((e,i)=>gn.createElement(xn,{key:i,node:e,page:t,colors:n,onRequestClose:o,onPageChange:r}));if(l>0){const{backgroundColor:e,...t}=c;return gn.createElement("div",{style:{minWidth:0,backgroundColor:e,...u?.src?Me(u.src,s):{}}},gn.createElement("div",{style:{...t,backdropFilter:`blur(${l}px)`,WebkitBackdropFilter:`blur(${l}px)`}},a))}return gn.createElement("div",{style:c},a)}function En({page:e,params:t,onRequestClose:n,onPageChange:o}){const r={position:"relative",boxSizing:"border-box",overflow:"hidden",backgroundColor:t.colors.background,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',color:t.colors.text,borderRadius:t.borderRadius>0?t.borderRadius:void 0,boxShadow:t.boxShadow&&"none"!==t.boxShadow?t.boxShadow:void 0};return e.height&&(r.height=e.height,r.overflowY="auto"),gn.createElement("div",{style:r},gn.createElement(xn,{node:e.layout,page:e,colors:t.colors,onRequestClose:n,onPageChange:o}))}function Pn({onRequestClose:e}){return gn.createElement("button",{type:"button","aria-label":"Close",onClick:e,style:{position:"absolute",top:10,right:10,width:24,height:24,padding:0,border:"none",borderRadius:"50%",background:"rgba(255, 255, 255, 0.92)",boxShadow:"0 1px 3px rgba(16, 24, 40, 0.25)",color:"#667085",fontSize:13,lineHeight:1,cursor:"pointer"}},"✕")}function Fn(e,t){const{placement:n}=e,o={position:"fixed",boxSizing:"border-box",maxWidth:nt(n),maxHeight:nt(n),pointerEvents:"auto"};if(t){o.width=t;const e=n.h;"left"===e?o.left=n.offset:"right"===e?o.right=n.offset:o.left="50%"}else o.left=n.offset,o.right=n.offset;"top"===n.v?o.top=n.offset:"bottom"===n.v?o.bottom=n.offset:o.top="50%";const r=t&&"center"===n.h?"-50%":"0",i="middle"===n.v?"-50%":"0";"0"===r&&"0"===i||(o.transform=`translate(${r}, ${i})`);const u=bn[e.animation];return u&&(o.animation=u),o}function Nn({params:e,mode:t="live",onRequestClose:n}){const[o,r]=yt(null);gt(()=>{tt(e).forEach(e=>e.images.forEach(({src:e})=>{e&&((new Image).src=e)}))},[e]);const i=tt(e);if(0===i.length)return null;const u=i.find(e=>e.key===o)??function(e,t){return t.find(t=>t.key===e.startPage)??t[0]}(e,i);if("preview"===t)return gn.createElement("div",{style:{position:"relative",width:u.width??"100%"}},gn.createElement(En,{page:u,params:e,onRequestClose:n,onPageChange:r}));const l=e.overlay;return gn.createElement(gn.Fragment,null,gn.createElement("style",null,"\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"),l&&gn.createElement("div",{style:{position:"fixed",inset:0,backgroundColor:l.color,opacity:l.opacity,animation:"pw-vpopup-overlay 0.2s ease-out backwards",pointerEvents:"auto"},onClick:n}),gn.createElement("div",{style:Fn(e,u.width)},gn.createElement(En,{page:u,params:e,onRequestClose:n,onPageChange:r}),gn.createElement(Pn,{onRequestClose:n})))}const Rn=e=>{const t=function(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;return"object"!=typeof o||null===o?null:Array.isArray(o.pages)&&0!==o.pages.length?{version:2,params:{...o,colors:Le(o)}}:null}(e);return t?0===tt(t.params).length?null:t.params:null},An="keyValue",In="messages",On="inboxMessages";function jn(e,t){return function(n){n.objectStoreNames.contains(e)||t(n)}}const $n=[jn(An,function(e){e.createObjectStore(An,{keyPath:"key"})}),jn("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})}),jn(In,function(e){e.createObjectStore(In,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),jn(On,function(e){const t="status",n=e.createObjectStore(On,{keyPath:"inbox_id",autoIncrement:!1});n.createIndex(t,t,{unique:!1,multiEntry:!0}),n.createIndex("rt","rt",{unique:!1,multiEntry:!0})})];class Tn{get all(){return $n}}class Mn{constructor(e,t=new Tn){this.db=e,this.migrationsBuilder=t}applyMigrations(){this.applyMigrationsPack(this.migrationsBuilder.all)}applyMigrationsPack(e){e.forEach(e=>{e(this.db)})}}function Hn(e,t){console.info("onversionchange",t),e.close()}let Wn;function Un(e){return(Wn||(Wn=new Promise((e,t)=>{const n=indexedDB.open("PUSHWOOSH_SDK_STORE",7);n.onsuccess=n=>{const o=n.target.result;o.onversionchange=Hn.bind(null,o,t),e(o)},n.onerror=()=>t(n.error),n.onupgradeneeded=e=>{const n=e.target.result;n.onversionchange=Hn.bind(null,n,t),new Mn(n).applyMigrations()}})),Wn).then(t=>new Promise((n,o)=>e(t,n,o)))}class Bn{_add(e){return Un((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 Un((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 Un((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)}})}}Dn=An;var Dn;const zn=new class extends Bn{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)}},Ln=(new class extends Bn{constructor(){super(...arguments),this.name=In,this.maxItems=25}add(e){return this._add({...e,date:new Date})}},{error:1,info:2,debug:3});let qn=3;const Vn={setLevel(e){Ln[e]||(e="error"),qn=Ln[e]},write(e,t,n){return"error"===e?this.error(t):this.info(t),zn.add(e,t,n)}};Object.keys(Ln).forEach(e=>{const t=Ln[e];Vn[e]=(...n)=>{t<=qn&&(console.groupCollapsed(e),console.info("",...n),console.trace("trace"),console.groupEnd())}});class Zn{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)}constructor(e){this.isRecurringVisitor=!1,this.loadedPopups=new Map,this.pendingTimers=new Map,this.isNavigationSubscribed=!1,this.openPopupsCount=0,this.bodyOverflowBeforeLock=null,this.pw=e}async run(){const{pw:e}=this;await e.api.ensureDeviceRegistered(),this.isRecurringVisitor=await e.data.getIsRecurringVisitor();const t=await e.api.getPopupForms();(await Promise.allSettled(t.map(e=>this.loadWebPopup(e)))).forEach((e,n)=>{"rejected"===e.status&&Vn.error(e.reason,`Failed to load web popup "${t[n].code}"`)}),this.subscribeToNavigation(),this.renderForCurrentPage(),await e.data.setIsRecurringVisitor(!0)}async loadWebPopup(e){if(!await this.checkStrongCondition(e))return;const t=await this.pw.api.getPopupFormContent(e.popup_form_content_code),n=Rn(t.json);n?this.loadedPopups.set(e.code,{popup:e,parsed:n}):Vn.error(new Error("Unsupported popup content format"),`Web popup "${e.code}" content is not a supported {version, params} popup; skipping`)}renderForCurrentPage(){this.cancelPendingForUnmatchedPages();const e=[];this.loadedPopups.forEach((t,n)=>{this.checkSoftCondition(t.popup)&&e.push([n,t])}),e.forEach(([e,{popup:t,parsed:n}])=>{this.addToQueue(t,n),this.loadedPopups.delete(e)})}cancelPendingForUnmatchedPages(){this.pendingTimers.forEach(({timeoutId:e,loaded:t},n)=>{this.checkSoftCondition(t.popup)||(window.clearTimeout(e),this.pendingTimers.delete(n),this.loadedPopups.set(n,t))})}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)}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}=e;return!t||(0===t.length||t.includes(window.location.pathname))}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=>{Vn.error(t,`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`${n}.shown.${e}`}addToQueue(e,t){this.pw.api.recordPopupFormEvent(e.code,1).catch(t=>{Vn.error(t,`Failed to record web popup queued event for "${e.code}"`)});const o=window.setTimeout(()=>{this.pendingTimers.delete(e.code);const o=document.createElement("div");o.id=`${n}-${e.code}`,o.style.position="fixed",o.style.inset="0",o.style.zIndex=String(2147483647),o.style.pointerEvents="none",document.body.appendChild(o);const r=o.attachShadow({mode:"open"}),i=document.createElement("div");r.appendChild(i);const u=!!t.overlay;u&&this.lockBodyScroll();((e,t,n)=>{G(X(Nn,{params:t,mode:"live",onRequestClose:n}),e)})(i,t,()=>{u&&this.unlockBodyScroll(),o.remove(),this.pw.dispatchEvent("hide-web-popup",{code:e.code})}),this.markAsShown(e).catch(t=>{Vn.error(t,`Failed to mark web popup "${e.code}" as shown`)}),this.pw.dispatchEvent("show-web-popup",{code:e.code})},1e3*e.delay);this.pendingTimers.set(e.code,{timeoutId:o,loaded:{popup:e,parsed:t}})}}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)=>{if(Array.isArray(n))for(var o=0;o<n.length;){var r=n[o++],i=n[o++];e.o(t,r)?0===i&&o++:0===i?Object.defineProperty(t,r,{enumerable:!0,value:n[o++]}):Object.defineProperty(t,r,{enumerable:!0,get:i})}else for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};e.r(t),e.d(t,{WebPopupsWidget:()=>Kn});const n="pushwoosh-web-popups";var o,r,i,u,l,s,a,c,_,f,p,d,h,m,y,v={},g=[],b=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,k=Array.isArray;function w(e,t){for(var n in t)e[n]=t[n];return e}function C(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function S(e,t,n){var r,i,u,l={};for(u in t)"key"==u?r=t[u]:"ref"==u?i=t[u]:l[u]=t[u];if(arguments.length>2&&(l.children=arguments.length>3?o.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(u in e.defaultProps)void 0===l[u]&&(l[u]=e.defaultProps[u]);return x(e,l,r,i,null)}function x(e,t,n,o,u){var l={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:u??++i,__i:-1,__u:0};return null==u&&null!=r.vnode&&r.vnode(l),l}function P(e){return e.children}function E(e,t){this.props=e,this.context=t}function F(e,t){if(null==t)return e.__?F(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?F(e):null}function N(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],i=[],u=w({},t);u.__v=t.__v+1,r.vnode&&r.vnode(u),B(e.__P,u,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??F(t),!!(32&t.__u),i),u.__v=t.__v,u.__.__k[u.__i]=u,z(o,u,i),t.__e=t.__=null,u.__e!=n&&R(u)}}function R(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}),R(e)}function A(e){(!e.__d&&(e.__d=!0)&&u.push(e)&&!I.__r++||l!=r.debounceRendering)&&((l=r.debounceRendering)||s)(I)}function I(){try{for(var e,t=1;u.length;)u.length>t&&u.sort(a),e=u.shift(),t=u.length,N(e)}finally{u.length=I.__r=0}}function O(e,t,n,o,r,i,u,l,s,a,c){var _,f,p,d,h,m,y,b=o&&o.__k||g,k=t.length;for(s=j(n,t,b,s,k),_=0;_<k;_++)null!=(p=n.__k[_])&&(f=-1!=p.__i&&b[p.__i]||v,p.__i=_,m=B(e,p,f,r,i,u,l,s,a,c),d=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&V(f.ref,null,p),c.push(p.ref,p.__c||d,p)),null==h&&null!=d&&(h=d),(y=!!(4&p.__u))||f.__k===p.__k?(s=$(p,s,e,y),y&&f.__e&&(f.__e=null)):"function"==typeof p.type&&void 0!==m?s=m:d&&(s=d.nextSibling),p.__u&=-7);return n.__e=h,s}function j(e,t,n,o,r){var i,u,l,s,a,c=n.length,_=c,f=0;for(e.__k=new Array(r),i=0;i<r;i++)null!=(u=t[i])&&"boolean"!=typeof u&&"function"!=typeof u?("string"==typeof u||"number"==typeof u||"bigint"==typeof u||u.constructor==String?u=e.__k[i]=x(null,u,null,null,null):k(u)?u=e.__k[i]=x(P,{children:u},null,null,null):void 0===u.constructor&&u.__b>0?u=e.__k[i]=x(u.type,u.props,u.key,u.ref?u.ref:null,u.__v):e.__k[i]=u,s=i+f,u.__=e,u.__b=e.__b+1,l=null,-1!=(a=u.__i=M(u,n,s,_))&&(_--,(l=n[a])&&(l.__u|=2)),null==l||null==l.__v?(-1==a&&(r>c?f--:r<c&&f++),"function"!=typeof u.type&&(u.__u|=4)):a!=s&&(a==s-1?f--:a==s+1?f++:(a>s?f--:f++,u.__u|=4))):e.__k[i]=null;if(_)for(i=0;i<c;i++)null!=(l=n[i])&&!(2&l.__u)&&(l.__e==o&&(o=F(l)),Z(l,l));return o}function $(e,t,n,o){var r,i;if("function"==typeof e.type){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=$(r[i],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=F(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function T(e,t){return t=t||[],null==e||"boolean"==typeof e||(k(e)?e.some(function(e){T(e,t)}):t.push(e)),t}function M(e,t,n,o){var r,i,u,l=e.key,s=e.type,a=t[n],c=null!=a&&!(2&a.__u);if(null===a&&null==l||c&&l==a.key&&s==a.type)return n;if(o>(c?1:0))for(r=n-1,i=n+1;r>=0||i<t.length;)if(null!=(a=t[u=r>=0?r--:i++])&&!(2&a.__u)&&l==a.key&&s==a.type)return u;return-1}function H(e,t,n){"-"==t[0]?e.setProperty(t,n??""):e[t]=null==n?"":"number"!=typeof n||b.test(t)?n:n+"px"}function W(e,t,n,o,r){var i,u;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||H(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||H(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(p,"$1")),u=t.toLowerCase(),t=u in e||"onFocusOut"==t||"onFocusIn"==t?u.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n[f]=o[f]:(n[f]=d,e.addEventListener(t,i?m:h,i)):e.removeEventListener(t,i?m:h,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 U(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t[_])t[_]=d++;else if(t[_]<n[f])return;return n(r.event?r.event(t):t)}}}function B(e,t,n,o,i,u,l,s,a,c){var _,f,p,d,h,m,y,v,b,S,x,F,N,R,A,I,j=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(a=!!(32&n.__u),u=[s=t.__e=n.__e]),(_=r.__b)&&_(t);e:if("function"==typeof j){f=l.length;try{if(b=t.props,S=j.prototype&&j.prototype.render,x=(_=j.contextType)&&o[_.__c],F=_?x?x.props.value:_.__:o,n.__c?v=(p=t.__c=n.__c).__=p.__E:(S?t.__c=p=new j(b,F):(t.__c=p=new E(b,F),p.constructor=j,p.render=K),x&&x.sub(p),p.state||(p.state={}),p.__n=o,d=p.__d=!0,p.__h=[],p._sb=[]),S&&null==p.__s&&(p.__s=p.state),S&&null!=j.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=w({},p.__s)),w(p.__s,j.getDerivedStateFromProps(b,p.__s))),h=p.props,m=p.state,p.__v=t,d)S&&null==j.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),S&&null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(S&&null==j.getDerivedStateFromProps&&b!==h&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(b,F),t.__v==n.__v||!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(b,p.__s,F)){t.__v!=n.__v&&(p.props=b,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),g.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&l.push(p);break e}null!=p.componentWillUpdate&&p.componentWillUpdate(b,p.__s,F),S&&null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(h,m,y)})}if(p.context=F,p.props=b,p.__P=e,p.__e=!1,N=r.__r,R=0,S)p.state=p.__s,p.__d=!1,N&&N(t),_=p.render(p.props,p.state,p.context),g.push.apply(p.__h,p._sb),p._sb=[];else do{p.__d=!1,N&&N(t),_=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++R<25);p.state=p.__s,null!=p.getChildContext&&(o=w(w({},o),p.getChildContext())),S&&!d&&null!=p.getSnapshotBeforeUpdate&&(y=p.getSnapshotBeforeUpdate(h,m)),A=null!=_&&_.type===P&&null==_.key?L(_.props.children):_,s=O(e,k(A)?A:[A],t,n,o,i,u,l,s,a,c),p.base=t.__e,t.__u&=-161,p.__h.length&&l.push(p),v&&(p.__E=p.__=null)}catch(e){if(l.length=f,t.__v=null,a||null!=u){if(e.then){for(t.__u|=a?160:128;s&&8==s.nodeType&&s.nextSibling;)s=s.nextSibling;null!=u&&(u[u.indexOf(s)]=null),t.__e=s}else if(null!=u)for(I=u.length;I--;)C(u[I])}else t.__e=n.__e;null==t.__k&&(t.__k=n.__k||[]),e.then||D(t),r.__e(e,t,n)}}else null==u&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=q(n.__e,t,n,o,i,u,l,a,c);return(_=r.diffed)&&_(t),128&t.__u?void 0:s}function D(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(D))}function z(e,t,n){for(var o=0;o<n.length;o++)V(n[o],n[++o],n[++o]);r.__c&&r.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){r.__e(e,t.__v)}})}function L(e){return"object"!=typeof e||null==e||e.__b>0?e:k(e)?e.map(L):void 0!==e.constructor?null:w({},e)}function q(e,t,n,i,u,l,s,a,c){var _,f,p,d,h,m,y,g=n.props||v,b=t.props,w=t.type;if("svg"==w?u="http://www.w3.org/2000/svg":"math"==w?u="http://www.w3.org/1998/Math/MathML":u||(u="http://www.w3.org/1999/xhtml"),null!=l)for(_=0;_<l.length;_++)if((h=l[_])&&"setAttribute"in h==!!w&&(w?h.localName==w:3==h.nodeType)){e=h,l[_]=null;break}if(null==e){if(null==w)return document.createTextNode(b);e=document.createElementNS(u,w,b.is&&b),a&&(r.__m&&r.__m(t,l),a=!1),l=null}if(null==w)g===b||a&&e.data==b||(e.data=b);else{if(l="textarea"==w&&null!=b.defaultValue?null:l&&o.call(e.childNodes),!a&&null!=l)for(g={},_=0;_<e.attributes.length;_++)g[(h=e.attributes[_]).name]=h.value;for(_ in g)h=g[_],"dangerouslySetInnerHTML"==_?p=h:"children"==_||_ in b||"value"==_&&"defaultValue"in b||"checked"==_&&"defaultChecked"in b||W(e,_,null,h,u);for(_ in b)h=b[_],"children"==_?d=h:"dangerouslySetInnerHTML"==_?f=h:"value"==_?m=h:"checked"==_?y=h:a&&"function"!=typeof h||g[_]===h||W(e,_,h,g[_],u);if(f)a||p&&(f.__html==p.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(p&&(e.innerHTML=""),O("template"==t.type?e.content:e,k(d)?d:[d],t,n,i,"foreignObject"==w?"http://www.w3.org/1999/xhtml":u,l,s,l?l[0]:n.__k&&F(n,0),a,c),null!=l)for(_=l.length;_--;)C(l[_]);a&&"textarea"!=w||(_="value","progress"==w&&null==m?e.removeAttribute("value"):null!=m&&(m!==e[_]||"progress"==w&&!m||"option"==w&&m!=g[_])&&W(e,_,m,g[_],u),_="checked",null!=y&&y!=e[_]&&W(e,_,y,g[_],u))}return e}function V(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){r.__e(e,n)}}function Z(e,t,n){var o,i;if(r.unmount&&r.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||V(o,null,t)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){r.__e(e,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&Z(o[i],t,n||"function"!=typeof e.type);n||C(e.__e),e.__c=e.__=e.__e=void 0}function K(e,t,n){return this.constructor(e,n)}function G(e,t,n){var i,u,l,s;t==document&&(t=document.documentElement),r.__&&r.__(e,t),u=(i="function"==typeof n)?null:n&&n.__k||t.__k,l=[],s=[],B(t,e=(!i&&n||t).__k=S(P,null,[e]),u||v,v,t.namespaceURI,!i&&n?[n]:u?null:t.firstChild?o.call(t.childNodes):null,l,!i&&n?n:u?u.__e:t.firstChild,i,s),z(l,e,s),e.props.children=null}function J(e,t){G(e,t,J)}function Q(e,t,n){var r,i,u,l,s=w({},e.props);for(u in e.type&&e.type.defaultProps&&(l=e.type.defaultProps),t)"key"==u?r=t[u]:"ref"==u?i=t[u]:s[u]=void 0===t[u]&&null!=l?l[u]:t[u];return arguments.length>2&&(s.children=arguments.length>3?o.call(arguments,2):n),x(e.type,s,r||e.key,i||e.ref,null)}o=g.slice,r={__e:function(e,t,n,o){for(var r,i,u;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&null!=i.getDerivedStateFromError&&(r.setState(i.getDerivedStateFromError(e)),u=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,o||{}),u=r.__d),u)return r.__E=r}catch(t){e=t}throw e}},i=0,E.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=w({},this.state),"function"==typeof e&&(e=e(w({},n),this.props)),e&&w(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),A(this))},E.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),A(this))},E.prototype.render=P,u=[],s="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,a=function(e,t){return e.__v.__b-t.__v.__b},I.__r=0,c=Math.random().toString(8),_="__d"+c,f="__a"+c,p=/(PointerCapture)$|Capture$/i,d=0,h=U(!1),m=U(!0),y=0;var Y=0;Array.isArray;function X(e,t,n,o,i,u){t||(t={});var l,s,a=t;if("ref"in a)for(s in a={},t)"ref"==s?l=t[s]:a[s]=t[s];var c={type:e,props:a,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Y,__i:-1,__u:0,__source:i,__self:u};if("function"==typeof e&&(l=e.defaultProps))for(s in l)void 0===a[s]&&(a[s]=l[s]);return r.vnode&&r.vnode(c),c}const ee=/^(https?:|mailto:|tel:)/i,te="#FFFFFF",ne="#2970FF",oe="#101828",re="#667085",ie="#FFFFFF",ue={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}},le={h1:1,h2:1,h3:1,icon:1,eyebrow:.8,body:.9,caption:.75};function se(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,u]=[0,2,4].map(e=>parseInt(o.slice(e,e+2),16));return`rgba(${r}, ${i}, ${u}, ${t})`}(t.textInverse,le[e]??1):"icon"!==e?"caption"===e||"eyebrow"===e?t.textSecondary:t.text:void 0}const ae="\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",ce=["Vertical","Horizontal","Columns","Rows"],_e=["normal","reverse"],fe=["start","center","end","stretch"],pe=["start","center","end","space-between"],de=["left","center","right"],he=["default","inverse"],me=2e3,ye={px:me,"%":100,em:125,rem:125},ve=/^(\d{1,4}(?:\.\d+)?)(px|%|em|rem)$/,ge={px:me,"%":100,fr:100},be=/^(\d{1,4}(?:\.\d+)?)(px|%|fr)$/,ke=["auto","min-content","max-content"];function we(e,t){return t.includes(e)?e:void 0}function Ce(e){if("number"==typeof e&&Number.isFinite(e))return Math.min(Math.max(e,0),me);if("string"!=typeof e)return;const t=ve.exec(e.trim());if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),ye[o])}${o}`}const Se=["top","right","bottom","left"];function xe(e){if(ke.includes(e))return e;const t=be.exec(e);if(!t)return;const[,n,o]=t;return`${Math.min(parseFloat(n),ge[o])}${o}`}function Pe(e){return"string"==typeof e&&e.length>0?e:void 0}function Ee(e){const t={},n=Ce(e.gap);void 0!==n&&(t.gap=n);const o=function(e){const t=Ce(e);if(void 0!==t)return t;if("object"!=typeof e||null===e)return;const n={};for(const t of Se){const o=Ce(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=we(e.alignItems,fe);r&&(t.alignItems=r);const i=we(e.justifyContent,pe);i&&(t.justifyContent=i);const u=Pe(e.backgroundImage);u&&(t.backgroundImage=u);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(xe);return n.every(e=>void 0!==e)?n.join(" "):void 0}(e.sizes);return void 0!==l&&(t.sizes=l),t}function Fe(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=Pe(r.content);if(!e)return null;const t={type:"Content",props:{content:e}},n=we(r.align,de);n&&(t.props.align=n);const o=we(r.tone,he);return o&&"default"!==o&&(t.props.tone=o),t}if("Image"===o.type){const e=Pe(r.image);if(!e)return null;return{type:"Image",props:{image:e}}}if(!Array.isArray(o.children))return null;const i=we(o.type,ce)??"Vertical",u=[];for(const e of o.children){const o=Fe(e,t+1,n);o&&u.push(o)}const l=Ee(r);return"reverse"===we(r.order,_e)&&(u.reverse(),"string"==typeof l.sizes&&(l.sizes=l.sizes.split(" ").reverse().join(" "))),{type:i,props:l,children:u}}function Ne(e){return Fe(e,0,{nodes:100})}const Re=/^[a-zA-Z][a-zA-Z0-9-]*$/,Ae=/^\$([a-zA-Z][a-zA-Z0-9-]*)$/;function Ie(e,t){return e.includes("$")?e.split(/(\s+)/).map(e=>{const n=Ae.exec(e)?.[1];return void 0!==n&&Object.prototype.hasOwnProperty.call(t,n)?t[n]:e}).join(""):e}function Oe(e,t){return"object"!=typeof e||null===e||0===Object.keys(t).length?e:$e(e,t,0)}const je=new Set(["content","image","backgroundImage"]);function $e(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(!je.has(n))if("string"==typeof o)e[n]=Ie(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]=Ie(n,t));e[n]=r}r.props=e}return Array.isArray(o.children)&&(r.children=o.children.map(e=>$e(e,t,n+1))),r}function Te(e){return"number"==typeof e?`${e}px`:e}function Me(e,t){if("string"==typeof e)return e;return`repeat(${"number"==typeof e?e:Math.max(t,1)}, 1fr)`}function He(e,t=0){const n=`url(${JSON.stringify(e)})`,o=t>0?`rgba(16, 24, 40, ${Math.min(t,1)})`:null;return{backgroundImage:o?`linear-gradient(${o}, ${o}), ${n}`:n,backgroundSize:"cover",backgroundPosition:"center"}}function We(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=Me(o.sizes,e.children.length)),"Rows"===e.type&&(r.gridTemplateRows=Me(o.sizes,e.children.length)),void 0!==o.gap&&(r.gap=Te(o.gap)),void 0!==o.padding&&(r.padding=function(e){if("number"==typeof e||"string"==typeof e)return Te(e);const t=e=>void 0===e?"0":Te(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),t&&Object.assign(r,He(t,n)),r}function Ue(e){const t=(e||"").trim();if(t)return t.startsWith("#")||t.startsWith("/")||t.startsWith("?")||ee.test(t)?t:void 0}const Be=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(!Be.has(e.tagName)){De(e,t,n);continue}const r=n.createElement(e.tagName.toLowerCase());if("A"===e.tagName){const t=Ue(e.getAttribute("href")??void 0);t&&r.setAttribute("href",t),r.setAttribute("target","_blank"),r.setAttribute("rel","noreferrer")}t.appendChild(r),De(e,r,n)}}function ze(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 qe(e){const t="object"==typeof e.colors&&null!==e.colors?e.colors:{};return{background:Le(t.background)??Le(e.background)??te,accent:Le(t.accent)??Le(e.accent)??ne,text:Le(t.text)??oe,textSecondary:Le(t.textSecondary)??re,textInverse:Le(t.textInverse)??ie}}const Ve=["cover","contain"];function Ze(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&&"string"==typeof n.src&&t.push({key:n.key,label:"string"==typeof n.label?n.label:"",src:n.src,...Ve.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 Ke=["px","%","em","rem","fr"];function Ge(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}function Je(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=Ge(t.min),n=Ge(t.max),o="length"===t.kind&&Array.isArray(t.units)?t.units.filter(e=>Ke.includes(e)):[];return{kind:t.kind,...void 0!==e?{min:e}:{},...void 0!==n?{max:n}:{},...o.length>0?{units:o}:{}}}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||!Re.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=Je(n.control);t.push({key:n.key,label:"string"==typeof n.label?n.label:"",value:n.value,...e?{control:e}:{}})}return t}function Ye(e){return Object.fromEntries(e.map(e=>[e.key,e.value]))}function Xe(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:n.slots.slice(0,50)}))}return t}function et(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.min(e,2e3):void 0}function tt(e,t){if(null!==e)return et(e)??et(t)}function nt(e){const t=[];for(const n of e.pages){const o=Qe(n.values),r=Ne(Oe(n.layout,Ye(o)));if(!r)continue;const i=tt(n.width,e.width),u=tt(n.height,e.height);t.push({key:n.key,layout:r,images:Ze(n.images),contents:Xe(n.contents),...void 0!==i?{width:i}:{},...void 0!==u?{height:u}:{}})}return t}function ot(e){return`calc(100% - ${2*e.offset}px)`}var rt,it,ut,lt,st=0,at=[],ct=r,_t=ct.__b,ft=ct.__r,pt=ct.diffed,dt=ct.__c,ht=ct.unmount,mt=ct.__;function yt(e,t){ct.__h&&ct.__h(it,e,st||t),st=0;var n=it.__H||(it.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function vt(e){return st=1,gt($t,e)}function gt(e,t,n){var o=yt(rt++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):$t(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=it,!it.__f)){var r=function(e,t,n){if(!o.__c.__H)return!0;var r=!1,u=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]&&(u=!0)}}),i){var l=i.call(this,e,t,n);return r?l||u:l}return!r||u};it.__f=!0;var i=it.shouldComponentUpdate,u=it.componentWillUpdate;it.componentWillUpdate=function(e,t,n){if(this.__e){var o=i;i=void 0,r(e,t,n),i=o}u&&u.call(this,e,t,n)},it.shouldComponentUpdate=r}return o.__N||o.__}function bt(e,t){var n=yt(rt++,3);!ct.__s&&jt(n.__H,t)&&(n.__=e,n.u=t,it.__H.__h.push(n))}function kt(e,t){var n=yt(rt++,4);!ct.__s&&jt(n.__H,t)&&(n.__=e,n.u=t,it.__h.push(n))}function wt(e){return st=5,St(function(){return{current:e}},[])}function Ct(e,t,n){st=6,kt(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 St(e,t){var n=yt(rt++,7);return jt(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function xt(e,t){return st=8,St(function(){return e},t)}function Pt(e){var t=it.context[e.__c],n=yt(rt++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(it)),t.props.value):e.__}function Et(e,t){ct.useDebugValue&&ct.useDebugValue(t?t(e):e)}function Ft(){var e=yt(rt++,11);if(!e.__){for(var t=it.__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 Nt(){for(var e;e=at.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(It),t.__h.some(Ot),t.__h=[]}catch(n){t.__h=[],ct.__e(n,e.__v)}}}ct.__b=function(e){it=null,_t&&_t(e)},ct.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),mt&&mt(e,t)},ct.__r=function(e){ft&&ft(e),rt=0;var t=(it=e.__c).__H;t&&(ut===it?(t.__h=[],it.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(It),t.__h.some(Ot),t.__h=[],rt=0)),ut=it},ct.diffed=function(e){pt&&pt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==at.push(t)&<===ct.requestAnimationFrame||((lt=ct.requestAnimationFrame)||At)(Nt)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),ut=it=null},ct.__c=function(e,t){t.some(function(e){try{e.__h.some(It),e.__h=e.__h.filter(function(e){return!e.__||Ot(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],ct.__e(n,e.__v)}}),dt&&dt(e,t)},ct.unmount=function(e){ht&&ht(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{It(e)}catch(e){t=e}}),n.__H=void 0,t&&ct.__e(t,n.__v))};var Rt="function"==typeof requestAnimationFrame;function At(e){var t,n=function(){clearTimeout(o),Rt&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Rt&&(t=requestAnimationFrame(n))}function It(e){var t=it,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),it=t}function Ot(e){var t=it;e.__c=e.__(),it=t}function jt(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function $t(e,t){return"function"==typeof t?t(e):t}function Tt(e,t){for(var n in t)e[n]=t[n];return e}function Mt(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 Ht(e,t){var n=t(),o=vt({t:{__:n,u:t}}),r=o[0].t,i=o[1];return kt(function(){r.__=n,r.u=t,Wt(r)&&i({t:r})},[e,n,t]),bt(function(){return Wt(r)&&i({t:r}),e(function(){Wt(r)&&i({t:r})})},[e]),n}function Wt(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 Ut(e){e()}function Bt(e){return e}function Dt(){return[!1,Ut]}var zt=kt;function Lt(e,t){this.props=e,this.context=t}(Lt.prototype=new E).isPureReactComponent=!0,Lt.prototype.shouldComponentUpdate=function(e,t){return Mt(this.props,e)||Mt(this.state,t)};var qt=r.__b;r.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),qt&&qt(e)};var Vt="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var Zt=function(e,t){return null==e?null:T(T(e).map(t))},Kt={map:Zt,forEach:Zt,count:function(e){return e?T(e).length:0},only:function(e){var t=T(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:T},Gt=r.__e;r.__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);Gt(e,t,n,o)};var Jt=r.unmount;function Qt(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=Tt({},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 Qt(e,t,n)})),e}function Yt(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return Yt(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 Xt(){this.__u=0,this.o=null,this.__b=null}function en(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function tn(){this.i=null,this.l=null}r.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Jt&&Jt(e)},(Xt.prototype=new E).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var r=en(o.__v),i=!1,u=function(){i||o.__z||(i=!0,n.__R=null,r?r(s):s())};n.__R=u;var l=n.__P;n.__P=null;var s=function(){if(! --o.__u){if(o.state.__a){var e=o.state.__a;o.__v.__k[0]=Yt(e,e.__c.__P,e.__c.__O)}var t;for(o.setState({__a:o.__b=null});t=o.o.pop();)t.__P=l,t.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(u,u)},Xt.prototype.componentWillUnmount=function(){this.o=[]},Xt.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]=Qt(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&S(P,null,e.fallback);return r&&(r.__u&=-33),[S(P,null,t.__a?null:e.children),r]};var nn=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 on(e){return this.getChildContext=function(){return e.context},e.children}function rn(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){G(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)}}}G(S(on,{context:t.context},e.__v),t.v)}(tn.prototype=new E).__a=function(e){var t=this,n=en(t.__v),o=t.l.get(e);return o[0]++,function(r){var i=function(){t.props.revealOrder?(o.push(r),nn(t,e,o)):r()};n?n(i):i()}},tn.prototype.render=function(e){this.i=null,this.l=new Map;var t=T(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},tn.prototype.componentDidUpdate=tn.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){nn(e,n,t)})};var un="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,ln=/^(?: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]/,sn=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,an=/[A-Z0-9]/g,cn="undefined"!=typeof document,_n=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};E.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(E.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var fn=r.event;r.event=function(e){return fn&&(e=fn(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var pn,dn={configurable:!0,get:function(){return this.class}},hn=r.vnode;r.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 u=t[i];if(!("value"===i&&"defaultValue"in t&&null==u||cn&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var l=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===u?u="":"translate"===l&&"no"===u?u=!1:"o"===l[0]&&"n"===l[1]?"ondoubleclick"===l?i="ondblclick":"onchange"!==l||"input"!==n&&"textarea"!==n||_n(t.type)?"onfocus"===l?i="onfocusin":"onblur"===l?i="onfocusout":sn.test(i)&&(i=l):l=i="oninput":r&&ln.test(i)?i=i.replace(an,"-$&").toLowerCase():null===u&&(u=void 0),"oninput"===l&&o[i=l]&&(i="oninputCapture"),o[i]=u}}"select"==n&&(o.multiple&&Array.isArray(o.value)&&(o.value=T(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),null!=o.defaultValue&&(o.value=T(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",dn)):t.className&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=un,hn&&hn(e)};var mn=r.__r;r.__r=function(e){mn&&mn(e),pn=e.__c};var yn=r.diffed;r.diffed=function(e){yn&&yn(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),pn=null};var vn={ReactCurrentDispatcher:{current:{readContext:function(e){return pn.__n[e.__c].props.value},useCallback:xt,useContext:Pt,useDebugValue:Et,useDeferredValue:Bt,useEffect:bt,useId:Ft,useImperativeHandle:Ct,useInsertionEffect:zt,useLayoutEffect:kt,useMemo:St,useReducer:gt,useRef:wt,useState:vt,useSyncExternalStore:Ht,useTransition:Dt}}};function gn(e){return!!e&&e.$$typeof===un}var bn={useState:vt,useId:Ft,useReducer:gt,useEffect:bt,useLayoutEffect:kt,useInsertionEffect:zt,useTransition:Dt,useDeferredValue:Bt,useSyncExternalStore:Ht,startTransition:Ut,useRef:wt,useImperativeHandle:Ct,useMemo:St,useCallback:xt,useContext:Pt,useDebugValue:Et,version:"18.3.1",Children:Kt,render:function(e,t,n){return null==t.__k&&(t.textContent=""),G(e,t),"function"==typeof n&&n(),e?e.__c:null},hydrate:function(e,t,n){return J(e,t),"function"==typeof n&&n(),e?e.__c:null},unmountComponentAtNode:function(e){return!!e.__k&&(G(null,e),!0)},createPortal:function(e,t){var n=S(rn,{__v:e,h:t});return n.containerInfo=t,n},createElement:S,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,A(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"+y++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t},createFactory:function(e){return S.bind(null,e)},cloneElement:function(e){return gn(e)?Q.apply(null,arguments):e},createRef:function(){return{current:null}},Fragment:P,isValidElement:gn,isElement:gn,isFragment:function(e){return gn(e)&&e.type===P},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:E,PureComponent:Lt,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:Mt(this.props,e)}function o(t){return this.shouldComponentUpdate=n,S(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=Tt({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=Vt,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t},flushSync:function(e,t){var n=r.debounceRendering;r.debounceRendering=function(e){return e()};var o=e(t);return r.debounceRendering=n,o},unstable_batchedUpdates:function(e,t){return e(t)},StrictMode:P,Suspense:Xt,SuspenseList:tn,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?S(r,i):null}return i.displayName="Lazy",i.__f=!0,i},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:vn};const kn={none:void 0,fade:"pw-vpopup-fade 0.35s ease-out backwards",slide:"pw-vpopup-slide 0.35s ease-out backwards"};function wn({slot:e,align:t,inverse:n,colors:o}){const r={...ue[e.variant],textAlign:e.align??t,padding:"4px 0"},i=se(e.variant,o,n);return i&&(r.color=i),bn.createElement("div",{style:r,dangerouslySetInnerHTML:{__html:ze(e.html)}})}function Cn({slot:e,accent:t,onRequestClose:n,onPageChange:o}){const r={display:"block",boxSizing:"border-box",width:"100%",padding:"10px 25px",borderRadius:3,fontSize:14,fontWeight:600,fontFamily:"inherit",lineHeight:1.5,textAlign:"center",textDecoration:"none",cursor:"pointer",..."secondary"===e.variant?{backgroundColor:"#FFFFFF",color:t,border:`1px solid ${t}`}:{backgroundColor:t,color:"#FFFFFF",border:"none"}},i={padding:"8px 0 4px"};if("close"===e.action.type)return bn.createElement("div",{style:i},bn.createElement("button",{type:"button",style:r,onClick:n},e.label));if("page"===e.action.type){const t=e.action.page;return bn.createElement("div",{style:i},bn.createElement("button",{type:"button",style:r,onClick:()=>o(t)},e.label))}const u=Ue(e.action.url);return u?bn.createElement("div",{style:i},bn.createElement("a",{href:u,target:"_blank",rel:"noreferrer",style:r},e.label)):bn.createElement("div",{style:i},bn.createElement("button",{type:"button",style:r},e.label))}function Sn({node:e,page:t,colors:n,onRequestClose:o,onPageChange:r}){const i=t.contents.find(t=>t.key===e.props.content);if(!i)return null;const u=e.props.align??"left",l="inverse"===e.props.tone;return bn.createElement("div",{style:{minWidth:0}},i.slots.map(e=>"text"===e.type?bn.createElement(wn,{key:e.key,slot:e,align:u,inverse:l,colors:n}):bn.createElement(Cn,{key:e.key,slot:e,accent:n.accent,onRequestClose:o,onPageChange:r})))}function xn({node:e,page:t}){const n=t.images.find(t=>t.key===e.props.image);if(!n?.src)return null;const o={display:"block",width:"100%",minWidth:0};return n.fit?(o.height="100%",o.objectFit=n.fit):o.height="auto",n.blur&&(o.filter=`blur(${n.blur}px)`),bn.createElement("img",{src:n.src,alt:"",style:o})}function Pn({node:e,page:t,colors:n,onRequestClose:o,onPageChange:r}){if("Content"===e.type)return bn.createElement(Sn,{node:e,page:t,colors:n,onRequestClose:o,onPageChange:r});if("Image"===e.type)return bn.createElement(xn,{node:e,page:t});const i=e.props?.backgroundImage,u=i?t.images.find(e=>e.key===i):void 0,l=u?.blur??0,s=u?.dim??0,a=We(e,l>0?void 0:u?.src||void 0,s);i&&(a.backgroundColor="#1D2939");const c=e.children.map((e,i)=>bn.createElement(Pn,{key:i,node:e,page:t,colors:n,onRequestClose:o,onPageChange:r}));if(l>0){const{backgroundColor:e,...t}=a;return bn.createElement("div",{style:{minWidth:0,backgroundColor:e,...u?.src?He(u.src,s):{}}},bn.createElement("div",{style:{...t,backdropFilter:`blur(${l}px)`,WebkitBackdropFilter:`blur(${l}px)`}},c))}return bn.createElement("div",{style:a},c)}function En({page:e,params:t,animatePage:n,onRequestClose:o,onPageChange:r}){const i={position:"relative",boxSizing:"border-box",overflow:"hidden",backgroundColor:t.colors.background,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',color:t.colors.text,borderRadius:t.borderRadius>0?t.borderRadius:void 0,boxShadow:t.boxShadow&&"none"!==t.boxShadow?t.boxShadow:void 0,transition:"height 300ms ease"};return e.height&&(i.height=e.height,i.overflowY="auto"),bn.createElement("div",{style:i},bn.createElement("div",{key:e.key,style:n?{animation:"pw-vpopup-page 300ms ease-out backwards"}:void 0},bn.createElement(Pn,{node:e.layout,page:e,colors:t.colors,onRequestClose:o,onPageChange:r})))}function Fn({onRequestClose:e}){return bn.createElement("button",{type:"button","aria-label":"Close",onClick:e,style:{position:"absolute",top:10,right:10,width:24,height:24,padding:0,border:"none",borderRadius:"50%",background:"rgba(255, 255, 255, 0.92)",boxShadow:"0 1px 3px rgba(16, 24, 40, 0.25)",color:"#667085",fontSize:13,lineHeight:1,cursor:"pointer"}},"✕")}function Nn(e,t){const{placement:n}=e,o={position:"fixed",boxSizing:"border-box",maxWidth:ot(n),maxHeight:ot(n),pointerEvents:"auto"};if(t){o.width=t;const e=n.h;"left"===e?o.left=n.offset:"right"===e?o.right=n.offset:o.left="50%"}else o.left=n.offset,o.right=n.offset;"top"===n.v?o.top=n.offset:"bottom"===n.v?o.bottom=n.offset:o.top="50%";const r=t&&"center"===n.h?"-50%":"0",i="middle"===n.v?"-50%":"0";"0"===r&&"0"===i||(o.transform=`translate(${r}, ${i})`);const u=kn[e.animation];return u&&(o.animation=u),o.transition="width 300ms ease",o}function Rn({params:e,mode:t="live",onRequestClose:n}){const[o,r]=vt(null);bt(()=>{nt(e).forEach(e=>e.images.forEach(({src:e})=>{e&&((new Image).src=e)}))},[e]);const i=nt(e);if(0===i.length)return null;const u=i.find(e=>e.key===o)??function(e,t){return t.find(t=>t.key===e.startPage)??t[0]}(e,i),l=null!==o;if("preview"===t)return bn.createElement("div",{style:{position:"relative",width:u.width??"100%",transition:"width 300ms ease"}},bn.createElement("style",null,ae),bn.createElement(En,{page:u,params:e,animatePage:l,onRequestClose:n,onPageChange:r}));const s=e.overlay;return bn.createElement(bn.Fragment,null,bn.createElement("style",null,ae),s&&bn.createElement("div",{style:{position:"fixed",inset:0,backgroundColor:s.color,opacity:s.opacity,animation:"pw-vpopup-overlay 0.2s ease-out backwards",pointerEvents:"auto"},onClick:n}),bn.createElement("div",{style:Nn(e,u.width)},bn.createElement(En,{page:u,params:e,animatePage:l,onRequestClose:n,onPageChange:r}),bn.createElement(Fn,{onRequestClose:n})))}const An=e=>{const t=function(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;return"object"!=typeof o||null===o?null:Array.isArray(o.pages)&&0!==o.pages.length?{version:2,params:{...o,colors:qe(o)}}:null}(e);return t?0===nt(t.params).length?null:t.params:null},In="keyValue",On="messages",jn="inboxMessages";function $n(e,t){return function(n){n.objectStoreNames.contains(e)||t(n)}}const Tn=[$n(In,function(e){e.createObjectStore(In,{keyPath:"key"})}),$n("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})}),$n(On,function(e){e.createObjectStore(On,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),$n(jn,function(e){const t="status",n=e.createObjectStore(jn,{keyPath:"inbox_id",autoIncrement:!1});n.createIndex(t,t,{unique:!1,multiEntry:!0}),n.createIndex("rt","rt",{unique:!1,multiEntry:!0})})];class Mn{get all(){return Tn}}class Hn{constructor(e,t=new Mn){this.db=e,this.migrationsBuilder=t}applyMigrations(){this.applyMigrationsPack(this.migrationsBuilder.all)}applyMigrationsPack(e){e.forEach(e=>{e(this.db)})}}function Wn(e,t){console.info("onversionchange",t),e.close()}let Un;function Bn(e){return(Un||(Un=new Promise((e,t)=>{const n=indexedDB.open("PUSHWOOSH_SDK_STORE",7);n.onsuccess=n=>{const o=n.target.result;o.onversionchange=Wn.bind(null,o,t),e(o)},n.onerror=()=>t(n.error),n.onupgradeneeded=e=>{const n=e.target.result;n.onversionchange=Wn.bind(null,n,t),new Hn(n).applyMigrations()}})),Un).then(t=>new Promise((n,o)=>e(t,n,o)))}class Dn{_add(e){return Bn((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 Bn((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 Bn((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)}})}}zn=In;var zn;const Ln=new class extends Dn{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)}},qn=(new class extends Dn{constructor(){super(...arguments),this.name=On,this.maxItems=25}add(e){return this._add({...e,date:new Date})}},{error:1,info:2,debug:3});let Vn=3;const Zn={setLevel(e){qn[e]||(e="error"),Vn=qn[e]},write(e,t,n){return"error"===e?this.error(t):this.info(t),Ln.add(e,t,n)}};Object.keys(qn).forEach(e=>{const t=qn[e];Zn[e]=(...n)=>{t<=Vn&&(console.groupCollapsed(e),console.info("",...n),console.trace("trace"),console.groupEnd())}});class Kn{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)}constructor(e){this.isRecurringVisitor=!1,this.loadedPopups=new Map,this.pendingTimers=new Map,this.isNavigationSubscribed=!1,this.openPopupsCount=0,this.bodyOverflowBeforeLock=null,this.pw=e}async run(){const{pw:e}=this;await e.api.ensureDeviceRegistered(),this.isRecurringVisitor=await e.data.getIsRecurringVisitor();const t=await e.api.getPopupForms();(await Promise.allSettled(t.map(e=>this.loadWebPopup(e)))).forEach((e,n)=>{"rejected"===e.status&&Zn.error(e.reason,`Failed to load web popup "${t[n].code}"`)}),this.subscribeToNavigation(),this.renderForCurrentPage(),await e.data.setIsRecurringVisitor(!0)}async loadWebPopup(e){if(!await this.checkStrongCondition(e))return;const t=await this.pw.api.getPopupFormContent(e.popup_form_content_code),n=An(t.json);n?this.loadedPopups.set(e.code,{popup:e,parsed:n}):Zn.error(new Error("Unsupported popup content format"),`Web popup "${e.code}" content is not a supported {version, params} popup; skipping`)}renderForCurrentPage(){this.cancelPendingForUnmatchedPages();const e=[];this.loadedPopups.forEach((t,n)=>{this.checkSoftCondition(t.popup)&&e.push([n,t])}),e.forEach(([e,{popup:t,parsed:n}])=>{this.addToQueue(t,n),this.loadedPopups.delete(e)})}cancelPendingForUnmatchedPages(){this.pendingTimers.forEach(({timeoutId:e,loaded:t},n)=>{this.checkSoftCondition(t.popup)||(window.clearTimeout(e),this.pendingTimers.delete(n),this.loadedPopups.set(n,t))})}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)}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}=e;return!t||(0===t.length||t.includes(window.location.pathname))}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=>{Zn.error(t,`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`${n}.shown.${e}`}addToQueue(e,t){this.pw.api.recordPopupFormEvent(e.code,1).catch(t=>{Zn.error(t,`Failed to record web popup queued event for "${e.code}"`)});const o=window.setTimeout(()=>{this.pendingTimers.delete(e.code);const o=document.createElement("div");o.id=`${n}-${e.code}`,o.style.position="fixed",o.style.inset="0",o.style.zIndex=String(2147483647),o.style.pointerEvents="none",document.body.appendChild(o);const r=o.attachShadow({mode:"open"}),i=document.createElement("div");r.appendChild(i);const u=!!t.overlay;u&&this.lockBodyScroll();((e,t,n)=>{G(X(Rn,{params:t,mode:"live",onRequestClose:n}),e)})(i,t,()=>{u&&this.unlockBodyScroll(),o.remove(),this.pw.dispatchEvent("hide-web-popup",{code:e.code})}),this.markAsShown(e).catch(t=>{Zn.error(t,`Failed to mark web popup "${e.code}" as shown`)}),this.pw.dispatchEvent("show-web-popup",{code:e.code})},1e3*e.delay);this.pendingTimers.set(e.code,{timeoutId:o,loaded:{popup:e,parsed:t}})}}return t})());
|
|
2
2
|
//# sourceMappingURL=widget-web-popups.js.map
|