@prodantix/sdk 0.8.0-beta.651 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,51 +1,20 @@
1
- (function(){'use strict';var ft=Object.defineProperty;var yt=(t,e,n)=>e in t?ft(t,e,{enumerable:true,configurable:true,writable:true,value:n}):t[e]=n;var A=(t,e,n)=>yt(t,typeof e!="symbol"?e+"":e,n);var O=class extends Error{constructor(n,r,o){super(r,o);A(this,"code");this.code=n,this.name="ProdantixError";}};var M=class extends O{constructor(n,r,o){super("transport",n,o);A(this,"status");this.status=r,this.name="TransportError";}};function G(t){let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}var B=class{constructor(){A(this,"store",new Map);}getItem(e){var n;return (n=this.store.get(e))!=null?n:null}removeItem(e){this.store.delete(e);}setItem(e,n){this.store.set(e,n);}};function H(){try{let t=globalThis.localStorage;if(t){let e="__pdx_probe__";return t.setItem(e,"1"),t.removeItem(e),t}}catch(t){return new B}return new B}function bt(){return globalThis.crypto}function vt(t){t[6]=t[6]&15|64,t[8]=t[8]&63|128;let e=[];for(let n=0;n<16;n+=1)e.push(t[n].toString(16).padStart(2,"0"));return `${e[0]}${e[1]}${e[2]}${e[3]}-${e[4]}${e[5]}-${e[6]}${e[7]}-${e[8]}${e[9]}-${e[10]}${e[11]}${e[12]}${e[13]}${e[14]}${e[15]}`}function kt(){let t=bt();if(t!=null&&t.randomUUID)return t.randomUUID();let e=new Uint8Array(16);if(t!=null&&t.getRandomValues)t.getRandomValues(e);else for(let n=0;n<16;n+=1)e[n]=Math.floor(Math.random()*256);return vt(e)}var q={uuid:kt};function Y(t){return t.slice(0,16)}function j(t,e){return `pdx.${t}.${e}`}var X="consent",St=["identityLink","analytics","marketing","functional"];function K(t){if(typeof t!="string")return null;try{let e=JSON.parse(t);if(e===null||typeof e!="object"||Array.isArray(e))return null;let n=e,r={};for(let o of St){let i=n[o];typeof i=="boolean"&&(r[o]=i);}return typeof n.version=="number"&&Number.isInteger(n.version)&&(r.version=n.version),Array.isArray(n.categories)&&n.categories.every(o=>typeof o=="string")&&(r.categories=n.categories),Object.keys(r).length===0?null:r}catch(e){return null}}var U=t=>j(t,"anonymous_id");function z(t,e){return K(t.getItem(j(e,X)))}function Q(t,e,n){var s;let r=j(e,X),o=K(JSON.stringify(n)),i=o===null?null:K(JSON.stringify({...(s=z(t,e))!=null?s:{},...o}));if(i===null){t.removeItem(r);return}t.setItem(r,JSON.stringify(i));}var E=["analytics","marketing","functional"],Z="prodantix:consent-ready",tt="prodantix:consent",et="__prodantixConsent",nt=(t,e)=>{var r;if(t===null||t.version===void 0)return true;let n=(r=t.categories)!=null?r:[];return e.categories.some(o=>!n.includes(o))},ot=(t,e)=>({analytics:t.categories.includes("analytics")&&e.has("analytics"),categories:[...t.categories],functional:t.categories.includes("functional")&&e.has("functional"),marketing:t.categories.includes("marketing")&&e.has("marketing"),version:t.version}),J=t=>new Set(E.filter(e=>(t==null?void 0:t[e])===true));var rt="prodantix-consent-style",wt=`
2
- .pdx-consent,.pdx-consent-dialog{color-scheme:light dark;--pdx-text:light-dark(oklch(0% 0 0/.93),oklch(100% 0 0));--pdx-text-2:light-dark(color-mix(in oklab,var(--pdx-text) 85%,transparent),color-mix(in oklab,var(--pdx-text) 70%,transparent));--pdx-surface:light-dark(oklch(97% .0029 264.54),oklch(26.5% .0157 256.82));--pdx-divider:light-dark(color-mix(in oklab,var(--pdx-text) 17.2%,transparent),color-mix(in oklab,var(--pdx-text) 12%,transparent));--pdx-hover:light-dark(color-mix(in oklab,var(--pdx-text) 4.6%,transparent),color-mix(in oklab,var(--pdx-text) 8%,transparent));--pdx-success:light-dark(oklch(52.4% .1274 163.23),oklch(69.51% .1809 145.62));box-sizing:border-box;font:14px/1.5 Geist,-apple-system,BlinkMacSystemFont,'Segoe UI',Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;color:var(--pdx-text)}
3
- .pdx-consent *,.pdx-consent-dialog *{box-sizing:border-box}
4
- .pdx-consent{position:fixed;z-index:2147483000;background:var(--pdx-surface);border:1px solid var(--pdx-divider)}
5
- .pdx-consent[data-layout="box"]{bottom:24px;left:24px;width:min(420px,calc(100vw - 32px));padding:20px;border-radius:12px;box-shadow:0 16px 40px rgba(0,0,0,.2)}
6
- .pdx-consent[data-layout^="bar"]{left:0;right:0;display:flex;flex-wrap:wrap;gap:12px 24px;align-items:center;justify-content:space-between;padding:20px 24px;border-width:1px 0;box-shadow:0 8px 24px rgba(0,0,0,.16)}
1
+ (function(){'use strict';var gt=Object.defineProperty;var mt=(t,e,n)=>e in t?gt(t,e,{enumerable:true,configurable:true,writable:true,value:n}):t[e]=n;var b=(t,e,n)=>mt(t,typeof e!="symbol"?e+"":e,n);var L=class extends Error{constructor(n,r,o){super(r,o);b(this,"code");this.code=n,this.name="ProdantixError";}};var C=class extends L{constructor(n,r,o){super("transport",n,o);b(this,"status");this.status=r,this.name="TransportError";}};function U(t){let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}var E=class{constructor(){b(this,"store",new Map);}getItem(e){var n;return (n=this.store.get(e))!=null?n:null}removeItem(e){this.store.delete(e);}setItem(e,n){this.store.set(e,n);}};function M(){try{let t=globalThis.localStorage;if(t){let e="__pdx_probe__";return t.setItem(e,"1"),t.removeItem(e),t}}catch(t){return new E}return new E}function yt(){return globalThis.crypto}function ht(t){t[6]=t[6]&15|64,t[8]=t[8]&63|128;let e=[];for(let n=0;n<16;n+=1)e.push(t[n].toString(16).padStart(2,"0"));return `${e[0]}${e[1]}${e[2]}${e[3]}-${e[4]}${e[5]}-${e[6]}${e[7]}-${e[8]}${e[9]}-${e[10]}${e[11]}${e[12]}${e[13]}${e[14]}${e[15]}`}function ft(){let t=yt();if(t!=null&&t.randomUUID)return t.randomUUID();let e=new Uint8Array(16);if(t!=null&&t.getRandomValues)t.getRandomValues(e);else for(let n=0;n<16;n+=1)e[n]=Math.floor(Math.random()*256);return ht(e)}var J={uuid:ft};function V(t){return t.slice(0,16)}function F(t,e){return `pdx.${t}.${e}`}var z="consent",xt=["identityLink","analytics","marketing","functional"];function N(t){if(typeof t!="string")return null;try{let e=JSON.parse(t);if(e===null||typeof e!="object"||Array.isArray(e))return null;let n=e,r={};for(let o of xt){let i=n[o];typeof i=="boolean"&&(r[o]=i);}return typeof n.version=="number"&&Number.isInteger(n.version)&&(r.version=n.version),Array.isArray(n.categories)&&n.categories.every(o=>typeof o=="string")&&(r.categories=n.categories),Object.keys(r).length===0?null:r}catch(e){return null}}var P=t=>F(t,"anonymous_id");function R(t,e){return N(t.getItem(F(e,z)))}function W(t,e,n){var s;let r=F(e,z),o=N(JSON.stringify(n)),i=o===null?null:N(JSON.stringify({...(s=R(t,e))!=null?s:{},...o}));if(i===null){t.removeItem(r);return}t.setItem(r,JSON.stringify(i));}var k=["analytics","marketing","functional"],G="prodantix:consent-ready",q="prodantix:consent",Y="__prodantixConsent",X=(t,e)=>{var r;if(t===null||t.version===void 0)return true;let n=(r=t.categories)!=null?r:[];return e.categories.some(o=>!n.includes(o))},Q=(t,e)=>({analytics:t.categories.includes("analytics")&&e.has("analytics"),categories:[...t.categories],functional:t.categories.includes("functional")&&e.has("functional"),marketing:t.categories.includes("marketing")&&e.has("marketing"),version:t.version}),B=t=>new Set(k.filter(e=>(t==null?void 0:t[e])===true));var Z="prodantix-consent-style",bt=`
2
+ .pdx-consent{position:fixed;z-index:2147483000;left:0;right:0;box-sizing:border-box;padding:16px;font:14px/1.5 system-ui,sans-serif;color:var(--pdx-consent-text);background:var(--pdx-consent-background);box-shadow:0 -2px 12px rgba(0,0,0,.15)}
7
3
  .pdx-consent[data-layout="bar_bottom"]{bottom:0}
8
4
  .pdx-consent[data-layout="bar_top"]{top:0}
9
- .pdx-consent-title{margin:0 0 4px;font-size:16px;font-weight:600}
10
- .pdx-consent-body,.pdx-consent-intro{margin:0;max-width:62ch;color:var(--pdx-text-2)}
11
- .pdx-consent[data-layout="box"] .pdx-consent-body{margin-bottom:16px}
12
- .pdx-consent a{color:var(--pdx-text);text-decoration:underline;text-underline-offset:2px}
5
+ .pdx-consent[data-layout="box"]{left:16px;right:auto;bottom:16px;max-width:360px;border-radius:var(--pdx-consent-radius)}
6
+ .pdx-consent h2{margin:0 0 4px;font-size:16px}
7
+ .pdx-consent p{margin:0 0 12px}
13
8
  .pdx-consent-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
14
- .pdx-consent-button{min-height:44px;padding:0 16px;font:inherit;font-weight:600;border:1px solid transparent;border-radius:8px;cursor:pointer}
15
- .pdx-consent-button[data-variant="contained"]{color:#fff;background:var(--pdx-accent);border-color:var(--pdx-accent)}
16
- .pdx-consent-button[data-variant="outlined"]{color:var(--pdx-text);background:transparent;border-color:var(--pdx-divider)}
17
- .pdx-consent-button[data-variant="outlined"]:hover{background:var(--pdx-hover)}
18
- .pdx-consent :focus-visible,.pdx-consent-dialog :focus-visible{outline:2px solid var(--pdx-text);outline-offset:2px}
19
- .pdx-consent-meta{width:100%;margin:12px 0 0;font-size:12px;color:var(--pdx-text-2)}
9
+ .pdx-consent-choice{min-width:120px;min-height:44px;padding:0 16px;font:inherit;font-weight:600;color:var(--pdx-consent-button-text);background:var(--pdx-consent-button);border:0;border-radius:var(--pdx-consent-radius);cursor:pointer}
10
+ .pdx-consent-link{min-height:44px;padding:0 8px;font:inherit;color:inherit;text-decoration:underline;background:none;border:0;cursor:pointer}
11
+ .pdx-consent-choice:focus-visible,.pdx-consent-link:focus-visible,.pdx-consent input:focus-visible{outline:2px solid currentColor;outline-offset:2px}
20
12
  .pdx-consent-dialog{position:fixed;inset:0;z-index:2147483001;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(0,0,0,.4)}
21
- .pdx-consent-panel{display:flex;flex-direction:column;width:100%;max-width:640px;max-height:min(720px,100%);background:var(--pdx-surface);border:1px solid var(--pdx-divider);border-radius:12px;box-shadow:0 16px 40px rgba(0,0,0,.2)}
22
- .pdx-consent-panel h2{margin:0;padding:20px 24px 12px;font-size:16px;font-weight:600}
23
- .pdx-consent-content{overflow:auto;padding:0 24px}
24
- .pdx-consent-intro{margin-bottom:16px}
25
- .pdx-consent-cats{display:flex;flex-direction:column;gap:8px}
26
- .pdx-consent-cat{position:relative;border:1px solid var(--pdx-divider);border-radius:8px}
27
- .pdx-consent-head{display:flex;gap:8px;align-items:center;width:100%;min-height:52px;padding:0 140px 0 16px;font:inherit;font-weight:600;color:inherit;text-align:start;background:none;border:0;cursor:pointer}
28
- .pdx-consent-head::before{content:"";width:6px;height:6px;border:solid currentColor;border-width:0 2px 2px 0;transform:rotate(-45deg)}
29
- .pdx-consent-head[aria-expanded="true"]::before{transform:rotate(45deg)}
30
- .pdx-consent-count{font-weight:400;font-size:12px;color:var(--pdx-text-2)}
31
- .pdx-consent-control{position:absolute;top:0;right:16px;display:flex;align-items:center;height:52px}
32
- .pdx-consent-chip{padding:2px 8px;font-size:12px;font-weight:600;color:var(--pdx-success);background:color-mix(in oklab,var(--pdx-success) 12%,transparent);border-radius:9999px}
33
- .pdx-consent-switch{appearance:none;position:relative;width:40px;height:24px;margin:0;background:var(--pdx-divider);border-radius:9999px;cursor:pointer}
34
- .pdx-consent-switch::after{content:"";position:absolute;top:3px;left:3px;width:18px;height:18px;background:#fff;border-radius:50%;box-shadow:0 1px 2px rgba(16,24,40,.2)}
35
- .pdx-consent-switch:checked{background:var(--pdx-accent)}
36
- .pdx-consent-switch:checked::after{transform:translateX(16px)}
37
- .pdx-consent-detail{padding:0 16px 16px}
38
- .pdx-consent-detail p{margin:0 0 12px;font-size:12px;color:var(--pdx-text-2)}
39
- .pdx-consent-table{width:100%;font-size:12px;border-collapse:collapse}
40
- .pdx-consent-table th{padding:8px 12px;font-size:11px;color:var(--pdx-text-2);text-align:start}
41
- .pdx-consent-table th,.pdx-consent-table td{border-bottom:1px solid var(--pdx-divider)}
42
- .pdx-consent-table td{padding:8px 12px;vertical-align:top}
43
- .pdx-consent-table tr:last-child td{border-bottom:0}
44
- .pdx-consent-name{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px}
45
- .pdx-consent-foot{justify-content:flex-end;padding:16px 24px 20px}
46
- @media (max-width:639px){.pdx-consent-dialog{align-items:flex-end;padding:0}.pdx-consent-panel{max-height:85vh;border-radius:12px 12px 0 0}.pdx-consent-foot .pdx-consent-button{flex:1 1 auto}}
47
- @media (prefers-reduced-motion:no-preference){.pdx-consent,.pdx-consent-panel{animation:pdx-consent-in .2s ease-out}.pdx-consent-switch::after{transition:transform .15s ease-out}}
48
- @keyframes pdx-consent-in{from{opacity:0;transform:translateY(8px)}}
49
- `,Ct={alwaysActive:"Always active",analyticsName:"Analytics",cookieColumn:"Cookie",durationColumn:"Duration",functionalName:"Functional",marketingName:"Marketing",necessaryName:"Necessary",preferencesTitle:"Privacy preferences",providerColumn:"Provider",purposeColumn:"Purpose",visitDuration:"Session"},It={days:"day",hours:"hour",minutes:"minute",months:"month",years:"year"},At=t=>{if(t.getElementById(rt))return;let e=t.createElement("style");e.id=rt,e.textContent=wt,t.head.append(e);},Et=(t,e,n)=>{var r;return t.unit==="visit"?n:new Intl.NumberFormat(e,{style:"unit",unit:It[t.unit],unitDisplay:"long"}).format((r=t.amount)!=null?r:0)},a=(t,e,n="",r="")=>{let o=t.createElement(e);return n&&(o.className=n),r&&(o.textContent=r),o},T=(t,e,n,r,o)=>{let i=a(t,"button","pdx-consent-button",e);return i.type="button",i.dataset.variant=n,i.dataset.testid=r,i.addEventListener("click",o),i},st=(t,e,n,r,o)=>{let i=a(t,"p",e,n);if(r.policyUrl.startsWith("https://")){let s=a(t,"a","",o||r.policyUrl);s.href=r.policyUrl,s.rel="noopener",s.target="_blank",s.dataset.testid="prodantix-consent-policy",i.append(" ",s);}return i},it="button,a[href],input:not([disabled])",at=(t,e,n,r)=>{At(t);let o={...e.texts};for(let[l,p]of Object.entries(Ct))o[l]||(o[l]=p);let i=E.filter(l=>e.categories.includes(l)),s=null,m=null,v=null,S=l=>{l.style.setProperty("--pdx-accent",e.style.accent);},x=()=>{m&&(m.remove(),m=null,v==null||v.focus());},u=l=>{x(),s==null||s.remove(),s=null,n.onAnswer(l);},f=(l,p,g,D)=>{var L,$;let C=a(t,"div","pdx-consent-cat");C.dataset.testid=`prodantix-consent-category-${p}`;let h=a(t,"button","pdx-consent-head",o[`${p}Name`]);h.type="button",h.setAttribute("aria-expanded","false"),h.dataset.testid=`prodantix-consent-category-${p}-head`,h.append(" ",a(t,"span","pdx-consent-count",String(g.length)));let k=a(t,"div","pdx-consent-detail");if(k.hidden=true,k.dataset.testid=`prodantix-consent-category-${p}-detail`,o[p]&&k.append(a(t,"p","",o[p])),g.length>0){let y=a(t,"table","pdx-consent-table"),c=a(t,"tr");for(let d of [o.cookieColumn,o.providerColumn,o.purposeColumn,o.durationColumn]){let b=a(t,"th","",d);b.scope="col",c.append(b);}y.append(a(t,"thead"),a(t,"tbody")),(L=y.tHead)==null||L.append(c);for(let d of g){let b=a(t,"tr");b.append(a(t,"td","pdx-consent-name",d.name),a(t,"td","",d.provider),a(t,"td","",d.purpose),a(t,"td","",Et(d.duration,e.language,o.visitDuration))),($=y.tBodies[0])==null||$.append(b);}k.append(y);}h.addEventListener("click",()=>{let y=h.getAttribute("aria-expanded")!=="true";h.setAttribute("aria-expanded",String(y)),k.hidden=!y;});let _=a(t,"span","pdx-consent-control");_.append(D),C.append(h,_,k),l.append(C);},w=l=>{var y;if(m)return;v=t.activeElement instanceof HTMLElement?t.activeElement:null;let p=a(t,"div","pdx-consent-dialog");S(p);let g=a(t,"div","pdx-consent-panel");g.setAttribute("role","dialog"),g.setAttribute("aria-modal","true"),g.setAttribute("aria-labelledby","pdx-consent-preferences-title"),g.dataset.testid="prodantix-consent-settings";let D=a(t,"h2","",o.preferencesTitle);D.id="pdx-consent-preferences-title";let C=a(t,"div","pdx-consent-content");o.preferencesIntro&&C.append(st(t,"pdx-consent-intro",o.preferencesIntro,e,o.policyLabel));let h=a(t,"div","pdx-consent-cats"),k=c=>e.items.filter(d=>d.category===c),_=a(t,"span","pdx-consent-chip",o.alwaysActive);_.dataset.testid="prodantix-consent-always-active",f(h,"necessary",k("necessary"),_);let L=new Map;for(let c of i){let d=a(t,"input","pdx-consent-switch");d.type="checkbox",d.setAttribute("role","switch"),d.checked=l.has(c),d.setAttribute("aria-checked",String(d.checked)),d.setAttribute("aria-label",o[`${c}Name`]),d.dataset.testid=`prodantix-consent-switch-${c}`,d.addEventListener("change",()=>d.setAttribute("aria-checked",String(d.checked))),L.set(c,d),f(h,c,k(c),d);}C.append(h);let $=a(t,"div","pdx-consent-actions pdx-consent-foot");$.append(T(t,o.rejectAll,"outlined","prodantix-consent-settings-reject",()=>u(new Set)),T(t,o.acceptAll,"outlined","prodantix-consent-settings-accept",()=>u(new Set(i))),T(t,o.save,"contained","prodantix-consent-save",()=>u(new Set(i.filter(c=>{var d;return ((d=L.get(c))==null?void 0:d.checked)===true}))))),g.append(D,C,$),p.append(g),p.addEventListener("keydown",c=>{if(c.key==="Escape"){c.preventDefault(),x();return}if(c.key!=="Tab")return;let d=[...g.querySelectorAll(it)],b=d[0],F=d[d.length-1];c.shiftKey&&t.activeElement===b?(c.preventDefault(),F==null||F.focus()):!c.shiftKey&&t.activeElement===F&&(c.preventDefault(),b==null||b.focus());}),t.body.append(p),m=p,(y=g.querySelector(it))==null||y.focus();};if(r){s=a(t,"section","pdx-consent"),s.dataset.layout=e.layout,s.dataset.testid="prodantix-consent-banner",s.setAttribute("aria-label",o.title),S(s);let l=a(t,"div");l.append(a(t,"p","pdx-consent-title",o.title),st(t,"pdx-consent-body",o.body,e,o.policyLabel));let p=a(t,"div","pdx-consent-actions");p.append(T(t,o.acceptAll,"contained","prodantix-consent-accept",()=>u(new Set(i))),T(t,o.rejectAll,"contained","prodantix-consent-reject",()=>u(new Set)),T(t,o.preferences,"outlined","prodantix-consent-open-settings",()=>w(new Set))),s.append(l,p),e.poweredBy&&s.append(a(t,"p","pdx-consent-meta",e.poweredByText)),t.body.append(s);}return {openSettings:w,remove:()=>{x(),s==null||s.remove(),s=null;}}};var Tt='script[type="text/plain"][data-prodantix-consent]',P=(t,e)=>{let n=0;for(let r of Array.from(t.querySelectorAll(Tt))){let o=r.dataset.prodantixConsent;if(o===void 0||!e.has(o))continue;let i=t.createElement("script");for(let s of Array.from(r.attributes))s.name!=="type"&&s.name!=="data-prodantix-consent"&&i.setAttribute(s.name,s.value);i.text=r.text,r.replaceWith(i),n+=1;}return n};var dt=(t,e,n)=>{t.win.dispatchEvent(new CustomEvent(e,{detail:n}));},ct=async t=>{let e=await t.fetch(`${t.edge}/v1/consent?language=${encodeURIComponent(t.language)}`,{headers:{authorization:`Bearer ${t.apiKey}`},method:"GET"});if(!e.ok)throw new M("the consent banner could not be read",e.status);let n=JSON.parse(await e.text()),r=z(t.shared,t.namespace),o=n.banner,i=o!==null&&r!==null&&!nt(r,o)?r:null,s={anonymousId:n.anonymousId,consent:i,rule:n.rule};if(t.win[et]=s,dt(t,Z,s),o===null)return P(t.doc,new Set(E)),{openSettings:()=>{}};P(t.doc,i!==null?J(i):n.rule==="notice"?new Set(E):new Set);let m=x=>{var w,l,p;let u=ot(o,x),f=n.anonymousId;u.analytics===true&&(f=(w=t.shared.getItem(U(t.namespace)))!=null?w:t.ids.uuid(),t.shared.setItem(U(t.namespace),f)),Q(t.shared,t.namespace,u),s.consent=u,dt(t,tt,u),P(t.doc,x),t.fetch(`${t.edge}/v1/consent`,{body:JSON.stringify({analytics:u.analytics===true,distinctId:f,functional:u.functional===true,marketing:u.marketing===true,pageUrl:(p=(l=t.doc.location)==null?void 0:l.href)!=null?p:"",version:o.version}),headers:{authorization:`Bearer ${t.apiKey}`,"content-type":"application/json"},method:"POST"}).then(g=>{g.ok||t.onError(new M("the consent answer could not be kept",g.status));}).catch(t.onError);},v=at(t.doc,o,{onAnswer:m},i===null),S=()=>v.openSettings(J(s.consent));return t.doc.addEventListener("click",x=>{var f,w;(w=(f=x.target)==null?void 0:f.closest)!=null&&w.call(f,"[data-prodantix-consent-settings]")&&(x.preventDefault(),S());}),{openSettings:S}};var _t=/^\d{1,3}(\.\d{1,3}){3}$/,Lt=/^[a-z0-9.-]+$/i;function pt(){return Math.random().toString(36).slice(2,12)}function R(t,e){let n=`${e}=`,r=[];for(let o of t.cookie.split(";")){let i=o.trim();i.startsWith(n)&&r.push(i.slice(n.length));}return r}function N(t,e,n){let r=["Path=/",`Max-Age=${e}`,"SameSite=Lax"];return t&&r.push(`Domain=${t}`),n&&r.push("Secure"),r.join("; ")}function lt(t,e,n,r){try{let o=`pdx_probe_${r()}`,i=r();t.cookie=`${o}=${i}; ${N(e,60,n)}`;let s=R(t,o).includes(i);t.cookie=`${o}=; ${N(e,0,n)}`;let m=R(t,o).includes(i);return s&&!m}catch(o){return false}}function $t(t){let e=t.replace(/^\[|\]$/g,"").toLowerCase();if(e.includes(":")||_t.test(e)||!e.includes("."))return [];let n=e.split("."),r=[];for(let o=n.length-2;o>=0;o-=1)r.push(n.slice(o).join("."));return r}function Mt(t,e,n,r=pt){for(let o of $t(t))if(lt(e,o,n,r))return o}function Nt(t){let e=new Map,n=JSON.parse(decodeURIComponent(t));if(n===null||typeof n!="object"||Array.isArray(n))return e;for(let[r,o]of Object.entries(n))typeof o=="string"&&e.set(r,o);return e}var V=class{constructor(e,n,r,o){this.jar=e;this.name=n;this.domain=r;this.secure=o;}getItem(e){var n;return (n=this.read().get(e))!=null?n:null}setItem(e,n){let r=this.read();r.set(e,n),this.write(r);}removeItem(e){let n=this.read();n.delete(e)&&this.write(n);}read(){try{let e=R(this.jar,this.name);e.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${N(void 0,0,this.secure)}`,e=R(this.jar,this.name));let n=e[0];return n?Nt(n):new Map}catch(e){return new Map}}write(e){try{if(e.size===0){this.jar.cookie=`${this.name}=; ${N(this.domain,0,this.secure)}`;return}let n=encodeURIComponent(JSON.stringify(Object.fromEntries(e)));this.jar.cookie=`${this.name}=${n}; ${N(this.domain,31536e3,this.secure)}`;}catch(n){return}}};function Dt(){return globalThis.document}function Ft(){var t,e;return (e=(t=globalThis.location)==null?void 0:t.hostname)!=null?e:""}function Bt(){var t;return ((t=globalThis.location)==null?void 0:t.protocol)==="https:"}function Pt(t){if(t===void 0)return;let e=t.startsWith(".")?t.slice(1):t;return Lt.test(e)?e.toLowerCase():void 0}function ut(t){var s,m,v,S,x;let e="jar"in t?t.jar:Dt();if(!e||((s=globalThis.navigator)==null?void 0:s.cookieEnabled)===false)return null;let r=(m=t.random)!=null?m:pt,o=(v=t.secure)!=null?v:Bt(),i=(S=t.hostname)!=null?S:Ft();try{let u=(x=Pt(t.domain))!=null?x:Mt(i,e,o,r);return lt(e,u,o,r)?new V(e,t.name,u,o):null}catch(u){return null}}var I=document.currentScript,W=I==null?void 0:I.dataset.key,gt=G(),mt,xt,ht;if(I&&W&&gt){let t=Y(W),e=H();try{e=(mt=ut({name:`pdx_${t}`}))!=null?mt:e;}catch(n){e=H();}ct({apiKey:W,doc:document,edge:(xt=I.dataset.edge)!=null?xt:new URL(I.src,window.location.href).origin,fetch:gt,ids:q,language:(ht=I.dataset.language)!=null?ht:document.documentElement.lang,namespace:t,onError:n=>console.error("[prodantix] the consent answer could not be kept",n),shared:e,win:window}).then(n=>{window.prodantixConsent=n;}).catch(n=>console.error("[prodantix] the consent banner could not be read",n));}
13
+ .pdx-consent-panel{box-sizing:border-box;width:100%;max-width:480px;max-height:100%;overflow:auto;padding:20px;font:14px/1.5 system-ui,sans-serif;color:var(--pdx-consent-text);background:var(--pdx-consent-background);border-radius:var(--pdx-consent-radius)}
14
+ .pdx-consent-panel h2{margin:0 0 12px;font-size:16px}
15
+ .pdx-consent-category{display:flex;gap:12px;align-items:flex-start;padding:8px 0;border-top:1px solid currentColor}
16
+ .pdx-consent-category input{width:20px;height:20px;margin:2px 0 0}
17
+ .pdx-consent-meta{margin:12px 0 0;font-size:12px;opacity:.8}
18
+ `,kt=t=>{if(t.getElementById(Z))return;let e=t.createElement("style");e.id=Z,e.textContent=bt,t.head.append(e);},tt=(t,e)=>{t.style.setProperty("--pdx-consent-background",e.style.background),t.style.setProperty("--pdx-consent-text",e.style.text),t.style.setProperty("--pdx-consent-button",e.style.button),t.style.setProperty("--pdx-consent-button-text",e.style.buttonText),t.style.setProperty("--pdx-consent-radius",`${e.style.radius}px`);},v=(t,e,n,r,o)=>{let i=t.createElement("button");return i.type="button",i.className=n==="choice"?"pdx-consent-choice":"pdx-consent-link",i.textContent=e,i.dataset.testid=r,i.addEventListener("click",o),i},et=(t,e,n,r)=>{kt(t);let o=e.texts,i=k.filter(d=>e.categories.includes(d)),s=null,g=null,y=null,h=()=>{g==null||g.remove(),g=null,y==null||y.focus();},p=d=>{h(),s==null||s.remove(),s=null,n.onAnswer(d);},l=d=>{var j;if(g)return;y=t.activeElement instanceof HTMLElement?t.activeElement:null;let u=t.createElement("div");u.className="pdx-consent-dialog";let a=t.createElement("div");a.className="pdx-consent-panel",a.setAttribute("role","dialog"),a.setAttribute("aria-modal","true"),a.setAttribute("aria-labelledby","pdx-consent-settings-title"),a.dataset.testid="prodantix-consent-settings",tt(a,e);let c=t.createElement("h2");c.id="pdx-consent-settings-title",c.textContent=o.settings,a.append(c);let S=new Map,H=(m,w,pt,ut)=>{let $=t.createElement("label");$.className="pdx-consent-category";let x=t.createElement("input");x.type="checkbox",x.checked=pt,x.disabled=ut,x.dataset.testid=`prodantix-consent-category-${m}`;let K=t.createElement("span");return K.textContent=w,$.append(x,K),a.append($),x};H("necessary",o.necessary,true,true);for(let m of i)S.set(m,H(m,o[m],d.has(m),false));let T=t.createElement("div");T.className="pdx-consent-actions",T.append(v(t,o.save,"choice","prodantix-consent-save",()=>p(new Set(i.filter(m=>{var w;return ((w=S.get(m))==null?void 0:w.checked)===true})))),v(t,o.acceptAll,"choice","prodantix-consent-settings-accept",()=>p(new Set(i))),v(t,o.rejectAll,"choice","prodantix-consent-settings-reject",()=>p(new Set))),a.append(T),u.append(a),u.addEventListener("keydown",m=>{m.key==="Escape"&&h();}),t.body.append(u),g=u,(j=a.querySelector("input:not([disabled])"))==null||j.focus();};if(r){s=t.createElement("section"),s.className="pdx-consent",s.dataset.layout=e.layout,s.dataset.testid="prodantix-consent-banner",s.setAttribute("aria-label",o.title),tt(s,e);let d=t.createElement("h2");d.textContent=o.title;let u=t.createElement("p");u.textContent=o.body,s.append(d,u);let a=t.createElement("div");if(a.className="pdx-consent-actions",a.append(v(t,o.acceptAll,"choice","prodantix-consent-accept",()=>p(new Set(i))),v(t,o.rejectAll,"choice","prodantix-consent-reject",()=>p(new Set)),v(t,o.settings,"link","prodantix-consent-open-settings",()=>l(new Set))),e.policyUrl.startsWith("https://")){let c=t.createElement("a");c.className="pdx-consent-link",c.href=e.policyUrl,c.rel="noopener",c.target="_blank",c.textContent=o.policyLabel||e.policyUrl,a.append(c);}if(s.append(a),e.poweredBy){let c=t.createElement("p");c.className="pdx-consent-meta",c.textContent=e.poweredByText,s.append(c);}t.body.append(s);}return {openSettings:l,remove:()=>{h(),s==null||s.remove(),s=null;}}};var vt='script[type="text/plain"][data-prodantix-consent]',A=(t,e)=>{let n=0;for(let r of Array.from(t.querySelectorAll(vt))){let o=r.dataset.prodantixConsent;if(o===void 0||!e.has(o))continue;let i=t.createElement("script");for(let s of Array.from(r.attributes))s.name!=="type"&&s.name!=="data-prodantix-consent"&&i.setAttribute(s.name,s.value);i.text=r.text,r.replaceWith(i),n+=1;}return n};var nt=(t,e,n)=>{t.win.dispatchEvent(new CustomEvent(e,{detail:n}));},ot=async t=>{let e=await t.fetch(`${t.edge}/v1/consent?language=${encodeURIComponent(t.language)}`,{headers:{authorization:`Bearer ${t.apiKey}`},method:"GET"});if(!e.ok)throw new C("the consent banner could not be read",e.status);let n=JSON.parse(await e.text()),r=R(t.shared,t.namespace),o=n.banner,i=o!==null&&r!==null&&!X(r,o)?r:null,s={anonymousId:n.anonymousId,consent:i,rule:n.rule};if(t.win[Y]=s,nt(t,G,s),o===null)return A(t.doc,new Set(k)),{openSettings:()=>{}};A(t.doc,i!==null?B(i):n.rule==="notice"?new Set(k):new Set);let g=p=>{var u,a,c;let l=Q(o,p),d=n.anonymousId;l.analytics===true&&(d=(u=t.shared.getItem(P(t.namespace)))!=null?u:t.ids.uuid(),t.shared.setItem(P(t.namespace),d)),W(t.shared,t.namespace,l),s.consent=l,nt(t,q,l),A(t.doc,p),t.fetch(`${t.edge}/v1/consent`,{body:JSON.stringify({analytics:l.analytics===true,distinctId:d,functional:l.functional===true,marketing:l.marketing===true,pageUrl:(c=(a=t.doc.location)==null?void 0:a.href)!=null?c:"",version:o.version}),headers:{authorization:`Bearer ${t.apiKey}`,"content-type":"application/json"},method:"POST"}).then(S=>{S.ok||t.onError(new C("the consent answer could not be kept",S.status));}).catch(t.onError);},y=et(t.doc,o,{onAnswer:g},i===null),h=()=>y.openSettings(B(s.consent));return t.doc.addEventListener("click",p=>{var d,u;(u=(d=p.target)==null?void 0:d.closest)!=null&&u.call(d,"[data-prodantix-consent-settings]")&&(p.preventDefault(),h());}),{openSettings:h}};var St=/^\d{1,3}(\.\d{1,3}){3}$/,Ct=/^[a-z0-9.-]+$/i;function rt(){return Math.random().toString(36).slice(2,12)}function _(t,e){let n=`${e}=`,r=[];for(let o of t.cookie.split(";")){let i=o.trim();i.startsWith(n)&&r.push(i.slice(n.length));}return r}function I(t,e,n){let r=["Path=/",`Max-Age=${e}`,"SameSite=Lax"];return t&&r.push(`Domain=${t}`),n&&r.push("Secure"),r.join("; ")}function st(t,e,n,r){try{let o=`pdx_probe_${r()}`,i=r();t.cookie=`${o}=${i}; ${I(e,60,n)}`;let s=_(t,o).includes(i);t.cookie=`${o}=; ${I(e,0,n)}`;let g=_(t,o).includes(i);return s&&!g}catch(o){return false}}function It(t){let e=t.replace(/^\[|\]$/g,"").toLowerCase();if(e.includes(":")||St.test(e)||!e.includes("."))return [];let n=e.split("."),r=[];for(let o=n.length-2;o>=0;o-=1)r.push(n.slice(o).join("."));return r}function wt(t,e,n,r=rt){for(let o of It(t))if(st(e,o,n,r))return o}function Et(t){let e=new Map,n=JSON.parse(decodeURIComponent(t));if(n===null||typeof n!="object"||Array.isArray(n))return e;for(let[r,o]of Object.entries(n))typeof o=="string"&&e.set(r,o);return e}var D=class{constructor(e,n,r,o){this.jar=e;this.name=n;this.domain=r;this.secure=o;}getItem(e){var n;return (n=this.read().get(e))!=null?n:null}setItem(e,n){let r=this.read();r.set(e,n),this.write(r);}removeItem(e){let n=this.read();n.delete(e)&&this.write(n);}read(){try{let e=_(this.jar,this.name);e.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${I(void 0,0,this.secure)}`,e=_(this.jar,this.name));let n=e[0];return n?Et(n):new Map}catch(e){return new Map}}write(e){try{if(e.size===0){this.jar.cookie=`${this.name}=; ${I(this.domain,0,this.secure)}`;return}let n=encodeURIComponent(JSON.stringify(Object.fromEntries(e)));this.jar.cookie=`${this.name}=${n}; ${I(this.domain,31536e3,this.secure)}`;}catch(n){return}}};function At(){return globalThis.document}function _t(){var t,e;return (e=(t=globalThis.location)==null?void 0:t.hostname)!=null?e:""}function Tt(){var t;return ((t=globalThis.location)==null?void 0:t.protocol)==="https:"}function $t(t){if(t===void 0)return;let e=t.startsWith(".")?t.slice(1):t;return Ct.test(e)?e.toLowerCase():void 0}function it(t){var s,g,y,h,p;let e="jar"in t?t.jar:At();if(!e||((s=globalThis.navigator)==null?void 0:s.cookieEnabled)===false)return null;let r=(g=t.random)!=null?g:rt,o=(y=t.secure)!=null?y:Tt(),i=(h=t.hostname)!=null?h:_t();try{let l=(p=$t(t.domain))!=null?p:wt(i,e,o,r);return st(e,l,o,r)?new D(e,t.name,l,o):null}catch(l){return null}}var f=document.currentScript,O=f==null?void 0:f.dataset.key,at=U(),dt,ct,lt;if(f&&O&&at){let t=V(O),e=M();try{e=(dt=it({name:`pdx_${t}`}))!=null?dt:e;}catch(n){e=M();}ot({apiKey:O,doc:document,edge:(ct=f.dataset.edge)!=null?ct:new URL(f.src,window.location.href).origin,fetch:at,ids:J,language:(lt=f.dataset.language)!=null?lt:document.documentElement.lang,namespace:t,onError:n=>console.error("[prodantix] the consent answer could not be kept",n),shared:e,win:window}).then(n=>{window.prodantixConsent=n;}).catch(n=>console.error("[prodantix] the consent banner could not be read",n));}
50
19
  })();//# sourceMappingURL=consent.iife.js.map
