web-push-notifications 3.89.0 → 3.89.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(this,()=>(()=>{"use strict";const e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};e.r(t),e.d(t,{PWSubscriptionWidget:()=>Yt});const n=/^(https?:|mailto:|tel:)/i,o="#101828",r="#667085",i="#FFFFFF",l={background:"#FFFFFF",accent:"#2970FF",text:o,textSecondary:r,textInverse:"#FFFFFF"};function s(e,t){return{display:"block",boxSizing:"border-box",width:"100%",padding:"10px 25px",borderRadius:6,fontSize:14,fontWeight:600,fontFamily:"inherit",lineHeight:1.5,textAlign:"center",textDecoration:"none",cursor:"pointer",..."secondary"===e?{backgroundColor:t.surface,color:t.accent,border:`1px solid ${t.accent}`}:{backgroundColor:t.accent,color:t.onAccent,border:"none"}}}const a={card:["top","bottom","top-left","top-right","bottom-left","bottom-right"],bar:["top","bottom"],modal:["center"]},c=Object.keys(a),_=["bottom-right","bottom-left","top-right","top-left"],u=["auto","launcher","manual"],d={delay:[0,3600],cappingCount:[0,100],cappingInterval:[0,8760],borderRadius:[0,32],offset:[0,100],size:[32,80],zIndex:[0,2147483647]},p={enable:!1,prompt:{layout:"card",position:"top",borderRadius:12,overlay:!1},launcher:{enabled:!1,position:"bottom-right",offset:20,size:48},display:{trigger:"auto",delay:5,cappingCount:3,cappingInterval:4},texts:{title:"Stay in the loop",message:"Allow notifications to get our news and special offers first.",acceptText:"Allow",declineText:"Not now",closeText:"Got it",blockedTitle:"Notifications are blocked",blockedMessage:"To get our notifications, allow them for this site in your browser settings.",launcherLabel:"Subscribe to notifications",launcherBlockedLabel:"Notifications are blocked"},colors:l,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',zIndex:2147483e3},f=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function h(e){const t=f.exec(e.trim())?.[1];if(!t)return null;const n=3===t.length?t.split("").map(e=>e+e).join(""):t;return[0,2,4].map(e=>parseInt(n.slice(e,e+2),16))}function m([e,t,n]){return`#${[e,t,n].map(e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")).join("")}`}function v(e,t,n){let o=n;return o<0&&(o+=1),o>1&&(o-=1),o<1/6?e+6*(t-e)*o:o<.5?t:o<2/3?e+(t-e)*(2/3-o)*6:e}function y(e){return e>.5?.07+.86*(1-e):e}function b(e){return e<.5?.93-e*((.93-.5)/.5):e}function g(e,t){const n=h(e);if(!n)return e;const[o,r,i]=function([e,t,n]){const[o,r,i]=[e/255,t/255,n/255],l=Math.max(o,r,i),s=Math.min(o,r,i),a=(l+s)/2;if(l===s)return[0,0,a];const c=l-s;let _;return _=l===o?(r-i)/c+(r<i?6:0):l===r?(i-o)/c+2:(o-r)/c+4,[_/6,a>.5?c/(2-l-s):c/(l+s),a]}(n);return m(function([e,t,n]){if(0===t){const e=255*n;return[e,e,e]}const o=n<.5?n*(1+t):n+t-n*t,r=2*n-o;return[255*v(r,o,e+1/3),255*v(r,o,e),255*v(r,o,e-1/3)]}([o,r,"fold"===t?y(i):b(i)]))}function w(e,t,n){const o=h(e),r=h(t);return o&&r?m(o.map((e,t)=>e+(r[t]-e)*n)):e}function x(e){const t=h(e);if(!t)return!1;const[n,o,r]=t;return(.299*n+.587*o+.114*r)/255>.6}function k(e){return{background:g(e.background,"fold"),accent:e.accent,text:g(e.text,"lift"),textSecondary:g(e.textSecondary,"lift"),textInverse:e.textInverse}}function S(e,t){return"light"===t?{surface:l.background,surfaceText:o,border:"#D0D5DD",onAccent:i,error:"#D92D20",chromeIcon:r}:{surface:w(e.background,e.text,.08),surfaceText:e.text,border:w(e.background,e.text,.24),onAccent:x(e.accent)?o:i,error:"#FDA29B",chromeIcon:e.textSecondary}}function M(e){return!0===e.dark?.enabled}function P(e,t="light"){return"dark"===t&&M(e)?"dark":"light"}function C(e,t="light"){const n=P(e,t),o="dark"===n?(r=e.colors,i=e.dark,{...k(r),...i?.colors??{}}):e.colors;var r,i;return{...o,scheme:n,...S(o,n)}}function I(e){const t=(e||"").trim();if(t)return t.startsWith("#")||t.startsWith("/")||t.startsWith("?")||n.test(t)?t:void 0}new Set(["STRONG","B","EM","I","U","BR","A"]);function A(e){return"string"==typeof e&&e?e:void 0}function F(e){const t="object"==typeof e.colors&&null!==e.colors?e.colors:{};return{background:A(t.background)??A(e.background)??l.background,accent:A(t.accent)??A(e.accent)??l.accent,text:A(t.text)??l.text,textSecondary:A(t.textSecondary)??l.textSecondary,textInverse:A(t.textInverse)??l.textInverse}}function z(e,t){const n=e.dark;if("object"!=typeof n||null===n)return;const o=n,r="object"==typeof o.colors&&null!==o.colors?o.colors:{},i=k(t),l=function(e){if("object"!=typeof e||null===e)return;const t=e,n=A(t.color);if(!n)return;return{color:n,opacity:"number"==typeof t.opacity&&Number.isFinite(t.opacity)?Math.max(0,Math.min(1,t.opacity)):1}}(o.overlay);return{enabled:!0===o.enabled,colors:{background:A(r.background)??i.background,accent:A(r.accent)??i.accent,text:A(r.text)??i.text,textSecondary:A(r.textSecondary)??i.textSecondary,textInverse:A(r.textInverse)??i.textInverse},...l?{overlay:l}:{},...A(o.boxShadow)?{boxShadow:o.boxShadow}:{}}}function H(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}function T(e,t,n){return t.includes(e)?e:n}function E(e,[t,n],o){return"number"==typeof e&&Number.isFinite(e)?Math.max(t,Math.min(n,Math.round(e))):o}function j(e,t){if("string"!=typeof e)return t;const n=e.trim();return n?n.slice(0,300):t}function D(e){const t=p.texts,n=Object.keys(t);return Object.fromEntries(n.map(n=>[n,j(e[n],t[n])]))}function O(e){const t=p,n=H(e),o=H(n.prompt),r=H(n.launcher),i=H(n.display),l=d,s=T(o.layout,c,t.prompt.layout),f=a[s],h=T(i.trigger,u,t.display.trigger),m=function(e){const t=I("string"==typeof e?e:void 0);return t&&/^(https?:\/\/|\/)/i.test(t)?t:void 0}(o.iconUrl),v=F({colors:n.colors}),y=z({dark:n.dark},v);return{enable:!0===n.enable,prompt:{layout:s,position:T(o.position,f,f[0]),...m?{iconUrl:m}:{},borderRadius:E(o.borderRadius,l.borderRadius,t.prompt.borderRadius),overlay:"modal"===s||!0===o.overlay},launcher:{enabled:"launcher"===h||!0===r.enabled,position:T(r.position,_,t.launcher.position),offset:E(r.offset,l.offset,t.launcher.offset),size:E(r.size,l.size,t.launcher.size)},display:{trigger:h,delay:E(i.delay,l.delay,t.display.delay),cappingCount:E(i.cappingCount,l.cappingCount,t.display.cappingCount),cappingInterval:E(i.cappingInterval,l.cappingInterval,t.display.cappingInterval)},texts:D(H(n.texts)),colors:v,...y?{dark:y}:{},fontFamily:j(n.fontFamily,t.fontFamily),zIndex:E(n.zIndex,l.zIndex,t.zIndex)}}function N(e){return"default"===e||"denied"===e}function U(e){return"denied"===e?"blocked":"ask"}function W(e,t){return e.enable&&e.launcher.enabled&&N(t)}var L,R,B,V,$,q,G,Z,K,X,J,Q,Y,ee,te={},ne=[],oe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,re=Array.isArray;function ie(e,t){for(var n in t)e[n]=t[n];return e}function le(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function se(e,t,n){var o,r,i,l={};for(i in t)"key"==i?o=t[i]:"ref"==i?r=t[i]:l[i]=t[i];if(arguments.length>2&&(l.children=arguments.length>3?L.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===l[i]&&(l[i]=e.defaultProps[i]);return ae(e,l,o,r,null)}function ae(e,t,n,o,r){var i={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++B,__i:-1,__u:0};return null==r&&null!=R.vnode&&R.vnode(i),i}function ce(e){return e.children}function _e(e,t){this.props=e,this.context=t}function ue(e,t){if(null==t)return e.__?ue(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?ue(e):null}function de(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],r=[],i=ie({},t);i.__v=t.__v+1,R.vnode&&R.vnode(i),Se(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??ue(t),!!(32&t.__u),r),i.__v=t.__v,i.__.__k[i.__i]=i,Pe(o,i,r),t.__e=t.__=null,i.__e!=n&&pe(i)}}function pe(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}),pe(e)}function fe(e){(!e.__d&&(e.__d=!0)&&V.push(e)&&!he.__r++||$!=R.debounceRendering)&&(($=R.debounceRendering)||q)(he)}function he(){try{for(var e,t=1;V.length;)V.length>t&&V.sort(G),e=V.shift(),t=V.length,de(e)}finally{V.length=he.__r=0}}function me(e,t,n,o,r,i,l,s,a,c,_){var u,d,p,f,h,m,v=o&&o.__k||ne,y=t.length;for(a=ve(n,t,v,a,y),u=0;u<y;u++)null!=(p=n.__k[u])&&(d=-1!=p.__i&&v[p.__i]||te,p.__i=u,m=Se(e,p,d,r,i,l,s,a,c,_),f=p.__e,p.ref&&d.ref!=p.ref&&(d.ref&&Ae(d.ref,null,p),_.push(p.ref,p.__c||f,p)),null==h&&null!=f&&(h=f),4&p.__u?(a=ye(p,a,e),d.__e&&(d.__e=null)):"function"==typeof p.type&&void 0!==m?a=m:f&&(a=f.nextSibling),p.__u&=-7);return n.__e=h,a}function ve(e,t,n,o,r){var i,l,s,a,c,_=n.length,u=_,d=0;for(e.__k=new Array(r),i=0;i<r;i++)null!=(l=t[i])&&"boolean"!=typeof l&&"function"!=typeof l?("string"==typeof l||"number"==typeof l||"bigint"==typeof l||l.constructor==String?l=e.__k[i]=ae(null,l,null,null,null):re(l)?l=e.__k[i]=ae(ce,{children:l},null,null,null):void 0===l.constructor&&l.__b>0?l=e.__k[i]=ae(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):e.__k[i]=l,a=i+d,l.__=e,l.__b=e.__b+1,s=null,-1!=(c=l.__i=ge(l,n,a,u))&&(u--,(s=n[c])&&(s.__u|=2)),null==s||null==s.__v?(-1==c&&(r>_?d--:r<_&&d++),"function"!=typeof l.type&&(l.__u|=4)):c!=a&&(c==a-1?d--:c==a+1?d++:(c>a?d--:d++,l.__u|=4))):e.__k[i]=null;if(u)for(i=0;i<_;i++)null!=(s=n[i])&&!(2&s.__u)&&(s.__e==o&&(o=ue(s)),Fe(s,s));return o}function ye(e,t,n){var o,r;if("function"==typeof e.type){for(o=e.__k,r=0;o&&r<o.length;r++)o[r]&&(o[r].__=e,t=ye(o[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=ue(e)),t=n.insertBefore(e.__e,t||null));do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function be(e,t){return t=t||[],null==e||"boolean"==typeof e||(re(e)?e.some(function(e){be(e,t)}):t.push(e)),t}function ge(e,t,n,o){var r,i,l,s=e.key,a=e.type,c=t[n],_=null!=c&&!(2&c.__u);if(null===c&&null==s||_&&s==c.key&&a==c.type)return n;if(o>(_?1:0))for(r=n-1,i=n+1;r>=0||i<t.length;)if(null!=(c=t[l=r>=0?r--:i++])&&!(2&c.__u)&&s==c.key&&a==c.type)return l;return-1}function we(e,t,n){"-"==t[0]?e.setProperty(t,n??""):e[t]=null==n?"":"number"!=typeof n||oe.test(t)?n:n+"px"}function xe(e,t,n,o,r){var i,l;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||we(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||we(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(J,"$1")),l=t.toLowerCase(),t=l in e||"onFocusOut"==t||"onFocusIn"==t?l.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n[X]=o[X]:(n[X]=Q,e.addEventListener(t,i?ee:Y,i)):e.removeEventListener(t,i?ee:Y,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 ke(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t[K])t[K]=Q++;else if(t[K]<n[X])return;return n(R.event?R.event(t):t)}}}function Se(e,t,n,o,r,i,l,s,a,c){var _,u,d,p,f,h,m,v,y,b,g,w,x,k,S,M,P=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(a=!!(32&n.__u),i=[s=t.__e=n.__e]),(_=R.__b)&&_(t);e:if("function"==typeof P){u=l.length;try{if(y=t.props,b=P.prototype&&P.prototype.render,g=(_=P.contextType)&&o[_.__c],w=_?g?g.props.value:_.__:o,n.__c?v=(d=t.__c=n.__c).__=d.__E:(b?t.__c=d=new P(y,w):(t.__c=d=new _e(y,w),d.constructor=P,d.render=ze),g&&g.sub(d),d.state||(d.state={}),d.__n=o,p=d.__d=!0,d.__h=[],d._sb=[]),b&&null==d.__s&&(d.__s=d.state),b&&null!=P.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=ie({},d.__s)),ie(d.__s,P.getDerivedStateFromProps(y,d.__s))),f=d.props,h=d.state,d.__v=t,p)b&&null==P.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),b&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(b&&null==P.getDerivedStateFromProps&&y!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(y,w),t.__v==n.__v||!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(y,d.__s,w)){t.__v!=n.__v&&(d.props=y,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),ne.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&l.push(d),s=ue(n);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(y,d.__s,w),b&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(f,h,m)})}if(d.context=w,d.props=y,d.__P=e,d.__e=!1,x=R.__r,k=0,b)d.state=d.__s,d.__d=!1,x&&x(t),_=d.render(d.props,d.state,d.context),ne.push.apply(d.__h,d._sb),d._sb=[];else do{d.__d=!1,x&&x(t),_=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++k<25);d.state=d.__s,null!=d.getChildContext&&(o=ie(ie({},o),d.getChildContext())),b&&!p&&null!=d.getSnapshotBeforeUpdate&&(m=d.getSnapshotBeforeUpdate(f,h)),S=null!=_&&_.type===ce&&null==_.key?Ce(_.props.children):_,s=me(e,re(S)?S:[S],t,n,o,r,i,l,s,a,c),d.base=t.__e,t.__u&=-161,d.__h.length&&l.push(d),v&&(d.__E=d.__=null)}catch(e){if(l.length=u,t.__v=null,a||null!=i){if(e.then){for(t.__u|=a?160:128;s&&8==s.nodeType&&s.nextSibling;)s=s.nextSibling;null!=i&&(i[i.indexOf(s)]=null),t.__e=s}else if(null!=i)for(M=i.length;M--;)le(i[M])}else t.__e=n.__e;null==t.__k&&(t.__k=n.__k||[]),e.then||Me(t),R.__e(e,t,n)}}else null==i&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=Ie(n.__e,t,n,o,r,i,l,a,c);return(_=R.diffed)&&_(t),128&t.__u?void 0:s}function Me(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Me))}function Pe(e,t,n){for(var o=0;o<n.length;o++)Ae(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 Ce(e){return"object"!=typeof e||null==e||e.__b>0?e:re(e)?e.map(Ce):void 0!==e.constructor?null:ie({},e)}function Ie(e,t,n,o,r,i,l,s,a){var c,_,u,d,p,f,h,m=n.props||te,v=t.props,y=t.type;if("svg"==y?r="http://www.w3.org/2000/svg":"math"==y?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),null!=i)for(c=0;c<i.length;c++)if((p=i[c])&&"setAttribute"in p==!!y&&(y?p.localName==y:3==p.nodeType)){e=p,i[c]=null;break}if(null==e){if(null==y)return document.createTextNode(v);e=document.createElementNS(r,y,v.is&&v),s&&(R.__m&&R.__m(t,i),s=!1),i=null}if(null==y)m===v||s&&e.data==v||(e.data=v);else{if(i="textarea"==y&&null!=v.defaultValue?null:i&&L.call(e.childNodes),!s&&null!=i)for(m={},c=0;c<e.attributes.length;c++)m[(p=e.attributes[c]).name]=p.value;for(c in m)p=m[c],"dangerouslySetInnerHTML"==c?u=p:"children"==c||c in v||"value"==c&&"defaultValue"in v||"checked"==c&&"defaultChecked"in v||xe(e,c,null,p,r);for(c in v)p=v[c],"children"==c?d=p:"dangerouslySetInnerHTML"==c?_=p:"value"==c?f=p:"checked"==c?h=p:s&&"function"!=typeof p||m[c]===p||xe(e,c,p,m[c],r);if(_)s||u&&(_.__html==u.__html||_.__html==e.innerHTML)||(e.innerHTML=_.__html),t.__k=[];else if(u&&(e.innerHTML=""),me("template"==t.type?e.content:e,re(d)?d:[d],t,n,o,"foreignObject"==y?"http://www.w3.org/1999/xhtml":r,i,l,i?i[0]:n.__k&&ue(n,0),s,a),null!=i)for(c=i.length;c--;)le(i[c]);s&&"textarea"!=y||(c="value","progress"==y&&null==f?e.removeAttribute("value"):null!=f&&(f!==e[c]||"progress"==y&&!f||"option"==y&&f!=m[c])&&xe(e,c,f,m[c],r),c="checked",null!=h&&h!=e[c]&&xe(e,c,h,m[c],r))}return e}function Ae(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 Fe(e,t,n){var o,r;if(R.unmount&&R.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||Ae(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(r=0;r<o.length;r++)o[r]&&Fe(o[r],t,n||"function"!=typeof e.type);n||le(e.__e),e.__c=e.__=e.__e=void 0}function ze(e,t,n){return this.constructor(e,n)}function He(e,t,n){var o,r,i,l;t==document&&(t=document.documentElement),R.__&&R.__(e,t),r=(o="function"==typeof n)?null:n&&n.__k||t.__k,i=[],l=[],Se(t,e=(!o&&n||t).__k=se(ce,null,[e]),r||te,te,t.namespaceURI,!o&&n?[n]:r?null:t.firstChild?L.call(t.childNodes):null,i,!o&&n?n:r?r.__e:t.firstChild,o,l),Pe(i,e,l),e.props.children=null}L=ne.slice,R={__e:function(e,t,n,o){for(var r,i,l;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&null!=i.getDerivedStateFromError&&(r.setState(i.getDerivedStateFromError(e)),l=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,o||{}),l=r.__d),l)return r.__E=r}catch(t){e=t}throw e}},B=0,_e.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=ie({},this.state),"function"==typeof e&&(e=e(ie({},n),this.props)),e&&ie(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),fe(this))},_e.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),fe(this))},_e.prototype.render=ce,V=[],q="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,G=function(e,t){return e.__v.__b-t.__v.__b},he.__r=0,Z=Math.random().toString(8),K="__d"+Z,X="__a"+Z,J=/(PointerCapture)$|Capture$/i,Q=0,Y=ke(!1),ee=ke(!0);var Te=0;Array.isArray;function Ee(e,t,n,o,r,i){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:--Te,__i:-1,__u:0,__source:r,__self:i};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}var je,De,Oe,Ne,Ue=0,We=[],Le=R,Re=Le.__b,Be=Le.__r,Ve=Le.diffed,$e=Le.__c,qe=Le.unmount,Ge=Le.__;function Ze(e,t){Le.__h&&Le.__h(De,e,Ue||t),Ue=0;var n=De.__H||(De.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Ke(e){return Ue=1,function(e,t,n){var o=Ze(je++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):nt(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=De,!De.__f)){var r=function(e,t,n){if(!o.__c.__H)return!0;var r=!1,l=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]&&(l=!0)}}),i){var s=i.call(this,e,t,n);return r?s||l:s}return!r||l};De.__f=!0;var i=De.shouldComponentUpdate,l=De.componentWillUpdate;De.componentWillUpdate=function(e,t,n){if(this.__e){var o=i;i=void 0,r(e,t,n),i=o}l&&l.call(this,e,t,n)},De.shouldComponentUpdate=r}return o.__N||o.__}(nt,e)}function Xe(){for(var e;e=We.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Ye),t.__h.some(et),t.__h=[]}catch(n){t.__h=[],Le.__e(n,e.__v)}}}Le.__b=function(e){De=null,Re&&Re(e)},Le.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ge&&Ge(e,t)},Le.__r=function(e){Be&&Be(e),je=0;var t=(De=e.__c).__H;t&&(Oe===De?(t.__h=[],De.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(Ye),t.__h.some(et),t.__h=[],je=0)),Oe=De},Le.diffed=function(e){Ve&&Ve(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==We.push(t)&&Ne===Le.requestAnimationFrame||((Ne=Le.requestAnimationFrame)||Qe)(Xe)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),Oe=De=null},Le.__c=function(e,t){t.some(function(e){try{e.__h.some(Ye),e.__h=e.__h.filter(function(e){return!e.__||et(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],Le.__e(n,e.__v)}}),$e&&$e(e,t)},Le.unmount=function(e){qe&&qe(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{Ye(e)}catch(e){t=e}}),n.__H=void 0,t&&Le.__e(t,n.__v))};var Je="function"==typeof requestAnimationFrame;function Qe(e){var t,n=function(){clearTimeout(o),Je&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Je&&(t=requestAnimationFrame(n))}function Ye(e){var t=De,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),De=t}function et(e){var t=De;e.__c=e.__(),De=t}function tt(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function nt(e,t){return"function"==typeof t?t(e):t}function ot(e,t){for(var n in t)e[n]=t[n];return e}function rt(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 it(e,t){this.props=e,this.context=t}(it.prototype=new _e).isPureReactComponent=!0,it.prototype.shouldComponentUpdate=function(e,t){return rt(this.props,e)||rt(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)};"undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref");var st=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);st(e,t,n,o)};var at=R.unmount;function ct(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=ot({},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 ct(e,t,n)})),e}function _t(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return _t(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 ut(){this.__u=0,this.o=null,this.__b=null}function dt(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function pt(){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),at&&at(e)},(ut.prototype=new _e).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var r=dt(o.__v),i=!1,l=function(){i||o.__z||(i=!0,n.__R=null,r?r(a):a())};n.__R=l;var s=n.__P;n.__P=null;var a=function(){if(! --o.__u){if(o.state.__a){var e=o.state.__a;o.__v.__k[0]=_t(e,e.__c.__P,e.__c.__O)}var t;for(o.setState({__a:o.__b=null});t=o.o.pop();)t.__P=s,t.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(l,l)},ut.prototype.componentWillUnmount=function(){this.o=[]},ut.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]=ct(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&se(ce,null,e.fallback);return r&&(r.__u&=-33),[se(ce,null,t.__a?null:e.children),r]};var ft=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]}};(pt.prototype=new _e).__a=function(e){var t=this,n=dt(t.__v),o=t.l.get(e);return o[0]++,function(r){var i=function(){t.props.revealOrder?(o.push(r),ft(t,e,o)):r()};n?n(i):i()}},pt.prototype.render=function(e){this.i=null,this.l=new Map;var t=be(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},pt.prototype.componentDidUpdate=pt.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){ft(e,n,t)})};var ht="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,mt=/^(?: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]/,vt=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,yt=/[A-Z0-9]/g,bt="undefined"!=typeof document,gt=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 wt=R.event;R.event=function(e){return wt&&(e=wt(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var xt={configurable:!0,get:function(){return this.class}},kt=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 l=t[i];if(!("value"===i&&"defaultValue"in t&&null==l||bt&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var s=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===l?l="":"translate"===s&&"no"===l?l=!1:"o"===s[0]&&"n"===s[1]?"ondoubleclick"===s?i="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||gt(t.type)?"onfocus"===s?i="onfocusin":"onblur"===s?i="onfocusout":vt.test(i)&&(i=s):s=i="oninput":r&&mt.test(i)?i=i.replace(yt,"-$&").toLowerCase():null===l&&(l=void 0),"oninput"===s&&o[i=s]&&(i="oninputCapture"),o[i]=l}}"select"==n&&(o.multiple&&Array.isArray(o.value)&&(o.value=be(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),null!=o.defaultValue&&(o.value=be(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",xt)):t.className&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=ht,kt&&kt(e)};var St=R.__r;R.__r=function(e){St&&St(e),e.__c};var Mt=R.diffed;R.diffed=function(e){Mt&&Mt(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)};const Pt="(prefers-color-scheme: dark)";function Ct(e,t){const[n,o]=Ke(()=>"auto"===e&&t&&"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia(Pt).matches);return function(e,t){var n=Ze(je++,3);!Le.__s&&tt(n.__H,t)&&(n.__=e,n.u=t,De.__H.__h.push(n))}(()=>{if("auto"!==e||!t||"undefined"==typeof window||"function"!=typeof window.matchMedia)return;const n=window.matchMedia(Pt),r=e=>o(e.matches);return o(n.matches),n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[e,t]),"auto"!==e?e:n?"dark":"light"}const It={bell:"M6 10a6 6 0 0 1 12 0c0 4 1.5 5.5 2 6H4c.5-.5 2-2 2-6M10 20a2 2 0 0 0 4 0",gift:"M3 11h18v9a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1zM2.5 7h19v4h-19zM12 7v14M12 7c-1 0-3-.2-3.5-1a2 2 0 0 1 3.5-1 2 2 0 0 1 3.5 1c-.5.8-2.5 1-3.5 1z",cart:"M2 4h2.2l2.4 11.2A2 2 0 0 0 8.6 17H19M6 7h15l-2.2 7.5H8M10.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M19.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0",chart:"M3 21h18M7 21V11M12 21V6M17 21v-8",lock:"M5 11h14v10H5zM8 11V8a4 4 0 0 1 8 0v3",calendar:"M4 6h16v15H4zM4 10h16M9 3v4M15 3v4",check:"M4 13l5 5L20 6",star:"M12 3l2.9 5.9 6.5.9-4.7 4.6 1.1 6.5-5.8-3.1-5.8 3.1 1.1-6.5L2.6 9.8l6.5-.9z",clock:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0M12 7v5l4 2",tag:"M20.6 13.4l-7.2 7.2a2 2 0 0 1-2.8 0l-7-7A2 2 0 0 1 3 12.2V5a2 2 0 0 1 2-2h7.2a2 2 0 0 1 1.4.6l7 7a2 2 0 0 1 0 2.8zM9 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0",mail:"M3 6h18v12H3zM3 7l9 6 9-6",phone:"M7 2h10a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1M10 19h4",download:"M12 3v12M7 11l5 5 5-5M4 20h16",play:"M8 5l12 7-12 7z",shield:"M12 3l8 3v6c0 5-3.4 8.6-8 10-4.6-1.4-8-5-8-10V6z",sparkle:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM18 15l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1L15 18l2.1-.9z",percent:"M19 5L5 19M8.5 8.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0M20.5 15.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0",truck:"M2 7h12v10H2zM14 10h4l3 3v4h-7M8.5 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M20 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0",ticket:"M4 7h16v4a2 2 0 0 0 0 4v3H4v-3a2 2 0 0 0 0-4zM14 7v12",user:"M20 21a8 8 0 0 0-16 0M16 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0"},At=(Object.keys(It),"0 12px 32px rgba(16, 24, 40, 0.18)");function Ft(e,t){const[n,o]=e.split("-");return{[n]:t,[o]:t}}function zt(e,t){return t?(e?"pw-subw-drop":"pw-subw-rise")+" 0.3s ease-out backwards":void 0}function Ht(e,t,n){const{layout:o,position:r}=e.prompt,i={position:t,zIndex:e.zIndex,boxSizing:"border-box",pointerEvents:"auto"};if("bar"===o)return{...i,left:0,right:0,[r]:0,animation:zt("top"===r,n)};if("modal"===o)return{...i,top:"50%",left:"50%",width:"min(420px, calc(100% - 32px))",transform:"translate(-50%, -50%)",animation:n?"pw-subw-fade 0.25s ease-out backwards":void 0};const l="min(360px, calc(100% - 32px))",s=zt(r.startsWith("top"),n);return"top"===r||"bottom"===r?{...i,[r]:16,left:"50%",width:l,transform:"translateX(-50%)",animation:s}:{...i,...Ft(r,16),width:l,animation:s}}function Tt({label:e,primary:t,colors:n,disabled:o,onClick:r}){return Ee("button",{type:"button",disabled:o,onClick:r,style:{...s(t?"primary":"secondary",n),display:"inline-block",width:"auto",padding:"8px 18px",whiteSpace:"nowrap",opacity:o?.6:1,cursor:o?"default":"pointer"},children:e})}function Et({config:e,variant:t,colors:n,busy:o,onAccept:r,onDecline:i}){const{prompt:l,texts:s}=e,a="bar"===l.layout,c="blocked"===t;return Ee("div",{role:"dialog","aria-label":c?s.blockedTitle:s.title,style:{display:"flex",flexDirection:a?"row":"column",alignItems:a?"center":"stretch",flexWrap:a?"wrap":"nowrap",gap:16,padding:a?"12px 20px":20,boxSizing:"border-box",width:"100%",borderRadius:a?0:l.borderRadius,boxShadow:At,backgroundColor:n.background,color:n.text,fontFamily:e.fontFamily,colorScheme:n.scheme},children:[Ee("div",{style:{display:"flex",alignItems:"flex-start",gap:12,flex:a?"1 1 240px":void 0},children:[l.iconUrl&&Ee("img",{src:l.iconUrl,alt:"",width:48,height:48,style:{flex:"none",borderRadius:8,objectFit:"cover"}}),Ee("div",{style:{display:"flex",flexDirection:"column",gap:4,minWidth:0},children:[Ee("div",{style:{fontSize:16,fontWeight:600,lineHeight:1.4},children:c?s.blockedTitle:s.title}),Ee("div",{style:{fontSize:14,lineHeight:1.5,color:n.textSecondary},children:c?s.blockedMessage:s.message})]})]}),Ee("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,flex:"none"},children:c?Ee(Tt,{label:s.closeText,primary:!0,colors:n,onClick:i}):Ee(ce,{children:[Ee(Tt,{label:s.declineText,primary:!1,colors:n,onClick:i}),Ee(Tt,{label:s.acceptText,primary:!0,colors:n,disabled:o,onClick:r})]})})]})}function jt({config:e,blocked:t,colors:n,onClick:o}){const{size:r}=e.launcher,i=t?e.texts.launcherBlockedLabel:e.texts.launcherLabel,l=Math.round(r/2);return Ee("button",{type:"button","aria-label":i,title:i,onClick:o,style:{display:"flex",alignItems:"center",justifyContent:"center",width:r,height:r,padding:0,border:"none",borderRadius:"50%",backgroundColor:n.accent,color:n.onAccent,boxShadow:At,cursor:"pointer",opacity:t?.7:1},children:Ee("svg",{width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[Ee("path",{d:It.bell}),t&&Ee("path",{d:"M4 4l16 16"})]})})}function Dt({config:e,permission:t,open:n,mode:o="live",colorScheme:r="auto",busy:i,onAccept:l,onDecline:s,onLauncherClick:a}){const c=C(e,Ct(r,M(e))),_="live"===o,u=_?"fixed":"absolute",d=W(e,t);return e.enable&&(n||d)?Ee(ce,{children:[_&&Ee("style",{children:"\n@keyframes pw-subw-fade { from { opacity: 0; } }\n@keyframes pw-subw-drop { from { opacity: 0; translate: 0 -16px; } }\n@keyframes pw-subw-rise { from { opacity: 0; translate: 0 16px; } }\n"}),d&&Ee("div",{style:{position:u,zIndex:e.zIndex,pointerEvents:"auto",...Ft(e.launcher.position,e.launcher.offset)},children:Ee(jt,{config:e,blocked:"denied"===t,colors:c,onClick:a})}),n&&e.prompt.overlay&&Ee("div",{style:{position:u,inset:0,zIndex:e.zIndex,backgroundColor:"rgba(16, 24, 40, 0.5)",animation:_?"pw-subw-fade 0.2s ease-out backwards":void 0,pointerEvents:"auto"},onClick:s}),n&&Ee("div",{style:Ht(e,u,_),children:Ee(Et,{config:e,variant:U(t),colors:c,busy:i,onAccept:l,onDecline:s})})]}):null}const Ot="keyValue",Nt="messages",Ut="inboxMessages";function Wt(e,t){return function(n){n.objectStoreNames.contains(e)||t(n)}}const Lt=[Wt(Ot,function(e){e.createObjectStore(Ot,{keyPath:"key"})}),Wt("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})}),Wt(Nt,function(e){e.createObjectStore(Nt,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),Wt(Ut,function(e){const t="status",n=e.createObjectStore(Ut,{keyPath:"inbox_id",autoIncrement:!1});n.createIndex(t,t,{unique:!1,multiEntry:!0}),n.createIndex("rt","rt",{unique:!1,multiEntry:!0})})];class Rt{get all(){return Lt}}class Bt{constructor(e,t=new Rt){this.db=e,this.migrationsBuilder=t}applyMigrations(){this.applyMigrationsPack(this.migrationsBuilder.all)}applyMigrationsPack(e){e.forEach(e=>{e(this.db)})}}function Vt(e,t){console.info("onversionchange",t),e.close()}let $t;function qt(e){return($t||($t=new Promise((e,t)=>{const n=indexedDB.open("PUSHWOOSH_SDK_STORE",7);n.onsuccess=n=>{const o=n.target.result;o.onversionchange=Vt.bind(null,o,t),e(o)},n.onerror=()=>t(n.error),n.onupgradeneeded=e=>{const n=e.target.result;n.onversionchange=Vt.bind(null,n,t),new Bt(n).applyMigrations()}})),$t).then(t=>new Promise((n,o)=>e(t,n,o)))}class Gt{_add(e){return qt((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 qt((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 qt((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)}})}}Zt=Ot;var Zt;const Kt=new class extends Gt{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)}},Xt=(new class extends Gt{constructor(){super(...arguments),this.name=Nt,this.maxItems=25}add(e){return this._add({...e,date:new Date})}},{error:1,info:2,debug:3});let Jt=3;const Qt={setLevel(e){Xt[e]||(e="error"),Jt=Xt[e]},write(e,t,n){return"error"===e?this.error(t):this.info(t),Kt.add(e,t,n)}};Object.keys(Xt).forEach(e=>{const t=Xt[e];Qt[e]=(...n)=>{t<=Jt&&(console.groupCollapsed(e),console.info("",...n),console.trace("trace"),console.groupEnd())}});class Yt{constructor(e){this.permission="unsupported",this.open=!1,this.busy=!1,this.container=null,this.autoShowTimer=null,this.pw=e,this.config=O(e.initParams.subscriptionWidget),this.accept=this.accept.bind(this),this.decline=this.decline.bind(this),this.toggle=this.toggle.bind(this),e.moduleRegistry.subscriptionWidget=this}async run(){const{pw:e,config:t}=this;t.enable&&e.isPushAvailable()&&(this.permission=await this.readPermission(),this.mount(),this.listenSubscriptionChanges(),await this.scheduleAutoShow())}show(){this.container&&N(this.permission)&&!this.open&&(this.open=!0,this.render(),this.pw.dispatchEvent("show-subscription-widget",{}))}hide(){this.open&&(this.open=!1,this.busy=!1,this.render(),this.pw.dispatchEvent("hide-subscription-widget",{}))}toggle(e){e??!this.open?this.show():this.hide()}isVisible(){return this.open}async readPermission(){const e=this.pw.driver?.getPermission();return"denied"===e?"denied":await this.pw.isSubscribed()?"granted":"default"}mount(){const e=document.createElement("div");e.id="pushwoosh-subscription-widget",e.style.position="fixed",e.style.inset="0",e.style.zIndex=String(this.config.zIndex),e.style.pointerEvents="none",document.body.appendChild(e),this.container=document.createElement("div"),e.attachShadow({mode:"open"}).appendChild(this.container),this.render()}render(){this.container&&(this.open||W(this.config,this.permission)?((e,t)=>{He(Ee(Dt,{...t,mode:"live"}),e)})(this.container,{config:this.config,permission:this.permission,open:this.open,busy:this.busy,onAccept:this.accept,onDecline:this.decline,onLauncherClick:this.toggle}):He(null,this.container))}async scheduleAutoShow(){const e=await this.pw.data.getSubscriptionWidgetHistory();(function(e,t,n,o){const{trigger:r,cappingCount:i,cappingInterval:l}=e.display;return!(!e.enable||"auto"!==r||"default"!==t||i>0&&n.shownCount>=i||!(null===n.lastShownAt||o-n.lastShownAt>=36e5*l))})(this.config,this.permission,e,Date.now())&&(this.autoShowTimer=setTimeout(async()=>{this.autoShowTimer=null,this.open||"default"!==this.permission||(this.show(),await this.pw.data.setSubscriptionWidgetHistory(function(e,t){return{shownCount:e.shownCount+1,lastShownAt:t}}(e,Date.now())))},1e3*this.config.display.delay))}async accept(){this.busy=!0,this.render();try{await this.pw.subscribe()}catch(e){Qt.error(e,"Pushwoosh subscription widget: failed to subscribe")}if(this.permission=await this.readPermission(),"denied"===this.permission)return this.busy=!1,void this.render();this.hide()}decline(){this.hide()}listenSubscriptionChanges(){const e=async()=>{this.permission=await this.readPermission(),"granted"===this.permission&&(this.cancelAutoShow(),this.hide()),this.render()};this.pw.addEventHandler("subscribe",e),this.pw.addEventHandler("unsubscribe",e),this.pw.addEventHandler("permission-denied",e)}cancelAutoShow(){null!==this.autoShowTimer&&(clearTimeout(this.autoShowTimer),this.autoShowTimer=null)}}return t})());
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(this,()=>(()=>{"use strict";const e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};e.r(t),e.d(t,{PWSubscriptionWidget:()=>Yt});const n=/^(https?:|mailto:|tel:)/i,o="#101828",r="#667085",i="#FFFFFF",l={background:"#FFFFFF",accent:"#2970FF",text:o,textSecondary:r,textInverse:"#FFFFFF"};function s(e,t){return{display:"block",boxSizing:"border-box",width:"100%",padding:"10px 25px",borderRadius:6,fontSize:14,fontWeight:600,fontFamily:"inherit",lineHeight:1.5,textAlign:"center",textDecoration:"none",cursor:"pointer",..."secondary"===e?{backgroundColor:t.surface,color:t.accent,border:`1px solid ${t.accent}`}:{backgroundColor:t.accent,color:t.onAccent,border:"none"}}}const a={card:["top","bottom","top-left","top-right","bottom-left","bottom-right"],bar:["top","bottom"],modal:["center"]},c=Object.keys(a),_=["bottom-right","bottom-left","top-right","top-left"],u=["auto","launcher","manual"],d={delay:[0,3600],cappingCount:[0,100],cappingInterval:[0,8760],borderRadius:[0,32],offset:[0,100],size:[32,80],zIndex:[0,2147483647]},p={enable:!1,prompt:{layout:"card",position:"top",borderRadius:12,overlay:!1},launcher:{enabled:!1,position:"bottom-right",offset:20,size:48},display:{trigger:"auto",delay:5,cappingCount:3,cappingInterval:4},texts:{title:"Stay in the loop",message:"Allow notifications to get our news and special offers first.",acceptText:"Allow",declineText:"Not now",closeText:"Got it",blockedTitle:"Notifications are blocked",blockedMessage:"To get our notifications, allow them for this site in your browser settings.",launcherLabel:"Subscribe to notifications",launcherBlockedLabel:"Notifications are blocked"},colors:l,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',zIndex:2147483e3},f=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function h(e){const t=f.exec(e.trim())?.[1];if(!t)return null;const n=3===t.length?t.split("").map(e=>e+e).join(""):t;return[0,2,4].map(e=>parseInt(n.slice(e,e+2),16))}function m([e,t,n]){return`#${[e,t,n].map(e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")).join("")}`}function v(e,t,n){let o=n;return o<0&&(o+=1),o>1&&(o-=1),o<1/6?e+6*(t-e)*o:o<.5?t:o<2/3?e+(t-e)*(2/3-o)*6:e}function y(e){return e>.5?.07+.86*(1-e):e}function b(e){return e<.5?.93-e*((.93-.5)/.5):e}function g(e,t){const n=h(e);if(!n)return e;const[o,r,i]=function([e,t,n]){const[o,r,i]=[e/255,t/255,n/255],l=Math.max(o,r,i),s=Math.min(o,r,i),a=(l+s)/2;if(l===s)return[0,0,a];const c=l-s;let _;return _=l===o?(r-i)/c+(r<i?6:0):l===r?(i-o)/c+2:(o-r)/c+4,[_/6,a>.5?c/(2-l-s):c/(l+s),a]}(n);return m(function([e,t,n]){if(0===t){const e=255*n;return[e,e,e]}const o=n<.5?n*(1+t):n+t-n*t,r=2*n-o;return[255*v(r,o,e+1/3),255*v(r,o,e),255*v(r,o,e-1/3)]}([o,r,"fold"===t?y(i):b(i)]))}function w(e,t,n){const o=h(e),r=h(t);return o&&r?m(o.map((e,t)=>e+(r[t]-e)*n)):e}function x(e){const t=h(e);if(!t)return!1;const[n,o,r]=t;return(.299*n+.587*o+.114*r)/255>.6}function k(e){return{background:g(e.background,"fold"),accent:e.accent,text:g(e.text,"lift"),textSecondary:g(e.textSecondary,"lift"),textInverse:e.textInverse}}function S(e,t){return"light"===t?{surface:l.background,surfaceText:o,border:"#D0D5DD",onAccent:i,error:"#D92D20",chromeIcon:r}:{surface:w(e.background,e.text,.08),surfaceText:e.text,border:w(e.background,e.text,.24),onAccent:x(e.accent)?o:i,error:"#FDA29B",chromeIcon:e.textSecondary}}function M(e){return!0===e.dark?.enabled}function P(e,t="light"){return"dark"===t&&M(e)?"dark":"light"}function C(e,t="light"){const n=P(e,t),o="dark"===n?(r=e.colors,i=e.dark,{...k(r),...i?.colors??{}}):e.colors;var r,i;return{...o,scheme:n,...S(o,n)}}function I(e){const t=(e||"").trim();if(t)return t.startsWith("#")||t.startsWith("/")||t.startsWith("?")||n.test(t)?t:void 0}new Set(["STRONG","B","EM","I","U","BR","A"]);function A(e){return"string"==typeof e&&e?e:void 0}function F(e){const t="object"==typeof e.colors&&null!==e.colors?e.colors:{};return{background:A(t.background)??A(e.background)??l.background,accent:A(t.accent)??A(e.accent)??l.accent,text:A(t.text)??l.text,textSecondary:A(t.textSecondary)??l.textSecondary,textInverse:A(t.textInverse)??l.textInverse}}function z(e,t){const n=e.dark;if("object"!=typeof n||null===n)return;const o=n,r="object"==typeof o.colors&&null!==o.colors?o.colors:{},i=k(t),l=function(e){if("object"!=typeof e||null===e)return;const t=e,n=A(t.color);if(!n)return;return{color:n,opacity:"number"==typeof t.opacity&&Number.isFinite(t.opacity)?Math.max(0,Math.min(1,t.opacity)):1}}(o.overlay);return{enabled:!0===o.enabled,colors:{background:A(r.background)??i.background,accent:A(r.accent)??i.accent,text:A(r.text)??i.text,textSecondary:A(r.textSecondary)??i.textSecondary,textInverse:A(r.textInverse)??i.textInverse},...l?{overlay:l}:{},...A(o.boxShadow)?{boxShadow:o.boxShadow}:{}}}function H(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}function T(e,t,n){return t.includes(e)?e:n}function E(e,[t,n],o){return"number"==typeof e&&Number.isFinite(e)?Math.max(t,Math.min(n,Math.round(e))):o}function j(e,t){if("string"!=typeof e)return t;const n=e.trim();return n?n.slice(0,300):t}function D(e){const t=p.texts,n=Object.keys(t);return Object.fromEntries(n.map(n=>[n,j(e[n],t[n])]))}function O(e){const t=p,n=H(e),o=H(n.prompt),r=H(n.launcher),i=H(n.display),l=d,s=T(o.layout,c,t.prompt.layout),f=a[s],h=T(i.trigger,u,t.display.trigger),m=function(e){const t=I("string"==typeof e?e:void 0);return t&&/^(https?:\/\/|\/)/i.test(t)?t:void 0}(o.iconUrl),v=F({colors:n.colors}),y=z({dark:n.dark},v);return{enable:!0===n.enable,prompt:{layout:s,position:T(o.position,f,f[0]),...m?{iconUrl:m}:{},borderRadius:E(o.borderRadius,l.borderRadius,t.prompt.borderRadius),overlay:"modal"===s||!0===o.overlay},launcher:{enabled:"launcher"===h||!0===r.enabled,position:T(r.position,_,t.launcher.position),offset:E(r.offset,l.offset,t.launcher.offset),size:E(r.size,l.size,t.launcher.size)},display:{trigger:h,delay:E(i.delay,l.delay,t.display.delay),cappingCount:E(i.cappingCount,l.cappingCount,t.display.cappingCount),cappingInterval:E(i.cappingInterval,l.cappingInterval,t.display.cappingInterval)},texts:D(H(n.texts)),colors:v,...y?{dark:y}:{},fontFamily:j(n.fontFamily,t.fontFamily),zIndex:E(n.zIndex,l.zIndex,t.zIndex)}}function N(e){return"default"===e||"denied"===e}function U(e){return"denied"===e?"blocked":"ask"}function W(e,t){return e.enable&&e.launcher.enabled&&N(t)}var L,R,B,V,$,q,G,Z,K,X,J,Q,Y,ee,te={},ne=[],oe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,re=Array.isArray;function ie(e,t){for(var n in t)e[n]=t[n];return e}function le(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function se(e,t,n){var o,r,i,l={};for(i in t)"key"==i?o=t[i]:"ref"==i?r=t[i]:l[i]=t[i];if(arguments.length>2&&(l.children=arguments.length>3?L.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===l[i]&&(l[i]=e.defaultProps[i]);return ae(e,l,o,r,null)}function ae(e,t,n,o,r){var i={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++B,__i:-1,__u:0};return null==r&&null!=R.vnode&&R.vnode(i),i}function ce(e){return e.children}function _e(e,t){this.props=e,this.context=t}function ue(e,t){if(null==t)return e.__?ue(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?ue(e):null}function de(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],r=[],i=ie({},t);i.__v=t.__v+1,R.vnode&&R.vnode(i),Se(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??ue(t),!!(32&t.__u),r),i.__v=t.__v,i.__.__k[i.__i]=i,Pe(o,i,r),t.__e=t.__=null,i.__e!=n&&pe(i)}}function pe(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}),pe(e)}function fe(e){(!e.__d&&(e.__d=!0)&&V.push(e)&&!he.__r++||$!=R.debounceRendering)&&(($=R.debounceRendering)||q)(he)}function he(){try{for(var e,t=1;V.length;)V.length>t&&V.sort(G),e=V.shift(),t=V.length,de(e)}finally{V.length=he.__r=0}}function me(e,t,n,o,r,i,l,s,a,c,_){var u,d,p,f,h,m,v=o&&o.__k||ne,y=t.length;for(a=ve(n,t,v,a,y),u=0;u<y;u++)null!=(p=n.__k[u])&&(d=-1!=p.__i&&v[p.__i]||te,p.__i=u,m=Se(e,p,d,r,i,l,s,a,c,_),f=p.__e,p.ref&&d.ref!=p.ref&&(d.ref&&Ae(d.ref,null,p),_.push(p.ref,p.__c||f,p)),null==h&&null!=f&&(h=f),4&p.__u?(a=ye(p,a,e),d.__e&&(d.__e=null)):"function"==typeof p.type&&void 0!==m?a=m:f&&(a=f.nextSibling),p.__u&=-7);return n.__e=h,a}function ve(e,t,n,o,r){var i,l,s,a,c,_=n.length,u=_,d=0;for(e.__k=new Array(r),i=0;i<r;i++)null!=(l=t[i])&&"boolean"!=typeof l&&"function"!=typeof l?("string"==typeof l||"number"==typeof l||"bigint"==typeof l||l.constructor==String?l=e.__k[i]=ae(null,l,null,null,null):re(l)?l=e.__k[i]=ae(ce,{children:l},null,null,null):void 0===l.constructor&&l.__b>0?l=e.__k[i]=ae(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):e.__k[i]=l,a=i+d,l.__=e,l.__b=e.__b+1,s=null,-1!=(c=l.__i=ge(l,n,a,u))&&(u--,(s=n[c])&&(s.__u|=2)),null==s||null==s.__v?(-1==c&&(r>_?d--:r<_&&d++),"function"!=typeof l.type&&(l.__u|=4)):c!=a&&(c==a-1?d--:c==a+1?d++:(c>a?d--:d++,l.__u|=4))):e.__k[i]=null;if(u)for(i=0;i<_;i++)null!=(s=n[i])&&!(2&s.__u)&&(s.__e==o&&(o=ue(s)),Fe(s,s));return o}function ye(e,t,n){var o,r;if("function"==typeof e.type){for(o=e.__k,r=0;o&&r<o.length;r++)o[r]&&(o[r].__=e,t=ye(o[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=ue(e)),t=n.insertBefore(e.__e,t||null));do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function be(e,t){return t=t||[],null==e||"boolean"==typeof e||(re(e)?e.some(function(e){be(e,t)}):t.push(e)),t}function ge(e,t,n,o){var r,i,l,s=e.key,a=e.type,c=t[n],_=null!=c&&!(2&c.__u);if(null===c&&null==s||_&&s==c.key&&a==c.type)return n;if(o>(_?1:0))for(r=n-1,i=n+1;r>=0||i<t.length;)if(null!=(c=t[l=r>=0?r--:i++])&&!(2&c.__u)&&s==c.key&&a==c.type)return l;return-1}function we(e,t,n){"-"==t[0]?e.setProperty(t,n??""):e[t]=null==n?"":"number"!=typeof n||oe.test(t)?n:n+"px"}function xe(e,t,n,o,r){var i,l;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||we(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||we(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(J,"$1")),l=t.toLowerCase(),t=l in e||"onFocusOut"==t||"onFocusIn"==t?l.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n[X]=o[X]:(n[X]=Q,e.addEventListener(t,i?ee:Y,i)):e.removeEventListener(t,i?ee:Y,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 ke(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t[K])t[K]=Q++;else if(t[K]<n[X])return;return n(R.event?R.event(t):t)}}}function Se(e,t,n,o,r,i,l,s,a,c){var _,u,d,p,f,h,m,v,y,b,g,w,x,k,S,M,P=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(a=!!(32&n.__u),i=[s=t.__e=n.__e]),(_=R.__b)&&_(t);e:if("function"==typeof P){u=l.length;try{if(y=t.props,b=P.prototype&&P.prototype.render,g=(_=P.contextType)&&o[_.__c],w=_?g?g.props.value:_.__:o,n.__c?v=(d=t.__c=n.__c).__=d.__E:(b?t.__c=d=new P(y,w):(t.__c=d=new _e(y,w),d.constructor=P,d.render=ze),g&&g.sub(d),d.state||(d.state={}),d.__n=o,p=d.__d=!0,d.__h=[],d._sb=[]),b&&null==d.__s&&(d.__s=d.state),b&&null!=P.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=ie({},d.__s)),ie(d.__s,P.getDerivedStateFromProps(y,d.__s))),f=d.props,h=d.state,d.__v=t,p)b&&null==P.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),b&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(b&&null==P.getDerivedStateFromProps&&y!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(y,w),t.__v==n.__v||!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(y,d.__s,w)){t.__v!=n.__v&&(d.props=y,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),ne.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&l.push(d),s=ue(n);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(y,d.__s,w),b&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(f,h,m)})}if(d.context=w,d.props=y,d.__P=e,d.__e=!1,x=R.__r,k=0,b)d.state=d.__s,d.__d=!1,x&&x(t),_=d.render(d.props,d.state,d.context),ne.push.apply(d.__h,d._sb),d._sb=[];else do{d.__d=!1,x&&x(t),_=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++k<25);d.state=d.__s,null!=d.getChildContext&&(o=ie(ie({},o),d.getChildContext())),b&&!p&&null!=d.getSnapshotBeforeUpdate&&(m=d.getSnapshotBeforeUpdate(f,h)),S=null!=_&&_.type===ce&&null==_.key?Ce(_.props.children):_,s=me(e,re(S)?S:[S],t,n,o,r,i,l,s,a,c),d.base=t.__e,t.__u&=-161,d.__h.length&&l.push(d),v&&(d.__E=d.__=null)}catch(e){if(l.length=u,t.__v=null,a||null!=i){if(e.then){for(t.__u|=a?160:128;s&&8==s.nodeType&&s.nextSibling;)s=s.nextSibling;null!=i&&(i[i.indexOf(s)]=null),t.__e=s}else if(null!=i)for(M=i.length;M--;)le(i[M])}else t.__e=n.__e;null==t.__k&&(t.__k=n.__k||[]),e.then||Me(t),R.__e(e,t,n)}}else null==i&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=Ie(n.__e,t,n,o,r,i,l,a,c);return(_=R.diffed)&&_(t),128&t.__u?void 0:s}function Me(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Me))}function Pe(e,t,n){for(var o=0;o<n.length;o++)Ae(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 Ce(e){return"object"!=typeof e||null==e||e.__b>0?e:re(e)?e.map(Ce):void 0!==e.constructor?null:ie({},e)}function Ie(e,t,n,o,r,i,l,s,a){var c,_,u,d,p,f,h,m=n.props||te,v=t.props,y=t.type;if("svg"==y?r="http://www.w3.org/2000/svg":"math"==y?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),null!=i)for(c=0;c<i.length;c++)if((p=i[c])&&"setAttribute"in p==!!y&&(y?p.localName==y:3==p.nodeType)){e=p,i[c]=null;break}if(null==e){if(null==y)return document.createTextNode(v);e=document.createElementNS(r,y,v.is&&v),s&&(R.__m&&R.__m(t,i),s=!1),i=null}if(null==y)m===v||s&&e.data==v||(e.data=v);else{if(i="textarea"==y&&null!=v.defaultValue?null:i&&L.call(e.childNodes),!s&&null!=i)for(m={},c=0;c<e.attributes.length;c++)m[(p=e.attributes[c]).name]=p.value;for(c in m)p=m[c],"dangerouslySetInnerHTML"==c?u=p:"children"==c||c in v||"value"==c&&"defaultValue"in v||"checked"==c&&"defaultChecked"in v||xe(e,c,null,p,r);for(c in v)p=v[c],"children"==c?d=p:"dangerouslySetInnerHTML"==c?_=p:"value"==c?f=p:"checked"==c?h=p:s&&"function"!=typeof p||m[c]===p||xe(e,c,p,m[c],r);if(_)s||u&&(_.__html==u.__html||_.__html==e.innerHTML)||(e.innerHTML=_.__html),t.__k=[];else if(u&&(e.innerHTML=""),me("template"==t.type?e.content:e,re(d)?d:[d],t,n,o,"foreignObject"==y?"http://www.w3.org/1999/xhtml":r,i,l,i?i[0]:n.__k&&ue(n,0),s,a),null!=i)for(c=i.length;c--;)le(i[c]);s&&"textarea"!=y||(c="value","progress"==y&&null==f?e.removeAttribute("value"):null!=f&&(f!==e[c]||"progress"==y&&!f||"option"==y&&f!=m[c])&&xe(e,c,f,m[c],r),c="checked",null!=h&&h!=e[c]&&xe(e,c,h,m[c],r))}return e}function Ae(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 Fe(e,t,n){var o,r;if(R.unmount&&R.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||Ae(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(r=0;r<o.length;r++)o[r]&&Fe(o[r],t,n||"function"!=typeof e.type);n||le(e.__e),e.__c=e.__=e.__e=void 0}function ze(e,t,n){return this.constructor(e,n)}function He(e,t,n){var o,r,i,l;t==document&&(t=document.documentElement),R.__&&R.__(e,t),r=(o="function"==typeof n)?null:n&&n.__k||t.__k,i=[],l=[],Se(t,e=(!o&&n||t).__k=se(ce,null,[e]),r||te,te,t.namespaceURI,!o&&n?[n]:r?null:t.firstChild?L.call(t.childNodes):null,i,!o&&n?n:r?r.__e:t.firstChild,o,l),Pe(i,e,l),e.props.children=null}L=ne.slice,R={__e:function(e,t,n,o){for(var r,i,l;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&null!=i.getDerivedStateFromError&&(r.setState(i.getDerivedStateFromError(e)),l=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,o||{}),l=r.__d),l)return r.__E=r}catch(t){e=t}throw e}},B=0,_e.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=ie({},this.state),"function"==typeof e&&(e=e(ie({},n),this.props)),e&&ie(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),fe(this))},_e.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),fe(this))},_e.prototype.render=ce,V=[],q="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,G=function(e,t){return e.__v.__b-t.__v.__b},he.__r=0,Z=Math.random().toString(8),K="__d"+Z,X="__a"+Z,J=/(PointerCapture)$|Capture$/i,Q=0,Y=ke(!1),ee=ke(!0);var Te=0;Array.isArray;function Ee(e,t,n,o,r,i){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:--Te,__i:-1,__u:0,__source:r,__self:i};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}var je,De,Oe,Ne,Ue=0,We=[],Le=R,Re=Le.__b,Be=Le.__r,Ve=Le.diffed,$e=Le.__c,qe=Le.unmount,Ge=Le.__;function Ze(e,t){Le.__h&&Le.__h(De,e,Ue||t),Ue=0;var n=De.__H||(De.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Ke(e){return Ue=1,function(e,t,n){var o=Ze(je++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):nt(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=De,!De.__f)){var r=function(e,t,n){if(!o.__c.__H)return!0;var r=!1,l=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]&&(l=!0)}}),i){var s=i.call(this,e,t,n);return r?s||l:s}return!r||l};De.__f=!0;var i=De.shouldComponentUpdate,l=De.componentWillUpdate;De.componentWillUpdate=function(e,t,n){if(this.__e){var o=i;i=void 0,r(e,t,n),i=o}l&&l.call(this,e,t,n)},De.shouldComponentUpdate=r}return o.__N||o.__}(nt,e)}function Xe(){for(var e;e=We.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Ye),t.__h.some(et),t.__h=[]}catch(n){t.__h=[],Le.__e(n,e.__v)}}}Le.__b=function(e){De=null,Re&&Re(e)},Le.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ge&&Ge(e,t)},Le.__r=function(e){Be&&Be(e),je=0;var t=(De=e.__c).__H;t&&(Oe===De?(t.__h=[],De.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(Ye),t.__h.some(et),t.__h=[],je=0)),Oe=De},Le.diffed=function(e){Ve&&Ve(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==We.push(t)&&Ne===Le.requestAnimationFrame||((Ne=Le.requestAnimationFrame)||Qe)(Xe)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),Oe=De=null},Le.__c=function(e,t){t.some(function(e){try{e.__h.some(Ye),e.__h=e.__h.filter(function(e){return!e.__||et(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],Le.__e(n,e.__v)}}),$e&&$e(e,t)},Le.unmount=function(e){qe&&qe(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{Ye(e)}catch(e){t=e}}),n.__H=void 0,t&&Le.__e(t,n.__v))};var Je="function"==typeof requestAnimationFrame;function Qe(e){var t,n=function(){clearTimeout(o),Je&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Je&&(t=requestAnimationFrame(n))}function Ye(e){var t=De,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),De=t}function et(e){var t=De;e.__c=e.__(),De=t}function tt(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function nt(e,t){return"function"==typeof t?t(e):t}function ot(e,t){for(var n in t)e[n]=t[n];return e}function rt(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 it(e,t){this.props=e,this.context=t}(it.prototype=new _e).isPureReactComponent=!0,it.prototype.shouldComponentUpdate=function(e,t){return rt(this.props,e)||rt(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)};"undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref");var st=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);st(e,t,n,o)};var at=R.unmount;function ct(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=ot({},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 ct(e,t,n)})),e}function _t(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return _t(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 ut(){this.__u=0,this.o=null,this.__b=null}function dt(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function pt(){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),at&&at(e)},(ut.prototype=new _e).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var r=dt(o.__v),i=!1,l=function(){i||o.__z||(i=!0,n.__R=null,r?r(a):a())};n.__R=l;var s=n.__P;n.__P=null;var a=function(){if(! --o.__u){if(o.state.__a){var e=o.state.__a;o.__v.__k[0]=_t(e,e.__c.__P,e.__c.__O)}var t;for(o.setState({__a:o.__b=null});t=o.o.pop();)t.__P=s,t.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(l,l)},ut.prototype.componentWillUnmount=function(){this.o=[]},ut.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]=ct(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&se(ce,null,e.fallback);return r&&(r.__u&=-33),[se(ce,null,t.__a?null:e.children),r]};var ft=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]}};(pt.prototype=new _e).__a=function(e){var t=this,n=dt(t.__v),o=t.l.get(e);return o[0]++,function(r){var i=function(){t.props.revealOrder?(o.push(r),ft(t,e,o)):r()};n?n(i):i()}},pt.prototype.render=function(e){this.i=null,this.l=new Map;var t=be(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},pt.prototype.componentDidUpdate=pt.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){ft(e,n,t)})};var ht="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,mt=/^(?: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]/,vt=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,yt=/[A-Z0-9]/g,bt="undefined"!=typeof document,gt=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 wt=R.event;R.event=function(e){return wt&&(e=wt(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var xt={configurable:!0,get:function(){return this.class}},kt=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 l=t[i];if(!("value"===i&&"defaultValue"in t&&null==l||bt&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var s=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===l?l="":"translate"===s&&"no"===l?l=!1:"o"===s[0]&&"n"===s[1]?"ondoubleclick"===s?i="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||gt(t.type)?"onfocus"===s?i="onfocusin":"onblur"===s?i="onfocusout":vt.test(i)&&(i=s):s=i="oninput":r&&mt.test(i)?i=i.replace(yt,"-$&").toLowerCase():null===l&&(l=void 0),"oninput"===s&&o[i=s]&&(i="oninputCapture"),o[i]=l}}"select"==n&&(o.multiple&&Array.isArray(o.value)&&(o.value=be(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),null!=o.defaultValue&&(o.value=be(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",xt)):t.className&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=ht,kt&&kt(e)};var St=R.__r;R.__r=function(e){St&&St(e),e.__c};var Mt=R.diffed;R.diffed=function(e){Mt&&Mt(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)};const Pt="(prefers-color-scheme: dark)";function Ct(e,t){const[n,o]=Ke(()=>"auto"===e&&t&&"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia(Pt).matches);return function(e,t){var n=Ze(je++,3);!Le.__s&&tt(n.__H,t)&&(n.__=e,n.u=t,De.__H.__h.push(n))}(()=>{if("auto"!==e||!t||"undefined"==typeof window||"function"!=typeof window.matchMedia)return;const n=window.matchMedia(Pt),r=e=>o(e.matches);return o(n.matches),n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[e,t]),"auto"!==e?e:n?"dark":"light"}const It={bell:"M6 10a6 6 0 0 1 12 0c0 4 1.5 5.5 2 6H4c.5-.5 2-2 2-6M10 20a2 2 0 0 0 4 0",gift:"M3 11h18v9a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1zM2.5 7h19v4h-19zM12 7v14M12 7c-1 0-3-.2-3.5-1a2 2 0 0 1 3.5-1 2 2 0 0 1 3.5 1c-.5.8-2.5 1-3.5 1z",cart:"M2 4h2.2l2.4 11.2A2 2 0 0 0 8.6 17H19M6 7h15l-2.2 7.5H8M10.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M19.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0",chart:"M3 21h18M7 21V11M12 21V6M17 21v-8",lock:"M5 11h14v10H5zM8 11V8a4 4 0 0 1 8 0v3",calendar:"M4 6h16v15H4zM4 10h16M9 3v4M15 3v4",check:"M4 13l5 5L20 6",star:"M12 3l2.9 5.9 6.5.9-4.7 4.6 1.1 6.5-5.8-3.1-5.8 3.1 1.1-6.5L2.6 9.8l6.5-.9z",clock:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0M12 7v5l4 2",tag:"M20.6 13.4l-7.2 7.2a2 2 0 0 1-2.8 0l-7-7A2 2 0 0 1 3 12.2V5a2 2 0 0 1 2-2h7.2a2 2 0 0 1 1.4.6l7 7a2 2 0 0 1 0 2.8zM9 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0",mail:"M3 6h18v12H3zM3 7l9 6 9-6",phone:"M7 2h10a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1M10 19h4",download:"M12 3v12M7 11l5 5 5-5M4 20h16",play:"M8 5l12 7-12 7z",shield:"M12 3l8 3v6c0 5-3.4 8.6-8 10-4.6-1.4-8-5-8-10V6z",sparkle:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM18 15l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1L15 18l2.1-.9z",percent:"M19 5L5 19M8.5 8.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0M20.5 15.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0",truck:"M2 7h12v10H2zM14 10h4l3 3v4h-7M8.5 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M20 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0",ticket:"M4 7h16v4a2 2 0 0 0 0 4v3H4v-3a2 2 0 0 0 0-4zM14 7v12",user:"M20 21a8 8 0 0 0-16 0M16 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0"},At=(Object.keys(It),"0 12px 32px rgba(16, 24, 40, 0.18)");function Ft(e,t){const[n,o]=e.split("-");return{[n]:t,[o]:t}}function zt(e,t){return t?(e?"pw-subw-drop":"pw-subw-rise")+" 0.3s ease-out backwards":void 0}function Ht(e,t,n){const{layout:o,position:r}=e.prompt,i={position:t,zIndex:e.zIndex,boxSizing:"border-box",pointerEvents:"auto"};if("bar"===o)return{...i,left:0,right:0,[r]:0,animation:zt("top"===r,n)};if("modal"===o)return{...i,top:"50%",left:"50%",width:"min(420px, calc(100% - 32px))",transform:"translate(-50%, -50%)",animation:n?"pw-subw-fade 0.25s ease-out backwards":void 0};const l="min(360px, calc(100% - 32px))",s=zt(r.startsWith("top"),n);return"top"===r||"bottom"===r?{...i,[r]:16,left:"50%",width:l,transform:"translateX(-50%)",animation:s}:{...i,...Ft(r,16),width:l,animation:s}}function Tt({label:e,primary:t,colors:n,disabled:o,onClick:r}){return Ee("button",{type:"button",disabled:o,onClick:r,style:{...s(t?"primary":"secondary",n),display:"inline-block",width:"auto",padding:"8px 18px",whiteSpace:"nowrap",opacity:o?.6:1,cursor:o?"default":"pointer"},children:e})}function Et({config:e,variant:t,colors:n,busy:o,onAccept:r,onDecline:i}){const{prompt:l,texts:s}=e,a="bar"===l.layout,c="blocked"===t;return Ee("div",{role:"dialog","aria-label":c?s.blockedTitle:s.title,style:{display:"flex",flexDirection:a?"row":"column",alignItems:a?"center":"stretch",flexWrap:a?"wrap":"nowrap",gap:16,padding:a?"12px 20px":20,boxSizing:"border-box",width:"100%",borderRadius:a?0:l.borderRadius,boxShadow:At,backgroundColor:n.background,color:n.text,fontFamily:e.fontFamily,colorScheme:n.scheme},children:[Ee("div",{style:{display:"flex",alignItems:"flex-start",gap:12,flex:a?"1 1 240px":void 0},children:[l.iconUrl&&Ee("img",{src:l.iconUrl,alt:"",width:48,height:48,style:{flex:"none",borderRadius:8,objectFit:"cover"}}),Ee("div",{style:{display:"flex",flexDirection:"column",gap:4,minWidth:0},children:[Ee("div",{style:{fontSize:16,fontWeight:600,lineHeight:1.4},children:c?s.blockedTitle:s.title}),Ee("div",{style:{fontSize:14,lineHeight:1.5,color:n.textSecondary},children:c?s.blockedMessage:s.message})]})]}),Ee("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,flex:"none"},children:c?Ee(Tt,{label:s.closeText,primary:!0,colors:n,onClick:i}):Ee(ce,{children:[Ee(Tt,{label:s.declineText,primary:!1,colors:n,onClick:i}),Ee(Tt,{label:s.acceptText,primary:!0,colors:n,disabled:o,onClick:r})]})})]})}function jt({config:e,blocked:t,colors:n,onClick:o}){const{size:r}=e.launcher,i=t?e.texts.launcherBlockedLabel:e.texts.launcherLabel,l=Math.round(r/2);return Ee("button",{type:"button","aria-label":i,title:i,onClick:o,style:{display:"flex",alignItems:"center",justifyContent:"center",width:r,height:r,padding:0,border:"none",borderRadius:"50%",backgroundColor:n.accent,color:n.onAccent,boxShadow:At,cursor:"pointer",opacity:t?.7:1},children:Ee("svg",{width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[Ee("path",{d:It.bell}),t&&Ee("path",{d:"M4 4l16 16"})]})})}function Dt({config:e,permission:t,open:n,mode:o="live",colorScheme:r="auto",busy:i,onAccept:l,onDecline:s,onLauncherClick:a}){const c=C(e,Ct(r,M(e))),_="live"===o,u=_?"fixed":"absolute",d=!n&&W(e,t);return e.enable&&(n||d)?Ee(ce,{children:[_&&Ee("style",{children:"\n@keyframes pw-subw-fade { from { opacity: 0; } }\n@keyframes pw-subw-drop { from { opacity: 0; translate: 0 -16px; } }\n@keyframes pw-subw-rise { from { opacity: 0; translate: 0 16px; } }\n"}),d&&Ee("div",{style:{position:u,zIndex:e.zIndex,pointerEvents:"auto",...Ft(e.launcher.position,e.launcher.offset)},children:Ee(jt,{config:e,blocked:"denied"===t,colors:c,onClick:a})}),n&&e.prompt.overlay&&Ee("div",{style:{position:u,inset:0,zIndex:e.zIndex,backgroundColor:"rgba(16, 24, 40, 0.5)",animation:_?"pw-subw-fade 0.2s ease-out backwards":void 0,pointerEvents:"auto"},onClick:s}),n&&Ee("div",{style:Ht(e,u,_),children:Ee(Et,{config:e,variant:U(t),colors:c,busy:i,onAccept:l,onDecline:s})})]}):null}const Ot="keyValue",Nt="messages",Ut="inboxMessages";function Wt(e,t){return function(n){n.objectStoreNames.contains(e)||t(n)}}const Lt=[Wt(Ot,function(e){e.createObjectStore(Ot,{keyPath:"key"})}),Wt("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})}),Wt(Nt,function(e){e.createObjectStore(Nt,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),Wt(Ut,function(e){const t="status",n=e.createObjectStore(Ut,{keyPath:"inbox_id",autoIncrement:!1});n.createIndex(t,t,{unique:!1,multiEntry:!0}),n.createIndex("rt","rt",{unique:!1,multiEntry:!0})})];class Rt{get all(){return Lt}}class Bt{constructor(e,t=new Rt){this.db=e,this.migrationsBuilder=t}applyMigrations(){this.applyMigrationsPack(this.migrationsBuilder.all)}applyMigrationsPack(e){e.forEach(e=>{e(this.db)})}}function Vt(e,t){console.info("onversionchange",t),e.close()}let $t;function qt(e){return($t||($t=new Promise((e,t)=>{const n=indexedDB.open("PUSHWOOSH_SDK_STORE",7);n.onsuccess=n=>{const o=n.target.result;o.onversionchange=Vt.bind(null,o,t),e(o)},n.onerror=()=>t(n.error),n.onupgradeneeded=e=>{const n=e.target.result;n.onversionchange=Vt.bind(null,n,t),new Bt(n).applyMigrations()}})),$t).then(t=>new Promise((n,o)=>e(t,n,o)))}class Gt{_add(e){return qt((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 qt((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 qt((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)}})}}Zt=Ot;var Zt;const Kt=new class extends Gt{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)}},Xt=(new class extends Gt{constructor(){super(...arguments),this.name=Nt,this.maxItems=25}add(e){return this._add({...e,date:new Date})}},{error:1,info:2,debug:3});let Jt=3;const Qt={setLevel(e){Xt[e]||(e="error"),Jt=Xt[e]},write(e,t,n){return"error"===e?this.error(t):this.info(t),Kt.add(e,t,n)}};Object.keys(Xt).forEach(e=>{const t=Xt[e];Qt[e]=(...n)=>{t<=Jt&&(console.groupCollapsed(e),console.info("",...n),console.trace("trace"),console.groupEnd())}});class Yt{constructor(e){this.permission="unsupported",this.open=!1,this.busy=!1,this.container=null,this.autoShowTimer=null,this.pw=e,this.config=O(e.initParams.subscriptionWidget),this.accept=this.accept.bind(this),this.decline=this.decline.bind(this),this.toggle=this.toggle.bind(this),e.moduleRegistry.subscriptionWidget=this}async run(){const{pw:e,config:t}=this;t.enable&&e.isPushAvailable()&&(this.permission=await this.readPermission(),this.mount(),this.listenSubscriptionChanges(),await this.scheduleAutoShow())}show(){this.container&&N(this.permission)&&!this.open&&(this.open=!0,this.render(),this.pw.dispatchEvent("show-subscription-widget",{}))}hide(){this.open&&(this.open=!1,this.busy=!1,this.render(),this.pw.dispatchEvent("hide-subscription-widget",{}))}toggle(e){e??!this.open?this.show():this.hide()}isVisible(){return this.open}async readPermission(){const e=this.pw.driver?.getPermission();return"denied"===e?"denied":await this.pw.isSubscribed()?"granted":"default"}mount(){const e=document.createElement("div");e.id="pushwoosh-subscription-widget",e.style.position="fixed",e.style.inset="0",e.style.zIndex=String(this.config.zIndex),e.style.pointerEvents="none",document.body.appendChild(e),this.container=document.createElement("div"),e.attachShadow({mode:"open"}).appendChild(this.container),this.render()}render(){this.container&&(this.open||W(this.config,this.permission)?((e,t)=>{He(Ee(Dt,{...t,mode:"live"}),e)})(this.container,{config:this.config,permission:this.permission,open:this.open,busy:this.busy,onAccept:this.accept,onDecline:this.decline,onLauncherClick:this.toggle}):He(null,this.container))}async scheduleAutoShow(){const e=await this.pw.data.getSubscriptionWidgetHistory();(function(e,t,n,o){const{trigger:r,cappingCount:i,cappingInterval:l}=e.display;return!(!e.enable||"auto"!==r||"default"!==t||i>0&&n.shownCount>=i||!(null===n.lastShownAt||o-n.lastShownAt>=36e5*l))})(this.config,this.permission,e,Date.now())&&(this.autoShowTimer=setTimeout(async()=>{this.autoShowTimer=null,this.open||"default"!==this.permission||(this.show(),await this.pw.data.setSubscriptionWidgetHistory(function(e,t){return{shownCount:e.shownCount+1,lastShownAt:t}}(e,Date.now())))},1e3*this.config.display.delay))}async accept(){this.busy=!0,this.render();try{await this.pw.subscribe()}catch(e){Qt.error(e,"Pushwoosh subscription widget: failed to subscribe")}if(this.permission=await this.readPermission(),"denied"===this.permission)return this.busy=!1,void this.render();this.hide()}decline(){this.hide()}listenSubscriptionChanges(){const e=async()=>{this.permission=await this.readPermission(),"granted"===this.permission&&(this.cancelAutoShow(),this.hide()),this.render()};this.pw.addEventHandler("subscribe",e),this.pw.addEventHandler("unsubscribe",e),this.pw.addEventHandler("permission-denied",e)}cancelAutoShow(){null!==this.autoShowTimer&&(clearTimeout(this.autoShowTimer),this.autoShowTimer=null)}}return t})());
2
2
  //# sourceMappingURL=widget-subscription.js.map