51
20
  //# sourceMappingURL=consent.iife.js.map
@@ -1,4 +1,4 @@
1
- (function(){'use strict';var Bt=Object.defineProperty;var jt=(n,e,t)=>e in n?Bt(n,e,{enumerable:true,configurable:true,writable:true,value:t}):n[e]=t;var d=(n,e,t)=>jt(n,typeof e!="symbol"?e+"":e,t);var M=class extends Error{constructor(t,r,i){super(r,i);d(this,"code");this.code=t,this.name="ProdantixError";}},V=class extends M{constructor(e){super("config",e),this.name="ConfigError";}},D=class extends M{constructor(t,r){super("validation",r);d(this,"field");this.field=t,this.name="ValidationError";}},m=class extends M{constructor(t,r,i){super("transport",t,i);d(this,"status");this.status=r,this.name="TransportError";}};function E(n){if(n)return n;let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}function S(){let n=globalThis.AbortController;return n?new n:void 0}var Be=n=>new Promise(e=>{setTimeout(e,n);});function C(n){return n.replace(/\/+$/,"")}var N=class{constructor(){d(this,"store",new Map);}getItem(e){var t;return (t=this.store.get(e))!=null?t:null}removeItem(e){this.store.delete(e);}setItem(e,t){this.store.set(e,t);}},H=class{constructor(e,t=()=>false){this.real=e;this.passes=t;d(this,"held",new N);d(this,"opened",false);}get isOpen(){return this.opened}open(){this.opened=true;}close(){this.opened=false;}target(e){return this.opened||this.passes(e)?this.real:this.held}getItem(e){return this.target(e).getItem(e)}removeItem(e){this.target(e).removeItem(e);}setItem(e,t){this.target(e).setItem(e,t);}};function je(){try{let n=globalThis.localStorage;if(n){let e="__pdx_probe__";return n.setItem(e,"1"),n.removeItem(e),n}}catch(n){return new N}return new N}var Ge={now:()=>new Date};function Y(n){return n.toISOString()}function Ve(){if(typeof window=="undefined"||typeof Intl=="undefined")return null;let n=Intl.DateTimeFormat().resolvedOptions().timeZone;return typeof n=="string"&&n!==""?n:null}function Gt(){return globalThis.crypto}function Vt(n){n[6]=n[6]&15|64,n[8]=n[8]&63|128;let e=[];for(let t=0;t<16;t+=1)e.push(n[t].toString(16).padStart(2,"0"));return `${e[0]}${e[1]}${e[2]}${e[3]}-${e[4]}${e[5]}-${e[6]}${e[7]}-${e[8]}${e[9]}-${e[10]}${e[11]}${e[12]}${e[13]}${e[14]}${e[15]}`}function Ht(){let n=Gt();if(n!=null&&n.randomUUID)return n.randomUUID();let e=new Uint8Array(16);if(n!=null&&n.getRandomValues)n.getRandomValues(e);else for(let t=0;t<16;t+=1)e[t]=Math.floor(Math.random()*256);return Vt(e)}var He={uuid:Ht};var Ut=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var Jt=/^(?:\$|[a-z])[a-z0-9_.]*$/;function Ue(n){let e=0;for(let t of n)e+=1;return e}function Je(n){return Ut.test(n)}function zt(n){return Jt.test(n)}function ze(n){let e=Ue(n);if(e<1||e>200)throw new D("distinct_id","distinct_id must be between 1 and 200 characters")}function We(n){let e=Ue(n);if(e<1||e>200)throw new D("event_name","event_name must be between 1 and 200 characters");if(!zt(n))throw new D("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var Ye="prodantix-js",Qe="0.8.0";var Wt=n=>{};function Xe(n){var i,o,s,a,l,g,v,c,$,L,f,_,T,z,A;if(!n.apiKey||!Je(n.apiKey))throw new V("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!n.host)throw new V("host is required (the ingest base URL)");let e=C(n.host),t=n.defaultProperties,r=(i=n.storage)!=null?i:new N;return {apiKey:n.apiKey,autocapture:(o=n.autocapture)!=null?o:false,clock:(s=n.clock)!=null?s:Ge,consent:n.consent,consentMode:n.consentMode,defaultProperties:typeof t=="function"?t:()=>t!=null?t:{},describeElement:n.describeElement,flagsHost:n.flagsHost?C(n.flagsHost):e,flushAt:(a=n.flushAt)!=null?a:20,flushIntervalMs:(l=n.flushIntervalMs)!=null?l:1e4,host:e,ids:(g=n.ids)!=null?g:He,locale:n.locale,maxQueueSize:(v=n.maxQueueSize)!=null?v:1e3,maxRetries:(c=n.maxRetries)!=null?c:3,namespace:be(n.apiKey),onError:($=n.onError)!=null?$:Wt,os:n.os,requestTimeoutMs:(L=n.requestTimeoutMs)!=null?L:1e4,sdkName:(f=n.sdkName)!=null?f:Ye,sdkVersion:(_=n.sdkVersion)!=null?_:Qe,sessionTracking:(T=n.sessionTracking)!=null?T:false,sharedStorage:(z=n.sharedStorage)!=null?z:r,socketFactory:n.socketFactory,storage:r,streamFlags:(A=n.streamFlags)!=null?A:false,transport:n.transport}}function be(n){return n.slice(0,16)}var Ze=(n,e)=>{let t={$cta_id:n.id,$cta_kind:n.kind,$cta_variant:n.variant.key,$cta_version:n.version},r=e===void 0?void 0:n.variant.content.buttons[e];return r&&e!==void 0&&(t.$cta_button=e,t.$cta_button_label=r.label,r.action.kind==="form"&&(t.$cta_form_id=r.action.value)),t},Q=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=E(e.fetch),this.host=C(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async ctas(e){let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=new URLSearchParams({anonymous:String(e.anonymous),device:e.device,distinct_id:e.distinctId,language:e.language,url:e.url}),i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s=await t(`${this.host}/v1/ctas?${r.toString()}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(s.status<200||s.status>=300)throw new m(`ctas request failed with status ${s.status}`,s.status);return JSON.parse(await s.text()).ctas}finally{o!==void 0&&clearTimeout(o);}}};function et(n,e,t){var i,o,s;We(n.eventName),ze(n.distinctId);let r={distinct_id:n.distinctId,event_id:(i=n.eventId)!=null?i:t.uuid(),event_name:n.eventName,properties:(o=n.properties)!=null?o:{},schema_version:1,timestamp:Y((s=n.timestamp)!=null?s:e.now())};return n.context&&(r.context=n.context),n.sessionId&&(r.session_id=n.sessionId),r}var q=Symbol("absent");function Yt(n,e){var i,o;if(n==="distinct_id")return e.distinctId;let t=(i=e.properties)!=null?i:{};if(Object.prototype.hasOwnProperty.call(t,n))return t[n];let r=(o=e.attributes)!=null?o:{};return Object.prototype.hasOwnProperty.call(r,n)?r[n]:q}function O(n){return n===q?"undefined":String(n)}function tt(n){return n===q?Number.NaN:Number(n)}function nt(n){return n!==q&&n!==null&&n!==""}function rt(n,e){if(!Array.isArray(e))return false;let t=O(n);return e.map(r=>String(r)).includes(t)}function it(n,e){var i,o;let t=Yt(n.attribute,e),r=n.value;switch(n.op){case "is_set":return nt(t);case "is_not_set":return !nt(t);case "eq":return O(t)===O(r===void 0?q:r);case "neq":return O(t)!==O(r===void 0?q:r);case "contains":return O(t).includes(O(r===void 0?q:r));case "in":return rt(t,r);case "not_in":return Array.isArray(r)?!rt(t,r):false;case "gt":return X(t,r,(s,a)=>s>a);case "gte":return X(t,r,(s,a)=>s>=a);case "lt":return X(t,r,(s,a)=>s<a);case "lte":return X(t,r,(s,a)=>s<=a);case "in_cohort":return typeof r=="string"&&r!==""&&((i=e.cohorts)!=null?i:[]).includes(r);case "not_in_cohort":return typeof r=="string"&&r!==""&&!((o=e.cohorts)!=null?o:[]).includes(r);default:return false}}function X(n,e,t){let r=tt(n),i=e===void 0?Number.NaN:tt(e);return Number.isNaN(r)||Number.isNaN(i)?false:t(r,i)}function st(n,e){let t=`${n}:${e}`,r=2166136261;for(let i=0;i<t.length;i++)r^=t.charCodeAt(i),r=Math.imul(r,16777619);return (r>>>0)%100}function xe(n,e){return n.targeting.length===0||n.targeting.every(t=>it(t,e))}function ot(n,e){var o;let t=st(n.key,e.distinctId),r=(o=n.variations)!=null?o:[];if(r.length===0)return n.rolloutPercentage>=100||t<n.rolloutPercentage?"true":"false";let i=0;for(let s=r.length-1;s>=0;s--)if(i+=r[s].weight,t<i)return r[s].key;return r[0].key}function ke(n,e,t,r){var i;for(let o of (i=n.prerequisites)!=null?i:[]){if(r.includes(o.flagKey))return false;let s=e.find(l=>l.key===o.flagKey);if(!s||!s.enabled)return false;r.push(s.key);let a=ke(s,e,t,r)&&xe(s,t)&&ot(s,t)===o.variationKey;if(r.pop(),!a)return false}return true}function Z(n,e,t){return n.enabled?ke(n,e,t,[n.key])?xe(n,t)?n.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:st(n.key,t.distinctId)<n.rolloutPercentage?{enabled:true,reason:"rollout"}:{enabled:false,reason:"rollout_excluded"}:{enabled:false,reason:"targeting"}:{enabled:false,reason:"prerequisite"}:{enabled:false,reason:"disabled"}}function at(n,e){let t={};for(let r of n)t[r.key]=Z(r,n,e).enabled;return t}function Se(n,e,t){var s,a;let r=(s=n.variations)!=null?s:[],i=r[0];if(!i)return null;if(!n.enabled||!ke(n,e,t,[n.key])||!xe(n,t))return i;let o=ot(n,t);return (a=r.find(l=>l.key===o))!=null?a:i}function dt(n){return n.some(e=>e.targeting.some(t=>t.op==="in_cohort"||t.op==="not_in_cohort"))}function lt(n){return `40${JSON.stringify(n)}`}function ct(){return "3"}function ut(n){let e=n.charAt(0),t=n.slice(1);if(e==="2")return {kind:"ping"};if(e==="1")return {kind:"disconnect"};if(e==="0"){let s=we(t);return {kind:"open",pingInterval:typeof(s==null?void 0:s.pingInterval)=="number"?s.pingInterval:25e3,pingTimeout:typeof(s==null?void 0:s.pingTimeout)=="number"?s.pingTimeout:2e4}}if(e!=="4")return {kind:"other"};let r=t.charAt(0),i=t.slice(1);if(r==="0")return {kind:"connected"};if(r==="1")return {kind:"disconnect"};if(r==="4"){let s=we(i);return {kind:"connectError",message:typeof(s==null?void 0:s.message)=="string"?s.message:"refused"}}if(r!=="2")return {kind:"other"};let o=we(i);return !Array.isArray(o)||typeof o[0]!="string"?{kind:"other"}:{kind:"event",name:o[0],payload:o[1]}}function we(n){try{return JSON.parse(n)}catch(e){return null}}var Qt="/socket.io/?EIO=4&transport=websocket",Xt=250,ee=class{constructor(e){this.options=e;d(this,"socket",null);d(this,"heartbeat",null);d(this,"pending",null);d(this,"lastKey","");d(this,"ready",false);d(this,"closed",false);d(this,"heartbeatWindow",45e3);d(this,"factory");d(this,"setTimer");d(this,"clearTimer");var t,r,i;this.factory=(t=e.socketFactory)!=null?t:Zt,this.setTimer=(r=e.setTimer)!=null?r:((o,s)=>setTimeout(o,s)),this.clearTimer=(i=e.clearTimer)!=null?i:(o=>clearTimeout(o));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${Qt}`,t;try{t=this.factory(e);}catch(r){this.options.onClosed(false);return}this.socket=t,t.onmessage=r=>this.receive(String(r.data)),t.onerror=()=>t.close(),t.onclose=()=>this.fell();}close(){this.closed=true,this.stopHeartbeat(),this.pending!==null&&this.clearTimer(this.pending),this.pending=null;let e=this.socket;this.socket=null,e==null||e.close();}receive(e){var r,i,o,s;let t=ut(e);if(t.kind==="open"){this.armHeartbeat(t.pingInterval+t.pingTimeout),(r=this.socket)==null||r.send(lt({projectKey:this.options.projectKey}));return}if(t.kind==="ping"){this.armHeartbeat(),(i=this.socket)==null||i.send(ct());return}if(t.kind==="connectError"||t.kind==="disconnect"){this.stopHeartbeat(),(o=this.socket)==null||o.close();return}if(t.kind==="event"){if(t.name==="ready"){this.ready=true;return}if(t.name==="flagChange"){let a=(s=t.payload)==null?void 0:s.key;this.lastKey=typeof a=="string"?a:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},Xt));}}}fell(){this.stopHeartbeat();let e=this.ready;this.socket=null,this.ready=false,this.closed||this.options.onClosed(e);}armHeartbeat(e){e!==void 0&&(this.heartbeatWindow=e),this.stopHeartbeat(),this.heartbeat=this.setTimer(()=>{var t;return (t=this.socket)==null?void 0:t.close()},this.heartbeatWindow);}stopHeartbeat(){this.heartbeat!==null&&this.clearTimer(this.heartbeat),this.heartbeat=null;}};function Zt(n){let e=globalThis.WebSocket;if(!e)throw new m("no WebSocket");return new e(n)}var te=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=E(e.fetch),this.host=C(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){var s,a;let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let l=await t(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!l.ok)throw new m(`flags request failed with status ${l.status}`,l.status);let g=JSON.parse(await l.text());return {flags:(s=g.flags)!=null?s:{},variants:(a=g.variants)!=null?a:{}}}finally{o!==void 0&&clearTimeout(o);}}async snapshot(){var o;let e=this.fetch;if(!e)throw new m("no fetch implementation available in this runtime");let t=`${this.host}/v1/flags/snapshot`,r=S(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await e(t,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new m(`flag snapshot request failed with status ${s.status}`,s.status);let a=JSON.parse(await s.text()),l={flags:(o=a.flags)!=null?o:[],generatedAt:a.generatedAt};return typeof a.socketUrl=="string"&&a.socketUrl!==""&&(l.socketUrl=a.socketUrl),l}finally{i!==void 0&&clearTimeout(i);}}async memberships(e){var s;let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await t(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new m(`memberships request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).cohorts)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};var pt="$form_viewed",mt="$form_started",U=class extends Error{constructor(t,r,i){super(i);d(this,"fields");d(this,"status");this.name="FormRefusedError",this.status=t,this.fields=r;}},ne=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=E(e.fetch),this.host=C(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async request(e,t){let r=this.fetch;if(!r)throw new m("no fetch implementation available in this runtime");let i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s={authorization:`Bearer ${this.projectKey}`};t.body!==void 0&&(s["content-type"]="application/json");let a=await r(`${this.host}${e}`,{body:t.body,headers:s,method:t.method,signal:i==null?void 0:i.signal});return {status:a.status,text:await a.text()}}finally{o!==void 0&&clearTimeout(o);}}async form(e,t){let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}?distinct_id=${encodeURIComponent(t)}`,{method:"GET"});if(r<200||r>=300)throw new m(`form request failed with status ${r}`,r);return JSON.parse(i)}async submit(e,t){var a,l,g,v;let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}/submissions`,{body:JSON.stringify(t),method:"POST"});if(r>=200&&r<300)return JSON.parse(i).afterSubmit;let o=[],s=`form submission failed with status ${r}`;try{let c=JSON.parse(i);o=(l=(a=c.error)==null?void 0:a.fields)!=null?l:[],s=(v=(g=c.error)==null?void 0:g.message)!=null?v:s;}catch(c){o=[];}throw new U(r,o,s)}};var gt="$survey_shown",ht="$survey_dismissed",ft="$survey_sent",re=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=E(e.fetch),this.host=C(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async surveys(e,t){var s;let r=this.fetch;if(!r)throw new m("no fetch implementation available in this runtime");let i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await r(`${this.host}/v1/surveys?distinct_id=${encodeURIComponent(e)}${t?`&lang=${encodeURIComponent(t)}`:""}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new m(`surveys request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).surveys)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};function ie(n,e){let t={$survey_id:n.id,$survey_iteration:n.iteration,$survey_name:n.name};for(let[r,i]of Object.entries(e))t[`$survey_response_${r}`]=i;return t}var se=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=E(e.fetch),this.host=C(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async guides(e){var o;let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=S(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await t(`${this.host}/v1/guides?distinct_id=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new m(`guides request failed with status ${s.status}`,s.status);return (o=JSON.parse(await s.text()).guides)!=null?o:[]}finally{i!==void 0&&clearTimeout(i);}}};function yt(n,e){let t={$guide_id:n.id,$guide_iteration:n.iteration,$guide_name:n.name};return e!==void 0&&(t.$guide_step_id=e),t}function Ce(n){if(typeof n!="string")return;let e=Array.from(n).length;return e>=1&&e<=200?n:void 0}function Te(n,e){return `pdx.${n}.${e}`}var Fe="consent",en=["identityLink","analytics","marketing","functional"];function Ee(n){if(typeof n!="string")return null;try{let e=JSON.parse(n);if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e,r={};for(let i of en){let o=t[i];typeof o=="boolean"&&(r[i]=o);}return typeof t.version=="number"&&Number.isInteger(t.version)&&(r.version=t.version),Array.isArray(t.categories)&&t.categories.every(i=>typeof i=="string")&&(r.categories=t.categories),Object.keys(r).length===0?null:r}catch(e){return null}}var vt=n=>n.endsWith(`.${Fe}`);function ae(n,e){return Ee(n.getItem(Te(e,Fe)))}function tn(n,e,t){var s;let r=Te(e,Fe),i=Ee(JSON.stringify(t)),o=i===null?null:Ee(JSON.stringify({...(s=ae(n,e))!=null?s:{},...i}));if(o===null){n.removeItem(r);return}n.setItem(r,JSON.stringify(o));}var oe=class{constructor(e,t,r,i){this.storage=e;this.shared=t;this.ids=r;this.namespace=i;d(this,"anonymousId");d(this,"distinctId");d(this,"identified");this.refresh();}refresh(){let e=Ce(this.shared.getItem(this.key("anonymous_id"))),t=Ce(this.storage.getItem(this.key("anonymous_id")));e?(this.anonymousId=e,t!==e&&this.storage.setItem(this.key("anonymous_id"),e)):t?(this.anonymousId=t,this.shared.setItem(this.key("anonymous_id"),t)):(this.anonymousId=this.ids.uuid(),this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId));let r=Ce(this.storage.getItem(this.key("distinct_id")));r?(this.distinctId=r,this.identified=true):(this.distinctId=this.anonymousId,this.identified=false);}getAnonymousId(){return this.anonymousId}getDistinctId(){return this.distinctId}isIdentified(){return this.identified}snapshot(){return {anonymousId:this.anonymousId,distinctId:this.distinctId,identified:this.identified}}consent(){return ae(this.shared,this.namespace)}setConsent(e){tn(this.shared,this.namespace,e);}assumeAnonymousId(e){this.anonymousId=e,this.shared.setItem(this.key("anonymous_id"),e),this.storage.setItem(this.key("anonymous_id"),e),this.identified||(this.distinctId=e);}identify(e){var o;let t=!this.identified||this.distinctId!==e,r=this.storage.getItem(this.key("linked_anonymous_id")),i=t||r!==this.anonymousId;return this.distinctId=e,this.identified=true,t&&this.storage.setItem(this.key("distinct_id"),e),!i||((o=this.consent())==null?void 0:o.identityLink)===false?{changed:t}:(this.storage.setItem(this.key("linked_anonymous_id"),this.anonymousId),{anonymousToLink:this.anonymousId,changed:t})}reset(){this.anonymousId=this.ids.uuid(),this.distinctId=this.anonymousId,this.identified=false,this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.removeItem(this.key("distinct_id")),this.storage.removeItem(this.key("linked_anonymous_id"));}key(e){return Te(this.namespace,e)}};var de=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=E(e.fetch),this.host=C(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async inbox(e){var s;let t=this.requireFetch(),r=`${this.host}/v1/messages?distinct_id=${encodeURIComponent(e)}`,i=await this.request(t,r,{headers:this.authHeaders(),method:"GET"});if(!i.ok)throw new m(`inbox request failed with status ${i.status}`,i.status);return (s=JSON.parse(await i.text()).messages)!=null?s:[]}async markRead(e,t){let r=this.requireFetch(),i=`${this.host}/v1/messages/read`,o=await this.request(r,i,{body:JSON.stringify({distinct_id:t,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!o.ok)throw new m(`mark-read request failed with status ${o.status}`,o.status)}requireFetch(){if(!this.fetch)throw new m("no fetch implementation available in this runtime");return this.fetch}authHeaders(){return {authorization:`Bearer ${this.projectKey}`}}async request(e,t,r){let i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(t,{...r,signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}};var le=class{constructor(e,t){this.maxSize=e;this.onOverflow=t;d(this,"events",[]);}get size(){return this.events.length}enqueue(e){this.events.push(e),this.enforceCap();}restore(e){this.events.push(...e),this.enforceCap();}requeue(e){this.events.unshift(...e),this.enforceCap();}drain(e){let t=e===void 0?this.events.length:Math.min(e,this.events.length);return this.events.splice(0,t)}snapshot(){return [...this.events]}enforceCap(){var t;if(this.events.length<=this.maxSize)return;let e=this.events.splice(0,this.events.length-this.maxSize);(t=this.onOverflow)==null||t.call(this,{dropped:e});}};var nn={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function rn(n){return `pdx.${n}.session`}var ce=class{constructor(e,t,r,i,o=nn){this.storage=e;this.ids=t;this.clock=r;this.namespace=i;this.options=o;}current(){return this.touch().id}startedAt(){return this.touch().startedAt}reset(){this.storage.removeItem(this.key());}touch(){let e=this.clock.now().getTime(),t=this.live(this.read(),e);if(t===void 0)return this.write({id:this.ids.uuid(),lastActivityAt:e,startedAt:e});if(e-t.lastActivityAt<=this.options.throttleMs)return t;let r=this.live(this.read(),e),i=r!==void 0&&r.id!==t.id?r:t;return this.write({...i,lastActivityAt:e})}live(e,t){if(e!==void 0&&!(t-e.lastActivityAt>this.options.idleMs||t-e.startedAt>this.options.maxMs))return e}write(e){return this.storage.setItem(this.key(),JSON.stringify(e)),e}read(){let e=this.storage.getItem(this.key());if(e)try{let t=JSON.parse(e);return typeof t.id=="string"&&typeof t.startedAt=="number"&&typeof t.lastActivityAt=="number"?{id:t.id,lastActivityAt:t.lastActivityAt,startedAt:t.startedAt}:void 0}catch(t){return}}key(){return rn(this.namespace)}};var k={createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",set:"$set"};function bt(n){return n>=400&&n<500&&n!==429}var K=class{constructor(e={}){d(this,"fetch");d(this,"maxRetries");d(this,"requestTimeoutMs");d(this,"baseDelayMs");d(this,"maxDelayMs");d(this,"sleep");d(this,"random");var t,r,i,o,s,a;this.fetch=E(e.fetch),this.maxRetries=(t=e.maxRetries)!=null?t:3,this.requestTimeoutMs=(r=e.requestTimeoutMs)!=null?r:1e4,this.baseDelayMs=(i=e.baseDelayMs)!=null?i:500,this.maxDelayMs=(o=e.maxDelayMs)!=null?o:3e4,this.sleep=(s=e.sleep)!=null?s:Be,this.random=(a=e.random)!=null?a:Math.random;}async send(e){let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=JSON.stringify(e.body),i;for(let o=0;o<=this.maxRetries;o+=1){try{let s=await this.attempt(t,e,r);if(s.ok)return;if(bt(s.status))throw new m(`ingest rejected batch with status ${s.status}`,s.status);i=new m(`ingest transient status ${s.status}`,s.status);}catch(s){if(s instanceof m&&s.status!==void 0&&bt(s.status))throw s;i=s;}o<this.maxRetries&&await this.sleep(this.backoff(o));}throw new m("ingest delivery failed after retries",void 0,{cause:i})}async attempt(e,t,r){let i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(t.url,{body:r,headers:{authorization:`Bearer ${t.projectKey}`,"content-type":"application/json"},method:"POST",signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};var sn="queue",on=1e3,xt=3e4,_e=n=>{let e={};return n.avatar!==void 0&&(e.$avatar=n.avatar),n.email!==void 0&&(e.$email=n.email),n.name!==void 0&&(e.$name=n.name),n.phone!==void 0&&(e.$phone=n.phone),e},ue=class{constructor(e){d(this,"config");d(this,"identity");d(this,"session");d(this,"queue");d(this,"transport");d(this,"flagsClient");d(this,"messagesClient");d(this,"surveysClient");d(this,"guidesClient");d(this,"captureListeners",new Set);d(this,"formsClient");d(this,"ctasClient");d(this,"context");d(this,"flushTimer");d(this,"flushing",false);d(this,"cachedFlags");d(this,"cachedSnapshot");d(this,"membershipCache");d(this,"stream");d(this,"shutDown",false);d(this,"exposures",new Set);d(this,"gates");d(this,"cookielessId");d(this,"storageListeners",new Set);var s,a,l;let t=Xe(e),r=(a=(s=ae(t.sharedStorage,t.namespace))!=null?s:t.consent)!=null?a:null;if(this.gates=[new H(t.storage),new H(t.sharedStorage,vt)],t.consentMode!=="banner"||(r==null?void 0:r.analytics)===true)for(let g of this.gates)g.open();let[i,o]=this.gates;this.config={...t,sharedStorage:o,storage:i},this.identity=new oe(this.config.storage,this.config.sharedStorage,this.config.ids,this.config.namespace),this.config.consent!==void 0&&this.identity.setConsent(this.config.consent),this.session=this.config.sessionTracking?new ce(this.config.sharedStorage,this.config.ids,this.config.clock,this.config.namespace):void 0,this.queue=new le(this.config.maxQueueSize,({dropped:g})=>{this.config.onError(new M("queue_overflow",`event queue overflow: dropped ${g.length} oldest event(s)`));}),this.transport=(l=this.config.transport)!=null?l:new K({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new te({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new de({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.surveysClient=new re({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.guidesClient=new se({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.formsClient=new ne({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.ctasClient=new Q({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.context={sdk:this.config.sdkName,sdk_version:this.config.sdkVersion},this.config.os&&(this.context.os=this.config.os),this.config.locale&&(this.context.locale=this.config.locale),this.restoreQueue(),this.startTimer();}get distinctId(){return this.identity.getDistinctId()}get anonymousId(){return this.identity.getAnonymousId()}get isIdentified(){return this.identity.isIdentified()}get sessionId(){var e;return (e=this.session)==null?void 0:e.current()}get sessionStartedAt(){var e;return (e=this.session)==null?void 0:e.startedAt()}capture(e,t={}){var r,i,o,s,a,l,g;try{this.identity.refresh();let v={...this.config.defaultProperties(),...t.element===void 0?{}:(o=(i=(r=this.config).describeElement)==null?void 0:i.call(r,t.element))!=null?o:{},...(s=t.properties)!=null?s:{}},c=et({context:this.context,distinctId:(a=t.distinctId)!=null?a:this.identity.getDistinctId(),eventName:e,properties:v,sessionId:(g=t.sessionId)!=null?g:(l=this.session)==null?void 0:l.current(),timestamp:t.timestamp},this.config.clock,this.config.ids);this.enqueue(c);}catch(v){this.config.onError(v);}for(let v of this.captureListeners)try{v(e);}catch(c){this.config.onError(c);}}onCapture(e){return this.captureListeners.add(e),()=>{this.captureListeners.delete(e);}}identify(e,t={}){var a,l;if(this.isCookieless())return;this.identity.refresh();let r=this.identity.identify(e),i={};r.anonymousToLink!==void 0&&(i.$anon_distinct_id=r.anonymousToLink);let o=Ve(),s={...o===null?{}:{$timezone:o},..._e((a=t.traits)!=null?a:{}),...(l=t.set)!=null?l:{}};Object.keys(s).length>0&&(i.$set=s),this.capture(k.identify,{properties:i});}link(e,t,r){if(this.isCookieless())return;let i={$anon_distinct_id:t},o=_e(r!=null?r:{});Object.keys(o).length>0&&(i.$set=o),this.capture(k.identify,{distinctId:e,properties:i});}setConsent(e){this.identity.setConsent(e),e.analytics===true&&this.allowStorage(),e.analytics===false&&this.config.consentMode==="banner"&&this.forbidStorage();}isCookieless(){return !this.gates[0].isOpen}takeCookielessId(e){this.cookielessId=e,this.isCookieless()&&this.identity.assumeAnonymousId(e);}allowStorage(){if(this.isCookieless()){for(let e of this.gates)e.open();this.identity.refresh();for(let e of [...this.storageListeners])e();}}onStorageAllowed(e){return this.storageListeners.add(e),()=>{this.storageListeners.delete(e);}}forbidStorage(){if(!this.isCookieless()){for(let e of ["anonymous_id","distinct_id","linked_anonymous_id","session"])this.config.storage.removeItem(`pdx.${this.config.namespace}.${e}`),this.config.sharedStorage.removeItem(`pdx.${this.config.namespace}.${e}`);for(let e of this.gates)e.close();this.identity.refresh(),this.cookielessId!==void 0&&this.identity.assumeAnonymousId(this.cookielessId);}}consent(){return this.identity.consent()}alias(e){this.capture(k.createAlias,{properties:{alias:e}});}group(e,t,r){let i={$group_key:t,$group_type:e};r&&(i.$set=r),this.capture(k.group,{properties:i});}setPersonProperties(e,t){if(this.isCookieless())return;let r={};e&&(r.$set=e),t&&(r.$set_once=t),this.capture(k.set,{properties:r});}setPersonTraits(e){if(this.isCookieless())return;let t=_e(e);Object.keys(t).length!==0&&this.capture(k.set,{properties:{$set:t}});}async getAllFlags(){var r;let e=this.identity.getDistinctId(),t=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:t.flags,variants:(r=t.variants)!=null?r:{}},t.flags}async isFeatureEnabled(e){var i,o,s,a;let r=(i=(await this.getAllFlags())[e])!=null?i:false;return this.recordExposure(e,(a=(s=(o=this.cachedFlags)==null?void 0:o.variants[e])==null?void 0:s.key)!=null?a:String(r)),r}async getVariant(e){var i,o,s,a;let t=await this.getAllFlags(),r=(o=(i=this.cachedFlags)==null?void 0:i.variants[e])!=null?o:null;return this.recordExposure(e,(a=r==null?void 0:r.key)!=null?a:String((s=t[e])!=null?s:false)),r}async getVariantLocal(e,t={}){var l;let r=await this.flagSnapshot(),i=r.flags.find(g=>g.key===e),o=await this.localContext(t,r.flags),s=i?Se(i,r.flags,o):null,a=i?Z(i,r.flags,o).enabled:false;return this.recordExposure(e,(l=s==null?void 0:s.key)!=null?l:String(a)),s?{key:s.key,value:s.value}:null}recordExposure(e,t){let r=`${this.identity.getDistinctId()} ${e} ${t}`;this.exposures.has(r)||(this.exposures.add(r),this.capture(k.featureFlagCalled,{properties:{$feature_flag:e,$feature_flag_response:t}}));}getCachedFlag(e){if(!(!this.cachedFlags||this.cachedFlags.distinctId!==this.distinctId))return this.cachedFlags.flags[e]}async getLocalFlags(e={}){let t=await this.flagSnapshot();return at(t.flags,await this.localContext(e,t.flags))}async isFeatureEnabledLocal(e,t={}){var a,l;let r=await this.flagSnapshot(),i=r.flags.find(g=>g.key===e),o=await this.localContext(t,r.flags),s=i?Z(i,r.flags,o).enabled:false;return this.recordExposure(e,(l=i?(a=Se(i,r.flags,o))==null?void 0:a.key:void 0)!=null?l:String(s)),s}async localContext(e,t){let r=this.identity.getDistinctId(),i=e.cohorts;if(i===void 0&&dt(t)){let o=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===r&&o-this.membershipCache.fetchedAt<xt?i=this.membershipCache.cohorts:(i=await this.flagsClient.memberships(r),this.membershipCache={cohorts:i,distinctId:r,fetchedAt:o});}return {attributes:e.attributes,cohorts:i,distinctId:r,properties:e.properties}}async flagSnapshot(){let e=this.config.clock.now().getTime();if(this.cachedSnapshot&&e-this.cachedSnapshot.fetchedAt<xt)return this.cachedSnapshot.snapshot;let t=await this.flagsClient.snapshot();return this.cachedSnapshot={fetchedAt:e,snapshot:t},this.maybeStream(t),t}maybeStream(e){if(!this.config.streamFlags||this.shutDown||this.stream||!e.socketUrl)return;let t=new ee({host:e.socketUrl,onChange:()=>{this.cachedSnapshot=void 0,this.flagSnapshot().catch(r=>this.config.onError(r));},onClosed:r=>{this.stream=void 0,r&&this.maybeStream(e);},projectKey:this.config.apiKey,socketFactory:this.config.socketFactory});this.stream=t,t.open();}async getInbox(){return this.messagesClient.inbox(this.identity.getDistinctId())}async markMessageRead(e){await this.messagesClient.markRead(e,this.identity.getDistinctId());}async getSurveys(e){return this.surveysClient.surveys(this.identity.getDistinctId(),e!=null?e:this.config.locale)}captureSurveyShown(e){this.capture(gt,{properties:ie(e,{})});}captureSurveyDismissed(e){this.capture(ht,{properties:ie(e,{})});}captureSurveySent(e,t){this.capture(ft,{properties:ie(e,t)});}async getGuides(){return this.guidesClient.guides(this.identity.getDistinctId())}captureGuide(e,t,r){this.capture(e,{properties:yt(t,r)});}async getForm(e){return this.formsClient.form(e,this.identity.getDistinctId())}async submitForm(e,t,r,i){let{$page_id:o,$page_variant:s}=this.config.defaultProperties();return this.formsClient.submit(e,{answers:t,challenge:r,distinctId:this.identity.getDistinctId(),isAnonymous:!this.identity.isIdentified(),pageUrl:typeof window=="undefined"?"":window.location.href,solution:i,...typeof o=="string"&&typeof s=="string"?{pageId:o,pageVariant:s}:{}})}async getCtas(e){return this.ctasClient.ctas({...e,anonymous:!this.identity.isIdentified(),distinctId:this.identity.getDistinctId()})}captureCta(e,t,r){this.capture(e,{properties:Ze(t,r)});}async flush(){if(this.flushing||this.queue.size===0)return;this.flushing=true;let e=this.queue.drain(on);try{await this.transport.send({body:{events:e,sent_at:Y(this.config.clock.now())},projectKey:this.config.apiKey,url:`${this.config.host}/v1/events`}),this.persistQueue();}catch(t){this.queue.requeue(e),this.persistQueue(),this.config.onError(t);}finally{this.flushing=false;}}reset(){var e;(e=this.session)==null||e.reset(),this.identity.reset(),this.cachedFlags=void 0,this.cachedSnapshot=void 0,this.membershipCache=void 0;}async shutdown(){var e;this.shutDown=true,this.stopTimer(),(e=this.stream)==null||e.close(),this.stream=void 0,await this.flush();}enqueue(e){this.queue.enqueue(e),this.persistQueue(),this.queue.size>=this.config.flushAt&&this.flush();}persistQueue(){try{this.config.storage.setItem(this.persistKey(),JSON.stringify(this.queue.snapshot()));}catch(e){this.config.onError(e);}}restoreQueue(){try{let e=this.config.storage.getItem(this.persistKey());if(!e)return;let t=JSON.parse(e);Array.isArray(t)&&this.queue.restore(t);}catch(e){this.config.onError(e);}}startTimer(){if(this.config.flushIntervalMs<=0)return;let e=setInterval(()=>{this.flush();},this.config.flushIntervalMs),t=e;typeof t.unref=="function"&&t.unref(),this.flushTimer=e;}stopTimer(){this.flushTimer!==void 0&&(clearInterval(this.flushTimer),this.flushTimer=void 0);}persistKey(){return `pdx.${this.config.namespace}.${sn}`}};function an(){let n=globalThis.document;return (n==null?void 0:n.visibilityState)==="hidden"}function dn(n){let e=globalThis.navigator,t=globalThis.Blob;if(!(e!=null&&e.sendBeacon)||!t)return false;let r=JSON.stringify({...n.body,api_key:n.projectKey});try{let i=new t([r],{type:"application/json"});return e.sendBeacon(n.url,i)}catch(i){return false}}var pe=class{constructor(e={}){d(this,"fetchTransport");this.fetchTransport=new K(e);}async send(e){an()&&dn(e)||await this.fetchTransport.send(e);}};var Ie="prodantix:consent-ready",$e="prodantix:consent",kt="__prodantixConsent";var St=(n,e)=>{n.takeCookielessId(e.anonymousId),e.consent!==null?n.setConsent(e.consent):e.rule==="notice"&&n.allowStorage();},wt=(n,e)=>{let t=e[kt];t&&St(n,t);let r=o=>{let s=o.detail;s&&St(n,s);},i=o=>{let s=o.detail;s&&n.setConsent(s);};return e.addEventListener(Ie,r),e.addEventListener($e,i),()=>{e.removeEventListener(Ie,r),e.removeEventListener($e,i);}};var ln=/^\d{1,3}(\.\d{1,3}){3}$/,cn=/^[a-z0-9.-]+$/i;function Ct(){return Math.random().toString(36).slice(2,12)}function me(n,e){let t=`${e}=`,r=[];for(let i of n.cookie.split(";")){let o=i.trim();o.startsWith(t)&&r.push(o.slice(t.length));}return r}function J(n,e,t){let r=["Path=/",`Max-Age=${e}`,"SameSite=Lax"];return n&&r.push(`Domain=${n}`),t&&r.push("Secure"),r.join("; ")}function Et(n,e,t,r){try{let i=`pdx_probe_${r()}`,o=r();n.cookie=`${i}=${o}; ${J(e,60,t)}`;let s=me(n,i).includes(o);n.cookie=`${i}=; ${J(e,0,t)}`;let a=me(n,i).includes(o);return s&&!a}catch(i){return false}}function un(n){let e=n.replace(/^\[|\]$/g,"").toLowerCase();if(e.includes(":")||ln.test(e)||!e.includes("."))return [];let t=e.split("."),r=[];for(let i=t.length-2;i>=0;i-=1)r.push(t.slice(i).join("."));return r}function pn(n,e,t,r=Ct){for(let i of un(n))if(Et(e,i,t,r))return i}function mn(n){let e=new Map,t=JSON.parse(decodeURIComponent(n));if(t===null||typeof t!="object"||Array.isArray(t))return e;for(let[r,i]of Object.entries(t))typeof i=="string"&&e.set(r,i);return e}var Ae=class{constructor(e,t,r,i){this.jar=e;this.name=t;this.domain=r;this.secure=i;}getItem(e){var t;return (t=this.read().get(e))!=null?t:null}setItem(e,t){let r=this.read();r.set(e,t),this.write(r);}removeItem(e){let t=this.read();t.delete(e)&&this.write(t);}read(){try{let e=me(this.jar,this.name);e.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${J(void 0,0,this.secure)}`,e=me(this.jar,this.name));let t=e[0];return t?mn(t):new Map}catch(e){return new Map}}write(e){try{if(e.size===0){this.jar.cookie=`${this.name}=; ${J(this.domain,0,this.secure)}`;return}let t=encodeURIComponent(JSON.stringify(Object.fromEntries(e)));this.jar.cookie=`${this.name}=${t}; ${J(this.domain,31536e3,this.secure)}`;}catch(t){return}}};function gn(){return globalThis.document}function hn(){var n,e;return (e=(n=globalThis.location)==null?void 0:n.hostname)!=null?e:""}function fn(){var n;return ((n=globalThis.location)==null?void 0:n.protocol)==="https:"}function yn(n){if(n===void 0)return;let e=n.startsWith(".")?n.slice(1):n;return cn.test(e)?e.toLowerCase():void 0}function Tt(n){var s,a,l,g,v;let e="jar"in n?n.jar:gn();if(!e||((s=globalThis.navigator)==null?void 0:s.cookieEnabled)===false)return null;let r=(a=n.random)!=null?a:Ct,i=(l=n.secure)!=null?l:fn(),o=(g=n.hostname)!=null?g:hn();try{let c=(v=yn(n.domain))!=null?v:pn(o,e,i,r);return Et(e,c,i,r)?new Ae(e,n.name,c,i):null}catch(c){return null}}var Ft=n=>`prodantix-form-popup:${n}`,vn=n=>{try{let e=window.localStorage.getItem(Ft(n));return e===null?null:Number(e)}catch(e){return null}},bn=(n,e)=>{try{window.localStorage.setItem(Ft(n),String(e));}catch(t){return}},_t=(n,e,t)=>t===null||e-t>=n.periodDays*864e5,Pe=(n,e,t=Date.now)=>{if(!_t(n,t(),vn(n.formId)))return ()=>{};let r=false,i=[],o=()=>{if(!r){r=true;for(let a of i)a();bn(n.formId,t()),e();}},s=n.trigger;if(s.kind==="delay"){let a=setTimeout(o,s.seconds*1e3);i.push(()=>clearTimeout(a));}else if(s.kind==="scroll"){let a=()=>{let l=document.documentElement.scrollHeight-window.innerHeight;(l<=0||window.scrollY/l*100>=s.percent)&&o();};window.addEventListener("scroll",a,{passive:true}),i.push(()=>window.removeEventListener("scroll",a));}else {let a=l=>{l.relatedTarget===null&&l.clientY<=0&&o();};document.addEventListener("mouseout",a),i.push(()=>document.removeEventListener("mouseout",a));}return ()=>{r=true;for(let a of i)a();}},Re=n=>{if(!n)return null;if(n==="exit")return {kind:"exit"};let[e,t]=n.split(":"),r=Number(t);return !Number.isFinite(r)||r<0?null:e==="delay"?{kind:"delay",seconds:r}:e==="scroll"?{kind:"scroll",percent:Math.min(100,r)}:null};var xn=n=>{let e=0;for(let t of n){if(t!==0)return e+Math.clz32(t)-24;e+=8;}return e},kn=async n=>new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(n))),It=async n=>{for(let e=0;;e+=1){let t=e.toString(36);if(xn(await kn(`${n.nonce}:${t}`))>=n.difficulty)return t}};var B={am:{back:"\u1270\u1218\u1208\u1235",close:"\u12DD\u130B",closed:"\u12ED\u1205 \u1245\u133D \u12A0\u1201\u1295 \u121D\u120B\u123E\u127D\u1295 \u12A0\u12ED\u1240\u1260\u120D\u121D\u1362",failed:"\u1218\u120B\u12AD \u12A0\u120D\u1270\u127B\u1208\u121D\u1362 \u12A5\u1295\u12F0\u1308\u1293 \u12ED\u121E\u12AD\u1229\u1362",invalid:"\u12ED\u1205 \u1218\u120D\u1235 \u12A0\u12ED\u1240\u1260\u120D\u121D\u1362",next:"\u1240\u1323\u12ED",poweredBy:"\u1260Prodantix \u12E8\u1270\u1230\u122B",required:"\u12ED\u1205 \u12EB\u1235\u1348\u120D\u130B\u120D\u1362",sending:"\u1260\u1218\u120B\u12AD \u120B\u12ED\u2026",step:"\u12F0\u1228\u1303 {step} \u12A8{total}",submit:"\u120B\u12AD",thanks:"\u12A5\u1293\u1218\u1230\u130D\u1293\u1208\u1295\u1362"},ar:{back:"\u0631\u062C\u0648\u0639",close:"\u0625\u063A\u0644\u0627\u0642",closed:"\u0644\u0627 \u064A\u0642\u0628\u0644 \u0647\u0630\u0627 \u0627\u0644\u0646\u0645\u0648\u0630\u062C \u0631\u062F\u0648\u062F\u064B\u0627 \u0627\u0644\u0622\u0646.",failed:"\u062A\u0639\u0630\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644. \u062D\u0627\u0648\u0644 \u0645\u0631\u0629 \u0623\u062E\u0631\u0649.",invalid:"\u0647\u0630\u0647 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629.",next:"\u0627\u0644\u062A\u0627\u0644\u064A",poweredBy:"\u0645\u062F\u0639\u0648\u0645 \u0645\u0646 Prodantix",required:"\u0647\u0630\u0627 \u0627\u0644\u062D\u0642\u0644 \u0645\u0637\u0644\u0648\u0628.",sending:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u2026",step:"\u0627\u0644\u062E\u0637\u0648\u0629 {step} \u0645\u0646 {total}",submit:"\u0625\u0631\u0633\u0627\u0644",thanks:"\u0634\u0643\u0631\u064B\u0627 \u0644\u0643."},bn:{back:"\u09AA\u09C7\u099B\u09A8\u09C7",close:"\u09AC\u09A8\u09CD\u09A7 \u0995\u09B0\u09C1\u09A8",closed:"\u098F\u0987 \u09AB\u09B0\u09CD\u09AE\u099F\u09BF \u098F\u0996\u09A8 \u0989\u09A4\u09CD\u09A4\u09B0 \u09A8\u09BF\u099A\u09CD\u099B\u09C7 \u09A8\u09BE\u0964",failed:"\u09AA\u09BE\u09A0\u09BE\u09A8\u09CB \u09AF\u09BE\u09AF\u09BC\u09A8\u09BF\u0964 \u0986\u09AC\u09BE\u09B0 \u099A\u09C7\u09B7\u09CD\u099F\u09BE \u0995\u09B0\u09C1\u09A8\u0964",invalid:"\u098F\u0987 \u0989\u09A4\u09CD\u09A4\u09B0\u099F\u09BF \u0997\u09CD\u09B0\u09B9\u09A3\u09AF\u09CB\u0997\u09CD\u09AF \u09A8\u09AF\u09BC\u0964",next:"\u09AA\u09B0\u09AC\u09B0\u09CD\u09A4\u09C0",poweredBy:"Prodantix \u09A6\u09CD\u09AC\u09BE\u09B0\u09BE \u099A\u09BE\u09B2\u09BF\u09A4",required:"\u098F\u099F\u09BF \u0986\u09AC\u09B6\u09CD\u09AF\u0995\u0964",sending:"\u09AA\u09BE\u09A0\u09BE\u09A8\u09CB \u09B9\u099A\u09CD\u099B\u09C7\u2026",step:"\u09A7\u09BE\u09AA {step} / {total}",submit:"\u099C\u09AE\u09BE \u09A6\u09BF\u09A8",thanks:"\u09A7\u09A8\u09CD\u09AF\u09AC\u09BE\u09A6\u0964"},de:{back:"Zur\xFCck",close:"Schlie\xDFen",closed:"Dieses Formular nimmt gerade keine Antworten an.",failed:"Senden fehlgeschlagen. Bitte erneut versuchen.",invalid:"Diese Antwort wird nicht angenommen.",next:"Weiter",poweredBy:"Bereitgestellt von Prodantix",required:"Dieses Feld ist erforderlich.",sending:"Wird gesendet\u2026",step:"Schritt {step} von {total}",submit:"Absenden",thanks:"Vielen Dank."},en:{back:"Back",close:"Close",closed:"This form is not accepting responses right now.",failed:"This could not be sent. Try again.",invalid:"This answer is not accepted.",next:"Next",poweredBy:"Powered by Prodantix",required:"This is required.",sending:"Sending\u2026",step:"Step {step} of {total}",submit:"Submit",thanks:"Thank you."},es:{back:"Atr\xE1s",close:"Cerrar",closed:"Este formulario no acepta respuestas ahora.",failed:"No se pudo enviar. Int\xE9ntalo de nuevo.",invalid:"Esta respuesta no se acepta.",next:"Siguiente",poweredBy:"Con la tecnolog\xEDa de Prodantix",required:"Este campo es obligatorio.",sending:"Enviando\u2026",step:"Paso {step} de {total}",submit:"Enviar",thanks:"Gracias."},et:{back:"Tagasi",close:"Sulge",closed:"See vorm ei v\xF5ta praegu vastuseid vastu.",failed:"Saatmine eba\xF5nnestus. Proovi uuesti.",invalid:"Seda vastust ei v\xF5eta vastu.",next:"Edasi",poweredBy:"Toetab Prodantix",required:"See on kohustuslik.",sending:"Saatmine\u2026",step:"Samm {step}/{total}",submit:"Saada",thanks:"Ait\xE4h."},fil:{back:"Bumalik",close:"Isara",closed:"Hindi tumatanggap ng sagot ang form na ito ngayon.",failed:"Hindi naipadala. Subukan ulit.",invalid:"Hindi tinatanggap ang sagot na ito.",next:"Susunod",poweredBy:"Pinapagana ng Prodantix",required:"Kailangan ito.",sending:"Ipinapadala\u2026",step:"Hakbang {step} sa {total}",submit:"Ipadala",thanks:"Salamat."},fr:{back:"Retour",close:"Fermer",closed:"Ce formulaire n\u2019accepte plus de r\xE9ponses pour le moment.",failed:"L\u2019envoi a \xE9chou\xE9. R\xE9essayez.",invalid:"Cette r\xE9ponse n\u2019est pas accept\xE9e.",next:"Suivant",poweredBy:"Propuls\xE9 par Prodantix",required:"Ce champ est obligatoire.",sending:"Envoi\u2026",step:"\xC9tape {step} sur {total}",submit:"Envoyer",thanks:"Merci."},hi:{back:"\u092A\u0940\u091B\u0947",close:"\u092C\u0902\u0926 \u0915\u0930\u0947\u0902",closed:"\u092F\u0939 \u092B\u093C\u0949\u0930\u094D\u092E \u0905\u092D\u0940 \u091C\u0935\u093E\u092C \u0928\u0939\u0940\u0902 \u0932\u0947 \u0930\u0939\u093E \u0939\u0948\u0964",failed:"\u092D\u0947\u091C\u093E \u0928\u0939\u0940\u0902 \u091C\u093E \u0938\u0915\u093E\u0964 \u092B\u093F\u0930 \u0915\u094B\u0936\u093F\u0936 \u0915\u0930\u0947\u0902\u0964",invalid:"\u092F\u0939 \u091C\u0935\u093E\u092C \u0938\u094D\u0935\u0940\u0915\u093E\u0930 \u0928\u0939\u0940\u0902 \u0939\u0948\u0964",next:"\u0906\u0917\u0947",poweredBy:"Prodantix \u0926\u094D\u0935\u093E\u0930\u093E \u0938\u0902\u091A\u093E\u0932\u093F\u0924",required:"\u092F\u0939 \u091C\u093C\u0930\u0942\u0930\u0940 \u0939\u0948\u0964",sending:"\u092D\u0947\u091C\u093E \u091C\u093E \u0930\u0939\u093E \u0939\u0948\u2026",step:"\u091A\u0930\u0923 {step} / {total}",submit:"\u092D\u0947\u091C\u0947\u0902",thanks:"\u0927\u0928\u094D\u092F\u0935\u093E\u0926\u0964"},id:{back:"Kembali",close:"Tutup",closed:"Formulir ini sedang tidak menerima tanggapan.",failed:"Gagal mengirim. Coba lagi.",invalid:"Jawaban ini tidak diterima.",next:"Berikutnya",poweredBy:"Didukung oleh Prodantix",required:"Wajib diisi.",sending:"Mengirim\u2026",step:"Langkah {step} dari {total}",submit:"Kirim",thanks:"Terima kasih."},ja:{back:"\u623B\u308B",close:"\u9589\u3058\u308B",closed:"\u3053\u306E\u30D5\u30A9\u30FC\u30E0\u306F\u73FE\u5728\u56DE\u7B54\u3092\u53D7\u3051\u4ED8\u3051\u3066\u3044\u307E\u305B\u3093\u3002",failed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",invalid:"\u3053\u306E\u56DE\u7B54\u306F\u53D7\u3051\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3002",next:"\u6B21\u3078",poweredBy:"Powered by Prodantix",required:"\u5FC5\u9808\u9805\u76EE\u3067\u3059\u3002",sending:"\u9001\u4FE1\u4E2D\u2026",step:"\u30B9\u30C6\u30C3\u30D7 {step}/{total}",submit:"\u9001\u4FE1",thanks:"\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3057\u305F\u3002"},ko:{back:"\uC774\uC804",close:"\uB2EB\uAE30",closed:"\uC774 \uC591\uC2DD\uC740 \uC9C0\uAE08 \uC751\uB2F5\uC744 \uBC1B\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",failed:"\uBCF4\uB0B4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694.",invalid:"\uC774 \uB2F5\uBCC0\uC740 \uBC1B\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",next:"\uB2E4\uC74C",poweredBy:"Prodantix \uC81C\uACF5",required:"\uD544\uC218 \uD56D\uBAA9\uC785\uB2C8\uB2E4.",sending:"\uBCF4\uB0B4\uB294 \uC911\u2026",step:"{total}\uB2E8\uACC4 \uC911 {step}\uB2E8\uACC4",submit:"\uC81C\uCD9C",thanks:"\uAC10\uC0AC\uD569\uB2C8\uB2E4."},pt:{back:"Voltar",close:"Fechar",closed:"Este formul\xE1rio n\xE3o est\xE1 a aceitar respostas neste momento.",failed:"N\xE3o foi poss\xEDvel enviar. Tente novamente.",invalid:"Esta resposta n\xE3o \xE9 aceite.",next:"Seguinte",poweredBy:"Com tecnologia Prodantix",required:"Este campo \xE9 obrigat\xF3rio.",sending:"A enviar\u2026",step:"Passo {step} de {total}",submit:"Enviar",thanks:"Obrigado."},ru:{back:"\u041D\u0430\u0437\u0430\u0434",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",closed:"\u042D\u0442\u0430 \u0444\u043E\u0440\u043C\u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u043D\u0435 \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442 \u043E\u0442\u0432\u0435\u0442\u044B.",failed:"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437.",invalid:"\u042D\u0442\u043E\u0442 \u043E\u0442\u0432\u0435\u0442 \u043D\u0435 \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442\u0441\u044F.",next:"\u0414\u0430\u043B\u0435\u0435",poweredBy:"\u0420\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u043D\u0430 Prodantix",required:"\u042D\u0442\u043E \u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u043F\u043E\u043B\u0435.",sending:"\u041E\u0442\u043F\u0440\u0430\u0432\u043A\u0430\u2026",step:"\u0428\u0430\u0433 {step} \u0438\u0437 {total}",submit:"\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C",thanks:"\u0421\u043F\u0430\u0441\u0438\u0431\u043E."},sw:{back:"Rudi",close:"Funga",closed:"Fomu hii haipokei majibu kwa sasa.",failed:"Imeshindwa kutuma. Jaribu tena.",invalid:"Jibu hili halikubaliki.",next:"Endelea",poweredBy:"Inaendeshwa na Prodantix",required:"Hii inahitajika.",sending:"Inatuma\u2026",step:"Hatua {step} kati ya {total}",submit:"Tuma",thanks:"Asante."},vi:{back:"Quay l\u1EA1i",close:"\u0110\xF3ng",closed:"Bi\u1EC3u m\u1EABu n\xE0y hi\u1EC7n kh\xF4ng nh\u1EADn c\xE2u tr\u1EA3 l\u1EDDi.",failed:"Kh\xF4ng g\u1EEDi \u0111\u01B0\u1EE3c. H\xE3y th\u1EED l\u1EA1i.",invalid:"C\xE2u tr\u1EA3 l\u1EDDi n\xE0y kh\xF4ng \u0111\u01B0\u1EE3c ch\u1EA5p nh\u1EADn.",next:"Ti\u1EBFp",poweredBy:"\u0110\u01B0\u1EE3c h\u1ED7 tr\u1EE3 b\u1EDFi Prodantix",required:"Tr\u01B0\u1EDDng n\xE0y l\xE0 b\u1EAFt bu\u1ED9c.",sending:"\u0110ang g\u1EEDi\u2026",step:"B\u01B0\u1EDBc {step}/{total}",submit:"G\u1EEDi",thanks:"C\u1EA3m \u01A1n b\u1EA1n."},zh:{back:"\u4E0A\u4E00\u6B65",close:"\u5173\u95ED",closed:"\u6B64\u8868\u5355\u76EE\u524D\u4E0D\u63A5\u53D7\u56DE\u590D\u3002",failed:"\u53D1\u9001\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002",invalid:"\u6B64\u56DE\u7B54\u65E0\u6548\u3002",next:"\u4E0B\u4E00\u6B65",poweredBy:"\u7531 Prodantix \u63D0\u4F9B\u652F\u6301",required:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879\u3002",sending:"\u6B63\u5728\u53D1\u9001\u2026",step:"\u7B2C {step} \u6B65\uFF0C\u5171 {total} \u6B65",submit:"\u63D0\u4EA4",thanks:"\u8C22\u8C22\u3002"}},Me=n=>{var t;let e=(t=(n!=null?n:"").toLowerCase().split("-")[0])!=null?t:"";return e in B?e:"en"};var x="prodantix-form",Sn=`.${x}{font-family:var(--pdx-font);color:var(--pdx-text);background:var(--pdx-background);max-width:var(--pdx-width);box-sizing:border-box;padding:16px;border-radius:var(--pdx-radius)}
1
+ (function(){'use strict';var Bt=Object.defineProperty;var jt=(n,e,t)=>e in n?Bt(n,e,{enumerable:true,configurable:true,writable:true,value:t}):n[e]=t;var d=(n,e,t)=>jt(n,typeof e!="symbol"?e+"":e,t);var M=class extends Error{constructor(t,r,i){super(r,i);d(this,"code");this.code=t,this.name="ProdantixError";}},V=class extends M{constructor(e){super("config",e),this.name="ConfigError";}},D=class extends M{constructor(t,r){super("validation",r);d(this,"field");this.field=t,this.name="ValidationError";}},m=class extends M{constructor(t,r,i){super("transport",t,i);d(this,"status");this.status=r,this.name="TransportError";}};function C(n){if(n)return n;let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}function S(){let n=globalThis.AbortController;return n?new n:void 0}var Be=n=>new Promise(e=>{setTimeout(e,n);});function E(n){return n.replace(/\/+$/,"")}var N=class{constructor(){d(this,"store",new Map);}getItem(e){var t;return (t=this.store.get(e))!=null?t:null}removeItem(e){this.store.delete(e);}setItem(e,t){this.store.set(e,t);}},H=class{constructor(e,t=()=>false){this.real=e;this.passes=t;d(this,"held",new N);d(this,"opened",false);}get isOpen(){return this.opened}open(){this.opened=true;}close(){this.opened=false;}target(e){return this.opened||this.passes(e)?this.real:this.held}getItem(e){return this.target(e).getItem(e)}removeItem(e){this.target(e).removeItem(e);}setItem(e,t){this.target(e).setItem(e,t);}};function je(){try{let n=globalThis.localStorage;if(n){let e="__pdx_probe__";return n.setItem(e,"1"),n.removeItem(e),n}}catch(n){return new N}return new N}var Ge={now:()=>new Date};function Y(n){return n.toISOString()}function Ve(){if(typeof window=="undefined"||typeof Intl=="undefined")return null;let n=Intl.DateTimeFormat().resolvedOptions().timeZone;return typeof n=="string"&&n!==""?n:null}function Gt(){return globalThis.crypto}function Vt(n){n[6]=n[6]&15|64,n[8]=n[8]&63|128;let e=[];for(let t=0;t<16;t+=1)e.push(n[t].toString(16).padStart(2,"0"));return `${e[0]}${e[1]}${e[2]}${e[3]}-${e[4]}${e[5]}-${e[6]}${e[7]}-${e[8]}${e[9]}-${e[10]}${e[11]}${e[12]}${e[13]}${e[14]}${e[15]}`}function Ht(){let n=Gt();if(n!=null&&n.randomUUID)return n.randomUUID();let e=new Uint8Array(16);if(n!=null&&n.getRandomValues)n.getRandomValues(e);else for(let t=0;t<16;t+=1)e[t]=Math.floor(Math.random()*256);return Vt(e)}var He={uuid:Ht};var Ut=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var Jt=/^(?:\$|[a-z])[a-z0-9_.]*$/;function Ue(n){let e=0;for(let t of n)e+=1;return e}function Je(n){return Ut.test(n)}function zt(n){return Jt.test(n)}function ze(n){let e=Ue(n);if(e<1||e>200)throw new D("distinct_id","distinct_id must be between 1 and 200 characters")}function We(n){let e=Ue(n);if(e<1||e>200)throw new D("event_name","event_name must be between 1 and 200 characters");if(!zt(n))throw new D("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var Ye="prodantix-js",Qe="0.8.0";var Wt=n=>{};function Xe(n){var i,o,s,a,l,g,v,c,$,L,f,_,T,z,A;if(!n.apiKey||!Je(n.apiKey))throw new V("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!n.host)throw new V("host is required (the ingest base URL)");let e=E(n.host),t=n.defaultProperties,r=(i=n.storage)!=null?i:new N;return {apiKey:n.apiKey,autocapture:(o=n.autocapture)!=null?o:false,clock:(s=n.clock)!=null?s:Ge,consent:n.consent,consentMode:n.consentMode,defaultProperties:typeof t=="function"?t:()=>t!=null?t:{},describeElement:n.describeElement,flagsHost:n.flagsHost?E(n.flagsHost):e,flushAt:(a=n.flushAt)!=null?a:20,flushIntervalMs:(l=n.flushIntervalMs)!=null?l:1e4,host:e,ids:(g=n.ids)!=null?g:He,locale:n.locale,maxQueueSize:(v=n.maxQueueSize)!=null?v:1e3,maxRetries:(c=n.maxRetries)!=null?c:3,namespace:be(n.apiKey),onError:($=n.onError)!=null?$:Wt,os:n.os,requestTimeoutMs:(L=n.requestTimeoutMs)!=null?L:1e4,sdkName:(f=n.sdkName)!=null?f:Ye,sdkVersion:(_=n.sdkVersion)!=null?_:Qe,sessionTracking:(T=n.sessionTracking)!=null?T:false,sharedStorage:(z=n.sharedStorage)!=null?z:r,socketFactory:n.socketFactory,storage:r,streamFlags:(A=n.streamFlags)!=null?A:false,transport:n.transport}}function be(n){return n.slice(0,16)}var Ze=(n,e)=>{let t={$cta_id:n.id,$cta_kind:n.kind,$cta_variant:n.variant.key,$cta_version:n.version},r=e===void 0?void 0:n.variant.content.buttons[e];return r&&e!==void 0&&(t.$cta_button=e,t.$cta_button_label=r.label,r.action.kind==="form"&&(t.$cta_form_id=r.action.value)),t},Q=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=C(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async ctas(e){let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=new URLSearchParams({anonymous:String(e.anonymous),device:e.device,distinct_id:e.distinctId,language:e.language,url:e.url}),i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s=await t(`${this.host}/v1/ctas?${r.toString()}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(s.status<200||s.status>=300)throw new m(`ctas request failed with status ${s.status}`,s.status);return JSON.parse(await s.text()).ctas}finally{o!==void 0&&clearTimeout(o);}}};function et(n,e,t){var i,o,s;We(n.eventName),ze(n.distinctId);let r={distinct_id:n.distinctId,event_id:(i=n.eventId)!=null?i:t.uuid(),event_name:n.eventName,properties:(o=n.properties)!=null?o:{},schema_version:1,timestamp:Y((s=n.timestamp)!=null?s:e.now())};return n.context&&(r.context=n.context),n.sessionId&&(r.session_id=n.sessionId),r}var q=Symbol("absent");function Yt(n,e){var i,o;if(n==="distinct_id")return e.distinctId;let t=(i=e.properties)!=null?i:{};if(Object.prototype.hasOwnProperty.call(t,n))return t[n];let r=(o=e.attributes)!=null?o:{};return Object.prototype.hasOwnProperty.call(r,n)?r[n]:q}function O(n){return n===q?"undefined":String(n)}function tt(n){return n===q?Number.NaN:Number(n)}function nt(n){return n!==q&&n!==null&&n!==""}function rt(n,e){if(!Array.isArray(e))return false;let t=O(n);return e.map(r=>String(r)).includes(t)}function it(n,e){var i,o;let t=Yt(n.attribute,e),r=n.value;switch(n.op){case "is_set":return nt(t);case "is_not_set":return !nt(t);case "eq":return O(t)===O(r===void 0?q:r);case "neq":return O(t)!==O(r===void 0?q:r);case "contains":return O(t).includes(O(r===void 0?q:r));case "in":return rt(t,r);case "not_in":return Array.isArray(r)?!rt(t,r):false;case "gt":return X(t,r,(s,a)=>s>a);case "gte":return X(t,r,(s,a)=>s>=a);case "lt":return X(t,r,(s,a)=>s<a);case "lte":return X(t,r,(s,a)=>s<=a);case "in_cohort":return typeof r=="string"&&r!==""&&((i=e.cohorts)!=null?i:[]).includes(r);case "not_in_cohort":return typeof r=="string"&&r!==""&&!((o=e.cohorts)!=null?o:[]).includes(r);default:return false}}function X(n,e,t){let r=tt(n),i=e===void 0?Number.NaN:tt(e);return Number.isNaN(r)||Number.isNaN(i)?false:t(r,i)}function st(n,e){let t=`${n}:${e}`,r=2166136261;for(let i=0;i<t.length;i++)r^=t.charCodeAt(i),r=Math.imul(r,16777619);return (r>>>0)%100}function xe(n,e){return n.targeting.length===0||n.targeting.every(t=>it(t,e))}function ot(n,e){var o;let t=st(n.key,e.distinctId),r=(o=n.variations)!=null?o:[];if(r.length===0)return n.rolloutPercentage>=100||t<n.rolloutPercentage?"true":"false";let i=0;for(let s=r.length-1;s>=0;s--)if(i+=r[s].weight,t<i)return r[s].key;return r[0].key}function ke(n,e,t,r){var i;for(let o of (i=n.prerequisites)!=null?i:[]){if(r.includes(o.flagKey))return false;let s=e.find(l=>l.key===o.flagKey);if(!s||!s.enabled)return false;r.push(s.key);let a=ke(s,e,t,r)&&xe(s,t)&&ot(s,t)===o.variationKey;if(r.pop(),!a)return false}return true}function Z(n,e,t){return n.enabled?ke(n,e,t,[n.key])?xe(n,t)?n.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:st(n.key,t.distinctId)<n.rolloutPercentage?{enabled:true,reason:"rollout"}:{enabled:false,reason:"rollout_excluded"}:{enabled:false,reason:"targeting"}:{enabled:false,reason:"prerequisite"}:{enabled:false,reason:"disabled"}}function at(n,e){let t={};for(let r of n)t[r.key]=Z(r,n,e).enabled;return t}function Se(n,e,t){var s,a;let r=(s=n.variations)!=null?s:[],i=r[0];if(!i)return null;if(!n.enabled||!ke(n,e,t,[n.key])||!xe(n,t))return i;let o=ot(n,t);return (a=r.find(l=>l.key===o))!=null?a:i}function dt(n){return n.some(e=>e.targeting.some(t=>t.op==="in_cohort"||t.op==="not_in_cohort"))}function lt(n){return `40${JSON.stringify(n)}`}function ct(){return "3"}function ut(n){let e=n.charAt(0),t=n.slice(1);if(e==="2")return {kind:"ping"};if(e==="1")return {kind:"disconnect"};if(e==="0"){let s=we(t);return {kind:"open",pingInterval:typeof(s==null?void 0:s.pingInterval)=="number"?s.pingInterval:25e3,pingTimeout:typeof(s==null?void 0:s.pingTimeout)=="number"?s.pingTimeout:2e4}}if(e!=="4")return {kind:"other"};let r=t.charAt(0),i=t.slice(1);if(r==="0")return {kind:"connected"};if(r==="1")return {kind:"disconnect"};if(r==="4"){let s=we(i);return {kind:"connectError",message:typeof(s==null?void 0:s.message)=="string"?s.message:"refused"}}if(r!=="2")return {kind:"other"};let o=we(i);return !Array.isArray(o)||typeof o[0]!="string"?{kind:"other"}:{kind:"event",name:o[0],payload:o[1]}}function we(n){try{return JSON.parse(n)}catch(e){return null}}var Qt="/socket.io/?EIO=4&transport=websocket",Xt=250,ee=class{constructor(e){this.options=e;d(this,"socket",null);d(this,"heartbeat",null);d(this,"pending",null);d(this,"lastKey","");d(this,"ready",false);d(this,"closed",false);d(this,"heartbeatWindow",45e3);d(this,"factory");d(this,"setTimer");d(this,"clearTimer");var t,r,i;this.factory=(t=e.socketFactory)!=null?t:Zt,this.setTimer=(r=e.setTimer)!=null?r:((o,s)=>setTimeout(o,s)),this.clearTimer=(i=e.clearTimer)!=null?i:(o=>clearTimeout(o));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${Qt}`,t;try{t=this.factory(e);}catch(r){this.options.onClosed(false);return}this.socket=t,t.onmessage=r=>this.receive(String(r.data)),t.onerror=()=>t.close(),t.onclose=()=>this.fell();}close(){this.closed=true,this.stopHeartbeat(),this.pending!==null&&this.clearTimer(this.pending),this.pending=null;let e=this.socket;this.socket=null,e==null||e.close();}receive(e){var r,i,o,s;let t=ut(e);if(t.kind==="open"){this.armHeartbeat(t.pingInterval+t.pingTimeout),(r=this.socket)==null||r.send(lt({projectKey:this.options.projectKey}));return}if(t.kind==="ping"){this.armHeartbeat(),(i=this.socket)==null||i.send(ct());return}if(t.kind==="connectError"||t.kind==="disconnect"){this.stopHeartbeat(),(o=this.socket)==null||o.close();return}if(t.kind==="event"){if(t.name==="ready"){this.ready=true;return}if(t.name==="flagChange"){let a=(s=t.payload)==null?void 0:s.key;this.lastKey=typeof a=="string"?a:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},Xt));}}}fell(){this.stopHeartbeat();let e=this.ready;this.socket=null,this.ready=false,this.closed||this.options.onClosed(e);}armHeartbeat(e){e!==void 0&&(this.heartbeatWindow=e),this.stopHeartbeat(),this.heartbeat=this.setTimer(()=>{var t;return (t=this.socket)==null?void 0:t.close()},this.heartbeatWindow);}stopHeartbeat(){this.heartbeat!==null&&this.clearTimer(this.heartbeat),this.heartbeat=null;}};function Zt(n){let e=globalThis.WebSocket;if(!e)throw new m("no WebSocket");return new e(n)}var te=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=C(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){var s,a;let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let l=await t(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!l.ok)throw new m(`flags request failed with status ${l.status}`,l.status);let g=JSON.parse(await l.text());return {flags:(s=g.flags)!=null?s:{},variants:(a=g.variants)!=null?a:{}}}finally{o!==void 0&&clearTimeout(o);}}async snapshot(){var o;let e=this.fetch;if(!e)throw new m("no fetch implementation available in this runtime");let t=`${this.host}/v1/flags/snapshot`,r=S(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await e(t,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new m(`flag snapshot request failed with status ${s.status}`,s.status);let a=JSON.parse(await s.text()),l={flags:(o=a.flags)!=null?o:[],generatedAt:a.generatedAt};return typeof a.socketUrl=="string"&&a.socketUrl!==""&&(l.socketUrl=a.socketUrl),l}finally{i!==void 0&&clearTimeout(i);}}async memberships(e){var s;let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await t(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new m(`memberships request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).cohorts)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};var pt="$form_viewed",mt="$form_started",U=class extends Error{constructor(t,r,i){super(i);d(this,"fields");d(this,"status");this.name="FormRefusedError",this.status=t,this.fields=r;}},ne=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=C(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async request(e,t){let r=this.fetch;if(!r)throw new m("no fetch implementation available in this runtime");let i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s={authorization:`Bearer ${this.projectKey}`};t.body!==void 0&&(s["content-type"]="application/json");let a=await r(`${this.host}${e}`,{body:t.body,headers:s,method:t.method,signal:i==null?void 0:i.signal});return {status:a.status,text:await a.text()}}finally{o!==void 0&&clearTimeout(o);}}async form(e,t){let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}?distinct_id=${encodeURIComponent(t)}`,{method:"GET"});if(r<200||r>=300)throw new m(`form request failed with status ${r}`,r);return JSON.parse(i)}async submit(e,t){var a,l,g,v;let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}/submissions`,{body:JSON.stringify(t),method:"POST"});if(r>=200&&r<300)return JSON.parse(i).afterSubmit;let o=[],s=`form submission failed with status ${r}`;try{let c=JSON.parse(i);o=(l=(a=c.error)==null?void 0:a.fields)!=null?l:[],s=(v=(g=c.error)==null?void 0:g.message)!=null?v:s;}catch(c){o=[];}throw new U(r,o,s)}};var gt="$survey_shown",ht="$survey_dismissed",ft="$survey_sent",re=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=C(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async surveys(e,t){var s;let r=this.fetch;if(!r)throw new m("no fetch implementation available in this runtime");let i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await r(`${this.host}/v1/surveys?distinct_id=${encodeURIComponent(e)}${t?`&lang=${encodeURIComponent(t)}`:""}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new m(`surveys request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).surveys)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};function ie(n,e){let t={$survey_id:n.id,$survey_iteration:n.iteration,$survey_name:n.name};for(let[r,i]of Object.entries(e))t[`$survey_response_${r}`]=i;return t}var se=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=C(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async guides(e){var o;let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=S(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await t(`${this.host}/v1/guides?distinct_id=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new m(`guides request failed with status ${s.status}`,s.status);return (o=JSON.parse(await s.text()).guides)!=null?o:[]}finally{i!==void 0&&clearTimeout(i);}}};function yt(n,e){let t={$guide_id:n.id,$guide_iteration:n.iteration,$guide_name:n.name};return e!==void 0&&(t.$guide_step_id=e),t}function Ee(n){if(typeof n!="string")return;let e=Array.from(n).length;return e>=1&&e<=200?n:void 0}function Te(n,e){return `pdx.${n}.${e}`}var Fe="consent",en=["identityLink","analytics","marketing","functional"];function Ce(n){if(typeof n!="string")return null;try{let e=JSON.parse(n);if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e,r={};for(let i of en){let o=t[i];typeof o=="boolean"&&(r[i]=o);}return typeof t.version=="number"&&Number.isInteger(t.version)&&(r.version=t.version),Array.isArray(t.categories)&&t.categories.every(i=>typeof i=="string")&&(r.categories=t.categories),Object.keys(r).length===0?null:r}catch(e){return null}}var vt=n=>n.endsWith(`.${Fe}`);function ae(n,e){return Ce(n.getItem(Te(e,Fe)))}function tn(n,e,t){var s;let r=Te(e,Fe),i=Ce(JSON.stringify(t)),o=i===null?null:Ce(JSON.stringify({...(s=ae(n,e))!=null?s:{},...i}));if(o===null){n.removeItem(r);return}n.setItem(r,JSON.stringify(o));}var oe=class{constructor(e,t,r,i){this.storage=e;this.shared=t;this.ids=r;this.namespace=i;d(this,"anonymousId");d(this,"distinctId");d(this,"identified");this.refresh();}refresh(){let e=Ee(this.shared.getItem(this.key("anonymous_id"))),t=Ee(this.storage.getItem(this.key("anonymous_id")));e?(this.anonymousId=e,t!==e&&this.storage.setItem(this.key("anonymous_id"),e)):t?(this.anonymousId=t,this.shared.setItem(this.key("anonymous_id"),t)):(this.anonymousId=this.ids.uuid(),this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId));let r=Ee(this.storage.getItem(this.key("distinct_id")));r?(this.distinctId=r,this.identified=true):(this.distinctId=this.anonymousId,this.identified=false);}getAnonymousId(){return this.anonymousId}getDistinctId(){return this.distinctId}isIdentified(){return this.identified}snapshot(){return {anonymousId:this.anonymousId,distinctId:this.distinctId,identified:this.identified}}consent(){return ae(this.shared,this.namespace)}setConsent(e){tn(this.shared,this.namespace,e);}assumeAnonymousId(e){this.anonymousId=e,this.shared.setItem(this.key("anonymous_id"),e),this.storage.setItem(this.key("anonymous_id"),e),this.identified||(this.distinctId=e);}identify(e){var o;let t=!this.identified||this.distinctId!==e,r=this.storage.getItem(this.key("linked_anonymous_id")),i=t||r!==this.anonymousId;return this.distinctId=e,this.identified=true,t&&this.storage.setItem(this.key("distinct_id"),e),!i||((o=this.consent())==null?void 0:o.identityLink)===false?{changed:t}:(this.storage.setItem(this.key("linked_anonymous_id"),this.anonymousId),{anonymousToLink:this.anonymousId,changed:t})}reset(){this.anonymousId=this.ids.uuid(),this.distinctId=this.anonymousId,this.identified=false,this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.removeItem(this.key("distinct_id")),this.storage.removeItem(this.key("linked_anonymous_id"));}key(e){return Te(this.namespace,e)}};var de=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=C(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async inbox(e){var s;let t=this.requireFetch(),r=`${this.host}/v1/messages?distinct_id=${encodeURIComponent(e)}`,i=await this.request(t,r,{headers:this.authHeaders(),method:"GET"});if(!i.ok)throw new m(`inbox request failed with status ${i.status}`,i.status);return (s=JSON.parse(await i.text()).messages)!=null?s:[]}async markRead(e,t){let r=this.requireFetch(),i=`${this.host}/v1/messages/read`,o=await this.request(r,i,{body:JSON.stringify({distinct_id:t,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!o.ok)throw new m(`mark-read request failed with status ${o.status}`,o.status)}requireFetch(){if(!this.fetch)throw new m("no fetch implementation available in this runtime");return this.fetch}authHeaders(){return {authorization:`Bearer ${this.projectKey}`}}async request(e,t,r){let i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(t,{...r,signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}};var le=class{constructor(e,t){this.maxSize=e;this.onOverflow=t;d(this,"events",[]);}get size(){return this.events.length}enqueue(e){this.events.push(e),this.enforceCap();}restore(e){this.events.push(...e),this.enforceCap();}requeue(e){this.events.unshift(...e),this.enforceCap();}drain(e){let t=e===void 0?this.events.length:Math.min(e,this.events.length);return this.events.splice(0,t)}snapshot(){return [...this.events]}enforceCap(){var t;if(this.events.length<=this.maxSize)return;let e=this.events.splice(0,this.events.length-this.maxSize);(t=this.onOverflow)==null||t.call(this,{dropped:e});}};var nn={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function rn(n){return `pdx.${n}.session`}var ce=class{constructor(e,t,r,i,o=nn){this.storage=e;this.ids=t;this.clock=r;this.namespace=i;this.options=o;}current(){return this.touch().id}startedAt(){return this.touch().startedAt}reset(){this.storage.removeItem(this.key());}touch(){let e=this.clock.now().getTime(),t=this.live(this.read(),e);if(t===void 0)return this.write({id:this.ids.uuid(),lastActivityAt:e,startedAt:e});if(e-t.lastActivityAt<=this.options.throttleMs)return t;let r=this.live(this.read(),e),i=r!==void 0&&r.id!==t.id?r:t;return this.write({...i,lastActivityAt:e})}live(e,t){if(e!==void 0&&!(t-e.lastActivityAt>this.options.idleMs||t-e.startedAt>this.options.maxMs))return e}write(e){return this.storage.setItem(this.key(),JSON.stringify(e)),e}read(){let e=this.storage.getItem(this.key());if(e)try{let t=JSON.parse(e);return typeof t.id=="string"&&typeof t.startedAt=="number"&&typeof t.lastActivityAt=="number"?{id:t.id,lastActivityAt:t.lastActivityAt,startedAt:t.startedAt}:void 0}catch(t){return}}key(){return rn(this.namespace)}};var k={createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",set:"$set"};function bt(n){return n>=400&&n<500&&n!==429}var K=class{constructor(e={}){d(this,"fetch");d(this,"maxRetries");d(this,"requestTimeoutMs");d(this,"baseDelayMs");d(this,"maxDelayMs");d(this,"sleep");d(this,"random");var t,r,i,o,s,a;this.fetch=C(e.fetch),this.maxRetries=(t=e.maxRetries)!=null?t:3,this.requestTimeoutMs=(r=e.requestTimeoutMs)!=null?r:1e4,this.baseDelayMs=(i=e.baseDelayMs)!=null?i:500,this.maxDelayMs=(o=e.maxDelayMs)!=null?o:3e4,this.sleep=(s=e.sleep)!=null?s:Be,this.random=(a=e.random)!=null?a:Math.random;}async send(e){let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=JSON.stringify(e.body),i;for(let o=0;o<=this.maxRetries;o+=1){try{let s=await this.attempt(t,e,r);if(s.ok)return;if(bt(s.status))throw new m(`ingest rejected batch with status ${s.status}`,s.status);i=new m(`ingest transient status ${s.status}`,s.status);}catch(s){if(s instanceof m&&s.status!==void 0&&bt(s.status))throw s;i=s;}o<this.maxRetries&&await this.sleep(this.backoff(o));}throw new m("ingest delivery failed after retries",void 0,{cause:i})}async attempt(e,t,r){let i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(t.url,{body:r,headers:{authorization:`Bearer ${t.projectKey}`,"content-type":"application/json"},method:"POST",signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};var sn="queue",on=1e3,xt=3e4,_e=n=>{let e={};return n.avatar!==void 0&&(e.$avatar=n.avatar),n.email!==void 0&&(e.$email=n.email),n.name!==void 0&&(e.$name=n.name),n.phone!==void 0&&(e.$phone=n.phone),e},ue=class{constructor(e){d(this,"config");d(this,"identity");d(this,"session");d(this,"queue");d(this,"transport");d(this,"flagsClient");d(this,"messagesClient");d(this,"surveysClient");d(this,"guidesClient");d(this,"captureListeners",new Set);d(this,"formsClient");d(this,"ctasClient");d(this,"context");d(this,"flushTimer");d(this,"flushing",false);d(this,"cachedFlags");d(this,"cachedSnapshot");d(this,"membershipCache");d(this,"stream");d(this,"shutDown",false);d(this,"exposures",new Set);d(this,"gates");d(this,"cookielessId");d(this,"storageListeners",new Set);var s,a,l;let t=Xe(e),r=(a=(s=ae(t.sharedStorage,t.namespace))!=null?s:t.consent)!=null?a:null;if(this.gates=[new H(t.storage),new H(t.sharedStorage,vt)],t.consentMode!=="banner"||(r==null?void 0:r.analytics)===true)for(let g of this.gates)g.open();let[i,o]=this.gates;this.config={...t,sharedStorage:o,storage:i},this.identity=new oe(this.config.storage,this.config.sharedStorage,this.config.ids,this.config.namespace),this.config.consent!==void 0&&this.identity.setConsent(this.config.consent),this.session=this.config.sessionTracking?new ce(this.config.sharedStorage,this.config.ids,this.config.clock,this.config.namespace):void 0,this.queue=new le(this.config.maxQueueSize,({dropped:g})=>{this.config.onError(new M("queue_overflow",`event queue overflow: dropped ${g.length} oldest event(s)`));}),this.transport=(l=this.config.transport)!=null?l:new K({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new te({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new de({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.surveysClient=new re({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.guidesClient=new se({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.formsClient=new ne({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.ctasClient=new Q({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.context={sdk:this.config.sdkName,sdk_version:this.config.sdkVersion},this.config.os&&(this.context.os=this.config.os),this.config.locale&&(this.context.locale=this.config.locale),this.restoreQueue(),this.startTimer();}get distinctId(){return this.identity.getDistinctId()}get anonymousId(){return this.identity.getAnonymousId()}get isIdentified(){return this.identity.isIdentified()}get sessionId(){var e;return (e=this.session)==null?void 0:e.current()}get sessionStartedAt(){var e;return (e=this.session)==null?void 0:e.startedAt()}capture(e,t={}){var r,i,o,s,a,l,g;try{this.identity.refresh();let v={...this.config.defaultProperties(),...t.element===void 0?{}:(o=(i=(r=this.config).describeElement)==null?void 0:i.call(r,t.element))!=null?o:{},...(s=t.properties)!=null?s:{}},c=et({context:this.context,distinctId:(a=t.distinctId)!=null?a:this.identity.getDistinctId(),eventName:e,properties:v,sessionId:(g=t.sessionId)!=null?g:(l=this.session)==null?void 0:l.current(),timestamp:t.timestamp},this.config.clock,this.config.ids);this.enqueue(c);}catch(v){this.config.onError(v);}for(let v of this.captureListeners)try{v(e);}catch(c){this.config.onError(c);}}onCapture(e){return this.captureListeners.add(e),()=>{this.captureListeners.delete(e);}}identify(e,t={}){var a,l;if(this.isCookieless())return;this.identity.refresh();let r=this.identity.identify(e),i={};r.anonymousToLink!==void 0&&(i.$anon_distinct_id=r.anonymousToLink);let o=Ve(),s={...o===null?{}:{$timezone:o},..._e((a=t.traits)!=null?a:{}),...(l=t.set)!=null?l:{}};Object.keys(s).length>0&&(i.$set=s),this.capture(k.identify,{properties:i});}link(e,t,r){if(this.isCookieless())return;let i={$anon_distinct_id:t},o=_e(r!=null?r:{});Object.keys(o).length>0&&(i.$set=o),this.capture(k.identify,{distinctId:e,properties:i});}setConsent(e){this.identity.setConsent(e),e.analytics===true&&this.allowStorage(),e.analytics===false&&this.config.consentMode==="banner"&&this.forbidStorage();}isCookieless(){return !this.gates[0].isOpen}takeCookielessId(e){this.cookielessId=e,this.isCookieless()&&this.identity.assumeAnonymousId(e);}allowStorage(){if(this.isCookieless()){for(let e of this.gates)e.open();this.identity.refresh();for(let e of [...this.storageListeners])e();}}onStorageAllowed(e){return this.storageListeners.add(e),()=>{this.storageListeners.delete(e);}}forbidStorage(){if(!this.isCookieless()){for(let e of ["anonymous_id","distinct_id","linked_anonymous_id","session"])this.config.storage.removeItem(`pdx.${this.config.namespace}.${e}`),this.config.sharedStorage.removeItem(`pdx.${this.config.namespace}.${e}`);for(let e of this.gates)e.close();this.identity.refresh(),this.cookielessId!==void 0&&this.identity.assumeAnonymousId(this.cookielessId);}}consent(){return this.identity.consent()}alias(e){this.capture(k.createAlias,{properties:{alias:e}});}group(e,t,r){let i={$group_key:t,$group_type:e};r&&(i.$set=r),this.capture(k.group,{properties:i});}setPersonProperties(e,t){if(this.isCookieless())return;let r={};e&&(r.$set=e),t&&(r.$set_once=t),this.capture(k.set,{properties:r});}setPersonTraits(e){if(this.isCookieless())return;let t=_e(e);Object.keys(t).length!==0&&this.capture(k.set,{properties:{$set:t}});}async getAllFlags(){var r;let e=this.identity.getDistinctId(),t=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:t.flags,variants:(r=t.variants)!=null?r:{}},t.flags}async isFeatureEnabled(e){var i,o,s,a;let r=(i=(await this.getAllFlags())[e])!=null?i:false;return this.recordExposure(e,(a=(s=(o=this.cachedFlags)==null?void 0:o.variants[e])==null?void 0:s.key)!=null?a:String(r)),r}async getVariant(e){var i,o,s,a;let t=await this.getAllFlags(),r=(o=(i=this.cachedFlags)==null?void 0:i.variants[e])!=null?o:null;return this.recordExposure(e,(a=r==null?void 0:r.key)!=null?a:String((s=t[e])!=null?s:false)),r}async getVariantLocal(e,t={}){var l;let r=await this.flagSnapshot(),i=r.flags.find(g=>g.key===e),o=await this.localContext(t,r.flags),s=i?Se(i,r.flags,o):null,a=i?Z(i,r.flags,o).enabled:false;return this.recordExposure(e,(l=s==null?void 0:s.key)!=null?l:String(a)),s?{key:s.key,value:s.value}:null}recordExposure(e,t){let r=`${this.identity.getDistinctId()} ${e} ${t}`;this.exposures.has(r)||(this.exposures.add(r),this.capture(k.featureFlagCalled,{properties:{$feature_flag:e,$feature_flag_response:t}}));}getCachedFlag(e){if(!(!this.cachedFlags||this.cachedFlags.distinctId!==this.distinctId))return this.cachedFlags.flags[e]}async getLocalFlags(e={}){let t=await this.flagSnapshot();return at(t.flags,await this.localContext(e,t.flags))}async isFeatureEnabledLocal(e,t={}){var a,l;let r=await this.flagSnapshot(),i=r.flags.find(g=>g.key===e),o=await this.localContext(t,r.flags),s=i?Z(i,r.flags,o).enabled:false;return this.recordExposure(e,(l=i?(a=Se(i,r.flags,o))==null?void 0:a.key:void 0)!=null?l:String(s)),s}async localContext(e,t){let r=this.identity.getDistinctId(),i=e.cohorts;if(i===void 0&&dt(t)){let o=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===r&&o-this.membershipCache.fetchedAt<xt?i=this.membershipCache.cohorts:(i=await this.flagsClient.memberships(r),this.membershipCache={cohorts:i,distinctId:r,fetchedAt:o});}return {attributes:e.attributes,cohorts:i,distinctId:r,properties:e.properties}}async flagSnapshot(){let e=this.config.clock.now().getTime();if(this.cachedSnapshot&&e-this.cachedSnapshot.fetchedAt<xt)return this.cachedSnapshot.snapshot;let t=await this.flagsClient.snapshot();return this.cachedSnapshot={fetchedAt:e,snapshot:t},this.maybeStream(t),t}maybeStream(e){if(!this.config.streamFlags||this.shutDown||this.stream||!e.socketUrl)return;let t=new ee({host:e.socketUrl,onChange:()=>{this.cachedSnapshot=void 0,this.flagSnapshot().catch(r=>this.config.onError(r));},onClosed:r=>{this.stream=void 0,r&&this.maybeStream(e);},projectKey:this.config.apiKey,socketFactory:this.config.socketFactory});this.stream=t,t.open();}async getInbox(){return this.messagesClient.inbox(this.identity.getDistinctId())}async markMessageRead(e){await this.messagesClient.markRead(e,this.identity.getDistinctId());}async getSurveys(e){return this.surveysClient.surveys(this.identity.getDistinctId(),e!=null?e:this.config.locale)}captureSurveyShown(e){this.capture(gt,{properties:ie(e,{})});}captureSurveyDismissed(e){this.capture(ht,{properties:ie(e,{})});}captureSurveySent(e,t){this.capture(ft,{properties:ie(e,t)});}async getGuides(){return this.guidesClient.guides(this.identity.getDistinctId())}captureGuide(e,t,r){this.capture(e,{properties:yt(t,r)});}async getForm(e){return this.formsClient.form(e,this.identity.getDistinctId())}async submitForm(e,t,r,i){let{$page_id:o,$page_variant:s}=this.config.defaultProperties();return this.formsClient.submit(e,{answers:t,challenge:r,distinctId:this.identity.getDistinctId(),isAnonymous:!this.identity.isIdentified(),pageUrl:typeof window=="undefined"?"":window.location.href,solution:i,...typeof o=="string"&&typeof s=="string"?{pageId:o,pageVariant:s}:{}})}async getCtas(e){return this.ctasClient.ctas({...e,anonymous:!this.identity.isIdentified(),distinctId:this.identity.getDistinctId()})}captureCta(e,t,r){this.capture(e,{properties:Ze(t,r)});}async flush(){if(this.flushing||this.queue.size===0)return;this.flushing=true;let e=this.queue.drain(on);try{await this.transport.send({body:{events:e,sent_at:Y(this.config.clock.now())},projectKey:this.config.apiKey,url:`${this.config.host}/v1/events`}),this.persistQueue();}catch(t){this.queue.requeue(e),this.persistQueue(),this.config.onError(t);}finally{this.flushing=false;}}reset(){var e;(e=this.session)==null||e.reset(),this.identity.reset(),this.cachedFlags=void 0,this.cachedSnapshot=void 0,this.membershipCache=void 0;}async shutdown(){var e;this.shutDown=true,this.stopTimer(),(e=this.stream)==null||e.close(),this.stream=void 0,await this.flush();}enqueue(e){this.queue.enqueue(e),this.persistQueue(),this.queue.size>=this.config.flushAt&&this.flush();}persistQueue(){try{this.config.storage.setItem(this.persistKey(),JSON.stringify(this.queue.snapshot()));}catch(e){this.config.onError(e);}}restoreQueue(){try{let e=this.config.storage.getItem(this.persistKey());if(!e)return;let t=JSON.parse(e);Array.isArray(t)&&this.queue.restore(t);}catch(e){this.config.onError(e);}}startTimer(){if(this.config.flushIntervalMs<=0)return;let e=setInterval(()=>{this.flush();},this.config.flushIntervalMs),t=e;typeof t.unref=="function"&&t.unref(),this.flushTimer=e;}stopTimer(){this.flushTimer!==void 0&&(clearInterval(this.flushTimer),this.flushTimer=void 0);}persistKey(){return `pdx.${this.config.namespace}.${sn}`}};function an(){let n=globalThis.document;return (n==null?void 0:n.visibilityState)==="hidden"}function dn(n){let e=globalThis.navigator,t=globalThis.Blob;if(!(e!=null&&e.sendBeacon)||!t)return false;let r=JSON.stringify({...n.body,api_key:n.projectKey});try{let i=new t([r],{type:"application/json"});return e.sendBeacon(n.url,i)}catch(i){return false}}var pe=class{constructor(e={}){d(this,"fetchTransport");this.fetchTransport=new K(e);}async send(e){an()&&dn(e)||await this.fetchTransport.send(e);}};var Ie="prodantix:consent-ready",$e="prodantix:consent",kt="__prodantixConsent";var St=(n,e)=>{n.takeCookielessId(e.anonymousId),e.consent!==null?n.setConsent(e.consent):e.rule==="notice"&&n.allowStorage();},wt=(n,e)=>{let t=e[kt];t&&St(n,t);let r=o=>{let s=o.detail;s&&St(n,s);},i=o=>{let s=o.detail;s&&n.setConsent(s);};return e.addEventListener(Ie,r),e.addEventListener($e,i),()=>{e.removeEventListener(Ie,r),e.removeEventListener($e,i);}};var ln=/^\d{1,3}(\.\d{1,3}){3}$/,cn=/^[a-z0-9.-]+$/i;function Et(){return Math.random().toString(36).slice(2,12)}function me(n,e){let t=`${e}=`,r=[];for(let i of n.cookie.split(";")){let o=i.trim();o.startsWith(t)&&r.push(o.slice(t.length));}return r}function J(n,e,t){let r=["Path=/",`Max-Age=${e}`,"SameSite=Lax"];return n&&r.push(`Domain=${n}`),t&&r.push("Secure"),r.join("; ")}function Ct(n,e,t,r){try{let i=`pdx_probe_${r()}`,o=r();n.cookie=`${i}=${o}; ${J(e,60,t)}`;let s=me(n,i).includes(o);n.cookie=`${i}=; ${J(e,0,t)}`;let a=me(n,i).includes(o);return s&&!a}catch(i){return false}}function un(n){let e=n.replace(/^\[|\]$/g,"").toLowerCase();if(e.includes(":")||ln.test(e)||!e.includes("."))return [];let t=e.split("."),r=[];for(let i=t.length-2;i>=0;i-=1)r.push(t.slice(i).join("."));return r}function pn(n,e,t,r=Et){for(let i of un(n))if(Ct(e,i,t,r))return i}function mn(n){let e=new Map,t=JSON.parse(decodeURIComponent(n));if(t===null||typeof t!="object"||Array.isArray(t))return e;for(let[r,i]of Object.entries(t))typeof i=="string"&&e.set(r,i);return e}var Ae=class{constructor(e,t,r,i){this.jar=e;this.name=t;this.domain=r;this.secure=i;}getItem(e){var t;return (t=this.read().get(e))!=null?t:null}setItem(e,t){let r=this.read();r.set(e,t),this.write(r);}removeItem(e){let t=this.read();t.delete(e)&&this.write(t);}read(){try{let e=me(this.jar,this.name);e.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${J(void 0,0,this.secure)}`,e=me(this.jar,this.name));let t=e[0];return t?mn(t):new Map}catch(e){return new Map}}write(e){try{if(e.size===0){this.jar.cookie=`${this.name}=; ${J(this.domain,0,this.secure)}`;return}let t=encodeURIComponent(JSON.stringify(Object.fromEntries(e)));this.jar.cookie=`${this.name}=${t}; ${J(this.domain,31536e3,this.secure)}`;}catch(t){return}}};function gn(){return globalThis.document}function hn(){var n,e;return (e=(n=globalThis.location)==null?void 0:n.hostname)!=null?e:""}function fn(){var n;return ((n=globalThis.location)==null?void 0:n.protocol)==="https:"}function yn(n){if(n===void 0)return;let e=n.startsWith(".")?n.slice(1):n;return cn.test(e)?e.toLowerCase():void 0}function Tt(n){var s,a,l,g,v;let e="jar"in n?n.jar:gn();if(!e||((s=globalThis.navigator)==null?void 0:s.cookieEnabled)===false)return null;let r=(a=n.random)!=null?a:Et,i=(l=n.secure)!=null?l:fn(),o=(g=n.hostname)!=null?g:hn();try{let c=(v=yn(n.domain))!=null?v:pn(o,e,i,r);return Ct(e,c,i,r)?new Ae(e,n.name,c,i):null}catch(c){return null}}var Ft=n=>`prodantix-form-popup:${n}`,vn=n=>{try{let e=window.localStorage.getItem(Ft(n));return e===null?null:Number(e)}catch(e){return null}},bn=(n,e)=>{try{window.localStorage.setItem(Ft(n),String(e));}catch(t){return}},_t=(n,e,t)=>t===null||e-t>=n.periodDays*864e5,Pe=(n,e,t=Date.now)=>{if(!_t(n,t(),vn(n.formId)))return ()=>{};let r=false,i=[],o=()=>{if(!r){r=true;for(let a of i)a();bn(n.formId,t()),e();}},s=n.trigger;if(s.kind==="delay"){let a=setTimeout(o,s.seconds*1e3);i.push(()=>clearTimeout(a));}else if(s.kind==="scroll"){let a=()=>{let l=document.documentElement.scrollHeight-window.innerHeight;(l<=0||window.scrollY/l*100>=s.percent)&&o();};window.addEventListener("scroll",a,{passive:true}),i.push(()=>window.removeEventListener("scroll",a));}else {let a=l=>{l.relatedTarget===null&&l.clientY<=0&&o();};document.addEventListener("mouseout",a),i.push(()=>document.removeEventListener("mouseout",a));}return ()=>{r=true;for(let a of i)a();}},Re=n=>{if(!n)return null;if(n==="exit")return {kind:"exit"};let[e,t]=n.split(":"),r=Number(t);return !Number.isFinite(r)||r<0?null:e==="delay"?{kind:"delay",seconds:r}:e==="scroll"?{kind:"scroll",percent:Math.min(100,r)}:null};var xn=n=>{let e=0;for(let t of n){if(t!==0)return e+Math.clz32(t)-24;e+=8;}return e},kn=async n=>new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(n))),It=async n=>{for(let e=0;;e+=1){let t=e.toString(36);if(xn(await kn(`${n.nonce}:${t}`))>=n.difficulty)return t}};var B={am:{back:"\u1270\u1218\u1208\u1235",close:"\u12DD\u130B",closed:"\u12ED\u1205 \u1245\u133D \u12A0\u1201\u1295 \u121D\u120B\u123E\u127D\u1295 \u12A0\u12ED\u1240\u1260\u120D\u121D\u1362",failed:"\u1218\u120B\u12AD \u12A0\u120D\u1270\u127B\u1208\u121D\u1362 \u12A5\u1295\u12F0\u1308\u1293 \u12ED\u121E\u12AD\u1229\u1362",invalid:"\u12ED\u1205 \u1218\u120D\u1235 \u12A0\u12ED\u1240\u1260\u120D\u121D\u1362",next:"\u1240\u1323\u12ED",poweredBy:"\u1260Prodantix \u12E8\u1270\u1230\u122B",required:"\u12ED\u1205 \u12EB\u1235\u1348\u120D\u130B\u120D\u1362",sending:"\u1260\u1218\u120B\u12AD \u120B\u12ED\u2026",step:"\u12F0\u1228\u1303 {step} \u12A8{total}",submit:"\u120B\u12AD",thanks:"\u12A5\u1293\u1218\u1230\u130D\u1293\u1208\u1295\u1362"},ar:{back:"\u0631\u062C\u0648\u0639",close:"\u0625\u063A\u0644\u0627\u0642",closed:"\u0644\u0627 \u064A\u0642\u0628\u0644 \u0647\u0630\u0627 \u0627\u0644\u0646\u0645\u0648\u0630\u062C \u0631\u062F\u0648\u062F\u064B\u0627 \u0627\u0644\u0622\u0646.",failed:"\u062A\u0639\u0630\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644. \u062D\u0627\u0648\u0644 \u0645\u0631\u0629 \u0623\u062E\u0631\u0649.",invalid:"\u0647\u0630\u0647 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629.",next:"\u0627\u0644\u062A\u0627\u0644\u064A",poweredBy:"\u0645\u062F\u0639\u0648\u0645 \u0645\u0646 Prodantix",required:"\u0647\u0630\u0627 \u0627\u0644\u062D\u0642\u0644 \u0645\u0637\u0644\u0648\u0628.",sending:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u2026",step:"\u0627\u0644\u062E\u0637\u0648\u0629 {step} \u0645\u0646 {total}",submit:"\u0625\u0631\u0633\u0627\u0644",thanks:"\u0634\u0643\u0631\u064B\u0627 \u0644\u0643."},bn:{back:"\u09AA\u09C7\u099B\u09A8\u09C7",close:"\u09AC\u09A8\u09CD\u09A7 \u0995\u09B0\u09C1\u09A8",closed:"\u098F\u0987 \u09AB\u09B0\u09CD\u09AE\u099F\u09BF \u098F\u0996\u09A8 \u0989\u09A4\u09CD\u09A4\u09B0 \u09A8\u09BF\u099A\u09CD\u099B\u09C7 \u09A8\u09BE\u0964",failed:"\u09AA\u09BE\u09A0\u09BE\u09A8\u09CB \u09AF\u09BE\u09AF\u09BC\u09A8\u09BF\u0964 \u0986\u09AC\u09BE\u09B0 \u099A\u09C7\u09B7\u09CD\u099F\u09BE \u0995\u09B0\u09C1\u09A8\u0964",invalid:"\u098F\u0987 \u0989\u09A4\u09CD\u09A4\u09B0\u099F\u09BF \u0997\u09CD\u09B0\u09B9\u09A3\u09AF\u09CB\u0997\u09CD\u09AF \u09A8\u09AF\u09BC\u0964",next:"\u09AA\u09B0\u09AC\u09B0\u09CD\u09A4\u09C0",poweredBy:"Prodantix \u09A6\u09CD\u09AC\u09BE\u09B0\u09BE \u099A\u09BE\u09B2\u09BF\u09A4",required:"\u098F\u099F\u09BF \u0986\u09AC\u09B6\u09CD\u09AF\u0995\u0964",sending:"\u09AA\u09BE\u09A0\u09BE\u09A8\u09CB \u09B9\u099A\u09CD\u099B\u09C7\u2026",step:"\u09A7\u09BE\u09AA {step} / {total}",submit:"\u099C\u09AE\u09BE \u09A6\u09BF\u09A8",thanks:"\u09A7\u09A8\u09CD\u09AF\u09AC\u09BE\u09A6\u0964"},de:{back:"Zur\xFCck",close:"Schlie\xDFen",closed:"Dieses Formular nimmt gerade keine Antworten an.",failed:"Senden fehlgeschlagen. Bitte erneut versuchen.",invalid:"Diese Antwort wird nicht angenommen.",next:"Weiter",poweredBy:"Bereitgestellt von Prodantix",required:"Dieses Feld ist erforderlich.",sending:"Wird gesendet\u2026",step:"Schritt {step} von {total}",submit:"Absenden",thanks:"Vielen Dank."},en:{back:"Back",close:"Close",closed:"This form is not accepting responses right now.",failed:"This could not be sent. Try again.",invalid:"This answer is not accepted.",next:"Next",poweredBy:"Powered by Prodantix",required:"This is required.",sending:"Sending\u2026",step:"Step {step} of {total}",submit:"Submit",thanks:"Thank you."},es:{back:"Atr\xE1s",close:"Cerrar",closed:"Este formulario no acepta respuestas ahora.",failed:"No se pudo enviar. Int\xE9ntalo de nuevo.",invalid:"Esta respuesta no se acepta.",next:"Siguiente",poweredBy:"Con la tecnolog\xEDa de Prodantix",required:"Este campo es obligatorio.",sending:"Enviando\u2026",step:"Paso {step} de {total}",submit:"Enviar",thanks:"Gracias."},et:{back:"Tagasi",close:"Sulge",closed:"See vorm ei v\xF5ta praegu vastuseid vastu.",failed:"Saatmine eba\xF5nnestus. Proovi uuesti.",invalid:"Seda vastust ei v\xF5eta vastu.",next:"Edasi",poweredBy:"Toetab Prodantix",required:"See on kohustuslik.",sending:"Saatmine\u2026",step:"Samm {step}/{total}",submit:"Saada",thanks:"Ait\xE4h."},fil:{back:"Bumalik",close:"Isara",closed:"Hindi tumatanggap ng sagot ang form na ito ngayon.",failed:"Hindi naipadala. Subukan ulit.",invalid:"Hindi tinatanggap ang sagot na ito.",next:"Susunod",poweredBy:"Pinapagana ng Prodantix",required:"Kailangan ito.",sending:"Ipinapadala\u2026",step:"Hakbang {step} sa {total}",submit:"Ipadala",thanks:"Salamat."},fr:{back:"Retour",close:"Fermer",closed:"Ce formulaire n\u2019accepte plus de r\xE9ponses pour le moment.",failed:"L\u2019envoi a \xE9chou\xE9. R\xE9essayez.",invalid:"Cette r\xE9ponse n\u2019est pas accept\xE9e.",next:"Suivant",poweredBy:"Propuls\xE9 par Prodantix",required:"Ce champ est obligatoire.",sending:"Envoi\u2026",step:"\xC9tape {step} sur {total}",submit:"Envoyer",thanks:"Merci."},hi:{back:"\u092A\u0940\u091B\u0947",close:"\u092C\u0902\u0926 \u0915\u0930\u0947\u0902",closed:"\u092F\u0939 \u092B\u093C\u0949\u0930\u094D\u092E \u0905\u092D\u0940 \u091C\u0935\u093E\u092C \u0928\u0939\u0940\u0902 \u0932\u0947 \u0930\u0939\u093E \u0939\u0948\u0964",failed:"\u092D\u0947\u091C\u093E \u0928\u0939\u0940\u0902 \u091C\u093E \u0938\u0915\u093E\u0964 \u092B\u093F\u0930 \u0915\u094B\u0936\u093F\u0936 \u0915\u0930\u0947\u0902\u0964",invalid:"\u092F\u0939 \u091C\u0935\u093E\u092C \u0938\u094D\u0935\u0940\u0915\u093E\u0930 \u0928\u0939\u0940\u0902 \u0939\u0948\u0964",next:"\u0906\u0917\u0947",poweredBy:"Prodantix \u0926\u094D\u0935\u093E\u0930\u093E \u0938\u0902\u091A\u093E\u0932\u093F\u0924",required:"\u092F\u0939 \u091C\u093C\u0930\u0942\u0930\u0940 \u0939\u0948\u0964",sending:"\u092D\u0947\u091C\u093E \u091C\u093E \u0930\u0939\u093E \u0939\u0948\u2026",step:"\u091A\u0930\u0923 {step} / {total}",submit:"\u092D\u0947\u091C\u0947\u0902",thanks:"\u0927\u0928\u094D\u092F\u0935\u093E\u0926\u0964"},id:{back:"Kembali",close:"Tutup",closed:"Formulir ini sedang tidak menerima tanggapan.",failed:"Gagal mengirim. Coba lagi.",invalid:"Jawaban ini tidak diterima.",next:"Berikutnya",poweredBy:"Didukung oleh Prodantix",required:"Wajib diisi.",sending:"Mengirim\u2026",step:"Langkah {step} dari {total}",submit:"Kirim",thanks:"Terima kasih."},ja:{back:"\u623B\u308B",close:"\u9589\u3058\u308B",closed:"\u3053\u306E\u30D5\u30A9\u30FC\u30E0\u306F\u73FE\u5728\u56DE\u7B54\u3092\u53D7\u3051\u4ED8\u3051\u3066\u3044\u307E\u305B\u3093\u3002",failed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",invalid:"\u3053\u306E\u56DE\u7B54\u306F\u53D7\u3051\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3002",next:"\u6B21\u3078",poweredBy:"Powered by Prodantix",required:"\u5FC5\u9808\u9805\u76EE\u3067\u3059\u3002",sending:"\u9001\u4FE1\u4E2D\u2026",step:"\u30B9\u30C6\u30C3\u30D7 {step}/{total}",submit:"\u9001\u4FE1",thanks:"\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3057\u305F\u3002"},ko:{back:"\uC774\uC804",close:"\uB2EB\uAE30",closed:"\uC774 \uC591\uC2DD\uC740 \uC9C0\uAE08 \uC751\uB2F5\uC744 \uBC1B\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",failed:"\uBCF4\uB0B4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694.",invalid:"\uC774 \uB2F5\uBCC0\uC740 \uBC1B\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",next:"\uB2E4\uC74C",poweredBy:"Prodantix \uC81C\uACF5",required:"\uD544\uC218 \uD56D\uBAA9\uC785\uB2C8\uB2E4.",sending:"\uBCF4\uB0B4\uB294 \uC911\u2026",step:"{total}\uB2E8\uACC4 \uC911 {step}\uB2E8\uACC4",submit:"\uC81C\uCD9C",thanks:"\uAC10\uC0AC\uD569\uB2C8\uB2E4."},pt:{back:"Voltar",close:"Fechar",closed:"Este formul\xE1rio n\xE3o est\xE1 a aceitar respostas neste momento.",failed:"N\xE3o foi poss\xEDvel enviar. Tente novamente.",invalid:"Esta resposta n\xE3o \xE9 aceite.",next:"Seguinte",poweredBy:"Com tecnologia Prodantix",required:"Este campo \xE9 obrigat\xF3rio.",sending:"A enviar\u2026",step:"Passo {step} de {total}",submit:"Enviar",thanks:"Obrigado."},ru:{back:"\u041D\u0430\u0437\u0430\u0434",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",closed:"\u042D\u0442\u0430 \u0444\u043E\u0440\u043C\u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u043D\u0435 \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442 \u043E\u0442\u0432\u0435\u0442\u044B.",failed:"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437.",invalid:"\u042D\u0442\u043E\u0442 \u043E\u0442\u0432\u0435\u0442 \u043D\u0435 \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442\u0441\u044F.",next:"\u0414\u0430\u043B\u0435\u0435",poweredBy:"\u0420\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u043D\u0430 Prodantix",required:"\u042D\u0442\u043E \u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u043F\u043E\u043B\u0435.",sending:"\u041E\u0442\u043F\u0440\u0430\u0432\u043A\u0430\u2026",step:"\u0428\u0430\u0433 {step} \u0438\u0437 {total}",submit:"\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C",thanks:"\u0421\u043F\u0430\u0441\u0438\u0431\u043E."},sw:{back:"Rudi",close:"Funga",closed:"Fomu hii haipokei majibu kwa sasa.",failed:"Imeshindwa kutuma. Jaribu tena.",invalid:"Jibu hili halikubaliki.",next:"Endelea",poweredBy:"Inaendeshwa na Prodantix",required:"Hii inahitajika.",sending:"Inatuma\u2026",step:"Hatua {step} kati ya {total}",submit:"Tuma",thanks:"Asante."},vi:{back:"Quay l\u1EA1i",close:"\u0110\xF3ng",closed:"Bi\u1EC3u m\u1EABu n\xE0y hi\u1EC7n kh\xF4ng nh\u1EADn c\xE2u tr\u1EA3 l\u1EDDi.",failed:"Kh\xF4ng g\u1EEDi \u0111\u01B0\u1EE3c. H\xE3y th\u1EED l\u1EA1i.",invalid:"C\xE2u tr\u1EA3 l\u1EDDi n\xE0y kh\xF4ng \u0111\u01B0\u1EE3c ch\u1EA5p nh\u1EADn.",next:"Ti\u1EBFp",poweredBy:"\u0110\u01B0\u1EE3c h\u1ED7 tr\u1EE3 b\u1EDFi Prodantix",required:"Tr\u01B0\u1EDDng n\xE0y l\xE0 b\u1EAFt bu\u1ED9c.",sending:"\u0110ang g\u1EEDi\u2026",step:"B\u01B0\u1EDBc {step}/{total}",submit:"G\u1EEDi",thanks:"C\u1EA3m \u01A1n b\u1EA1n."},zh:{back:"\u4E0A\u4E00\u6B65",close:"\u5173\u95ED",closed:"\u6B64\u8868\u5355\u76EE\u524D\u4E0D\u63A5\u53D7\u56DE\u590D\u3002",failed:"\u53D1\u9001\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002",invalid:"\u6B64\u56DE\u7B54\u65E0\u6548\u3002",next:"\u4E0B\u4E00\u6B65",poweredBy:"\u7531 Prodantix \u63D0\u4F9B\u652F\u6301",required:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879\u3002",sending:"\u6B63\u5728\u53D1\u9001\u2026",step:"\u7B2C {step} \u6B65\uFF0C\u5171 {total} \u6B65",submit:"\u63D0\u4EA4",thanks:"\u8C22\u8C22\u3002"}},Me=n=>{var t;let e=(t=(n!=null?n:"").toLowerCase().split("-")[0])!=null?t:"";return e in B?e:"en"};var x="prodantix-form",Sn=`.${x}{font-family:var(--pdx-font);color:var(--pdx-text);background:var(--pdx-background);max-width:var(--pdx-width);box-sizing:border-box;padding:16px;border-radius:var(--pdx-radius)}
2
2
  .${x} *{box-sizing:border-box}
3
3
  .${x} .pdx-field{display:flex;flex-direction:column;gap:4px;margin:0 0 12px}
4
4
  .${x} .pdx-field[hidden]{display:none}
@@ -11,6 +11,6 @@
11
11
  .${x} button[data-variant=back]{background:transparent;color:inherit;border:1px solid currentColor}
12
12
  .${x} .pdx-actions{display:flex;gap:8px;justify-content:flex-end}
13
13
  .${x} .pdx-hp{position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden}
14
- .${x} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}`,$t=n=>n==null||n===false||typeof n=="string"&&n.trim()===""||Array.isArray(n)&&n.length===0,At=(n,e)=>{let t=n.condition;if(!t)return true;let r=e[t.field];return $t(r)?false:t.op==="is_set"?true:t.op==="equals"?typeof r=="string"&&r===t.values[0]:(Array.isArray(r)?r:[r]).some(o=>typeof o=="string"&&t.values.includes(o))},wn=n=>{let e=`${encodeURIComponent(n)}=`,t=document.cookie.split("; ").find(r=>r.startsWith(e));return t?decodeURIComponent(t.slice(e.length)):""},Cn=n=>{var t;let e=n.hidden;return e?e.source==="fixed"?e.value:e.source==="query"?(t=new URLSearchParams(window.location.search).get(e.value))!=null?t:"":wn(e.value):""},u=(n,e={},t=[])=>{let r=Object.assign(document.createElement(n),e);return r.append(...t),r},En=(n,e,t)=>{var v;let r=u("p",{className:"pdx-error",id:`${e}-error`}),i=n.help?u("p",{className:"pdx-help",id:`${e}-help`},[n.help]):null,o=[i?`${e}-help`:"",`${e}-error`].filter(Boolean).join(" "),s=u("div",{className:"pdx-field"});if(s.dataset.field=n.key,n.kind==="rich_text")return s.append(u("p",{},[n.label])),{error:r,field:n,focus:()=>{},read:()=>{},root:s};if(n.kind==="hidden")return s.hidden=true,{error:r,field:n,focus:()=>{},read:()=>Cn(n),root:s};if(n.kind==="radio"||n.kind==="checkboxes"){let c=u("fieldset",{});c.setAttribute("aria-describedby",o),n.required&&c.setAttribute("aria-required","true"),c.append(u("legend",{},[n.label]));let $=n.options.filter(f=>!f.archived).map((f,_)=>{let T=u("input",{id:`${e}-${_}`,name:e,type:n.kind==="radio"?"radio":"checkbox",value:f.value});return T.addEventListener("change",t),c.append(u("div",{className:"pdx-choice"},[T,u("label",{htmlFor:`${e}-${_}`},[f.label])])),T});return s.append(c,...i?[i]:[],r),{error:r,field:n,focus:()=>{var f;return (f=$[0])==null?void 0:f.focus()},read:()=>{var _;let f=$.filter(T=>T.checked).map(T=>T.value);return n.kind==="radio"?(_=f[0])!=null?_:"":f},root:s}}let a=u("label",{htmlFor:e},[n.label]),l;if(n.kind==="textarea")l=u("textarea",{id:e,placeholder:n.placeholder,rows:4});else if(n.kind==="dropdown")l=u("select",{id:e},[u("option",{value:""},[""]),...n.options.filter(c=>!c.archived).map(c=>u("option",{value:c.value},[c.label]))]);else if(n.kind==="checkbox")l=u("input",{id:e,type:"checkbox"});else {let c={date:"date",email:"email",file:"file",number:"number",phone:"tel"};l=u("input",{id:e,placeholder:n.placeholder,type:(v=c[n.kind])!=null?v:"text"}),n.kind==="email"&&(l.autocomplete="email");}return l.setAttribute("aria-describedby",o),n.required&&l.setAttribute("aria-required","true"),l.addEventListener("input",t),l.addEventListener("change",t),n.kind==="checkbox"?s.append(u("div",{className:"pdx-choice"},[l,a]),...i?[i]:[],r):s.append(a,...i?[i]:[],l,r),{error:r,field:n,focus:()=>l.focus(),read:()=>l instanceof HTMLInputElement&&l.type==="checkbox"?l.checked:n.kind==="number"?l.value===""?"":Number(l.value):l.value,root:s}},Tn=(n,e)=>{let t=e.style,r={"--pdx-background":t.background,"--pdx-button":t.button,"--pdx-button-text":t.buttonText,"--pdx-field-background":t.fieldBackground,"--pdx-field-text":t.fieldText,"--pdx-font":t.font,"--pdx-radius":`${t.radius}px`,"--pdx-text":t.text,"--pdx-width":`${t.width}px`};for(let[i,o]of Object.entries(r))n.style.setProperty(i,o);},Fn=()=>{document.getElementById("prodantix-form-style")||document.head.append(u("style",{id:"prodantix-form-style",textContent:Sn}));},ge=(n,e)=>{let{formId:t,host:r,language:i}=e,o=B[i],s=c=>o[c],a=u("form",{className:x,noValidate:true});a.dataset.prodantixForm=t;let l=u("p",{className:"pdx-meta"});l.setAttribute("aria-live","polite"),l.setAttribute("role","status");let g=false,v=r.form(t).then(c=>{if(g)return;if(!c.accepting){a.replaceChildren(u("p",{className:"pdx-meta"},[s("closed")]));return}Fn(),Tn(a,c);let $=c.challenge?It(c.challenge):null,L=false,f=[],_=()=>{let p={};for(let h of f.flat())if(!h.root.hidden||h.field.kind==="hidden"){let b=h.read();b!==void 0&&(p[h.field.key]=b);}return p},T=()=>{let p=_();for(let h of f.flat())h.field.kind!=="hidden"&&(h.root.hidden=!At(h.field,p));},z=()=>{L||(L=true,r.capture(mt,{$form_id:c.id,$form_version:c.version})),T();},A=c.steps.map((p,h)=>{let b=u("div",{});b.dataset.step=String(h),p.title&&b.append(u("p",{className:"pdx-meta"},[p.title]));let y=p.fields.map(F=>En(F,`pdx-${t}-${F.key}`,z));return f.push(y),b.append(...y.map(F=>F.root)),b}),Oe=u("input",{autocomplete:"off",name:c.honeypot,tabIndex:-1,type:"text"}),qe=u("div",{className:"pdx-hp"},[Oe]);qe.setAttribute("aria-hidden","true");let fe=[],j=u("div",{});if(c.consent.processing){let p=u("input",{id:`pdx-${t}-consent`,type:"checkbox"});p.setAttribute("aria-required","true"),fe.push({input:p,key:"$consent_processing"}),j.append(u("div",{className:"pdx-choice"},[p,u("label",{htmlFor:p.id},[c.consent.processing])]));}for(let p of c.consent.purposes){let h=u("input",{id:`pdx-${t}-consent-${p.key}`,type:"checkbox"});fe.push({input:h,key:`$consent_${p.key}`}),j.append(u("div",{className:"pdx-choice"},[h,u("label",{htmlFor:h.id},[p.label])])),p.notice&&j.append(u("p",{className:"pdx-help"},[p.notice]));}let ye=u("p",{className:"pdx-meta"}),G=u("button",{type:"button"},[s("back")]);G.dataset.variant="back";let W=u("button",{type:"button"},[s("next")]),R=u("button",{type:"submit"},[s("submit")]);G.dataset.action="back",W.dataset.action="next",R.dataset.action="submit";let Lt=u("div",{className:"pdx-actions"},[G,W,R]),I=0,ve=()=>{A.forEach((h,b)=>{h.hidden=b!==I;});let p=I===A.length-1;G.hidden=I===0,W.hidden=p,R.hidden=!p,j.hidden=!p,ye.hidden=A.length<2,ye.textContent=s("step").replace("{step}",String(I+1)).replace("{total}",String(A.length));},Dt=()=>{var p;for(let h of f.flat())h.error.textContent="",(p=h.root.querySelector("[aria-invalid]"))==null||p.removeAttribute("aria-invalid");},Le=(p,h)=>{var b;p.error.textContent=h,(b=p.root.querySelector("input,select,textarea,fieldset"))==null||b.setAttribute("aria-invalid","true");},De=p=>{var y,F;Dt();let h=_(),b=((y=f[p])!=null?y:[]).filter(P=>!P.root.hidden&&P.field.required&&$t(h[P.field.key]));for(let P of b)Le(P,s("required"));return b.length>0?(l.textContent=s("required"),(F=b[0])==null||F.focus(),false):true};G.addEventListener("click",()=>{I=Math.max(0,I-1),ve();}),W.addEventListener("click",()=>{De(I)&&(I+=1,ve());}),a.addEventListener("submit",p=>{if(p.preventDefault(),!De(I))return;let h={..._(),[c.honeypot]:Oe.value};for(let y of fe)h[y.key]=y.input.checked;R.disabled=true,R.textContent=s("sending");let b=c.challenge;if(!b||!$){l.textContent=s("closed");return}$.then(y=>r.submit(t,h,b,y)).then(y=>{if(y.kind==="redirect"&&y.value.startsWith("https://")){window.location.assign(y.value);return}let F=u("p",{},[y.kind==="message"&&y.value?y.value:s("thanks")]);F.setAttribute("role","status"),a.replaceChildren(F);}).catch(y=>{R.disabled=false,R.textContent=s("submit");let F=y instanceof U?y.fields:[];for(let P of F){let Ke=f.flat().find(Kt=>Kt.field.key===P.field);Ke&&Le(Ke,P.rule==="required"?s("required"):s("invalid"));}l.textContent=F.length>0?s("invalid"):s("failed");});}),a.append(ye,...A,qe,j,Lt,l),c.poweredBy&&e.poweredBy!==false&&a.append(u("p",{className:"pdx-meta"},[s("poweredBy")])),ve(),T(),r.capture(pt,{$form_id:c.id,$form_version:c.version});}).catch(()=>{g||a.replaceChildren(u("p",{className:"pdx-meta"},[s("closed")]));});return n.append(a),{destroy:()=>{g=true,a.remove();},ready:v}};var Pt=n=>({capture:(e,t)=>n.capture(e,{properties:t}),form:e=>n.getForm(e),submit:(e,t,r,i)=>n.submitForm(e,t,r,i)});var Rt=(n,e)=>({...n.page?{$page_id:n.page}:{},...n.page&&e?{$page_view_id:e}:{},...n.variant?{$page_variant:n.variant}:{}});var _n=(n,e)=>{var t;try{return (t=Tt({name:`pdx_${be(n)}`}))!=null?t:e}catch(r){return e}},w=document.currentScript,he=w==null?void 0:w.dataset.form,Ne=w==null?void 0:w.dataset.key,Mt,Nt,Ot,qt;if(w&&he&&Ne){let n=new URL(w.src,window.location.href).origin,e=je(),t=w.dataset.consent==="banner",r=new ue({apiKey:Ne,...t?{consentMode:"banner"}:{},defaultProperties:Rt(w.dataset),flagsHost:(Mt=w.dataset.edge)!=null?Mt:n,host:(Nt=w.dataset.host)!=null?Nt:n,sessionTracking:false,sharedStorage:_n(Ne,e),storage:e,transport:new pe({})});t&&wt(r,window);let i=Pt(r),o=Me((Ot=w.dataset.language)!=null?Ot:document.documentElement.lang),s=Re(w.dataset.popup);if(s)Pe({formId:he,periodDays:Number((qt=w.dataset.periodDays)!=null?qt:7),trigger:s},()=>{let a=document.createElement("dialog");a.className="prodantix-form-popup";let l=document.createElement("button");l.type="button",l.textContent="\xD7",l.setAttribute("aria-label",B[o].close),l.title=B[o].close,l.addEventListener("click",()=>a.close()),a.append(l),document.body.append(a),ge(a,{formId:he,host:i,language:o}),a.showModal();});else {let a=document.createElement("div");w.after(a),ge(a,{formId:he,host:i,language:o});}}
14
+ .${x} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}`,$t=n=>n==null||n===false||typeof n=="string"&&n.trim()===""||Array.isArray(n)&&n.length===0,At=(n,e)=>{let t=n.condition;if(!t)return true;let r=e[t.field];return $t(r)?false:t.op==="is_set"?true:t.op==="equals"?typeof r=="string"&&r===t.values[0]:(Array.isArray(r)?r:[r]).some(o=>typeof o=="string"&&t.values.includes(o))},wn=n=>{let e=`${encodeURIComponent(n)}=`,t=document.cookie.split("; ").find(r=>r.startsWith(e));return t?decodeURIComponent(t.slice(e.length)):""},En=n=>{var t;let e=n.hidden;return e?e.source==="fixed"?e.value:e.source==="query"?(t=new URLSearchParams(window.location.search).get(e.value))!=null?t:"":wn(e.value):""},u=(n,e={},t=[])=>{let r=Object.assign(document.createElement(n),e);return r.append(...t),r},Cn=(n,e,t)=>{var v;let r=u("p",{className:"pdx-error",id:`${e}-error`}),i=n.help?u("p",{className:"pdx-help",id:`${e}-help`},[n.help]):null,o=[i?`${e}-help`:"",`${e}-error`].filter(Boolean).join(" "),s=u("div",{className:"pdx-field"});if(s.dataset.field=n.key,n.kind==="rich_text")return s.append(u("p",{},[n.label])),{error:r,field:n,focus:()=>{},read:()=>{},root:s};if(n.kind==="hidden")return s.hidden=true,{error:r,field:n,focus:()=>{},read:()=>En(n),root:s};if(n.kind==="radio"||n.kind==="checkboxes"){let c=u("fieldset",{});c.setAttribute("aria-describedby",o),n.required&&c.setAttribute("aria-required","true"),c.append(u("legend",{},[n.label]));let $=n.options.filter(f=>!f.archived).map((f,_)=>{let T=u("input",{id:`${e}-${_}`,name:e,type:n.kind==="radio"?"radio":"checkbox",value:f.value});return T.addEventListener("change",t),c.append(u("div",{className:"pdx-choice"},[T,u("label",{htmlFor:`${e}-${_}`},[f.label])])),T});return s.append(c,...i?[i]:[],r),{error:r,field:n,focus:()=>{var f;return (f=$[0])==null?void 0:f.focus()},read:()=>{var _;let f=$.filter(T=>T.checked).map(T=>T.value);return n.kind==="radio"?(_=f[0])!=null?_:"":f},root:s}}let a=u("label",{htmlFor:e},[n.label]),l;if(n.kind==="textarea")l=u("textarea",{id:e,placeholder:n.placeholder,rows:4});else if(n.kind==="dropdown")l=u("select",{id:e},[u("option",{value:""},[""]),...n.options.filter(c=>!c.archived).map(c=>u("option",{value:c.value},[c.label]))]);else if(n.kind==="checkbox")l=u("input",{id:e,type:"checkbox"});else {let c={date:"date",email:"email",file:"file",number:"number",phone:"tel"};l=u("input",{id:e,placeholder:n.placeholder,type:(v=c[n.kind])!=null?v:"text"}),n.kind==="email"&&(l.autocomplete="email");}return l.setAttribute("aria-describedby",o),n.required&&l.setAttribute("aria-required","true"),l.addEventListener("input",t),l.addEventListener("change",t),n.kind==="checkbox"?s.append(u("div",{className:"pdx-choice"},[l,a]),...i?[i]:[],r):s.append(a,...i?[i]:[],l,r),{error:r,field:n,focus:()=>l.focus(),read:()=>l instanceof HTMLInputElement&&l.type==="checkbox"?l.checked:n.kind==="number"?l.value===""?"":Number(l.value):l.value,root:s}},Tn=(n,e)=>{let t=e.style,r={"--pdx-background":t.background,"--pdx-button":t.button,"--pdx-button-text":t.buttonText,"--pdx-field-background":t.fieldBackground,"--pdx-field-text":t.fieldText,"--pdx-font":t.font,"--pdx-radius":`${t.radius}px`,"--pdx-text":t.text,"--pdx-width":`${t.width}px`};for(let[i,o]of Object.entries(r))n.style.setProperty(i,o);},Fn=()=>{document.getElementById("prodantix-form-style")||document.head.append(u("style",{id:"prodantix-form-style",textContent:Sn}));},ge=(n,e)=>{let{formId:t,host:r,language:i}=e,o=B[i],s=c=>o[c],a=u("form",{className:x,noValidate:true});a.dataset.prodantixForm=t;let l=u("p",{className:"pdx-meta"});l.setAttribute("aria-live","polite"),l.setAttribute("role","status");let g=false,v=r.form(t).then(c=>{if(g)return;if(!c.accepting){a.replaceChildren(u("p",{className:"pdx-meta"},[s("closed")]));return}Fn(),Tn(a,c);let $=c.challenge?It(c.challenge):null,L=false,f=[],_=()=>{let p={};for(let h of f.flat())if(!h.root.hidden||h.field.kind==="hidden"){let b=h.read();b!==void 0&&(p[h.field.key]=b);}return p},T=()=>{let p=_();for(let h of f.flat())h.field.kind!=="hidden"&&(h.root.hidden=!At(h.field,p));},z=()=>{L||(L=true,r.capture(mt,{$form_id:c.id,$form_version:c.version})),T();},A=c.steps.map((p,h)=>{let b=u("div",{});b.dataset.step=String(h),p.title&&b.append(u("p",{className:"pdx-meta"},[p.title]));let y=p.fields.map(F=>Cn(F,`pdx-${t}-${F.key}`,z));return f.push(y),b.append(...y.map(F=>F.root)),b}),Oe=u("input",{autocomplete:"off",name:c.honeypot,tabIndex:-1,type:"text"}),qe=u("div",{className:"pdx-hp"},[Oe]);qe.setAttribute("aria-hidden","true");let fe=[],j=u("div",{});if(c.consent.processing){let p=u("input",{id:`pdx-${t}-consent`,type:"checkbox"});p.setAttribute("aria-required","true"),fe.push({input:p,key:"$consent_processing"}),j.append(u("div",{className:"pdx-choice"},[p,u("label",{htmlFor:p.id},[c.consent.processing])]));}for(let p of c.consent.purposes){let h=u("input",{id:`pdx-${t}-consent-${p.key}`,type:"checkbox"});fe.push({input:h,key:`$consent_${p.key}`}),j.append(u("div",{className:"pdx-choice"},[h,u("label",{htmlFor:h.id},[p.label])])),p.notice&&j.append(u("p",{className:"pdx-help"},[p.notice]));}let ye=u("p",{className:"pdx-meta"}),G=u("button",{type:"button"},[s("back")]);G.dataset.variant="back";let W=u("button",{type:"button"},[s("next")]),R=u("button",{type:"submit"},[s("submit")]);G.dataset.action="back",W.dataset.action="next",R.dataset.action="submit";let Lt=u("div",{className:"pdx-actions"},[G,W,R]),I=0,ve=()=>{A.forEach((h,b)=>{h.hidden=b!==I;});let p=I===A.length-1;G.hidden=I===0,W.hidden=p,R.hidden=!p,j.hidden=!p,ye.hidden=A.length<2,ye.textContent=s("step").replace("{step}",String(I+1)).replace("{total}",String(A.length));},Dt=()=>{var p;for(let h of f.flat())h.error.textContent="",(p=h.root.querySelector("[aria-invalid]"))==null||p.removeAttribute("aria-invalid");},Le=(p,h)=>{var b;p.error.textContent=h,(b=p.root.querySelector("input,select,textarea,fieldset"))==null||b.setAttribute("aria-invalid","true");},De=p=>{var y,F;Dt();let h=_(),b=((y=f[p])!=null?y:[]).filter(P=>!P.root.hidden&&P.field.required&&$t(h[P.field.key]));for(let P of b)Le(P,s("required"));return b.length>0?(l.textContent=s("required"),(F=b[0])==null||F.focus(),false):true};G.addEventListener("click",()=>{I=Math.max(0,I-1),ve();}),W.addEventListener("click",()=>{De(I)&&(I+=1,ve());}),a.addEventListener("submit",p=>{if(p.preventDefault(),!De(I))return;let h={..._(),[c.honeypot]:Oe.value};for(let y of fe)h[y.key]=y.input.checked;R.disabled=true,R.textContent=s("sending");let b=c.challenge;if(!b||!$){l.textContent=s("closed");return}$.then(y=>r.submit(t,h,b,y)).then(y=>{if(y.kind==="redirect"&&y.value.startsWith("https://")){window.location.assign(y.value);return}let F=u("p",{},[y.kind==="message"&&y.value?y.value:s("thanks")]);F.setAttribute("role","status"),a.replaceChildren(F);}).catch(y=>{R.disabled=false,R.textContent=s("submit");let F=y instanceof U?y.fields:[];for(let P of F){let Ke=f.flat().find(Kt=>Kt.field.key===P.field);Ke&&Le(Ke,P.rule==="required"?s("required"):s("invalid"));}l.textContent=F.length>0?s("invalid"):s("failed");});}),a.append(ye,...A,qe,j,Lt,l),c.poweredBy&&e.poweredBy!==false&&a.append(u("p",{className:"pdx-meta"},[s("poweredBy")])),ve(),T(),r.capture(pt,{$form_id:c.id,$form_version:c.version});}).catch(()=>{g||a.replaceChildren(u("p",{className:"pdx-meta"},[s("closed")]));});return n.append(a),{destroy:()=>{g=true,a.remove();},ready:v}};var Pt=n=>({capture:(e,t)=>n.capture(e,{properties:t}),form:e=>n.getForm(e),submit:(e,t,r,i)=>n.submitForm(e,t,r,i)});var Rt=(n,e)=>({...n.page?{$page_id:n.page}:{},...n.page&&e?{$page_view_id:e}:{},...n.variant?{$page_variant:n.variant}:{}});var _n=(n,e)=>{var t;try{return (t=Tt({name:`pdx_${be(n)}`}))!=null?t:e}catch(r){return e}},w=document.currentScript,he=w==null?void 0:w.dataset.form,Ne=w==null?void 0:w.dataset.key,Mt,Nt,Ot,qt;if(w&&he&&Ne){let n=new URL(w.src,window.location.href).origin,e=je(),t=w.dataset.consent==="banner",r=new ue({apiKey:Ne,...t?{consentMode:"banner"}:{},defaultProperties:Rt(w.dataset),flagsHost:(Mt=w.dataset.edge)!=null?Mt:n,host:(Nt=w.dataset.host)!=null?Nt:n,sessionTracking:false,sharedStorage:_n(Ne,e),storage:e,transport:new pe({})});t&&wt(r,window);let i=Pt(r),o=Me((Ot=w.dataset.language)!=null?Ot:document.documentElement.lang),s=Re(w.dataset.popup);if(s)Pe({formId:he,periodDays:Number((qt=w.dataset.periodDays)!=null?qt:7),trigger:s},()=>{let a=document.createElement("dialog");a.className="prodantix-form-popup";let l=document.createElement("button");l.type="button",l.textContent="\xD7",l.setAttribute("aria-label",B[o].close),l.title=B[o].close,l.addEventListener("click",()=>a.close()),a.append(l),document.body.append(a),ge(a,{formId:he,host:i,language:o}),a.showModal();});else {let a=document.createElement("div");w.after(a),ge(a,{formId:he,host:i,language:o});}}
15
15
  })();//# sourceMappingURL=forms.iife.js.map
16
16
  //# sourceMappingURL=forms.iife.js.map
@@ -1,2 +1,2 @@
1
- (function(){'use strict';var wt=Object.defineProperty;var Tt=(n,e,t)=>e in n?wt(n,e,{enumerable:true,configurable:true,writable:true,value:t}):n[e]=t;var c=(n,e,t)=>Tt(n,typeof e!="symbol"?e+"":e,t);var b=class extends Error{constructor(t,r,i){super(r,i);c(this,"code");this.code=t,this.name="ProdantixError";}},A=class extends b{constructor(e){super("config",e),this.name="ConfigError";}},T=class extends b{constructor(t,r){super("validation",r);c(this,"field");this.field=t,this.name="ValidationError";}},p=class extends b{constructor(t,r,i){super("transport",t,i);c(this,"status");this.status=r,this.name="TransportError";}};function y(n){if(n)return n;let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}function h(){let n=globalThis.AbortController;return n?new n:void 0}var xe=n=>new Promise(e=>{setTimeout(e,n);});function g(n){return n.replace(/\/+$/,"")}var E=class{constructor(){c(this,"store",new Map);}getItem(e){var t;return (t=this.store.get(e))!=null?t:null}removeItem(e){this.store.delete(e);}setItem(e,t){this.store.set(e,t);}},F=class{constructor(e,t=()=>false){this.real=e;this.passes=t;c(this,"held",new E);c(this,"opened",false);}get isOpen(){return this.opened}open(){this.opened=true;}close(){this.opened=false;}target(e){return this.opened||this.passes(e)?this.real:this.held}getItem(e){return this.target(e).getItem(e)}removeItem(e){this.target(e).removeItem(e);}setItem(e,t){this.target(e).setItem(e,t);}};function we(){try{let n=globalThis.localStorage;if(n){let e="__pdx_probe__";return n.setItem(e,"1"),n.removeItem(e),n}}catch(n){return new E}return new E}var Te={now:()=>new Date};function L(n){return n.toISOString()}function Ce(){if(typeof window=="undefined"||typeof Intl=="undefined")return null;let n=Intl.DateTimeFormat().resolvedOptions().timeZone;return typeof n=="string"&&n!==""?n:null}function Ct(){return globalThis.crypto}function _t(n){n[6]=n[6]&15|64,n[8]=n[8]&63|128;let e=[];for(let t=0;t<16;t+=1)e.push(n[t].toString(16).padStart(2,"0"));return `${e[0]}${e[1]}${e[2]}${e[3]}-${e[4]}${e[5]}-${e[6]}${e[7]}-${e[8]}${e[9]}-${e[10]}${e[11]}${e[12]}${e[13]}${e[14]}${e[15]}`}function te(){let n=Ct();if(n!=null&&n.randomUUID)return n.randomUUID();let e=new Uint8Array(16);if(n!=null&&n.getRandomValues)n.getRandomValues(e);else for(let t=0;t<16;t+=1)e[t]=Math.floor(Math.random()*256);return _t(e)}var _e={uuid:te};var It=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var At=/^(?:\$|[a-z])[a-z0-9_.]*$/;function Ie(n){let e=0;for(let t of n)e+=1;return e}function Ae(n){return It.test(n)}function Ft(n){return At.test(n)}function Fe(n){let e=Ie(n);if(e<1||e>200)throw new T("distinct_id","distinct_id must be between 1 and 200 characters")}function $e(n){let e=Ie(n);if(e<1||e>200)throw new T("event_name","event_name must be between 1 and 200 characters");if(!Ft(n))throw new T("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var Pe="prodantix-js",Me="0.8.0";var $t=n=>{};function Oe(n){var i,o,s,a,l,u,d,m,v,k,_,I,O,ke,Ee;if(!n.apiKey||!Ae(n.apiKey))throw new A("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!n.host)throw new A("host is required (the ingest base URL)");let e=g(n.host),t=n.defaultProperties,r=(i=n.storage)!=null?i:new E;return {apiKey:n.apiKey,autocapture:(o=n.autocapture)!=null?o:false,clock:(s=n.clock)!=null?s:Te,consent:n.consent,consentMode:n.consentMode,defaultProperties:typeof t=="function"?t:()=>t!=null?t:{},describeElement:n.describeElement,flagsHost:n.flagsHost?g(n.flagsHost):e,flushAt:(a=n.flushAt)!=null?a:20,flushIntervalMs:(l=n.flushIntervalMs)!=null?l:1e4,host:e,ids:(u=n.ids)!=null?u:_e,locale:n.locale,maxQueueSize:(d=n.maxQueueSize)!=null?d:1e3,maxRetries:(m=n.maxRetries)!=null?m:3,namespace:ne(n.apiKey),onError:(v=n.onError)!=null?v:$t,os:n.os,requestTimeoutMs:(k=n.requestTimeoutMs)!=null?k:1e4,sdkName:(_=n.sdkName)!=null?_:Pe,sdkVersion:(I=n.sdkVersion)!=null?I:Me,sessionTracking:(O=n.sessionTracking)!=null?O:false,sharedStorage:(ke=n.sharedStorage)!=null?ke:r,socketFactory:n.socketFactory,storage:r,streamFlags:(Ee=n.streamFlags)!=null?Ee:false,transport:n.transport}}function ne(n){return n.slice(0,16)}var Le=(n,e)=>{let t={$cta_id:n.id,$cta_kind:n.kind,$cta_variant:n.variant.key,$cta_version:n.version},r=e===void 0?void 0:n.variant.content.buttons[e];return r&&e!==void 0&&(t.$cta_button=e,t.$cta_button_label=r.label,r.action.kind==="form"&&(t.$cta_form_id=r.action.value)),t},N=class{constructor(e){c(this,"fetch");c(this,"host");c(this,"projectKey");c(this,"requestTimeoutMs");var t;this.fetch=y(e.fetch),this.host=g(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async ctas(e){let t=this.fetch;if(!t)throw new p("no fetch implementation available in this runtime");let r=new URLSearchParams({anonymous:String(e.anonymous),device:e.device,distinct_id:e.distinctId,language:e.language,url:e.url}),i=h(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s=await t(`${this.host}/v1/ctas?${r.toString()}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(s.status<200||s.status>=300)throw new p(`ctas request failed with status ${s.status}`,s.status);return JSON.parse(await s.text()).ctas}finally{o!==void 0&&clearTimeout(o);}}};function Ne(n,e,t){var i,o,s;$e(n.eventName),Fe(n.distinctId);let r={distinct_id:n.distinctId,event_id:(i=n.eventId)!=null?i:t.uuid(),event_name:n.eventName,properties:(o=n.properties)!=null?o:{},schema_version:1,timestamp:L((s=n.timestamp)!=null?s:e.now())};return n.context&&(r.context=n.context),n.sessionId&&(r.session_id=n.sessionId),r}var w=Symbol("absent");function Pt(n,e){var i,o;if(n==="distinct_id")return e.distinctId;let t=(i=e.properties)!=null?i:{};if(Object.prototype.hasOwnProperty.call(t,n))return t[n];let r=(o=e.attributes)!=null?o:{};return Object.prototype.hasOwnProperty.call(r,n)?r[n]:w}function x(n){return n===w?"undefined":String(n)}function Re(n){return n===w?Number.NaN:Number(n)}function De(n){return n!==w&&n!==null&&n!==""}function qe(n,e){if(!Array.isArray(e))return false;let t=x(n);return e.map(r=>String(r)).includes(t)}function Ke(n,e){var i,o;let t=Pt(n.attribute,e),r=n.value;switch(n.op){case "is_set":return De(t);case "is_not_set":return !De(t);case "eq":return x(t)===x(r===void 0?w:r);case "neq":return x(t)!==x(r===void 0?w:r);case "contains":return x(t).includes(x(r===void 0?w:r));case "in":return qe(t,r);case "not_in":return Array.isArray(r)?!qe(t,r):false;case "gt":return R(t,r,(s,a)=>s>a);case "gte":return R(t,r,(s,a)=>s>=a);case "lt":return R(t,r,(s,a)=>s<a);case "lte":return R(t,r,(s,a)=>s<=a);case "in_cohort":return typeof r=="string"&&r!==""&&((i=e.cohorts)!=null?i:[]).includes(r);case "not_in_cohort":return typeof r=="string"&&r!==""&&!((o=e.cohorts)!=null?o:[]).includes(r);default:return false}}function R(n,e,t){let r=Re(n),i=e===void 0?Number.NaN:Re(e);return Number.isNaN(r)||Number.isNaN(i)?false:t(r,i)}function Ve(n,e){let t=`${n}:${e}`,r=2166136261;for(let i=0;i<t.length;i++)r^=t.charCodeAt(i),r=Math.imul(r,16777619);return (r>>>0)%100}function re(n,e){return n.targeting.length===0||n.targeting.every(t=>Ke(t,e))}function je(n,e){var o;let t=Ve(n.key,e.distinctId),r=(o=n.variations)!=null?o:[];if(r.length===0)return n.rolloutPercentage>=100||t<n.rolloutPercentage?"true":"false";let i=0;for(let s=r.length-1;s>=0;s--)if(i+=r[s].weight,t<i)return r[s].key;return r[0].key}function ie(n,e,t,r){var i;for(let o of (i=n.prerequisites)!=null?i:[]){if(r.includes(o.flagKey))return false;let s=e.find(l=>l.key===o.flagKey);if(!s||!s.enabled)return false;r.push(s.key);let a=ie(s,e,t,r)&&re(s,t)&&je(s,t)===o.variationKey;if(r.pop(),!a)return false}return true}function D(n,e,t){return n.enabled?ie(n,e,t,[n.key])?re(n,t)?n.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:Ve(n.key,t.distinctId)<n.rolloutPercentage?{enabled:true,reason:"rollout"}:{enabled:false,reason:"rollout_excluded"}:{enabled:false,reason:"targeting"}:{enabled:false,reason:"prerequisite"}:{enabled:false,reason:"disabled"}}function Ge(n,e){let t={};for(let r of n)t[r.key]=D(r,n,e).enabled;return t}function se(n,e,t){var s,a;let r=(s=n.variations)!=null?s:[],i=r[0];if(!i)return null;if(!n.enabled||!ie(n,e,t,[n.key])||!re(n,t))return i;let o=je(n,t);return (a=r.find(l=>l.key===o))!=null?a:i}function Be(n){return n.some(e=>e.targeting.some(t=>t.op==="in_cohort"||t.op==="not_in_cohort"))}function Ue(n){return `40${JSON.stringify(n)}`}function He(){return "3"}function Je(n){let e=n.charAt(0),t=n.slice(1);if(e==="2")return {kind:"ping"};if(e==="1")return {kind:"disconnect"};if(e==="0"){let s=oe(t);return {kind:"open",pingInterval:typeof(s==null?void 0:s.pingInterval)=="number"?s.pingInterval:25e3,pingTimeout:typeof(s==null?void 0:s.pingTimeout)=="number"?s.pingTimeout:2e4}}if(e!=="4")return {kind:"other"};let r=t.charAt(0),i=t.slice(1);if(r==="0")return {kind:"connected"};if(r==="1")return {kind:"disconnect"};if(r==="4"){let s=oe(i);return {kind:"connectError",message:typeof(s==null?void 0:s.message)=="string"?s.message:"refused"}}if(r!=="2")return {kind:"other"};let o=oe(i);return !Array.isArray(o)||typeof o[0]!="string"?{kind:"other"}:{kind:"event",name:o[0],payload:o[1]}}function oe(n){try{return JSON.parse(n)}catch(e){return null}}var Mt="/socket.io/?EIO=4&transport=websocket",Ot=250,q=class{constructor(e){this.options=e;c(this,"socket",null);c(this,"heartbeat",null);c(this,"pending",null);c(this,"lastKey","");c(this,"ready",false);c(this,"closed",false);c(this,"heartbeatWindow",45e3);c(this,"factory");c(this,"setTimer");c(this,"clearTimer");var t,r,i;this.factory=(t=e.socketFactory)!=null?t:Lt,this.setTimer=(r=e.setTimer)!=null?r:((o,s)=>setTimeout(o,s)),this.clearTimer=(i=e.clearTimer)!=null?i:(o=>clearTimeout(o));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${Mt}`,t;try{t=this.factory(e);}catch(r){this.options.onClosed(false);return}this.socket=t,t.onmessage=r=>this.receive(String(r.data)),t.onerror=()=>t.close(),t.onclose=()=>this.fell();}close(){this.closed=true,this.stopHeartbeat(),this.pending!==null&&this.clearTimer(this.pending),this.pending=null;let e=this.socket;this.socket=null,e==null||e.close();}receive(e){var r,i,o,s;let t=Je(e);if(t.kind==="open"){this.armHeartbeat(t.pingInterval+t.pingTimeout),(r=this.socket)==null||r.send(Ue({projectKey:this.options.projectKey}));return}if(t.kind==="ping"){this.armHeartbeat(),(i=this.socket)==null||i.send(He());return}if(t.kind==="connectError"||t.kind==="disconnect"){this.stopHeartbeat(),(o=this.socket)==null||o.close();return}if(t.kind==="event"){if(t.name==="ready"){this.ready=true;return}if(t.name==="flagChange"){let a=(s=t.payload)==null?void 0:s.key;this.lastKey=typeof a=="string"?a:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},Ot));}}}fell(){this.stopHeartbeat();let e=this.ready;this.socket=null,this.ready=false,this.closed||this.options.onClosed(e);}armHeartbeat(e){e!==void 0&&(this.heartbeatWindow=e),this.stopHeartbeat(),this.heartbeat=this.setTimer(()=>{var t;return (t=this.socket)==null?void 0:t.close()},this.heartbeatWindow);}stopHeartbeat(){this.heartbeat!==null&&this.clearTimer(this.heartbeat),this.heartbeat=null;}};function Lt(n){let e=globalThis.WebSocket;if(!e)throw new p("no WebSocket");return new e(n)}var K=class{constructor(e){c(this,"fetch");c(this,"host");c(this,"projectKey");c(this,"requestTimeoutMs");var t;this.fetch=y(e.fetch),this.host=g(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){var s,a;let t=this.fetch;if(!t)throw new p("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,i=h(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let l=await t(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!l.ok)throw new p(`flags request failed with status ${l.status}`,l.status);let u=JSON.parse(await l.text());return {flags:(s=u.flags)!=null?s:{},variants:(a=u.variants)!=null?a:{}}}finally{o!==void 0&&clearTimeout(o);}}async snapshot(){var o;let e=this.fetch;if(!e)throw new p("no fetch implementation available in this runtime");let t=`${this.host}/v1/flags/snapshot`,r=h(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await e(t,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new p(`flag snapshot request failed with status ${s.status}`,s.status);let a=JSON.parse(await s.text()),l={flags:(o=a.flags)!=null?o:[],generatedAt:a.generatedAt};return typeof a.socketUrl=="string"&&a.socketUrl!==""&&(l.socketUrl=a.socketUrl),l}finally{i!==void 0&&clearTimeout(i);}}async memberships(e){var s;let t=this.fetch;if(!t)throw new p("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,i=h(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await t(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new p(`memberships request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).cohorts)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};var ae=class extends Error{constructor(t,r,i){super(i);c(this,"fields");c(this,"status");this.name="FormRefusedError",this.status=t,this.fields=r;}},V=class{constructor(e){c(this,"fetch");c(this,"host");c(this,"projectKey");c(this,"requestTimeoutMs");var t;this.fetch=y(e.fetch),this.host=g(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async request(e,t){let r=this.fetch;if(!r)throw new p("no fetch implementation available in this runtime");let i=h(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s={authorization:`Bearer ${this.projectKey}`};t.body!==void 0&&(s["content-type"]="application/json");let a=await r(`${this.host}${e}`,{body:t.body,headers:s,method:t.method,signal:i==null?void 0:i.signal});return {status:a.status,text:await a.text()}}finally{o!==void 0&&clearTimeout(o);}}async form(e,t){let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}?distinct_id=${encodeURIComponent(t)}`,{method:"GET"});if(r<200||r>=300)throw new p(`form request failed with status ${r}`,r);return JSON.parse(i)}async submit(e,t){var a,l,u,d;let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}/submissions`,{body:JSON.stringify(t),method:"POST"});if(r>=200&&r<300)return JSON.parse(i).afterSubmit;let o=[],s=`form submission failed with status ${r}`;try{let m=JSON.parse(i);o=(l=(a=m.error)==null?void 0:a.fields)!=null?l:[],s=(d=(u=m.error)==null?void 0:u.message)!=null?d:s;}catch(m){o=[];}throw new ae(r,o,s)}};var We="$survey_shown",ze="$survey_dismissed",Ye="$survey_sent",j=class{constructor(e){c(this,"fetch");c(this,"host");c(this,"projectKey");c(this,"requestTimeoutMs");var t;this.fetch=y(e.fetch),this.host=g(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async surveys(e,t){var s;let r=this.fetch;if(!r)throw new p("no fetch implementation available in this runtime");let i=h(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await r(`${this.host}/v1/surveys?distinct_id=${encodeURIComponent(e)}${t?`&lang=${encodeURIComponent(t)}`:""}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new p(`surveys request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).surveys)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};function G(n,e){let t={$survey_id:n.id,$survey_iteration:n.iteration,$survey_name:n.name};for(let[r,i]of Object.entries(e))t[`$survey_response_${r}`]=i;return t}var B=class{constructor(e){c(this,"fetch");c(this,"host");c(this,"projectKey");c(this,"requestTimeoutMs");var t;this.fetch=y(e.fetch),this.host=g(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async guides(e){var o;let t=this.fetch;if(!t)throw new p("no fetch implementation available in this runtime");let r=h(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await t(`${this.host}/v1/guides?distinct_id=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new p(`guides request failed with status ${s.status}`,s.status);return (o=JSON.parse(await s.text()).guides)!=null?o:[]}finally{i!==void 0&&clearTimeout(i);}}};function Qe(n,e){let t={$guide_id:n.id,$guide_iteration:n.iteration,$guide_name:n.name};return e!==void 0&&(t.$guide_step_id=e),t}function ce(n){if(typeof n!="string")return;let e=Array.from(n).length;return e>=1&&e<=200?n:void 0}function ue(n,e){return `pdx.${n}.${e}`}var de="consent",Nt=["identityLink","analytics","marketing","functional"];function le(n){if(typeof n!="string")return null;try{let e=JSON.parse(n);if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e,r={};for(let i of Nt){let o=t[i];typeof o=="boolean"&&(r[i]=o);}return typeof t.version=="number"&&Number.isInteger(t.version)&&(r.version=t.version),Array.isArray(t.categories)&&t.categories.every(i=>typeof i=="string")&&(r.categories=t.categories),Object.keys(r).length===0?null:r}catch(e){return null}}var Xe=n=>n.endsWith(`.${de}`);function H(n,e){return le(n.getItem(ue(e,de)))}function Rt(n,e,t){var s;let r=ue(e,de),i=le(JSON.stringify(t)),o=i===null?null:le(JSON.stringify({...(s=H(n,e))!=null?s:{},...i}));if(o===null){n.removeItem(r);return}n.setItem(r,JSON.stringify(o));}var U=class{constructor(e,t,r,i){this.storage=e;this.shared=t;this.ids=r;this.namespace=i;c(this,"anonymousId");c(this,"distinctId");c(this,"identified");this.refresh();}refresh(){let e=ce(this.shared.getItem(this.key("anonymous_id"))),t=ce(this.storage.getItem(this.key("anonymous_id")));e?(this.anonymousId=e,t!==e&&this.storage.setItem(this.key("anonymous_id"),e)):t?(this.anonymousId=t,this.shared.setItem(this.key("anonymous_id"),t)):(this.anonymousId=this.ids.uuid(),this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId));let r=ce(this.storage.getItem(this.key("distinct_id")));r?(this.distinctId=r,this.identified=true):(this.distinctId=this.anonymousId,this.identified=false);}getAnonymousId(){return this.anonymousId}getDistinctId(){return this.distinctId}isIdentified(){return this.identified}snapshot(){return {anonymousId:this.anonymousId,distinctId:this.distinctId,identified:this.identified}}consent(){return H(this.shared,this.namespace)}setConsent(e){Rt(this.shared,this.namespace,e);}assumeAnonymousId(e){this.anonymousId=e,this.shared.setItem(this.key("anonymous_id"),e),this.storage.setItem(this.key("anonymous_id"),e),this.identified||(this.distinctId=e);}identify(e){var o;let t=!this.identified||this.distinctId!==e,r=this.storage.getItem(this.key("linked_anonymous_id")),i=t||r!==this.anonymousId;return this.distinctId=e,this.identified=true,t&&this.storage.setItem(this.key("distinct_id"),e),!i||((o=this.consent())==null?void 0:o.identityLink)===false?{changed:t}:(this.storage.setItem(this.key("linked_anonymous_id"),this.anonymousId),{anonymousToLink:this.anonymousId,changed:t})}reset(){this.anonymousId=this.ids.uuid(),this.distinctId=this.anonymousId,this.identified=false,this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.removeItem(this.key("distinct_id")),this.storage.removeItem(this.key("linked_anonymous_id"));}key(e){return ue(this.namespace,e)}};var J=class{constructor(e){c(this,"fetch");c(this,"host");c(this,"projectKey");c(this,"requestTimeoutMs");var t;this.fetch=y(e.fetch),this.host=g(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async inbox(e){var s;let t=this.requireFetch(),r=`${this.host}/v1/messages?distinct_id=${encodeURIComponent(e)}`,i=await this.request(t,r,{headers:this.authHeaders(),method:"GET"});if(!i.ok)throw new p(`inbox request failed with status ${i.status}`,i.status);return (s=JSON.parse(await i.text()).messages)!=null?s:[]}async markRead(e,t){let r=this.requireFetch(),i=`${this.host}/v1/messages/read`,o=await this.request(r,i,{body:JSON.stringify({distinct_id:t,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!o.ok)throw new p(`mark-read request failed with status ${o.status}`,o.status)}requireFetch(){if(!this.fetch)throw new p("no fetch implementation available in this runtime");return this.fetch}authHeaders(){return {authorization:`Bearer ${this.projectKey}`}}async request(e,t,r){let i=h(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(t,{...r,signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}};var W=class{constructor(e,t){this.maxSize=e;this.onOverflow=t;c(this,"events",[]);}get size(){return this.events.length}enqueue(e){this.events.push(e),this.enforceCap();}restore(e){this.events.push(...e),this.enforceCap();}requeue(e){this.events.unshift(...e),this.enforceCap();}drain(e){let t=e===void 0?this.events.length:Math.min(e,this.events.length);return this.events.splice(0,t)}snapshot(){return [...this.events]}enforceCap(){var t;if(this.events.length<=this.maxSize)return;let e=this.events.splice(0,this.events.length-this.maxSize);(t=this.onOverflow)==null||t.call(this,{dropped:e});}};var Dt={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function qt(n){return `pdx.${n}.session`}var z=class{constructor(e,t,r,i,o=Dt){this.storage=e;this.ids=t;this.clock=r;this.namespace=i;this.options=o;}current(){return this.touch().id}startedAt(){return this.touch().startedAt}reset(){this.storage.removeItem(this.key());}touch(){let e=this.clock.now().getTime(),t=this.live(this.read(),e);if(t===void 0)return this.write({id:this.ids.uuid(),lastActivityAt:e,startedAt:e});if(e-t.lastActivityAt<=this.options.throttleMs)return t;let r=this.live(this.read(),e),i=r!==void 0&&r.id!==t.id?r:t;return this.write({...i,lastActivityAt:e})}live(e,t){if(e!==void 0&&!(t-e.lastActivityAt>this.options.idleMs||t-e.startedAt>this.options.maxMs))return e}write(e){return this.storage.setItem(this.key(),JSON.stringify(e)),e}read(){let e=this.storage.getItem(this.key());if(e)try{let t=JSON.parse(e);return typeof t.id=="string"&&typeof t.startedAt=="number"&&typeof t.lastActivityAt=="number"?{id:t.id,lastActivityAt:t.lastActivityAt,startedAt:t.startedAt}:void 0}catch(t){return}}key(){return qt(this.namespace)}};var f={autocapture:"$autocapture",createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",pageleave:"$pageleave",pageview:"$pageview",set:"$set",webVitals:"$web_vitals"};function Ze(n){return n>=400&&n<500&&n!==429}var C=class{constructor(e={}){c(this,"fetch");c(this,"maxRetries");c(this,"requestTimeoutMs");c(this,"baseDelayMs");c(this,"maxDelayMs");c(this,"sleep");c(this,"random");var t,r,i,o,s,a;this.fetch=y(e.fetch),this.maxRetries=(t=e.maxRetries)!=null?t:3,this.requestTimeoutMs=(r=e.requestTimeoutMs)!=null?r:1e4,this.baseDelayMs=(i=e.baseDelayMs)!=null?i:500,this.maxDelayMs=(o=e.maxDelayMs)!=null?o:3e4,this.sleep=(s=e.sleep)!=null?s:xe,this.random=(a=e.random)!=null?a:Math.random;}async send(e){let t=this.fetch;if(!t)throw new p("no fetch implementation available in this runtime");let r=JSON.stringify(e.body),i;for(let o=0;o<=this.maxRetries;o+=1){try{let s=await this.attempt(t,e,r);if(s.ok)return;if(Ze(s.status))throw new p(`ingest rejected batch with status ${s.status}`,s.status);i=new p(`ingest transient status ${s.status}`,s.status);}catch(s){if(s instanceof p&&s.status!==void 0&&Ze(s.status))throw s;i=s;}o<this.maxRetries&&await this.sleep(this.backoff(o));}throw new p("ingest delivery failed after retries",void 0,{cause:i})}async attempt(e,t,r){let i=h(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(t.url,{body:r,headers:{authorization:`Bearer ${t.projectKey}`,"content-type":"application/json"},method:"POST",signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};var Kt="queue",Vt=1e3,et=3e4,pe=n=>{let e={};return n.avatar!==void 0&&(e.$avatar=n.avatar),n.email!==void 0&&(e.$email=n.email),n.name!==void 0&&(e.$name=n.name),n.phone!==void 0&&(e.$phone=n.phone),e},Y=class{constructor(e){c(this,"config");c(this,"identity");c(this,"session");c(this,"queue");c(this,"transport");c(this,"flagsClient");c(this,"messagesClient");c(this,"surveysClient");c(this,"guidesClient");c(this,"captureListeners",new Set);c(this,"formsClient");c(this,"ctasClient");c(this,"context");c(this,"flushTimer");c(this,"flushing",false);c(this,"cachedFlags");c(this,"cachedSnapshot");c(this,"membershipCache");c(this,"stream");c(this,"shutDown",false);c(this,"exposures",new Set);c(this,"gates");c(this,"cookielessId");c(this,"storageListeners",new Set);var s,a,l;let t=Oe(e),r=(a=(s=H(t.sharedStorage,t.namespace))!=null?s:t.consent)!=null?a:null;if(this.gates=[new F(t.storage),new F(t.sharedStorage,Xe)],t.consentMode!=="banner"||(r==null?void 0:r.analytics)===true)for(let u of this.gates)u.open();let[i,o]=this.gates;this.config={...t,sharedStorage:o,storage:i},this.identity=new U(this.config.storage,this.config.sharedStorage,this.config.ids,this.config.namespace),this.config.consent!==void 0&&this.identity.setConsent(this.config.consent),this.session=this.config.sessionTracking?new z(this.config.sharedStorage,this.config.ids,this.config.clock,this.config.namespace):void 0,this.queue=new W(this.config.maxQueueSize,({dropped:u})=>{this.config.onError(new b("queue_overflow",`event queue overflow: dropped ${u.length} oldest event(s)`));}),this.transport=(l=this.config.transport)!=null?l:new C({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new K({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new J({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.surveysClient=new j({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.guidesClient=new B({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.formsClient=new V({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.ctasClient=new N({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.context={sdk:this.config.sdkName,sdk_version:this.config.sdkVersion},this.config.os&&(this.context.os=this.config.os),this.config.locale&&(this.context.locale=this.config.locale),this.restoreQueue(),this.startTimer();}get distinctId(){return this.identity.getDistinctId()}get anonymousId(){return this.identity.getAnonymousId()}get isIdentified(){return this.identity.isIdentified()}get sessionId(){var e;return (e=this.session)==null?void 0:e.current()}get sessionStartedAt(){var e;return (e=this.session)==null?void 0:e.startedAt()}capture(e,t={}){var r,i,o,s,a,l,u;try{this.identity.refresh();let d={...this.config.defaultProperties(),...t.element===void 0?{}:(o=(i=(r=this.config).describeElement)==null?void 0:i.call(r,t.element))!=null?o:{},...(s=t.properties)!=null?s:{}},m=Ne({context:this.context,distinctId:(a=t.distinctId)!=null?a:this.identity.getDistinctId(),eventName:e,properties:d,sessionId:(u=t.sessionId)!=null?u:(l=this.session)==null?void 0:l.current(),timestamp:t.timestamp},this.config.clock,this.config.ids);this.enqueue(m);}catch(d){this.config.onError(d);}for(let d of this.captureListeners)try{d(e);}catch(m){this.config.onError(m);}}onCapture(e){return this.captureListeners.add(e),()=>{this.captureListeners.delete(e);}}identify(e,t={}){var a,l;if(this.isCookieless())return;this.identity.refresh();let r=this.identity.identify(e),i={};r.anonymousToLink!==void 0&&(i.$anon_distinct_id=r.anonymousToLink);let o=Ce(),s={...o===null?{}:{$timezone:o},...pe((a=t.traits)!=null?a:{}),...(l=t.set)!=null?l:{}};Object.keys(s).length>0&&(i.$set=s),this.capture(f.identify,{properties:i});}link(e,t,r){if(this.isCookieless())return;let i={$anon_distinct_id:t},o=pe(r!=null?r:{});Object.keys(o).length>0&&(i.$set=o),this.capture(f.identify,{distinctId:e,properties:i});}setConsent(e){this.identity.setConsent(e),e.analytics===true&&this.allowStorage(),e.analytics===false&&this.config.consentMode==="banner"&&this.forbidStorage();}isCookieless(){return !this.gates[0].isOpen}takeCookielessId(e){this.cookielessId=e,this.isCookieless()&&this.identity.assumeAnonymousId(e);}allowStorage(){if(this.isCookieless()){for(let e of this.gates)e.open();this.identity.refresh();for(let e of [...this.storageListeners])e();}}onStorageAllowed(e){return this.storageListeners.add(e),()=>{this.storageListeners.delete(e);}}forbidStorage(){if(!this.isCookieless()){for(let e of ["anonymous_id","distinct_id","linked_anonymous_id","session"])this.config.storage.removeItem(`pdx.${this.config.namespace}.${e}`),this.config.sharedStorage.removeItem(`pdx.${this.config.namespace}.${e}`);for(let e of this.gates)e.close();this.identity.refresh(),this.cookielessId!==void 0&&this.identity.assumeAnonymousId(this.cookielessId);}}consent(){return this.identity.consent()}alias(e){this.capture(f.createAlias,{properties:{alias:e}});}group(e,t,r){let i={$group_key:t,$group_type:e};r&&(i.$set=r),this.capture(f.group,{properties:i});}setPersonProperties(e,t){if(this.isCookieless())return;let r={};e&&(r.$set=e),t&&(r.$set_once=t),this.capture(f.set,{properties:r});}setPersonTraits(e){if(this.isCookieless())return;let t=pe(e);Object.keys(t).length!==0&&this.capture(f.set,{properties:{$set:t}});}async getAllFlags(){var r;let e=this.identity.getDistinctId(),t=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:t.flags,variants:(r=t.variants)!=null?r:{}},t.flags}async isFeatureEnabled(e){var i,o,s,a;let r=(i=(await this.getAllFlags())[e])!=null?i:false;return this.recordExposure(e,(a=(s=(o=this.cachedFlags)==null?void 0:o.variants[e])==null?void 0:s.key)!=null?a:String(r)),r}async getVariant(e){var i,o,s,a;let t=await this.getAllFlags(),r=(o=(i=this.cachedFlags)==null?void 0:i.variants[e])!=null?o:null;return this.recordExposure(e,(a=r==null?void 0:r.key)!=null?a:String((s=t[e])!=null?s:false)),r}async getVariantLocal(e,t={}){var l;let r=await this.flagSnapshot(),i=r.flags.find(u=>u.key===e),o=await this.localContext(t,r.flags),s=i?se(i,r.flags,o):null,a=i?D(i,r.flags,o).enabled:false;return this.recordExposure(e,(l=s==null?void 0:s.key)!=null?l:String(a)),s?{key:s.key,value:s.value}:null}recordExposure(e,t){let r=`${this.identity.getDistinctId()} ${e} ${t}`;this.exposures.has(r)||(this.exposures.add(r),this.capture(f.featureFlagCalled,{properties:{$feature_flag:e,$feature_flag_response:t}}));}getCachedFlag(e){if(!(!this.cachedFlags||this.cachedFlags.distinctId!==this.distinctId))return this.cachedFlags.flags[e]}async getLocalFlags(e={}){let t=await this.flagSnapshot();return Ge(t.flags,await this.localContext(e,t.flags))}async isFeatureEnabledLocal(e,t={}){var a,l;let r=await this.flagSnapshot(),i=r.flags.find(u=>u.key===e),o=await this.localContext(t,r.flags),s=i?D(i,r.flags,o).enabled:false;return this.recordExposure(e,(l=i?(a=se(i,r.flags,o))==null?void 0:a.key:void 0)!=null?l:String(s)),s}async localContext(e,t){let r=this.identity.getDistinctId(),i=e.cohorts;if(i===void 0&&Be(t)){let o=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===r&&o-this.membershipCache.fetchedAt<et?i=this.membershipCache.cohorts:(i=await this.flagsClient.memberships(r),this.membershipCache={cohorts:i,distinctId:r,fetchedAt:o});}return {attributes:e.attributes,cohorts:i,distinctId:r,properties:e.properties}}async flagSnapshot(){let e=this.config.clock.now().getTime();if(this.cachedSnapshot&&e-this.cachedSnapshot.fetchedAt<et)return this.cachedSnapshot.snapshot;let t=await this.flagsClient.snapshot();return this.cachedSnapshot={fetchedAt:e,snapshot:t},this.maybeStream(t),t}maybeStream(e){if(!this.config.streamFlags||this.shutDown||this.stream||!e.socketUrl)return;let t=new q({host:e.socketUrl,onChange:()=>{this.cachedSnapshot=void 0,this.flagSnapshot().catch(r=>this.config.onError(r));},onClosed:r=>{this.stream=void 0,r&&this.maybeStream(e);},projectKey:this.config.apiKey,socketFactory:this.config.socketFactory});this.stream=t,t.open();}async getInbox(){return this.messagesClient.inbox(this.identity.getDistinctId())}async markMessageRead(e){await this.messagesClient.markRead(e,this.identity.getDistinctId());}async getSurveys(e){return this.surveysClient.surveys(this.identity.getDistinctId(),e!=null?e:this.config.locale)}captureSurveyShown(e){this.capture(We,{properties:G(e,{})});}captureSurveyDismissed(e){this.capture(ze,{properties:G(e,{})});}captureSurveySent(e,t){this.capture(Ye,{properties:G(e,t)});}async getGuides(){return this.guidesClient.guides(this.identity.getDistinctId())}captureGuide(e,t,r){this.capture(e,{properties:Qe(t,r)});}async getForm(e){return this.formsClient.form(e,this.identity.getDistinctId())}async submitForm(e,t,r,i){let{$page_id:o,$page_variant:s}=this.config.defaultProperties();return this.formsClient.submit(e,{answers:t,challenge:r,distinctId:this.identity.getDistinctId(),isAnonymous:!this.identity.isIdentified(),pageUrl:typeof window=="undefined"?"":window.location.href,solution:i,...typeof o=="string"&&typeof s=="string"?{pageId:o,pageVariant:s}:{}})}async getCtas(e){return this.ctasClient.ctas({...e,anonymous:!this.identity.isIdentified(),distinctId:this.identity.getDistinctId()})}captureCta(e,t,r){this.capture(e,{properties:Le(t,r)});}async flush(){if(this.flushing||this.queue.size===0)return;this.flushing=true;let e=this.queue.drain(Vt);try{await this.transport.send({body:{events:e,sent_at:L(this.config.clock.now())},projectKey:this.config.apiKey,url:`${this.config.host}/v1/events`}),this.persistQueue();}catch(t){this.queue.requeue(e),this.persistQueue(),this.config.onError(t);}finally{this.flushing=false;}}reset(){var e;(e=this.session)==null||e.reset(),this.identity.reset(),this.cachedFlags=void 0,this.cachedSnapshot=void 0,this.membershipCache=void 0;}async shutdown(){var e;this.shutDown=true,this.stopTimer(),(e=this.stream)==null||e.close(),this.stream=void 0,await this.flush();}enqueue(e){this.queue.enqueue(e),this.persistQueue(),this.queue.size>=this.config.flushAt&&this.flush();}persistQueue(){try{this.config.storage.setItem(this.persistKey(),JSON.stringify(this.queue.snapshot()));}catch(e){this.config.onError(e);}}restoreQueue(){try{let e=this.config.storage.getItem(this.persistKey());if(!e)return;let t=JSON.parse(e);Array.isArray(t)&&this.queue.restore(t);}catch(e){this.config.onError(e);}}startTimer(){if(this.config.flushIntervalMs<=0)return;let e=setInterval(()=>{this.flush();},this.config.flushIntervalMs),t=e;typeof t.unref=="function"&&t.unref(),this.flushTimer=e;}stopTimer(){this.flushTimer!==void 0&&(clearInterval(this.flushTimer),this.flushTimer=void 0);}persistKey(){return `pdx.${this.config.namespace}.${Kt}`}};var jt="data-prodantix",Gt="data-prodantix-action",Bt="data-prodantix-ignore",$=300,me="data-pdx-no-capture",fe="pdx-no-capture",Ut=new Set(["a","button","input","label","option","select","summary","textarea"]),Ht=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]);function Jt(n){var e;return Ut.has(n.tagName.toLowerCase())||Ht.has(((e=n.getAttribute("role"))!=null?e:"").trim().toLowerCase())}function nt(n){for(let e=n;e!==null;e=e.parentElement)if(Jt(e))return e;return n}function rt(n){for(let e=n;e!==null;e=e.parentElement)if(e.getAttribute(Bt)!==null)return true;return false}function it(n){for(let e=n;e!==null;e=e.parentElement)if(e.getAttribute(me)!==null||typeof e.className=="string"&&e.className.split(/\s+/).includes(fe))return true;return false}function st(n){let e=new Set;return t=>{e.has(t.message)||(e.add(t.message),n(t));}}function tt(n,e,t){let r=n.getAttribute(e);if(r===null)return;let i=r.trim();if(i!==""){if(i.length>$){t(new b("validation",`${e} on a <${n.tagName.toLowerCase()}> is ${i.length} characters, over the ${$}-character limit, so it was ignored: "${i.slice(0,40)}\u2026"`));return}return i}}function ot(n,e){let t={},r=tt(n,jt,e);r!==void 0&&(t.$el_description=r,t.$el_description_source="annotation");let i=tt(n,Gt,e);return i!==void 0&&(t.$el_action=i),t}var Wt="$form_submitted",zt=new Set(["button","file","hidden","image","password","reset","submit"]),at=/(card|cc-?num|cvc|cvv|iban|security.?code)/i,Yt=n=>{var t;return ((t=n.getAttribute("autocomplete"))!=null?t:"").startsWith("cc-")||at.test(n.name)||at.test(n.id)},Qt=n=>{let e=n.name.toLowerCase();return n instanceof HTMLInputElement&&n.type==="email"||e==="email"||n.getAttribute("autocomplete")==="email"?"$email":e==="name"||e==="full_name"||e==="fullname"||n.getAttribute("autocomplete")==="name"?"$name":null},Xt=(n,e)=>{var i,o;if(n.closest("[data-prodantix-ignore]")||n.hasAttribute("data-prodantix-form"))return null;let t={},r={};for(let s of Array.from(n.elements)){if(!(s instanceof HTMLInputElement||s instanceof HTMLSelectElement||s instanceof HTMLTextAreaElement)||!s.name||s.closest("[data-prodantix-ignore]")||Yt(s)||s instanceof HTMLInputElement&&(zt.has(s.type)||(s.type==="checkbox"||s.type==="radio")&&!s.checked))continue;let a=s.value.trim();if(a==="")continue;t[s.name]=a;let l=Qt(s);l&&(r[l]=a);}return {$answers:t,$form_id:n.id||`${e}#${Array.from(n.ownerDocument.forms).indexOf(n)}`,$page_url:(o=(i=n.ownerDocument.location)==null?void 0:i.href)!=null?o:"",$set:r,collected:true}},ct=(n,e=document)=>{let t=r=>{var i,o;if(r.target instanceof HTMLFormElement){let s=Xt(r.target,(o=(i=e.location)==null?void 0:i.pathname)!=null?o:"");s&&n.capture(Wt,{properties:s});}};return e.addEventListener("submit",t,true),()=>e.removeEventListener("submit",t,true)};var Zt=1e3,en=5e3,tn=50,he=class{constructor(){c(this,"fcp");c(this,"lcp");c(this,"cls");c(this,"window",{end:0,start:0,sum:0});c(this,"interactions",new Map);}add(e){var t,r;if(e.entryType==="paint"&&e.name==="first-contentful-paint"&&(this.fcp=e.startTime),e.entryType==="largest-contentful-paint"&&(this.lcp=e.startTime),e.entryType==="layout-shift"&&!e.hadRecentInput&&e.value!==void 0){let i=this.window.sum>0&&e.startTime-this.window.end<Zt&&e.startTime-this.window.start<en;this.window=i?{end:e.startTime,start:this.window.start,sum:this.window.sum+e.value}:{end:e.startTime,start:e.startTime,sum:e.value},this.cls=Math.max((t=this.cls)!=null?t:0,this.window.sum);}e.entryType==="event"&&e.interactionId!==void 0&&e.interactionId>0&&this.interactions.set(e.interactionId,Math.max((r=this.interactions.get(e.interactionId))!=null?r:0,e.duration));}properties(e){var r;let t={};if(this.lcp!==void 0&&(t.$lcp_ms=Math.round(this.lcp)),this.fcp!==void 0&&(t.$fcp_ms=Math.round(this.fcp)),this.cls!==void 0&&(t.$cls=Math.round(this.cls*1e4)/1e4),this.interactions.size>0){let i=[...this.interactions.values()].sort((o,s)=>s-o);t.$inp_ms=Math.round((r=i[Math.min(i.length-1,Math.floor(i.length/tn))])!=null?r:0);}return e!==void 0&&(t.$ttfb_ms=Math.round(e)),t}},nn=[{type:"paint"},{type:"largest-contentful-paint"},{type:"layout-shift"},{durationThreshold:40,type:"event"}];function lt(n,e){let t=new he,r=[];for(let s of nn){let a=e.observer(l=>{for(let u of l)t.add(u);});if(a!==void 0)try{a.observe({...s,buffered:!0}),r.push(a);}catch(l){a.disconnect();}}let i=false,o=()=>{if(i)return;let s=t.properties(e.firstByte());if(Object.keys(s).length===0)return;i=true;let a=e.path();n.capture(f.webVitals,{properties:a===void 0?s:{...s,$pathname:a}});};return e.addEventListener("visibilitychange",()=>{e.isHidden()&&o();}),e.addEventListener("pagehide",o),()=>{for(let s of r)s.disconnect();}}function ut(){if(!(typeof window=="undefined"||typeof document=="undefined"||typeof PerformanceObserver=="undefined"))return {addEventListener:(n,e)=>(n==="pagehide"?window:document).addEventListener(n,e),firstByte:()=>{let n=performance.getEntriesByType("navigation")[0];return n instanceof PerformanceNavigationTiming&&n.responseStart>0?n.responseStart:void 0},isHidden:()=>document.visibilityState==="hidden",observer:n=>{try{return new PerformanceObserver(e=>n(e.getEntries()))}catch(e){return}},path:()=>{var n;return (n=window.location)==null?void 0:n.pathname}}}var rn=new Set(["input","select","textarea"]),sn=new Set(["email","password","tel"]);function X(){return globalThis.location}function dt(){return globalThis.document}function on(){let n=globalThis.window;return n!=null?n:globalThis}function an(n){return typeof n=="object"&&n!==null&&typeof n.tagName=="string"}function Q(n,e){let t;try{t=new URL(n,e);}catch(r){return}return t.protocol==="http:"||t.protocol==="https:"?`${t.origin}${t.pathname}`:t.protocol}function pt(){let n=X(),e=dt(),t={};if(n){let r=Q(n.href);r&&(t.$current_url=r),t.$pathname=n.pathname,t.$host=n.host;}if(e){e.title&&(t.$title=e.title);let r=e.referrer?Q(e.referrer):void 0;r&&(t.$referrer=r);}return t}function cn(n){return typeof n.className=="string"?n.className:""}function ln(n){var e;return rn.has(n.tagName.toLowerCase())||sn.has(((e=n.getAttribute("type"))!=null?e:"").toLowerCase())}function un(n,e,t){var l,u;let r={$el_tag:n.tagName.toLowerCase(),$event_type:"click"};if(e)return r;let i=t?(l=n.textContent)==null?void 0:l.trim():void 0;i&&(r.$el_text=i.slice(0,255)),n.id&&(r.$el_id=n.id);let o=cn(n);o&&(r.$el_classes=o);let s=n.getAttribute("href"),a=s?Q(s,(u=X())==null?void 0:u.href):void 0;return a&&(r.$el_href=a),r}function ge(n){return (n!=null?n:"").replace(/\s+/g," ").trim()}function P(n,e){return {$el_description:n,$el_description_source:e}}function dn(n,e,t){var s;if(!e&&t){let a=ge(n.getAttribute("aria-label"));if(a!==""&&a.length<=$)return P(a,"aria_label");let l=ge(n.textContent);if(l!==""&&l.length<=$)return P(l,"text")}let r=e?null:n.getAttribute("href"),i=r?Q(r,(s=X())==null?void 0:s.href):void 0;if(i)return P(i,"href");let o=ge(n.getAttribute("role")).toLowerCase();return o===""?P(n.tagName.toLowerCase(),"tag"):P(o,"role")}function pn(n,e){let t=new Set,r=(u,d)=>{if(t.has(u))return false;try{return d()}catch(m){return t.add(u),e(new b("config",`autocapture maskSelectors entry "${u}" is not a valid selector`,{cause:m})),false}},i=(u,d)=>u.matches?r(d,()=>{var m;return ((m=u.matches)==null?void 0:m.call(u,d))===!0}):false,o=u=>{var m;let d=(m=u.querySelector)==null?void 0:m.bind(u);return d?d(`[${me}], .${fe}`)!==null||n.some(v=>r(v,()=>d(v)!==null)):false},s=u=>{for(let d=u;d;d=d.parentElement){let m=d;if(n.some(v=>i(m,v)))return true}return false},a=u=>{for(let d=u;d;d=d.parentElement)if(ln(d))return true;return false},l=u=>it(u)||s(u);return {holdsMasked:o,isMasked:u=>l(u)||a(u),isOptedOut:l}}function mn(n){let e=globalThis.history,t=on(),r="",i=()=>{let a=X(),l=a?`${a.pathname}${a.search}`:"";l!==r&&(r=l,n.capture(f.pageview,{properties:pt()}));};if(i(),!e||!t)return ()=>{};let o=e.pushState.bind(e),s=e.replaceState.bind(e);return e.pushState=(...a)=>{o(...a),i();},e.replaceState=(...a)=>{s(...a),i();},t.addEventListener("popstate",i),()=>{e.pushState=o,e.replaceState=s,t.removeEventListener("popstate",i);}}function fn(n,e){var l,u,d;let t=dt();if(!t)return ()=>{};let r=(l=e.onError)!=null?l:(()=>{}),i=pn((u=e.maskSelectors)!=null?u:[],r),o=st(r),s=(d=e.captureElementText)!=null?d:false,a=m=>{let v=m.target;if(!an(v)||rt(v))return;let k=nt(v),_=i.isMasked(v)||i.holdsMasked(k),I=i.isOptedOut(v)?{}:ot(k,o),O=I.$el_description===void 0?dn(k,_,s):{};n.capture(f.autocapture,{properties:{...pt(),...un(k,_,s),...O,...I}});};return t.addEventListener("click",a,true),()=>t.removeEventListener("click",a,true)}function mt(n,e={}){var i,o;let t=[];((i=e.pageviews)==null||i)&&t.push(mn(n)),((o=e.clicks)==null||o)&&t.push(fn(n,e)),e.collectForms===true&&typeof document!="undefined"&&t.push(ct(n));let r=e.webVitals===false?void 0:ut();return r!==void 0&&t.push(lt(n,r)),()=>{for(let s of t)s();}}function hn(){let n=globalThis.document;return (n==null?void 0:n.visibilityState)==="hidden"}function gn(n){let e=globalThis.navigator,t=globalThis.Blob;if(!(e!=null&&e.sendBeacon)||!t)return false;let r=JSON.stringify({...n.body,api_key:n.projectKey});try{let i=new t([r],{type:"application/json"});return e.sendBeacon(n.url,i)}catch(i){return false}}var Z=class{constructor(e={}){c(this,"fetchTransport");this.fetchTransport=new C(e);}async send(e){hn()&&gn(e)||await this.fetchTransport.send(e);}};var ye="prodantix:consent-ready",ve="prodantix:consent",ft="__prodantixConsent";var ht=(n,e)=>{n.takeCookielessId(e.anonymousId),e.consent!==null?n.setConsent(e.consent):e.rule==="notice"&&n.allowStorage();},gt=(n,e)=>{let t=e[ft];t&&ht(n,t);let r=o=>{let s=o.detail;s&&ht(n,s);},i=o=>{let s=o.detail;s&&n.setConsent(s);};return e.addEventListener(ye,r),e.addEventListener(ve,i),()=>{e.removeEventListener(ye,r),e.removeEventListener(ve,i);}};var yn=/^\d{1,3}(\.\d{1,3}){3}$/,vn=/^[a-z0-9.-]+$/i;function yt(){return Math.random().toString(36).slice(2,12)}function ee(n,e){let t=`${e}=`,r=[];for(let i of n.cookie.split(";")){let o=i.trim();o.startsWith(t)&&r.push(o.slice(t.length));}return r}function M(n,e,t){let r=["Path=/",`Max-Age=${e}`,"SameSite=Lax"];return n&&r.push(`Domain=${n}`),t&&r.push("Secure"),r.join("; ")}function vt(n,e,t,r){try{let i=`pdx_probe_${r()}`,o=r();n.cookie=`${i}=${o}; ${M(e,60,t)}`;let s=ee(n,i).includes(o);n.cookie=`${i}=; ${M(e,0,t)}`;let a=ee(n,i).includes(o);return s&&!a}catch(i){return false}}function bn(n){let e=n.replace(/^\[|\]$/g,"").toLowerCase();if(e.includes(":")||yn.test(e)||!e.includes("."))return [];let t=e.split("."),r=[];for(let i=t.length-2;i>=0;i-=1)r.push(t.slice(i).join("."));return r}function Sn(n,e,t,r=yt){for(let i of bn(n))if(vt(e,i,t,r))return i}function kn(n){let e=new Map,t=JSON.parse(decodeURIComponent(n));if(t===null||typeof t!="object"||Array.isArray(t))return e;for(let[r,i]of Object.entries(t))typeof i=="string"&&e.set(r,i);return e}var be=class{constructor(e,t,r,i){this.jar=e;this.name=t;this.domain=r;this.secure=i;}getItem(e){var t;return (t=this.read().get(e))!=null?t:null}setItem(e,t){let r=this.read();r.set(e,t),this.write(r);}removeItem(e){let t=this.read();t.delete(e)&&this.write(t);}read(){try{let e=ee(this.jar,this.name);e.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${M(void 0,0,this.secure)}`,e=ee(this.jar,this.name));let t=e[0];return t?kn(t):new Map}catch(e){return new Map}}write(e){try{if(e.size===0){this.jar.cookie=`${this.name}=; ${M(this.domain,0,this.secure)}`;return}let t=encodeURIComponent(JSON.stringify(Object.fromEntries(e)));this.jar.cookie=`${this.name}=${t}; ${M(this.domain,31536e3,this.secure)}`;}catch(t){return}}};function En(){return globalThis.document}function xn(){var n,e;return (e=(n=globalThis.location)==null?void 0:n.hostname)!=null?e:""}function wn(){var n;return ((n=globalThis.location)==null?void 0:n.protocol)==="https:"}function Tn(n){if(n===void 0)return;let e=n.startsWith(".")?n.slice(1):n;return vn.test(e)?e.toLowerCase():void 0}function bt(n){var s,a,l,u,d;let e="jar"in n?n.jar:En();if(!e||((s=globalThis.navigator)==null?void 0:s.cookieEnabled)===false)return null;let r=(a=n.random)!=null?a:yt,i=(l=n.secure)!=null?l:wn(),o=(u=n.hostname)!=null?u:xn();try{let m=(d=Tn(n.domain))!=null?d:Sn(o,e,i,r);return vt(e,m,i,r)?new be(e,n.name,m,i):null}catch(m){return null}}var St=(n,e,t,r=Date.now)=>{let i=0,o=e.visibilityState==="visible"?r():void 0,s=()=>{o!==void 0&&(i+=r()-o,o=void 0,n(Math.round(i/1e3)));},a=()=>{e.visibilityState==="visible"?o!=null||(o=r()):s();};return e.addEventListener("visibilitychange",a),t.addEventListener("pagehide",s),()=>{e.removeEventListener("visibilitychange",a),t.removeEventListener("pagehide",s);}};var kt=(n,e)=>({...n.page?{$page_id:n.page}:{},...n.page&&e?{$page_view_id:e}:{},...n.variant?{$page_variant:n.variant}:{}});var Cn=(n,e)=>{var t;try{return (t=bt({name:`pdx_${ne(n)}`}))!=null?t:e}catch(r){return e}},S=document.currentScript,Se=S==null?void 0:S.dataset.key,Et,xt;if(S&&Se){let n=new URL(S.src,window.location.href).origin,e=we(),t=S.dataset.consent==="banner",r=new Y({apiKey:Se,...t?{consentMode:"banner"}:{},defaultProperties:kt(S.dataset,te()),flagsHost:(Et=S.dataset.edge)!=null?Et:n,host:(xt=S.dataset.host)!=null?xt:n,sharedStorage:Cn(Se,e),storage:e,transport:new Z({})});t&&gt(r,window),mt(r,{clicks:true,collectForms:false,pageviews:true}),St(i=>{r.capture(f.pageleave,{properties:{$engaged_seconds:i}}),r.flush();},document,window);}})();//# sourceMappingURL=pages.iife.js.map
1
+ (function(){'use strict';var wt=Object.defineProperty;var Tt=(n,e,t)=>e in n?wt(n,e,{enumerable:true,configurable:true,writable:true,value:t}):n[e]=t;var c=(n,e,t)=>Tt(n,typeof e!="symbol"?e+"":e,t);var b=class extends Error{constructor(t,r,i){super(r,i);c(this,"code");this.code=t,this.name="ProdantixError";}},F=class extends b{constructor(e){super("config",e),this.name="ConfigError";}},T=class extends b{constructor(t,r){super("validation",r);c(this,"field");this.field=t,this.name="ValidationError";}},p=class extends b{constructor(t,r,i){super("transport",t,i);c(this,"status");this.status=r,this.name="TransportError";}};function y(n){if(n)return n;let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}function h(){let n=globalThis.AbortController;return n?new n:void 0}var xe=n=>new Promise(e=>{setTimeout(e,n);});function g(n){return n.replace(/\/+$/,"")}var E=class{constructor(){c(this,"store",new Map);}getItem(e){var t;return (t=this.store.get(e))!=null?t:null}removeItem(e){this.store.delete(e);}setItem(e,t){this.store.set(e,t);}},A=class{constructor(e,t=()=>false){this.real=e;this.passes=t;c(this,"held",new E);c(this,"opened",false);}get isOpen(){return this.opened}open(){this.opened=true;}close(){this.opened=false;}target(e){return this.opened||this.passes(e)?this.real:this.held}getItem(e){return this.target(e).getItem(e)}removeItem(e){this.target(e).removeItem(e);}setItem(e,t){this.target(e).setItem(e,t);}};function we(){try{let n=globalThis.localStorage;if(n){let e="__pdx_probe__";return n.setItem(e,"1"),n.removeItem(e),n}}catch(n){return new E}return new E}var Te={now:()=>new Date};function L(n){return n.toISOString()}function Ce(){if(typeof window=="undefined"||typeof Intl=="undefined")return null;let n=Intl.DateTimeFormat().resolvedOptions().timeZone;return typeof n=="string"&&n!==""?n:null}function Ct(){return globalThis.crypto}function _t(n){n[6]=n[6]&15|64,n[8]=n[8]&63|128;let e=[];for(let t=0;t<16;t+=1)e.push(n[t].toString(16).padStart(2,"0"));return `${e[0]}${e[1]}${e[2]}${e[3]}-${e[4]}${e[5]}-${e[6]}${e[7]}-${e[8]}${e[9]}-${e[10]}${e[11]}${e[12]}${e[13]}${e[14]}${e[15]}`}function te(){let n=Ct();if(n!=null&&n.randomUUID)return n.randomUUID();let e=new Uint8Array(16);if(n!=null&&n.getRandomValues)n.getRandomValues(e);else for(let t=0;t<16;t+=1)e[t]=Math.floor(Math.random()*256);return _t(e)}var _e={uuid:te};var It=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var Ft=/^(?:\$|[a-z])[a-z0-9_.]*$/;function Ie(n){let e=0;for(let t of n)e+=1;return e}function Fe(n){return It.test(n)}function At(n){return Ft.test(n)}function Ae(n){let e=Ie(n);if(e<1||e>200)throw new T("distinct_id","distinct_id must be between 1 and 200 characters")}function $e(n){let e=Ie(n);if(e<1||e>200)throw new T("event_name","event_name must be between 1 and 200 characters");if(!At(n))throw new T("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var Pe="prodantix-js",Me="0.8.0";var $t=n=>{};function Oe(n){var i,o,s,a,l,u,d,f,v,k,_,I,O,ke,Ee;if(!n.apiKey||!Fe(n.apiKey))throw new F("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!n.host)throw new F("host is required (the ingest base URL)");let e=g(n.host),t=n.defaultProperties,r=(i=n.storage)!=null?i:new E;return {apiKey:n.apiKey,autocapture:(o=n.autocapture)!=null?o:false,clock:(s=n.clock)!=null?s:Te,consent:n.consent,consentMode:n.consentMode,defaultProperties:typeof t=="function"?t:()=>t!=null?t:{},describeElement:n.describeElement,flagsHost:n.flagsHost?g(n.flagsHost):e,flushAt:(a=n.flushAt)!=null?a:20,flushIntervalMs:(l=n.flushIntervalMs)!=null?l:1e4,host:e,ids:(u=n.ids)!=null?u:_e,locale:n.locale,maxQueueSize:(d=n.maxQueueSize)!=null?d:1e3,maxRetries:(f=n.maxRetries)!=null?f:3,namespace:ne(n.apiKey),onError:(v=n.onError)!=null?v:$t,os:n.os,requestTimeoutMs:(k=n.requestTimeoutMs)!=null?k:1e4,sdkName:(_=n.sdkName)!=null?_:Pe,sdkVersion:(I=n.sdkVersion)!=null?I:Me,sessionTracking:(O=n.sessionTracking)!=null?O:false,sharedStorage:(ke=n.sharedStorage)!=null?ke:r,socketFactory:n.socketFactory,storage:r,streamFlags:(Ee=n.streamFlags)!=null?Ee:false,transport:n.transport}}function ne(n){return n.slice(0,16)}var Le=(n,e)=>{let t={$cta_id:n.id,$cta_kind:n.kind,$cta_variant:n.variant.key,$cta_version:n.version},r=e===void 0?void 0:n.variant.content.buttons[e];return r&&e!==void 0&&(t.$cta_button=e,t.$cta_button_label=r.label,r.action.kind==="form"&&(t.$cta_form_id=r.action.value)),t},N=class{constructor(e){c(this,"fetch");c(this,"host");c(this,"projectKey");c(this,"requestTimeoutMs");var t;this.fetch=y(e.fetch),this.host=g(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async ctas(e){let t=this.fetch;if(!t)throw new p("no fetch implementation available in this runtime");let r=new URLSearchParams({anonymous:String(e.anonymous),device:e.device,distinct_id:e.distinctId,language:e.language,url:e.url}),i=h(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s=await t(`${this.host}/v1/ctas?${r.toString()}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(s.status<200||s.status>=300)throw new p(`ctas request failed with status ${s.status}`,s.status);return JSON.parse(await s.text()).ctas}finally{o!==void 0&&clearTimeout(o);}}};function Ne(n,e,t){var i,o,s;$e(n.eventName),Ae(n.distinctId);let r={distinct_id:n.distinctId,event_id:(i=n.eventId)!=null?i:t.uuid(),event_name:n.eventName,properties:(o=n.properties)!=null?o:{},schema_version:1,timestamp:L((s=n.timestamp)!=null?s:e.now())};return n.context&&(r.context=n.context),n.sessionId&&(r.session_id=n.sessionId),r}var w=Symbol("absent");function Pt(n,e){var i,o;if(n==="distinct_id")return e.distinctId;let t=(i=e.properties)!=null?i:{};if(Object.prototype.hasOwnProperty.call(t,n))return t[n];let r=(o=e.attributes)!=null?o:{};return Object.prototype.hasOwnProperty.call(r,n)?r[n]:w}function x(n){return n===w?"undefined":String(n)}function Re(n){return n===w?Number.NaN:Number(n)}function De(n){return n!==w&&n!==null&&n!==""}function qe(n,e){if(!Array.isArray(e))return false;let t=x(n);return e.map(r=>String(r)).includes(t)}function Ke(n,e){var i,o;let t=Pt(n.attribute,e),r=n.value;switch(n.op){case "is_set":return De(t);case "is_not_set":return !De(t);case "eq":return x(t)===x(r===void 0?w:r);case "neq":return x(t)!==x(r===void 0?w:r);case "contains":return x(t).includes(x(r===void 0?w:r));case "in":return qe(t,r);case "not_in":return Array.isArray(r)?!qe(t,r):false;case "gt":return R(t,r,(s,a)=>s>a);case "gte":return R(t,r,(s,a)=>s>=a);case "lt":return R(t,r,(s,a)=>s<a);case "lte":return R(t,r,(s,a)=>s<=a);case "in_cohort":return typeof r=="string"&&r!==""&&((i=e.cohorts)!=null?i:[]).includes(r);case "not_in_cohort":return typeof r=="string"&&r!==""&&!((o=e.cohorts)!=null?o:[]).includes(r);default:return false}}function R(n,e,t){let r=Re(n),i=e===void 0?Number.NaN:Re(e);return Number.isNaN(r)||Number.isNaN(i)?false:t(r,i)}function Ve(n,e){let t=`${n}:${e}`,r=2166136261;for(let i=0;i<t.length;i++)r^=t.charCodeAt(i),r=Math.imul(r,16777619);return (r>>>0)%100}function re(n,e){return n.targeting.length===0||n.targeting.every(t=>Ke(t,e))}function je(n,e){var o;let t=Ve(n.key,e.distinctId),r=(o=n.variations)!=null?o:[];if(r.length===0)return n.rolloutPercentage>=100||t<n.rolloutPercentage?"true":"false";let i=0;for(let s=r.length-1;s>=0;s--)if(i+=r[s].weight,t<i)return r[s].key;return r[0].key}function ie(n,e,t,r){var i;for(let o of (i=n.prerequisites)!=null?i:[]){if(r.includes(o.flagKey))return false;let s=e.find(l=>l.key===o.flagKey);if(!s||!s.enabled)return false;r.push(s.key);let a=ie(s,e,t,r)&&re(s,t)&&je(s,t)===o.variationKey;if(r.pop(),!a)return false}return true}function D(n,e,t){return n.enabled?ie(n,e,t,[n.key])?re(n,t)?n.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:Ve(n.key,t.distinctId)<n.rolloutPercentage?{enabled:true,reason:"rollout"}:{enabled:false,reason:"rollout_excluded"}:{enabled:false,reason:"targeting"}:{enabled:false,reason:"prerequisite"}:{enabled:false,reason:"disabled"}}function Ge(n,e){let t={};for(let r of n)t[r.key]=D(r,n,e).enabled;return t}function se(n,e,t){var s,a;let r=(s=n.variations)!=null?s:[],i=r[0];if(!i)return null;if(!n.enabled||!ie(n,e,t,[n.key])||!re(n,t))return i;let o=je(n,t);return (a=r.find(l=>l.key===o))!=null?a:i}function Be(n){return n.some(e=>e.targeting.some(t=>t.op==="in_cohort"||t.op==="not_in_cohort"))}function Ue(n){return `40${JSON.stringify(n)}`}function He(){return "3"}function Je(n){let e=n.charAt(0),t=n.slice(1);if(e==="2")return {kind:"ping"};if(e==="1")return {kind:"disconnect"};if(e==="0"){let s=oe(t);return {kind:"open",pingInterval:typeof(s==null?void 0:s.pingInterval)=="number"?s.pingInterval:25e3,pingTimeout:typeof(s==null?void 0:s.pingTimeout)=="number"?s.pingTimeout:2e4}}if(e!=="4")return {kind:"other"};let r=t.charAt(0),i=t.slice(1);if(r==="0")return {kind:"connected"};if(r==="1")return {kind:"disconnect"};if(r==="4"){let s=oe(i);return {kind:"connectError",message:typeof(s==null?void 0:s.message)=="string"?s.message:"refused"}}if(r!=="2")return {kind:"other"};let o=oe(i);return !Array.isArray(o)||typeof o[0]!="string"?{kind:"other"}:{kind:"event",name:o[0],payload:o[1]}}function oe(n){try{return JSON.parse(n)}catch(e){return null}}var Mt="/socket.io/?EIO=4&transport=websocket",Ot=250,q=class{constructor(e){this.options=e;c(this,"socket",null);c(this,"heartbeat",null);c(this,"pending",null);c(this,"lastKey","");c(this,"ready",false);c(this,"closed",false);c(this,"heartbeatWindow",45e3);c(this,"factory");c(this,"setTimer");c(this,"clearTimer");var t,r,i;this.factory=(t=e.socketFactory)!=null?t:Lt,this.setTimer=(r=e.setTimer)!=null?r:((o,s)=>setTimeout(o,s)),this.clearTimer=(i=e.clearTimer)!=null?i:(o=>clearTimeout(o));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${Mt}`,t;try{t=this.factory(e);}catch(r){this.options.onClosed(false);return}this.socket=t,t.onmessage=r=>this.receive(String(r.data)),t.onerror=()=>t.close(),t.onclose=()=>this.fell();}close(){this.closed=true,this.stopHeartbeat(),this.pending!==null&&this.clearTimer(this.pending),this.pending=null;let e=this.socket;this.socket=null,e==null||e.close();}receive(e){var r,i,o,s;let t=Je(e);if(t.kind==="open"){this.armHeartbeat(t.pingInterval+t.pingTimeout),(r=this.socket)==null||r.send(Ue({projectKey:this.options.projectKey}));return}if(t.kind==="ping"){this.armHeartbeat(),(i=this.socket)==null||i.send(He());return}if(t.kind==="connectError"||t.kind==="disconnect"){this.stopHeartbeat(),(o=this.socket)==null||o.close();return}if(t.kind==="event"){if(t.name==="ready"){this.ready=true;return}if(t.name==="flagChange"){let a=(s=t.payload)==null?void 0:s.key;this.lastKey=typeof a=="string"?a:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},Ot));}}}fell(){this.stopHeartbeat();let e=this.ready;this.socket=null,this.ready=false,this.closed||this.options.onClosed(e);}armHeartbeat(e){e!==void 0&&(this.heartbeatWindow=e),this.stopHeartbeat(),this.heartbeat=this.setTimer(()=>{var t;return (t=this.socket)==null?void 0:t.close()},this.heartbeatWindow);}stopHeartbeat(){this.heartbeat!==null&&this.clearTimer(this.heartbeat),this.heartbeat=null;}};function Lt(n){let e=globalThis.WebSocket;if(!e)throw new p("no WebSocket");return new e(n)}var K=class{constructor(e){c(this,"fetch");c(this,"host");c(this,"projectKey");c(this,"requestTimeoutMs");var t;this.fetch=y(e.fetch),this.host=g(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){var s,a;let t=this.fetch;if(!t)throw new p("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,i=h(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let l=await t(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!l.ok)throw new p(`flags request failed with status ${l.status}`,l.status);let u=JSON.parse(await l.text());return {flags:(s=u.flags)!=null?s:{},variants:(a=u.variants)!=null?a:{}}}finally{o!==void 0&&clearTimeout(o);}}async snapshot(){var o;let e=this.fetch;if(!e)throw new p("no fetch implementation available in this runtime");let t=`${this.host}/v1/flags/snapshot`,r=h(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await e(t,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new p(`flag snapshot request failed with status ${s.status}`,s.status);let a=JSON.parse(await s.text()),l={flags:(o=a.flags)!=null?o:[],generatedAt:a.generatedAt};return typeof a.socketUrl=="string"&&a.socketUrl!==""&&(l.socketUrl=a.socketUrl),l}finally{i!==void 0&&clearTimeout(i);}}async memberships(e){var s;let t=this.fetch;if(!t)throw new p("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,i=h(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await t(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new p(`memberships request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).cohorts)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};var ae=class extends Error{constructor(t,r,i){super(i);c(this,"fields");c(this,"status");this.name="FormRefusedError",this.status=t,this.fields=r;}},V=class{constructor(e){c(this,"fetch");c(this,"host");c(this,"projectKey");c(this,"requestTimeoutMs");var t;this.fetch=y(e.fetch),this.host=g(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async request(e,t){let r=this.fetch;if(!r)throw new p("no fetch implementation available in this runtime");let i=h(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s={authorization:`Bearer ${this.projectKey}`};t.body!==void 0&&(s["content-type"]="application/json");let a=await r(`${this.host}${e}`,{body:t.body,headers:s,method:t.method,signal:i==null?void 0:i.signal});return {status:a.status,text:await a.text()}}finally{o!==void 0&&clearTimeout(o);}}async form(e,t){let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}?distinct_id=${encodeURIComponent(t)}`,{method:"GET"});if(r<200||r>=300)throw new p(`form request failed with status ${r}`,r);return JSON.parse(i)}async submit(e,t){var a,l,u,d;let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}/submissions`,{body:JSON.stringify(t),method:"POST"});if(r>=200&&r<300)return JSON.parse(i).afterSubmit;let o=[],s=`form submission failed with status ${r}`;try{let f=JSON.parse(i);o=(l=(a=f.error)==null?void 0:a.fields)!=null?l:[],s=(d=(u=f.error)==null?void 0:u.message)!=null?d:s;}catch(f){o=[];}throw new ae(r,o,s)}};var We="$survey_shown",ze="$survey_dismissed",Ye="$survey_sent",j=class{constructor(e){c(this,"fetch");c(this,"host");c(this,"projectKey");c(this,"requestTimeoutMs");var t;this.fetch=y(e.fetch),this.host=g(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async surveys(e,t){var s;let r=this.fetch;if(!r)throw new p("no fetch implementation available in this runtime");let i=h(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await r(`${this.host}/v1/surveys?distinct_id=${encodeURIComponent(e)}${t?`&lang=${encodeURIComponent(t)}`:""}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new p(`surveys request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).surveys)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};function G(n,e){let t={$survey_id:n.id,$survey_iteration:n.iteration,$survey_name:n.name};for(let[r,i]of Object.entries(e))t[`$survey_response_${r}`]=i;return t}var B=class{constructor(e){c(this,"fetch");c(this,"host");c(this,"projectKey");c(this,"requestTimeoutMs");var t;this.fetch=y(e.fetch),this.host=g(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async guides(e){var o;let t=this.fetch;if(!t)throw new p("no fetch implementation available in this runtime");let r=h(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await t(`${this.host}/v1/guides?distinct_id=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new p(`guides request failed with status ${s.status}`,s.status);return (o=JSON.parse(await s.text()).guides)!=null?o:[]}finally{i!==void 0&&clearTimeout(i);}}};function Qe(n,e){let t={$guide_id:n.id,$guide_iteration:n.iteration,$guide_name:n.name};return e!==void 0&&(t.$guide_step_id=e),t}function ce(n){if(typeof n!="string")return;let e=Array.from(n).length;return e>=1&&e<=200?n:void 0}function ue(n,e){return `pdx.${n}.${e}`}var de="consent",Nt=["identityLink","analytics","marketing","functional"];function le(n){if(typeof n!="string")return null;try{let e=JSON.parse(n);if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e,r={};for(let i of Nt){let o=t[i];typeof o=="boolean"&&(r[i]=o);}return typeof t.version=="number"&&Number.isInteger(t.version)&&(r.version=t.version),Array.isArray(t.categories)&&t.categories.every(i=>typeof i=="string")&&(r.categories=t.categories),Object.keys(r).length===0?null:r}catch(e){return null}}var Xe=n=>n.endsWith(`.${de}`);function H(n,e){return le(n.getItem(ue(e,de)))}function Rt(n,e,t){var s;let r=ue(e,de),i=le(JSON.stringify(t)),o=i===null?null:le(JSON.stringify({...(s=H(n,e))!=null?s:{},...i}));if(o===null){n.removeItem(r);return}n.setItem(r,JSON.stringify(o));}var U=class{constructor(e,t,r,i){this.storage=e;this.shared=t;this.ids=r;this.namespace=i;c(this,"anonymousId");c(this,"distinctId");c(this,"identified");this.refresh();}refresh(){let e=ce(this.shared.getItem(this.key("anonymous_id"))),t=ce(this.storage.getItem(this.key("anonymous_id")));e?(this.anonymousId=e,t!==e&&this.storage.setItem(this.key("anonymous_id"),e)):t?(this.anonymousId=t,this.shared.setItem(this.key("anonymous_id"),t)):(this.anonymousId=this.ids.uuid(),this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId));let r=ce(this.storage.getItem(this.key("distinct_id")));r?(this.distinctId=r,this.identified=true):(this.distinctId=this.anonymousId,this.identified=false);}getAnonymousId(){return this.anonymousId}getDistinctId(){return this.distinctId}isIdentified(){return this.identified}snapshot(){return {anonymousId:this.anonymousId,distinctId:this.distinctId,identified:this.identified}}consent(){return H(this.shared,this.namespace)}setConsent(e){Rt(this.shared,this.namespace,e);}assumeAnonymousId(e){this.anonymousId=e,this.shared.setItem(this.key("anonymous_id"),e),this.storage.setItem(this.key("anonymous_id"),e),this.identified||(this.distinctId=e);}identify(e){var o;let t=!this.identified||this.distinctId!==e,r=this.storage.getItem(this.key("linked_anonymous_id")),i=t||r!==this.anonymousId;return this.distinctId=e,this.identified=true,t&&this.storage.setItem(this.key("distinct_id"),e),!i||((o=this.consent())==null?void 0:o.identityLink)===false?{changed:t}:(this.storage.setItem(this.key("linked_anonymous_id"),this.anonymousId),{anonymousToLink:this.anonymousId,changed:t})}reset(){this.anonymousId=this.ids.uuid(),this.distinctId=this.anonymousId,this.identified=false,this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.removeItem(this.key("distinct_id")),this.storage.removeItem(this.key("linked_anonymous_id"));}key(e){return ue(this.namespace,e)}};var J=class{constructor(e){c(this,"fetch");c(this,"host");c(this,"projectKey");c(this,"requestTimeoutMs");var t;this.fetch=y(e.fetch),this.host=g(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async inbox(e){var s;let t=this.requireFetch(),r=`${this.host}/v1/messages?distinct_id=${encodeURIComponent(e)}`,i=await this.request(t,r,{headers:this.authHeaders(),method:"GET"});if(!i.ok)throw new p(`inbox request failed with status ${i.status}`,i.status);return (s=JSON.parse(await i.text()).messages)!=null?s:[]}async markRead(e,t){let r=this.requireFetch(),i=`${this.host}/v1/messages/read`,o=await this.request(r,i,{body:JSON.stringify({distinct_id:t,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!o.ok)throw new p(`mark-read request failed with status ${o.status}`,o.status)}requireFetch(){if(!this.fetch)throw new p("no fetch implementation available in this runtime");return this.fetch}authHeaders(){return {authorization:`Bearer ${this.projectKey}`}}async request(e,t,r){let i=h(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(t,{...r,signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}};var W=class{constructor(e,t){this.maxSize=e;this.onOverflow=t;c(this,"events",[]);}get size(){return this.events.length}enqueue(e){this.events.push(e),this.enforceCap();}restore(e){this.events.push(...e),this.enforceCap();}requeue(e){this.events.unshift(...e),this.enforceCap();}drain(e){let t=e===void 0?this.events.length:Math.min(e,this.events.length);return this.events.splice(0,t)}snapshot(){return [...this.events]}enforceCap(){var t;if(this.events.length<=this.maxSize)return;let e=this.events.splice(0,this.events.length-this.maxSize);(t=this.onOverflow)==null||t.call(this,{dropped:e});}};var Dt={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function qt(n){return `pdx.${n}.session`}var z=class{constructor(e,t,r,i,o=Dt){this.storage=e;this.ids=t;this.clock=r;this.namespace=i;this.options=o;}current(){return this.touch().id}startedAt(){return this.touch().startedAt}reset(){this.storage.removeItem(this.key());}touch(){let e=this.clock.now().getTime(),t=this.live(this.read(),e);if(t===void 0)return this.write({id:this.ids.uuid(),lastActivityAt:e,startedAt:e});if(e-t.lastActivityAt<=this.options.throttleMs)return t;let r=this.live(this.read(),e),i=r!==void 0&&r.id!==t.id?r:t;return this.write({...i,lastActivityAt:e})}live(e,t){if(e!==void 0&&!(t-e.lastActivityAt>this.options.idleMs||t-e.startedAt>this.options.maxMs))return e}write(e){return this.storage.setItem(this.key(),JSON.stringify(e)),e}read(){let e=this.storage.getItem(this.key());if(e)try{let t=JSON.parse(e);return typeof t.id=="string"&&typeof t.startedAt=="number"&&typeof t.lastActivityAt=="number"?{id:t.id,lastActivityAt:t.lastActivityAt,startedAt:t.startedAt}:void 0}catch(t){return}}key(){return qt(this.namespace)}};var m={autocapture:"$autocapture",createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",pageleave:"$pageleave",pageview:"$pageview",set:"$set",webVitals:"$web_vitals"};function Ze(n){return n>=400&&n<500&&n!==429}var C=class{constructor(e={}){c(this,"fetch");c(this,"maxRetries");c(this,"requestTimeoutMs");c(this,"baseDelayMs");c(this,"maxDelayMs");c(this,"sleep");c(this,"random");var t,r,i,o,s,a;this.fetch=y(e.fetch),this.maxRetries=(t=e.maxRetries)!=null?t:3,this.requestTimeoutMs=(r=e.requestTimeoutMs)!=null?r:1e4,this.baseDelayMs=(i=e.baseDelayMs)!=null?i:500,this.maxDelayMs=(o=e.maxDelayMs)!=null?o:3e4,this.sleep=(s=e.sleep)!=null?s:xe,this.random=(a=e.random)!=null?a:Math.random;}async send(e){let t=this.fetch;if(!t)throw new p("no fetch implementation available in this runtime");let r=JSON.stringify(e.body),i;for(let o=0;o<=this.maxRetries;o+=1){try{let s=await this.attempt(t,e,r);if(s.ok)return;if(Ze(s.status))throw new p(`ingest rejected batch with status ${s.status}`,s.status);i=new p(`ingest transient status ${s.status}`,s.status);}catch(s){if(s instanceof p&&s.status!==void 0&&Ze(s.status))throw s;i=s;}o<this.maxRetries&&await this.sleep(this.backoff(o));}throw new p("ingest delivery failed after retries",void 0,{cause:i})}async attempt(e,t,r){let i=h(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(t.url,{body:r,headers:{authorization:`Bearer ${t.projectKey}`,"content-type":"application/json"},method:"POST",signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};var Kt="queue",Vt=1e3,et=3e4,pe=n=>{let e={};return n.avatar!==void 0&&(e.$avatar=n.avatar),n.email!==void 0&&(e.$email=n.email),n.name!==void 0&&(e.$name=n.name),n.phone!==void 0&&(e.$phone=n.phone),e},Y=class{constructor(e){c(this,"config");c(this,"identity");c(this,"session");c(this,"queue");c(this,"transport");c(this,"flagsClient");c(this,"messagesClient");c(this,"surveysClient");c(this,"guidesClient");c(this,"captureListeners",new Set);c(this,"formsClient");c(this,"ctasClient");c(this,"context");c(this,"flushTimer");c(this,"flushing",false);c(this,"cachedFlags");c(this,"cachedSnapshot");c(this,"membershipCache");c(this,"stream");c(this,"shutDown",false);c(this,"exposures",new Set);c(this,"gates");c(this,"cookielessId");c(this,"storageListeners",new Set);var s,a,l;let t=Oe(e),r=(a=(s=H(t.sharedStorage,t.namespace))!=null?s:t.consent)!=null?a:null;if(this.gates=[new A(t.storage),new A(t.sharedStorage,Xe)],t.consentMode!=="banner"||(r==null?void 0:r.analytics)===true)for(let u of this.gates)u.open();let[i,o]=this.gates;this.config={...t,sharedStorage:o,storage:i},this.identity=new U(this.config.storage,this.config.sharedStorage,this.config.ids,this.config.namespace),this.config.consent!==void 0&&this.identity.setConsent(this.config.consent),this.session=this.config.sessionTracking?new z(this.config.sharedStorage,this.config.ids,this.config.clock,this.config.namespace):void 0,this.queue=new W(this.config.maxQueueSize,({dropped:u})=>{this.config.onError(new b("queue_overflow",`event queue overflow: dropped ${u.length} oldest event(s)`));}),this.transport=(l=this.config.transport)!=null?l:new C({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new K({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new J({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.surveysClient=new j({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.guidesClient=new B({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.formsClient=new V({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.ctasClient=new N({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.context={sdk:this.config.sdkName,sdk_version:this.config.sdkVersion},this.config.os&&(this.context.os=this.config.os),this.config.locale&&(this.context.locale=this.config.locale),this.restoreQueue(),this.startTimer();}get distinctId(){return this.identity.getDistinctId()}get anonymousId(){return this.identity.getAnonymousId()}get isIdentified(){return this.identity.isIdentified()}get sessionId(){var e;return (e=this.session)==null?void 0:e.current()}get sessionStartedAt(){var e;return (e=this.session)==null?void 0:e.startedAt()}capture(e,t={}){var r,i,o,s,a,l,u;try{this.identity.refresh();let d={...this.config.defaultProperties(),...t.element===void 0?{}:(o=(i=(r=this.config).describeElement)==null?void 0:i.call(r,t.element))!=null?o:{},...(s=t.properties)!=null?s:{}},f=Ne({context:this.context,distinctId:(a=t.distinctId)!=null?a:this.identity.getDistinctId(),eventName:e,properties:d,sessionId:(u=t.sessionId)!=null?u:(l=this.session)==null?void 0:l.current(),timestamp:t.timestamp},this.config.clock,this.config.ids);this.enqueue(f);}catch(d){this.config.onError(d);}for(let d of this.captureListeners)try{d(e);}catch(f){this.config.onError(f);}}onCapture(e){return this.captureListeners.add(e),()=>{this.captureListeners.delete(e);}}identify(e,t={}){var a,l;if(this.isCookieless())return;this.identity.refresh();let r=this.identity.identify(e),i={};r.anonymousToLink!==void 0&&(i.$anon_distinct_id=r.anonymousToLink);let o=Ce(),s={...o===null?{}:{$timezone:o},...pe((a=t.traits)!=null?a:{}),...(l=t.set)!=null?l:{}};Object.keys(s).length>0&&(i.$set=s),this.capture(m.identify,{properties:i});}link(e,t,r){if(this.isCookieless())return;let i={$anon_distinct_id:t},o=pe(r!=null?r:{});Object.keys(o).length>0&&(i.$set=o),this.capture(m.identify,{distinctId:e,properties:i});}setConsent(e){this.identity.setConsent(e),e.analytics===true&&this.allowStorage(),e.analytics===false&&this.config.consentMode==="banner"&&this.forbidStorage();}isCookieless(){return !this.gates[0].isOpen}takeCookielessId(e){this.cookielessId=e,this.isCookieless()&&this.identity.assumeAnonymousId(e);}allowStorage(){if(this.isCookieless()){for(let e of this.gates)e.open();this.identity.refresh();for(let e of [...this.storageListeners])e();}}onStorageAllowed(e){return this.storageListeners.add(e),()=>{this.storageListeners.delete(e);}}forbidStorage(){if(!this.isCookieless()){for(let e of ["anonymous_id","distinct_id","linked_anonymous_id","session"])this.config.storage.removeItem(`pdx.${this.config.namespace}.${e}`),this.config.sharedStorage.removeItem(`pdx.${this.config.namespace}.${e}`);for(let e of this.gates)e.close();this.identity.refresh(),this.cookielessId!==void 0&&this.identity.assumeAnonymousId(this.cookielessId);}}consent(){return this.identity.consent()}alias(e){this.capture(m.createAlias,{properties:{alias:e}});}group(e,t,r){let i={$group_key:t,$group_type:e};r&&(i.$set=r),this.capture(m.group,{properties:i});}setPersonProperties(e,t){if(this.isCookieless())return;let r={};e&&(r.$set=e),t&&(r.$set_once=t),this.capture(m.set,{properties:r});}setPersonTraits(e){if(this.isCookieless())return;let t=pe(e);Object.keys(t).length!==0&&this.capture(m.set,{properties:{$set:t}});}async getAllFlags(){var r;let e=this.identity.getDistinctId(),t=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:t.flags,variants:(r=t.variants)!=null?r:{}},t.flags}async isFeatureEnabled(e){var i,o,s,a;let r=(i=(await this.getAllFlags())[e])!=null?i:false;return this.recordExposure(e,(a=(s=(o=this.cachedFlags)==null?void 0:o.variants[e])==null?void 0:s.key)!=null?a:String(r)),r}async getVariant(e){var i,o,s,a;let t=await this.getAllFlags(),r=(o=(i=this.cachedFlags)==null?void 0:i.variants[e])!=null?o:null;return this.recordExposure(e,(a=r==null?void 0:r.key)!=null?a:String((s=t[e])!=null?s:false)),r}async getVariantLocal(e,t={}){var l;let r=await this.flagSnapshot(),i=r.flags.find(u=>u.key===e),o=await this.localContext(t,r.flags),s=i?se(i,r.flags,o):null,a=i?D(i,r.flags,o).enabled:false;return this.recordExposure(e,(l=s==null?void 0:s.key)!=null?l:String(a)),s?{key:s.key,value:s.value}:null}recordExposure(e,t){let r=`${this.identity.getDistinctId()} ${e} ${t}`;this.exposures.has(r)||(this.exposures.add(r),this.capture(m.featureFlagCalled,{properties:{$feature_flag:e,$feature_flag_response:t}}));}getCachedFlag(e){if(!(!this.cachedFlags||this.cachedFlags.distinctId!==this.distinctId))return this.cachedFlags.flags[e]}async getLocalFlags(e={}){let t=await this.flagSnapshot();return Ge(t.flags,await this.localContext(e,t.flags))}async isFeatureEnabledLocal(e,t={}){var a,l;let r=await this.flagSnapshot(),i=r.flags.find(u=>u.key===e),o=await this.localContext(t,r.flags),s=i?D(i,r.flags,o).enabled:false;return this.recordExposure(e,(l=i?(a=se(i,r.flags,o))==null?void 0:a.key:void 0)!=null?l:String(s)),s}async localContext(e,t){let r=this.identity.getDistinctId(),i=e.cohorts;if(i===void 0&&Be(t)){let o=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===r&&o-this.membershipCache.fetchedAt<et?i=this.membershipCache.cohorts:(i=await this.flagsClient.memberships(r),this.membershipCache={cohorts:i,distinctId:r,fetchedAt:o});}return {attributes:e.attributes,cohorts:i,distinctId:r,properties:e.properties}}async flagSnapshot(){let e=this.config.clock.now().getTime();if(this.cachedSnapshot&&e-this.cachedSnapshot.fetchedAt<et)return this.cachedSnapshot.snapshot;let t=await this.flagsClient.snapshot();return this.cachedSnapshot={fetchedAt:e,snapshot:t},this.maybeStream(t),t}maybeStream(e){if(!this.config.streamFlags||this.shutDown||this.stream||!e.socketUrl)return;let t=new q({host:e.socketUrl,onChange:()=>{this.cachedSnapshot=void 0,this.flagSnapshot().catch(r=>this.config.onError(r));},onClosed:r=>{this.stream=void 0,r&&this.maybeStream(e);},projectKey:this.config.apiKey,socketFactory:this.config.socketFactory});this.stream=t,t.open();}async getInbox(){return this.messagesClient.inbox(this.identity.getDistinctId())}async markMessageRead(e){await this.messagesClient.markRead(e,this.identity.getDistinctId());}async getSurveys(e){return this.surveysClient.surveys(this.identity.getDistinctId(),e!=null?e:this.config.locale)}captureSurveyShown(e){this.capture(We,{properties:G(e,{})});}captureSurveyDismissed(e){this.capture(ze,{properties:G(e,{})});}captureSurveySent(e,t){this.capture(Ye,{properties:G(e,t)});}async getGuides(){return this.guidesClient.guides(this.identity.getDistinctId())}captureGuide(e,t,r){this.capture(e,{properties:Qe(t,r)});}async getForm(e){return this.formsClient.form(e,this.identity.getDistinctId())}async submitForm(e,t,r,i){let{$page_id:o,$page_variant:s}=this.config.defaultProperties();return this.formsClient.submit(e,{answers:t,challenge:r,distinctId:this.identity.getDistinctId(),isAnonymous:!this.identity.isIdentified(),pageUrl:typeof window=="undefined"?"":window.location.href,solution:i,...typeof o=="string"&&typeof s=="string"?{pageId:o,pageVariant:s}:{}})}async getCtas(e){return this.ctasClient.ctas({...e,anonymous:!this.identity.isIdentified(),distinctId:this.identity.getDistinctId()})}captureCta(e,t,r){this.capture(e,{properties:Le(t,r)});}async flush(){if(this.flushing||this.queue.size===0)return;this.flushing=true;let e=this.queue.drain(Vt);try{await this.transport.send({body:{events:e,sent_at:L(this.config.clock.now())},projectKey:this.config.apiKey,url:`${this.config.host}/v1/events`}),this.persistQueue();}catch(t){this.queue.requeue(e),this.persistQueue(),this.config.onError(t);}finally{this.flushing=false;}}reset(){var e;(e=this.session)==null||e.reset(),this.identity.reset(),this.cachedFlags=void 0,this.cachedSnapshot=void 0,this.membershipCache=void 0;}async shutdown(){var e;this.shutDown=true,this.stopTimer(),(e=this.stream)==null||e.close(),this.stream=void 0,await this.flush();}enqueue(e){this.queue.enqueue(e),this.persistQueue(),this.queue.size>=this.config.flushAt&&this.flush();}persistQueue(){try{this.config.storage.setItem(this.persistKey(),JSON.stringify(this.queue.snapshot()));}catch(e){this.config.onError(e);}}restoreQueue(){try{let e=this.config.storage.getItem(this.persistKey());if(!e)return;let t=JSON.parse(e);Array.isArray(t)&&this.queue.restore(t);}catch(e){this.config.onError(e);}}startTimer(){if(this.config.flushIntervalMs<=0)return;let e=setInterval(()=>{this.flush();},this.config.flushIntervalMs),t=e;typeof t.unref=="function"&&t.unref(),this.flushTimer=e;}stopTimer(){this.flushTimer!==void 0&&(clearInterval(this.flushTimer),this.flushTimer=void 0);}persistKey(){return `pdx.${this.config.namespace}.${Kt}`}};var jt="data-prodantix",Gt="data-prodantix-action",Bt="data-prodantix-ignore",$=300,fe="data-pdx-no-capture",me="pdx-no-capture",Ut=new Set(["a","button","input","label","option","select","summary","textarea"]),Ht=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]);function Jt(n){var e;return Ut.has(n.tagName.toLowerCase())||Ht.has(((e=n.getAttribute("role"))!=null?e:"").trim().toLowerCase())}function nt(n){for(let e=n;e!==null;e=e.parentElement)if(Jt(e))return e;return n}function rt(n){for(let e=n;e!==null;e=e.parentElement)if(e.getAttribute(Bt)!==null)return true;return false}function it(n){for(let e=n;e!==null;e=e.parentElement)if(e.getAttribute(fe)!==null||typeof e.className=="string"&&e.className.split(/\s+/).includes(me))return true;return false}function st(n){let e=new Set;return t=>{e.has(t.message)||(e.add(t.message),n(t));}}function tt(n,e,t){let r=n.getAttribute(e);if(r===null)return;let i=r.trim();if(i!==""){if(i.length>$){t(new b("validation",`${e} on a <${n.tagName.toLowerCase()}> is ${i.length} characters, over the ${$}-character limit, so it was ignored: "${i.slice(0,40)}\u2026"`));return}return i}}function ot(n,e){let t={},r=tt(n,jt,e);r!==void 0&&(t.$el_description=r,t.$el_description_source="annotation");let i=tt(n,Gt,e);return i!==void 0&&(t.$el_action=i),t}var Wt="$form_submitted",zt=new Set(["button","file","hidden","image","password","reset","submit"]),at=/(card|cc-?num|cvc|cvv|iban|security.?code)/i,Yt=n=>{var t;return ((t=n.getAttribute("autocomplete"))!=null?t:"").startsWith("cc-")||at.test(n.name)||at.test(n.id)},Qt=n=>{let e=n.name.toLowerCase();return n instanceof HTMLInputElement&&n.type==="email"||e==="email"||n.getAttribute("autocomplete")==="email"?"$email":e==="name"||e==="full_name"||e==="fullname"||n.getAttribute("autocomplete")==="name"?"$name":null},Xt=(n,e)=>{var i,o;if(n.closest("[data-prodantix-ignore]")||n.hasAttribute("data-prodantix-form"))return null;let t={},r={};for(let s of Array.from(n.elements)){if(!(s instanceof HTMLInputElement||s instanceof HTMLSelectElement||s instanceof HTMLTextAreaElement)||!s.name||s.closest("[data-prodantix-ignore]")||Yt(s)||s instanceof HTMLInputElement&&(zt.has(s.type)||(s.type==="checkbox"||s.type==="radio")&&!s.checked))continue;let a=s.value.trim();if(a==="")continue;t[s.name]=a;let l=Qt(s);l&&(r[l]=a);}return {$answers:t,$form_id:n.id||`${e}#${Array.from(n.ownerDocument.forms).indexOf(n)}`,$page_url:(o=(i=n.ownerDocument.location)==null?void 0:i.href)!=null?o:"",$set:r,collected:true}},ct=(n,e=document)=>{let t=r=>{var i,o;if(r.target instanceof HTMLFormElement){let s=Xt(r.target,(o=(i=e.location)==null?void 0:i.pathname)!=null?o:"");s&&n.capture(Wt,{properties:s});}};return e.addEventListener("submit",t,true),()=>e.removeEventListener("submit",t,true)};var Zt=1e3,en=5e3,tn=50,he=class{constructor(){c(this,"fcp");c(this,"lcp");c(this,"cls");c(this,"window",{end:0,start:0,sum:0});c(this,"interactions",new Map);}add(e){var t,r;if(e.entryType==="paint"&&e.name==="first-contentful-paint"&&(this.fcp=e.startTime),e.entryType==="largest-contentful-paint"&&(this.lcp=e.startTime),e.entryType==="layout-shift"&&!e.hadRecentInput&&e.value!==void 0){let i=this.window.sum>0&&e.startTime-this.window.end<Zt&&e.startTime-this.window.start<en;this.window=i?{end:e.startTime,start:this.window.start,sum:this.window.sum+e.value}:{end:e.startTime,start:e.startTime,sum:e.value},this.cls=Math.max((t=this.cls)!=null?t:0,this.window.sum);}e.entryType==="event"&&e.interactionId!==void 0&&e.interactionId>0&&this.interactions.set(e.interactionId,Math.max((r=this.interactions.get(e.interactionId))!=null?r:0,e.duration));}properties(e){var r;let t={};if(this.lcp!==void 0&&(t.$lcp_ms=Math.round(this.lcp)),this.fcp!==void 0&&(t.$fcp_ms=Math.round(this.fcp)),this.cls!==void 0&&(t.$cls=Math.round(this.cls*1e4)/1e4),this.interactions.size>0){let i=[...this.interactions.values()].sort((o,s)=>s-o);t.$inp_ms=Math.round((r=i[Math.min(i.length-1,Math.floor(i.length/tn))])!=null?r:0);}return e!==void 0&&(t.$ttfb_ms=Math.round(e)),t}},nn=[{type:"paint"},{type:"largest-contentful-paint"},{type:"layout-shift"},{durationThreshold:40,type:"event"}];function lt(n,e){let t=new he,r=[];for(let s of nn){let a=e.observer(l=>{for(let u of l)t.add(u);});if(a!==void 0)try{a.observe({...s,buffered:!0}),r.push(a);}catch(l){a.disconnect();}}let i=false,o=()=>{if(i)return;let s=t.properties(e.firstByte());if(Object.keys(s).length===0)return;i=true;let a=e.path();n.capture(m.webVitals,{properties:a===void 0?s:{...s,$pathname:a}});};return e.addEventListener("visibilitychange",()=>{e.isHidden()&&o();}),e.addEventListener("pagehide",o),()=>{for(let s of r)s.disconnect();}}function ut(){if(!(typeof window=="undefined"||typeof document=="undefined"||typeof PerformanceObserver=="undefined"))return {addEventListener:(n,e)=>(n==="pagehide"?window:document).addEventListener(n,e),firstByte:()=>{let n=performance.getEntriesByType("navigation")[0];return n instanceof PerformanceNavigationTiming&&n.responseStart>0?n.responseStart:void 0},isHidden:()=>document.visibilityState==="hidden",observer:n=>{try{return new PerformanceObserver(e=>n(e.getEntries()))}catch(e){return}},path:()=>{var n;return (n=window.location)==null?void 0:n.pathname}}}var rn=new Set(["input","select","textarea"]),sn=new Set(["email","password","tel"]);function X(){return globalThis.location}function dt(){return globalThis.document}function on(){let n=globalThis.window;return n!=null?n:globalThis}function an(n){return typeof n=="object"&&n!==null&&typeof n.tagName=="string"}function Q(n,e){let t;try{t=new URL(n,e);}catch(r){return}return t.protocol==="http:"||t.protocol==="https:"?`${t.origin}${t.pathname}`:t.protocol}function pt(){let n=X(),e=dt(),t={};if(n){let r=Q(n.href);r&&(t.$current_url=r),t.$pathname=n.pathname,t.$host=n.host;}if(e){e.title&&(t.$title=e.title);let r=e.referrer?Q(e.referrer):void 0;r&&(t.$referrer=r);}return t}function cn(n){return typeof n.className=="string"?n.className:""}function ln(n){var e;return rn.has(n.tagName.toLowerCase())||sn.has(((e=n.getAttribute("type"))!=null?e:"").toLowerCase())}function un(n,e,t){var l,u;let r={$el_tag:n.tagName.toLowerCase(),$event_type:"click"};if(e)return r;let i=t?(l=n.textContent)==null?void 0:l.trim():void 0;i&&(r.$el_text=i.slice(0,255)),n.id&&(r.$el_id=n.id);let o=cn(n);o&&(r.$el_classes=o);let s=n.getAttribute("href"),a=s?Q(s,(u=X())==null?void 0:u.href):void 0;return a&&(r.$el_href=a),r}function ge(n){return (n!=null?n:"").replace(/\s+/g," ").trim()}function P(n,e){return {$el_description:n,$el_description_source:e}}function dn(n,e,t){var s;if(!e&&t){let a=ge(n.getAttribute("aria-label"));if(a!==""&&a.length<=$)return P(a,"aria_label");let l=ge(n.textContent);if(l!==""&&l.length<=$)return P(l,"text")}let r=e?null:n.getAttribute("href"),i=r?Q(r,(s=X())==null?void 0:s.href):void 0;if(i)return P(i,"href");let o=ge(n.getAttribute("role")).toLowerCase();return o===""?P(n.tagName.toLowerCase(),"tag"):P(o,"role")}function pn(n,e){let t=new Set,r=(u,d)=>{if(t.has(u))return false;try{return d()}catch(f){return t.add(u),e(new b("config",`autocapture maskSelectors entry "${u}" is not a valid selector`,{cause:f})),false}},i=(u,d)=>u.matches?r(d,()=>{var f;return ((f=u.matches)==null?void 0:f.call(u,d))===!0}):false,o=u=>{var f;let d=(f=u.querySelector)==null?void 0:f.bind(u);return d?d(`[${fe}], .${me}`)!==null||n.some(v=>r(v,()=>d(v)!==null)):false},s=u=>{for(let d=u;d;d=d.parentElement){let f=d;if(n.some(v=>i(f,v)))return true}return false},a=u=>{for(let d=u;d;d=d.parentElement)if(ln(d))return true;return false},l=u=>it(u)||s(u);return {holdsMasked:o,isMasked:u=>l(u)||a(u),isOptedOut:l}}function fn(n){let e=globalThis.history,t=on(),r="",i=()=>{let a=X(),l=a?`${a.pathname}${a.search}`:"";l!==r&&(r=l,n.capture(m.pageview,{properties:pt()}));};if(i(),!e||!t)return ()=>{};let o=e.pushState.bind(e),s=e.replaceState.bind(e);return e.pushState=(...a)=>{o(...a),i();},e.replaceState=(...a)=>{s(...a),i();},t.addEventListener("popstate",i),()=>{e.pushState=o,e.replaceState=s,t.removeEventListener("popstate",i);}}function mn(n,e){var l,u,d;let t=dt();if(!t)return ()=>{};let r=(l=e.onError)!=null?l:(()=>{}),i=pn((u=e.maskSelectors)!=null?u:[],r),o=st(r),s=(d=e.captureElementText)!=null?d:false,a=f=>{let v=f.target;if(!an(v)||rt(v))return;let k=nt(v),_=i.isMasked(v)||i.holdsMasked(k),I=i.isOptedOut(v)?{}:ot(k,o),O=I.$el_description===void 0?dn(k,_,s):{};n.capture(m.autocapture,{properties:{...pt(),...un(k,_,s),...O,...I}});};return t.addEventListener("click",a,true),()=>t.removeEventListener("click",a,true)}function ft(n,e={}){var i,o;let t=[];((i=e.pageviews)==null||i)&&t.push(fn(n)),((o=e.clicks)==null||o)&&t.push(mn(n,e)),e.collectForms===true&&typeof document!="undefined"&&t.push(ct(n));let r=e.webVitals===false?void 0:ut();return r!==void 0&&t.push(lt(n,r)),()=>{for(let s of t)s();}}function hn(){let n=globalThis.document;return (n==null?void 0:n.visibilityState)==="hidden"}function gn(n){let e=globalThis.navigator,t=globalThis.Blob;if(!(e!=null&&e.sendBeacon)||!t)return false;let r=JSON.stringify({...n.body,api_key:n.projectKey});try{let i=new t([r],{type:"application/json"});return e.sendBeacon(n.url,i)}catch(i){return false}}var Z=class{constructor(e={}){c(this,"fetchTransport");this.fetchTransport=new C(e);}async send(e){hn()&&gn(e)||await this.fetchTransport.send(e);}};var ye="prodantix:consent-ready",ve="prodantix:consent",mt="__prodantixConsent";var ht=(n,e)=>{n.takeCookielessId(e.anonymousId),e.consent!==null?n.setConsent(e.consent):e.rule==="notice"&&n.allowStorage();},gt=(n,e)=>{let t=e[mt];t&&ht(n,t);let r=o=>{let s=o.detail;s&&ht(n,s);},i=o=>{let s=o.detail;s&&n.setConsent(s);};return e.addEventListener(ye,r),e.addEventListener(ve,i),()=>{e.removeEventListener(ye,r),e.removeEventListener(ve,i);}};var yn=/^\d{1,3}(\.\d{1,3}){3}$/,vn=/^[a-z0-9.-]+$/i;function yt(){return Math.random().toString(36).slice(2,12)}function ee(n,e){let t=`${e}=`,r=[];for(let i of n.cookie.split(";")){let o=i.trim();o.startsWith(t)&&r.push(o.slice(t.length));}return r}function M(n,e,t){let r=["Path=/",`Max-Age=${e}`,"SameSite=Lax"];return n&&r.push(`Domain=${n}`),t&&r.push("Secure"),r.join("; ")}function vt(n,e,t,r){try{let i=`pdx_probe_${r()}`,o=r();n.cookie=`${i}=${o}; ${M(e,60,t)}`;let s=ee(n,i).includes(o);n.cookie=`${i}=; ${M(e,0,t)}`;let a=ee(n,i).includes(o);return s&&!a}catch(i){return false}}function bn(n){let e=n.replace(/^\[|\]$/g,"").toLowerCase();if(e.includes(":")||yn.test(e)||!e.includes("."))return [];let t=e.split("."),r=[];for(let i=t.length-2;i>=0;i-=1)r.push(t.slice(i).join("."));return r}function Sn(n,e,t,r=yt){for(let i of bn(n))if(vt(e,i,t,r))return i}function kn(n){let e=new Map,t=JSON.parse(decodeURIComponent(n));if(t===null||typeof t!="object"||Array.isArray(t))return e;for(let[r,i]of Object.entries(t))typeof i=="string"&&e.set(r,i);return e}var be=class{constructor(e,t,r,i){this.jar=e;this.name=t;this.domain=r;this.secure=i;}getItem(e){var t;return (t=this.read().get(e))!=null?t:null}setItem(e,t){let r=this.read();r.set(e,t),this.write(r);}removeItem(e){let t=this.read();t.delete(e)&&this.write(t);}read(){try{let e=ee(this.jar,this.name);e.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${M(void 0,0,this.secure)}`,e=ee(this.jar,this.name));let t=e[0];return t?kn(t):new Map}catch(e){return new Map}}write(e){try{if(e.size===0){this.jar.cookie=`${this.name}=; ${M(this.domain,0,this.secure)}`;return}let t=encodeURIComponent(JSON.stringify(Object.fromEntries(e)));this.jar.cookie=`${this.name}=${t}; ${M(this.domain,31536e3,this.secure)}`;}catch(t){return}}};function En(){return globalThis.document}function xn(){var n,e;return (e=(n=globalThis.location)==null?void 0:n.hostname)!=null?e:""}function wn(){var n;return ((n=globalThis.location)==null?void 0:n.protocol)==="https:"}function Tn(n){if(n===void 0)return;let e=n.startsWith(".")?n.slice(1):n;return vn.test(e)?e.toLowerCase():void 0}function bt(n){var s,a,l,u,d;let e="jar"in n?n.jar:En();if(!e||((s=globalThis.navigator)==null?void 0:s.cookieEnabled)===false)return null;let r=(a=n.random)!=null?a:yt,i=(l=n.secure)!=null?l:wn(),o=(u=n.hostname)!=null?u:xn();try{let f=(d=Tn(n.domain))!=null?d:Sn(o,e,i,r);return vt(e,f,i,r)?new be(e,n.name,f,i):null}catch(f){return null}}var St=(n,e,t,r=Date.now)=>{let i=0,o=e.visibilityState==="visible"?r():void 0,s=()=>{o!==void 0&&(i+=r()-o,o=void 0,n(Math.round(i/1e3)));},a=()=>{e.visibilityState==="visible"?o!=null||(o=r()):s();};return e.addEventListener("visibilitychange",a),t.addEventListener("pagehide",s),()=>{e.removeEventListener("visibilitychange",a),t.removeEventListener("pagehide",s);}};var kt=(n,e)=>({...n.page?{$page_id:n.page}:{},...n.page&&e?{$page_view_id:e}:{},...n.variant?{$page_variant:n.variant}:{}});var Cn=(n,e)=>{var t;try{return (t=bt({name:`pdx_${ne(n)}`}))!=null?t:e}catch(r){return e}},S=document.currentScript,Se=S==null?void 0:S.dataset.key,Et,xt;if(S&&Se){let n=new URL(S.src,window.location.href).origin,e=we(),t=S.dataset.consent==="banner",r=new Y({apiKey:Se,...t?{consentMode:"banner"}:{},defaultProperties:kt(S.dataset,te()),flagsHost:(Et=S.dataset.edge)!=null?Et:n,host:(xt=S.dataset.host)!=null?xt:n,sharedStorage:Cn(Se,e),storage:e,transport:new Z({})});t&&gt(r,window),ft(r,{clicks:true,collectForms:false,pageviews:true}),St(i=>{r.capture(m.pageleave,{properties:{$engaged_seconds:i}}),r.flush();},document,window);}})();//# sourceMappingURL=pages.iife.js.map
2
2
  //# sourceMappingURL=pages.iife.js.map
package/package.json CHANGED
@@ -63,5 +63,5 @@
63
63
  "sideEffects": false,
64
64
  "type": "module",
65
65
  "types": "./dist/index.d.ts",
66
- "version": "0.8.0-beta.651"
66
+ "version": "0.8.0"
67
67
  }