@prodantix/sdk 0.7.0 → 0.8.0-beta.547

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/web.js CHANGED
@@ -1,25 +1,25 @@
1
- import {Z as Z$1,e,d,u,s,b,c,h as h$1,_,t,S as S$1,U,V,P,M,L,J as J$1,O,H,B as B$1,N,E,I,F,G,z,k,j,i}from'./chunk-L4P6GMBC.js';import'./chunk-V77KYPOF.js';import {e as e$1,h,d as d$1,f,a as a$1}from'./chunk-ODN4ZELX.js';import {a}from'./chunk-5XGN7UAV.js';var lt="data-prodantix",pt="data-prodantix-action",mt="data-prodantix-ignore",D=300,ke="data-pdx-no-capture",be="pdx-no-capture",cn=new Set(["a","button","input","label","option","select","summary","textarea"]),ln=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]);function pn(e){return cn.has(e.tagName.toLowerCase())||ln.has((e.getAttribute("role")??"").trim().toLowerCase())}function we(e){for(let t=e;t!==null;t=t.parentElement)if(pn(t))return t;return e}function Ee(e){for(let t=e;t!==null;t=t.parentElement)if(t.getAttribute(mt)!==null)return true;return false}function Se(e){for(let t=e;t!==null;t=t.parentElement)if(t.getAttribute(ke)!==null||typeof t.className=="string"&&t.className.split(/\s+/).includes(be))return true;return false}function J(e){let t=new Set;return n=>{t.has(n.message)||(t.add(n.message),e(n));}}function ct(e,t,n){let r=e.getAttribute(t);if(r===null)return;let o=r.trim();if(o!==""){if(o.length>D){n(new a$1("validation",`${t} on a <${e.tagName.toLowerCase()}> is ${o.length} characters, over the ${D}-character limit, so it was ignored: "${o.slice(0,40)}\u2026"`));return}return o}}function Te(e,t){let n={},r=ct(e,lt,t);r!==void 0&&(n.$el_description=r,n.$el_description_source="annotation");let o=ct(e,pt,t);return o!==void 0&&(n.$el_action=o),n}function ft(e,t){return !mn(e)||Ee(e)||Se(e)?{}:Te(we(e),t)}function mn(e){return typeof e=="object"&&e!==null&&typeof e.tagName=="string"&&typeof e.getAttribute=="function"}var fn="$form_submitted",gn=new Set(["button","file","hidden","image","password","reset","submit"]),gt=/(card|cc-?num|cvc|cvv|iban|security.?code)/i,hn=e=>(e.getAttribute("autocomplete")??"").startsWith("cc-")||gt.test(e.name)||gt.test(e.id),yn=e=>{let t=e.name.toLowerCase();return e instanceof HTMLInputElement&&e.type==="email"||t==="email"||e.getAttribute("autocomplete")==="email"?"$email":t==="name"||t==="full_name"||t==="fullname"||e.getAttribute("autocomplete")==="name"?"$name":null},xn=(e,t)=>{if(e.closest("[data-prodantix-ignore]")||e.hasAttribute("data-prodantix-form"))return null;let n={},r={};for(let o of Array.from(e.elements)){if(!(o instanceof HTMLInputElement||o instanceof HTMLSelectElement||o instanceof HTMLTextAreaElement)||!o.name||o.closest("[data-prodantix-ignore]")||hn(o)||o instanceof HTMLInputElement&&(gn.has(o.type)||(o.type==="checkbox"||o.type==="radio")&&!o.checked))continue;let a=o.value.trim();if(a==="")continue;n[o.name]=a;let i=yn(o);i&&(r[i]=a);}return {$answers:n,$form_id:e.id||`${t}#${Array.from(e.ownerDocument.forms).indexOf(e)}`,$page_url:e.ownerDocument.location?.href??"",$set:r,collected:true}},ht=(e,t=document)=>{let n=r=>{if(r.target instanceof HTMLFormElement){let o=xn(r.target,t.location?.pathname??"");o&&e.capture(fn,{properties:o});}};return t.addEventListener("submit",n,true),()=>t.removeEventListener("submit",n,true)};var vn=new Set(["input","select","textarea"]),kn=new Set(["email","password","tel"]);function X(){return globalThis.location}function yt(){return globalThis.document}function bn(){return globalThis.window??globalThis}function wn(e){return typeof e=="object"&&e!==null&&typeof e.tagName=="string"}function Y(e,t){let n;try{n=new URL(e,t);}catch{return}return n.protocol==="http:"||n.protocol==="https:"?`${n.origin}${n.pathname}`:n.protocol}function xt(){let e=X(),t=yt(),n={};if(e){let r=Y(e.href);r&&(n.$current_url=r),n.$pathname=e.pathname,n.$host=e.host;}if(t){t.title&&(n.$title=t.title);let r=t.referrer?Y(t.referrer):void 0;r&&(n.$referrer=r);}return n}function En(e){return typeof e.className=="string"?e.className:""}function Sn(e){return vn.has(e.tagName.toLowerCase())||kn.has((e.getAttribute("type")??"").toLowerCase())}function Tn(e,t,n){let r={$el_tag:e.tagName.toLowerCase(),$event_type:"click"};if(t)return r;let o=n?e.textContent?.trim():void 0;o&&(r.$el_text=o.slice(0,255)),e.id&&(r.$el_id=e.id);let a=En(e);a&&(r.$el_classes=a);let i=e.getAttribute("href"),s=i?Y(i,X()?.href):void 0;return s&&(r.$el_href=s),r}function Ce(e){return (e??"").replace(/\s+/g," ").trim()}function q(e,t){return {$el_description:e,$el_description_source:t}}function Cn(e,t,n){if(!t&&n){let i=Ce(e.getAttribute("aria-label"));if(i!==""&&i.length<=D)return q(i,"aria_label");let s=Ce(e.textContent);if(s!==""&&s.length<=D)return q(s,"text")}let r=t?null:e.getAttribute("href"),o=r?Y(r,X()?.href):void 0;if(o)return q(o,"href");let a=Ce(e.getAttribute("role")).toLowerCase();return a===""?q(e.tagName.toLowerCase(),"tag"):q(a,"role")}function Ln(e,t){let n=new Set,r=(d,u)=>{if(n.has(d))return false;try{return u()}catch(l){return n.add(d),t(new a$1("config",`autocapture maskSelectors entry "${d}" is not a valid selector`,{cause:l})),false}},o=(d,u)=>d.matches?r(u,()=>d.matches?.(u)===!0):false,a=d=>{let u=d.querySelector?.bind(d);return u?u(`[${ke}], .${be}`)!==null||e.some(l=>r(l,()=>u(l)!==null)):false},i=d=>{for(let u=d;u;u=u.parentElement){let l=u;if(e.some(k=>o(l,k)))return true}return false},s=d=>{for(let u=d;u;u=u.parentElement)if(Sn(u))return true;return false},c=d=>Se(d)||i(d);return {holdsMasked:a,isMasked:d=>c(d)||s(d),isOptedOut:c}}function Pn(e){let t=globalThis.history,n=bn(),r="",o=()=>{let s=X(),c=s?`${s.pathname}${s.search}`:"";c!==r&&(r=c,e.capture(V.pageview,{properties:xt()}));};if(o(),!t||!n)return ()=>{};let a=t.pushState.bind(t),i=t.replaceState.bind(t);return t.pushState=(...s)=>{a(...s),o();},t.replaceState=(...s)=>{i(...s),o();},n.addEventListener("popstate",o),()=>{t.pushState=a,t.replaceState=i,n.removeEventListener("popstate",o);}}function An(e,t){let n=yt();if(!n)return ()=>{};let r=t.onError??(()=>{}),o=Ln(t.maskSelectors??[],r),a=J(r),i=t.captureElementText??false,s=c=>{let d=c.target;if(!wn(d)||Ee(d))return;let u=we(d),l=o.isMasked(d)||o.holdsMasked(u),k=o.isOptedOut(d)?{}:Te(u,a),L=k.$el_description===void 0?Cn(u,l,i):{};e.capture(V.autocapture,{properties:{...xt(),...Tn(u,l,i),...L,...k}});};return n.addEventListener("click",s,true),()=>n.removeEventListener("click",s,true)}function vt(e,t={}){let n=[];return (t.pageviews??true)&&n.push(Pn(e)),(t.clicks??true)&&n.push(An(e,t)),t.collectForms===true&&typeof document<"u"&&n.push(ht(e)),()=>{for(let r of n)r();}}function In(){return globalThis.document?.visibilityState==="hidden"}function Nn(e){let t=globalThis.navigator,n=globalThis.Blob;if(!t?.sendBeacon||!n)return false;let r=JSON.stringify({...e.body,api_key:e.projectKey});try{let o=new n([r],{type:"application/json"});return t.sendBeacon(e.url,o)}catch{return false}}var Q=class{constructor(t={}){a(this,"fetchTransport");this.fetchTransport=new Z$1(t);}async send(t){In()&&Nn(t)||await this.fetchTransport.send(t);}};var Le="prodantix:consent-ready",Pe="prodantix:consent",kt="__prodantixConsent";var bt=(e,t)=>{e.takeCookielessId(t.anonymousId),t.consent!==null?e.setConsent(t.consent):t.rule==="notice"&&e.allowStorage();},wt=(e,t)=>{let n=t[kt];n&&bt(e,n);let r=a=>{let i=a.detail;i&&bt(e,i);},o=a=>{let i=a.detail;i&&e.setConsent(i);};return t.addEventListener(Le,r),t.addEventListener(Pe,o),()=>{t.removeEventListener(Le,r),t.removeEventListener(Pe,o);}};var On=/^\d{1,3}(\.\d{1,3}){3}$/,Rn=/^[a-z0-9.-]+$/i;function Et(){return Math.random().toString(36).slice(2,12)}function Z(e,t){let n=`${t}=`,r=[];for(let o of e.cookie.split(";")){let a=o.trim();a.startsWith(n)&&r.push(a.slice(n.length));}return r}function K(e,t,n){let r=["Path=/",`Max-Age=${t}`,"SameSite=Lax"];return e&&r.push(`Domain=${e}`),n&&r.push("Secure"),r.join("; ")}function St(e,t,n,r){try{let o=`pdx_probe_${r()}`,a=r();e.cookie=`${o}=${a}; ${K(t,60,n)}`;let i=Z(e,o).includes(a);e.cookie=`${o}=; ${K(t,0,n)}`;let s=Z(e,o).includes(a);return i&&!s}catch{return false}}function Ie(e){let t=e.replace(/^\[|\]$/g,"").toLowerCase();if(t.includes(":")||On.test(t)||!t.includes("."))return [];let n=t.split("."),r=[];for(let o=n.length-2;o>=0;o-=1)r.push(n.slice(o).join("."));return r}function Tt(e,t,n,r=Et){for(let o of Ie(e))if(St(t,o,n,r))return o}function Mn(e){let t=new Map,n=JSON.parse(decodeURIComponent(e));if(n===null||typeof n!="object"||Array.isArray(n))return t;for(let[r,o]of Object.entries(n))typeof o=="string"&&t.set(r,o);return t}var Ae=class{constructor(t,n,r,o){this.jar=t;this.name=n;this.domain=r;this.secure=o;}getItem(t){return this.read().get(t)??null}setItem(t,n){let r=this.read();r.set(t,n),this.write(r);}removeItem(t){let n=this.read();n.delete(t)&&this.write(n);}read(){try{let t=Z(this.jar,this.name);t.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${K(void 0,0,this.secure)}`,t=Z(this.jar,this.name));let n=t[0];return n?Mn(n):new Map}catch{return new Map}}write(t){try{if(t.size===0){this.jar.cookie=`${this.name}=; ${K(this.domain,0,this.secure)}`;return}let n=encodeURIComponent(JSON.stringify(Object.fromEntries(t)));this.jar.cookie=`${this.name}=${n}; ${K(this.domain,31536e3,this.secure)}`;}catch{return}}};function _n(){return globalThis.document}function $n(){return globalThis.location?.hostname??""}function Fn(){return globalThis.location?.protocol==="https:"}function Dn(e){if(e===void 0)return;let t=e.startsWith(".")?e.slice(1):e;return Rn.test(t)?t.toLowerCase():void 0}function Ne(e){let t="jar"in e?e.jar:_n();if(!t||globalThis.navigator?.cookieEnabled===false)return null;let r=e.random??Et,o=e.secure??Fn(),a=e.hostname??$n();try{let i=Dn(e.domain)??Tt(a,t,o,r);return St(t,i,o,r)?new Ae(t,e.name,i,o):null}catch{return null}}var Bn=["am","ar","bn","de","en","es","et","fil","fr","hi","id","ja","ko","pt","ru","sw","vi","zh"],Ct=e=>{let t=(e??"").toLowerCase().split("-")[0]??"";return Bn.find(n=>n===t)??"en"};var Hn=/^\$(survey|guide|checklist)_/,Lt=()=>({guides:{done:[],settled:[]},surveys:{settled:[]}});function qn(e,t){try{let n=e.getItem(t);if(n===null)return Lt();let r=JSON.parse(n);return {guides:{done:r.guides?.done??[],lastShownAt:r.guides?.lastShownAt,settled:r.guides?.settled??[]},surveys:{lastShownAt:r.surveys?.lastShownAt,settled:r.surveys?.settled??[]}}}catch{return Lt()}}function Pt(e,t,n){let r=n();return r?Promise.resolve(r):new Promise(o=>{let a=e.document.createElement("script");a.src=t,a.async=true,a.onload=()=>o(n()??null),a.onerror=()=>o(null),e.document.head.append(a);})}function At(e,t,n){let r=`pdx_engage_${n.namespace}`,o=qn(n.storage,r),a=()=>{try{n.storage.setItem(r,JSON.stringify(o));}catch(h){n.onError(h);}},i=Ct(t.document.documentElement.lang||t.navigator.language),s=[],c=[],d=false,u=false,l=new Map,k=()=>Pt(t,`${n.edgeHost}/surveys.js`,()=>t.prodantixSurveys),L$1=()=>Pt(t,`${n.edgeHost}/guides.js`,()=>t.prodantixGuides),T=async h=>{if(d)return;let f=s.find(C=>B$1(C,o.surveys,t.location.href,Date.now(),h));if(!f)return;d=true;let E=await k();if(!E){d=false;return}let b=()=>{o.surveys.settled=[...o.surveys.settled.filter(C=>C!==z(f)),z(f)],a(),d=false;};E.showSurvey(t.document,f,i,{onDismissed:()=>{e.captureSurveyDismissed(f),b();},onSent:C=>{e.captureSurveySent(f,C),b();},onShown:()=>{o.surveys.lastShownAt=Date.now(),a(),e.captureSurveyShown(f);}});},I$1=h=>{o.guides.settled=[...o.guides.settled.filter(f=>f!==L(h)),L(h)],a();},O$1=async h=>{let f=c.filter(g=>!l.has(g.id)&&N(g,o.guides,t.location.href,Date.now(),h)),E$1=f.filter(g=>g.kind==="checklist"),b=u?void 0:f.find(g=>g.kind!=="checklist");if(E$1.length===0&&!b)return;b&&(u=true);let C=await L$1();if(!C){u=false;return}for(let g of E$1)l.has(g.id)||l.set(g.id,C.showChecklist(t.document,g,i,O(g,o.guides),{onDismissed:()=>{e.captureGuide(I,g),I$1(g),l.delete(g.id);},onShown:()=>e.captureGuide(E,g)}));if(!b)return;(b.kind==="tooltip"?C.showTooltip:C.showTour)(t.document,b,i,{onCompleted:()=>{e.captureGuide(H,b),I$1(b),u=false;},onDismissed:()=>{e.captureGuide(I,b),I$1(b),u=false;},onMissed:g=>e.captureGuide(G,b,g),onShown:()=>{o.guides.lastShownAt=Date.now(),a(),e.captureGuide(E,b);},onStep:g=>e.captureGuide(F,b,g)});},A=h=>{for(let f of c){let E=P(f,h);!E||o.guides.done.includes(M(f,E.id))||o.guides.settled.includes(L(f))||(o.guides.done=[...o.guides.done,M(f,E.id)],e.captureGuide(J$1,f,E.id),l.get(f.id)?.markDone(E.id),O(f,o.guides).length===f.steps.length&&(e.captureGuide(H,f),I$1(f),l.get(f.id)?.close(),l.delete(f.id)),a());}},N$1=h=>{n.surveys&&T(h).catch(n.onError),n.guides&&O$1(h).catch(n.onError);},F$1=e.onCapture(h=>{Hn.test(h)||(A(h),N$1(h));}),R=()=>N$1();t.addEventListener("popstate",R);let _=async()=>{let h=b=>(n.onError(b),[]),[f,E]=await Promise.all([n.surveys?e.getSurveys(t.document.documentElement.lang||t.navigator.language).catch(h):[],n.guides?e.getGuides().catch(h):[]]);s=f,c=E,N$1();};return t.document.readyState==="loading"?t.document.addEventListener("DOMContentLoaded",()=>void _(),{once:true}):_(),()=>{F$1(),t.removeEventListener("popstate",R);for(let h of l.values())h.close();l.clear();}}var Ot="_pdx",Rt="~",Kn=200,Gn=/^\d+$/;function Mt(e,t,n,r){let o=Vn(e.href);if(o===void 0||Re(o.search).some(Me))return;let a=It(o.hostname,n);a===void 0||a===It(r,n)||(o.search=`${o.search}${o.search?"&":"?"}${Ot}=${Un(t)}`,e.href=o.href);}function Un(e){return [e.anonymousId,e.sessionId,String(e.sessionStartedAt)].map(Wn).join(Rt)}function _t(e){let t=Re(e).find(Me);if(t===void 0)return;let n=jn(t).split(Rt);if(n.length!==3)return;let r=ee(n[0]),o=ee(n[1]),a=ee(n[2]);if(!(!Nt(r)||!Nt(o)||!zn(a)))return {anonymousId:r,sessionId:o,sessionStartedAt:Number(a)}}function $t(e,t){let n=Re(t.search),r=n.filter(a=>!Me(a));if(r.length===n.length)return;let o=r.length>0?`?${r.join("&")}`:"";e.replaceState(e.state,"",`${t.pathname}${o}${t.hash}`);}function Ft(e){if(e.location===void 0||typeof e.location.search!="string")return;let t=_t(e.location.search);if(t===void 0)return;let n=S$1(e.storage,e.shared,e.namespace,t.anonymousId);return U(e.shared,e.namespace,{id:t.sessionId,startedAt:t.sessionStartedAt},e.now),e.history!==void 0&&$t(e.history,e.location),n}function Oe(e,t,n){if(n.length===0)return ()=>{};let r=o=>{let a=Xn(o.target);if(a===void 0)return;let i=Jn(t);i!==void 0&&Mt(a,i,n,e.location?.hostname??"");};return e.addEventListener("click",r,true),e.addEventListener("auxclick",r,true),()=>{e.removeEventListener("click",r,true),e.removeEventListener("auxclick",r,true);}}function Vn(e){try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"?t:void 0}catch{return}}function It(e,t){let n=t.map(r=>r.replace(/^\./,"").toLowerCase());return Ie(e).find(r=>n.includes(r))}function Re(e){return e.replace(/^\?/,"").split("&").filter(t=>t!=="")}function Me(e){let t=e.indexOf("=");return ee(t===-1?e:e.slice(0,t))===Ot}function jn(e){let t=e.indexOf("=");return t===-1?"":e.slice(t+1)}function Wn(e){return encodeURIComponent(e).replace(/~/g,"%7E")}function ee(e){try{return decodeURIComponent(e)}catch{return}}function Nt(e$1){if(e$1===void 0)return false;let t=e(e$1);return t>=1&&t<=Kn}function zn(e){return e!==void 0&&Gn.test(e)&&Number.isSafeInteger(Number(e))}function Jn(e){if(e.consent?.()?.identityLink===false)return;let t=e.sessionId,n=e.sessionStartedAt;if(!(t===void 0||n===void 0))return {anonymousId:e.anonymousId,sessionId:t,sessionStartedAt:n}}function Yn(e){return typeof e.tagName=="string"&&e.tagName.toUpperCase()==="A"&&typeof e.href=="string"}function Xn(e){let t=typeof e=="object"?e:null;for(;t;){if(Yn(t))return t;t=t.parentElement??null;}}var Dt={maskAllInputs:true,maskAllText:false},Qn=new Set(["email","password","tel"]);function Bt(e){return e.replace(/\S/g,"*")}function te(e,t,n){return Zn(t)||n.maskAllInputs?Bt(e):e}function ne(e,t){return t.maskAllText?Bt(e):e}function Zn(e){return Qn.has((e??"").toLowerCase())}var er=5e3,re=class{constructor(t){this.options=t;a(this,"buffer",[]);a(this,"seq",0);a(this,"maxEvents");this.maxEvents=Math.min(Math.max(1,t.maxEvents),er);}add(t){return this.buffer.push(t),this.buffer.length>=this.maxEvents?this.flush():null}flush(){if(this.buffer.length===0)return null;let t=this.buffer;this.buffer=[];let n={distinct_id:this.options.distinctId(),events:t,masked:this.options.masked,schema_version:1,seq:this.seq,session_id:this.options.sessionId,timestamp:new Date(this.options.now()).toISOString()};return this.seq+=1,n}};var _e=1,$e=3,tr=9,oe=class{constructor(){a(this,"next",1);}allocate(){let t=this.next;return this.next+=1,t}},nr=new Set(["NOSCRIPT","SCRIPT"]);function ie(e,t,n,r){if(e.nodeType===$e){let o=t.allocate();return r?.(e,o),{id:o,textContent:ne(e.textValue??"",n),type:"text"}}if(e.nodeType===tr){let o=t.allocate();return r?.(e,o),{childNodes:Ht(e,t,n,r),id:o,type:"document"}}if(e.nodeType===_e){let o=e.tagName??"";if(nr.has(o))return null;let a=t.allocate();return r?.(e,a),{attributes:rr(e,n),childNodes:Ht(e,t,n,r),id:a,tagName:o,type:"element"}}return null}function Ht(e,t,n,r){let o=[];for(let a of e.childNodes??[]){let i=ie(a,t,n,r);i&&o.push(i);}return o}function rr(e,t){let n={};for(let r of e.attributes??[])n[r.name]=r.value;return e.inputValue!==void 0&&(n.value=te(e.inputValue,e.inputType,t)),n}async function qt(e,t){let n=`${h(t.replayHost)}/v1/replay`;return (await t.fetch(n,{body:JSON.stringify(e),headers:{authorization:`Bearer ${t.apiKey}`,"content-type":"application/json"},method:"POST"})).ok}var Kt=new Set(["INPUT","SELECT","TEXTAREA"]),se=class{constructor(t){this.options=t;a(this,"allocator",new oe);a(this,"mirror",new Map);a(this,"chunker");a(this,"fetchImpl");a(this,"observer");a(this,"timer");a(this,"started",false);this.chunker=new re({distinctId:t.distinctId,masked:t.mask.maskAllInputs,maxEvents:t.maxEvents,now:t.now,sessionId:t.sessionId}),this.fetchImpl=e$1(t.fetch);}start(){if(this.started)return;let t=or(),n=t?.documentElement;!t||!n||!this.fetchImpl||(this.started=true,this.captureFullSnapshot(n),this.observeMutations(n),this.observeInteractions(t),this.timer=setInterval(()=>this.upload(this.chunker.flush()),this.options.flushIntervalMs));}stop(){this.started&&(this.started=false,this.observer?.disconnect(),this.timer&&clearInterval(this.timer),this.upload(this.chunker.flush()));}captureFullSnapshot(t){let n=ie(this.adapt(t),this.allocator,this.options.mask,(r,o)=>{let a=r.ref;a&&this.mirror.set(a,o);});n&&this.push(2,{node:n});}observeMutations(t){let n=globalThis.MutationObserver;n&&(this.observer=new n(r=>{for(let o of r)this.handleMutation(o);}),this.observer.observe(t,{attributes:true,characterData:true,childList:true,subtree:true}));}handleMutation(t){if(t.type==="characterData"){let n=this.mirror.get(t.target);n!==void 0&&this.push(3,{texts:[{id:n,value:ne(t.target.textContent??"",this.options.mask)}]});return}if(t.type==="attributes"&&t.attributeName){let n=this.mirror.get(t.target),r=t.target;n!==void 0&&this.push(3,{attributes:[{attributes:{[t.attributeName]:r.getAttribute(t.attributeName)??""},id:n}]});return}if(t.type==="childList"){let n=this.mirror.get(t.target);if(n===void 0)return;for(let r of Array.from(t.addedNodes)){let o=ie(this.adapt(r),this.allocator,this.options.mask,(a,i)=>{let s=a.ref;s&&this.mirror.set(s,i);});o&&this.push(3,{adds:[{node:o,parentId:n}]});}for(let r of Array.from(t.removedNodes)){let o=this.mirror.get(r);o!==void 0&&(this.push(3,{removes:[{id:o,parentId:n}]}),this.mirror.delete(r));}}}observeInteractions(t){t.addEventListener("input",n=>{let r=n.target;if(!r||!Kt.has(r.tagName))return;let o=this.mirror.get(r);o!==void 0&&this.push(3,{input:{id:o,value:te(r.value??"",r.type,this.options.mask)}});},true),t.addEventListener("scroll",n=>{let r=n.target,o=r?this.mirror.get(r):void 0;this.push(3,{scroll:{id:o??0,x:r?.scrollLeft??0,y:r?.scrollTop??0}});},true);}adapt(t){let n={childNodes:[],nodeType:t.nodeType,ref:t};if(t.nodeType===$e)return n.textValue=t.textContent??"",n;if(t.nodeType===_e){let r=t;if(n.tagName=r.tagName,n.attributes=Array.from(r.attributes).map(o=>({name:o.name,value:o.value})),Kt.has(r.tagName)){let o=r;n.inputType=o.type,n.inputValue=o.value??"";}}return n.childNodes=Array.from(t.childNodes).map(r=>this.adapt(r)),n}push(t,n){let r=this.chunker.add({data:n,timestamp:this.options.now(),type:t});r&&this.upload(r);}upload(t){!t||!this.fetchImpl||qt(t,{apiKey:this.options.apiKey,fetch:this.fetchImpl,replayHost:this.options.replayHost}).catch(n=>this.options.onError?.(n));}};function or(){return globalThis.document}function Gt(e){let t=new se({apiKey:e.apiKey,distinctId:e.distinctId,flushIntervalMs:e.flushIntervalMs??5e3,mask:{...Dt,...e.mask},maxEvents:e.maxEvents??200,now:e.now??(()=>Date.now()),onError:e.onError,replayHost:e.replayHost,sessionId:e.sessionId??d()});return t.start(),t}var ae=e=>`prodantix-cta:${e}`,Ut=e=>{try{let t=window.localStorage.getItem(ae(e));return t===null?null:Number(t)}catch{return null}},Vt=e=>{try{return window.sessionStorage.getItem(ae(e))!==null}catch{return false}},jt=(e,t)=>{try{window.localStorage.setItem(ae(e),String(t)),window.sessionStorage.setItem(ae(e),String(t));}catch{return}},Wt=(e,t,n,r)=>t===null?true:e.kind==="once"?false:e.kind==="session"?!n:r-t>=e.value*864e5;var $={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"}},de=e=>{let t=(e??"").toLowerCase().split("-")[0]??"";return t in $?t:"en"};var y="prodantix-cta",zt="prodantix-cta-style",ir=`.${y}{font-family:system-ui,sans-serif;color:var(--pdx-text);background:var(--pdx-background);border-radius:var(--pdx-radius);box-sizing:border-box;padding:16px;display:flex;gap:12px;align-items:center;flex-wrap:wrap}
2
- .${y} *{box-sizing:border-box}
3
- .${y} h2{font-size:18px;line-height:1.3;margin:0;font-weight:700}
4
- .${y} p{margin:0;font-size:15px;line-height:1.5}
5
- .${y} img{max-width:100%;height:auto;border-radius:var(--pdx-radius)}
6
- .${y} .pdx-text{display:flex;flex-direction:column;gap:6px;flex:1 1 240px;min-width:0}
7
- .${y} .pdx-actions{display:flex;gap:8px;flex-wrap:wrap}
8
- .${y} button{font:inherit;min-height:44px;padding:0 18px;border:0;border-radius:var(--pdx-radius);background:var(--pdx-button);color:var(--pdx-button-text);cursor:pointer}
9
- .${y} button[data-secondary]{background:transparent;color:inherit;border:1px solid currentColor}
10
- .${y} .pdx-close{min-width:44px;padding:0;background:transparent;color:inherit;font-size:22px;line-height:1}
11
- .${y} .pdx-meta{font-size:12px;opacity:.85;flex-basis:100%}
12
- .${y} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}
13
- .${y}[data-kind=banner]{position:fixed;left:0;right:0;z-index:2147483000;border-radius:0}
14
- .${y}[data-kind=banner][data-placement=top]{top:0}
15
- .${y}[data-kind=banner][data-placement=bottom]{bottom:0}
16
- .${y}[data-kind=slide_in]{position:fixed;bottom:16px;z-index:2147483000;width:min(360px,calc(100vw - 32px));box-shadow:0 8px 32px rgba(0,0,0,.18)}
17
- .${y}[data-kind=slide_in][data-placement=bottom_left]{left:16px}
18
- .${y}[data-kind=slide_in][data-placement=bottom_right]{right:16px}
19
- dialog.${y}{border:0;max-width:min(480px,calc(100vw - 32px));box-shadow:0 16px 48px rgba(0,0,0,.24)}
20
- dialog.${y}::backdrop{background:rgba(0,0,0,.45)}
21
- @media (prefers-reduced-motion:no-preference){.${y}[data-kind=slide_in],.${y}[data-kind=banner],dialog.${y}{animation:pdx-cta-in .2s ease-out}}
22
- @keyframes pdx-cta-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}`,sr=()=>{if(document.getElementById(zt))return;let e=document.createElement("style");e.id=zt,e.textContent=ir,document.head.append(e);},ar=(e,t)=>{let n=t.variant.style;for(let[r,o]of [["--pdx-background",n.background],["--pdx-text",n.text],["--pdx-button",n.button],["--pdx-button-text",n.buttonText],["--pdx-radius",`${n.radius}px`]])e.style.setProperty(r,o);},Fe=(e,t,n,r)=>{let o=t.variant.content,a=$[n.language];if(e.className=y,e.dataset.kind=t.kind,e.dataset.placement=t.placement,e.dataset.ctaId=t.id,ar(e,t),o.image){let s=document.createElement("img");s.src=o.image,s.alt=o.imageAlt,s.loading="lazy",e.append(s);}let i=document.createElement("div");if(i.className="pdx-text",o.heading){let s=document.createElement("h2");s.textContent=o.heading,i.append(s);}if(o.body){let s=document.createElement("p");s.textContent=o.body,i.append(s);}if(e.append(i),o.buttons.length>0){let s=document.createElement("div");s.className="pdx-actions",o.buttons.forEach((c,d)=>{let u=document.createElement("button");u.type="button",u.textContent=c.label,u.dataset.action=`button-${d}`,d>0&&(u.dataset.secondary=""),u.addEventListener("click",()=>n.onButton(d)),s.append(u);}),e.append(s);}if(r){let s=document.createElement("button");s.type="button",s.className="pdx-close",s.dataset.action="close",s.textContent="\xD7",s.setAttribute("aria-label",a.close),s.title=a.close,s.addEventListener("click",r),e.append(s);}if(t.poweredBy){let s=document.createElement("p");s.className="pdx-meta",s.textContent=a.poweredBy,e.append(s);}},ue=(e,t)=>{sr();let n=e.variant.content.heading||e.variant.content.body;if(e.kind==="embedded"){let i=[...document.querySelectorAll("[data-prodantix-cta]")].filter(s=>s.dataset.prodantixCta===e.id).map(s=>{let c=document.createElement("section");return c.setAttribute("aria-label",n),Fe(c,e,t,null),s.replaceChildren(c),c});return {destroy:()=>i.forEach(s=>s.remove()),elements:i}}if(e.kind==="popup"){let a=document.activeElement instanceof HTMLElement?document.activeElement:null,i=document.createElement("dialog");i.setAttribute("aria-label",n);let s=false,c=()=>{s||(s=true,i.open&&i.close(),i.remove(),a?.focus());},d=()=>{c(),t.onDismiss();};return Fe(i,e,t,d),i.addEventListener("cancel",u=>{u.preventDefault(),d();}),document.body.append(i),i.showModal(),{destroy:c,elements:[i]}}let r=document.createElement("section");r.setAttribute("aria-label",n),e.kind==="slide_in"&&(r.setAttribute("role","dialog"),r.setAttribute("aria-modal","false"));let o=()=>r.remove();return Fe(r,e,t,()=>{o(),t.onDismiss();}),document.body.append(r),{destroy:o,elements:[r]}};var Jt=(e,t)=>{let n=false,r=[],o=()=>{n=true;for(let i of r.splice(0))i();},a=()=>{n||(o(),t());};if(e.kind==="load")queueMicrotask(a);else if(e.kind==="delay"){let i=setTimeout(a,e.value*1e3);r.push(()=>clearTimeout(i));}else if(e.kind==="scroll"){let i=()=>{let s=document.documentElement.scrollHeight-window.innerHeight;(s<=0||window.scrollY/s*100>=e.value)&&a();};window.addEventListener("scroll",i,{passive:true}),r.push(()=>window.removeEventListener("scroll",i)),i();}else if(e.kind==="exit"){let i=s=>{s.relatedTarget===null&&s.clientY<=0&&a();};document.addEventListener("mouseout",i),r.push(()=>document.removeEventListener("mouseout",i));}else {let i=e.value,s=d=>{try{return d.closest(i)!==null}catch{return false}},c=d=>{let u=d.target;u instanceof Element&&s(u)&&a();};document.addEventListener("click",c,true),r.push(()=>document.removeEventListener("click",c,true));}return o};var Yt=e=>`prodantix-form-popup:${e}`,dr=e=>{try{let t=window.localStorage.getItem(Yt(e));return t===null?null:Number(t)}catch{return null}},ur=(e,t)=>{try{window.localStorage.setItem(Yt(e),String(t));}catch{return}},Xt=(e,t,n)=>n===null||t-n>=e.periodDays*864e5,Qt=(e,t,n=Date.now)=>{if(!Xt(e,n(),dr(e.formId)))return ()=>{};let r=false,o=[],a=()=>{if(!r){r=true;for(let s of o)s();ur(e.formId,n()),t();}},i=e.trigger;if(i.kind==="delay"){let s=setTimeout(a,i.seconds*1e3);o.push(()=>clearTimeout(s));}else if(i.kind==="scroll"){let s=()=>{let c=document.documentElement.scrollHeight-window.innerHeight;(c<=0||window.scrollY/c*100>=i.percent)&&a();};window.addEventListener("scroll",s,{passive:true}),o.push(()=>window.removeEventListener("scroll",s));}else {let s=c=>{c.relatedTarget===null&&c.clientY<=0&&a();};document.addEventListener("mouseout",s),o.push(()=>document.removeEventListener("mouseout",s));}return ()=>{r=true;for(let s of o)s();}};var cr=e=>{let t=0;for(let n of e){if(n!==0)return t+Math.clz32(n)-24;t+=8;}return t},lr=async e=>new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e))),Zt=async e=>{for(let t=0;;t+=1){let n=t.toString(36);if(cr(await lr(`${e.nonce}:${n}`))>=e.difficulty)return n}};var S="prodantix-form",pr=`.${S}{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
+ import {Z as Z$1,e,d,u,s,b,c,h as h$1,_,t,S as S$1,U,V as V$1,P,M,L,J,O,H,B,N,E,I,F as F$1,G as G$1,z,k,j,i}from'./chunk-YHIIKYUP.js';import'./chunk-V77KYPOF.js';import {e as e$1,h,d as d$1,f,a as a$1}from'./chunk-ODN4ZELX.js';import {a}from'./chunk-5XGN7UAV.js';var ft="data-prodantix",gt="data-prodantix-action",ht="data-prodantix-ignore",F=300,be="data-pdx-no-capture",ke="pdx-no-capture",xn=new Set(["a","button","input","label","option","select","summary","textarea"]),bn=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]);function kn(e){return xn.has(e.tagName.toLowerCase())||bn.has((e.getAttribute("role")??"").trim().toLowerCase())}function we(e){for(let t=e;t!==null;t=t.parentElement)if(kn(t))return t;return e}function Ee(e){for(let t=e;t!==null;t=t.parentElement)if(t.getAttribute(ht)!==null)return true;return false}function Se(e){for(let t=e;t!==null;t=t.parentElement)if(t.getAttribute(be)!==null||typeof t.className=="string"&&t.className.split(/\s+/).includes(ke))return true;return false}function Y(e){let t=new Set;return n=>{t.has(n.message)||(t.add(n.message),e(n));}}function mt(e,t,n){let r=e.getAttribute(t);if(r===null)return;let o=r.trim();if(o!==""){if(o.length>F){n(new a$1("validation",`${t} on a <${e.tagName.toLowerCase()}> is ${o.length} characters, over the ${F}-character limit, so it was ignored: "${o.slice(0,40)}\u2026"`));return}return o}}function Te(e,t){let n={},r=mt(e,ft,t);r!==void 0&&(n.$el_description=r,n.$el_description_source="annotation");let o=mt(e,gt,t);return o!==void 0&&(n.$el_action=o),n}function yt(e,t){return !wn(e)||Ee(e)||Se(e)?{}:Te(we(e),t)}function wn(e){return typeof e=="object"&&e!==null&&typeof e.tagName=="string"&&typeof e.getAttribute=="function"}var En="$form_submitted",Sn=new Set(["button","file","hidden","image","password","reset","submit"]),vt=/(card|cc-?num|cvc|cvv|iban|security.?code)/i,Tn=e=>(e.getAttribute("autocomplete")??"").startsWith("cc-")||vt.test(e.name)||vt.test(e.id),Cn=e=>{let t=e.name.toLowerCase();return e instanceof HTMLInputElement&&e.type==="email"||t==="email"||e.getAttribute("autocomplete")==="email"?"$email":t==="name"||t==="full_name"||t==="fullname"||e.getAttribute("autocomplete")==="name"?"$name":null},Pn=(e,t)=>{if(e.closest("[data-prodantix-ignore]")||e.hasAttribute("data-prodantix-form"))return null;let n={},r={};for(let o of Array.from(e.elements)){if(!(o instanceof HTMLInputElement||o instanceof HTMLSelectElement||o instanceof HTMLTextAreaElement)||!o.name||o.closest("[data-prodantix-ignore]")||Tn(o)||o instanceof HTMLInputElement&&(Sn.has(o.type)||(o.type==="checkbox"||o.type==="radio")&&!o.checked))continue;let a=o.value.trim();if(a==="")continue;n[o.name]=a;let i=Cn(o);i&&(r[i]=a);}return {$answers:n,$form_id:e.id||`${t}#${Array.from(e.ownerDocument.forms).indexOf(e)}`,$page_url:e.ownerDocument.location?.href??"",$set:r,collected:true}},xt=(e,t=document)=>{let n=r=>{if(r.target instanceof HTMLFormElement){let o=Pn(r.target,t.location?.pathname??"");o&&e.capture(En,{properties:o});}};return t.addEventListener("submit",n,true),()=>t.removeEventListener("submit",n,true)};var Ln=1e3,An=5e3,In=50,Ce=class{constructor(){a(this,"fcp");a(this,"lcp");a(this,"cls");a(this,"window",{end:0,start:0,sum:0});a(this,"interactions",new Map);}add(t){if(t.entryType==="paint"&&t.name==="first-contentful-paint"&&(this.fcp=t.startTime),t.entryType==="largest-contentful-paint"&&(this.lcp=t.startTime),t.entryType==="layout-shift"&&!t.hadRecentInput&&t.value!==void 0){let n=this.window.sum>0&&t.startTime-this.window.end<Ln&&t.startTime-this.window.start<An;this.window=n?{end:t.startTime,start:this.window.start,sum:this.window.sum+t.value}:{end:t.startTime,start:t.startTime,sum:t.value},this.cls=Math.max(this.cls??0,this.window.sum);}t.entryType==="event"&&t.interactionId!==void 0&&t.interactionId>0&&this.interactions.set(t.interactionId,Math.max(this.interactions.get(t.interactionId)??0,t.duration));}properties(t){let n={};if(this.lcp!==void 0&&(n.$lcp_ms=Math.round(this.lcp)),this.fcp!==void 0&&(n.$fcp_ms=Math.round(this.fcp)),this.cls!==void 0&&(n.$cls=Math.round(this.cls*1e4)/1e4),this.interactions.size>0){let r=[...this.interactions.values()].sort((o,a)=>a-o);n.$inp_ms=Math.round(r[Math.min(r.length-1,Math.floor(r.length/In))]??0);}return t!==void 0&&(n.$ttfb_ms=Math.round(t)),n}},Nn=[{type:"paint"},{type:"largest-contentful-paint"},{type:"layout-shift"},{durationThreshold:40,type:"event"}];function bt(e,t){let n=new Ce,r=[];for(let i of Nn){let s=t.observer(c=>{for(let d of c)n.add(d);});if(s!==void 0)try{s.observe({...i,buffered:!0}),r.push(s);}catch{s.disconnect();}}let o=false,a=()=>{if(o)return;let i=n.properties(t.firstByte());if(Object.keys(i).length===0)return;o=true;let s=t.path();e.capture(V$1.webVitals,{properties:s===void 0?i:{...i,$pathname:s}});};return t.addEventListener("visibilitychange",()=>{t.isHidden()&&a();}),t.addEventListener("pagehide",a),()=>{for(let i of r)i.disconnect();}}function kt(){if(!(typeof window>"u"||typeof document>"u"||typeof PerformanceObserver>"u"))return {addEventListener:(e,t)=>(e==="pagehide"?window:document).addEventListener(e,t),firstByte:()=>{let e=performance.getEntriesByType("navigation")[0];return e instanceof PerformanceNavigationTiming&&e.responseStart>0?e.responseStart:void 0},isHidden:()=>document.visibilityState==="hidden",observer:e=>{try{return new PerformanceObserver(t=>e(t.getEntries()))}catch{return}},path:()=>window.location?.pathname}}var On=new Set(["input","select","textarea"]),_n=new Set(["email","password","tel"]);function Q(){return globalThis.location}function wt(){return globalThis.document}function Mn(){return globalThis.window??globalThis}function Rn(e){return typeof e=="object"&&e!==null&&typeof e.tagName=="string"}function X(e,t){let n;try{n=new URL(e,t);}catch{return}return n.protocol==="http:"||n.protocol==="https:"?`${n.origin}${n.pathname}`:n.protocol}function Et(){let e=Q(),t=wt(),n={};if(e){let r=X(e.href);r&&(n.$current_url=r),n.$pathname=e.pathname,n.$host=e.host;}if(t){t.title&&(n.$title=t.title);let r=t.referrer?X(t.referrer):void 0;r&&(n.$referrer=r);}return n}function $n(e){return typeof e.className=="string"?e.className:""}function Fn(e){return On.has(e.tagName.toLowerCase())||_n.has((e.getAttribute("type")??"").toLowerCase())}function Dn(e,t,n){let r={$el_tag:e.tagName.toLowerCase(),$event_type:"click"};if(t)return r;let o=n?e.textContent?.trim():void 0;o&&(r.$el_text=o.slice(0,255)),e.id&&(r.$el_id=e.id);let a=$n(e);a&&(r.$el_classes=a);let i=e.getAttribute("href"),s=i?X(i,Q()?.href):void 0;return s&&(r.$el_href=s),r}function Pe(e){return (e??"").replace(/\s+/g," ").trim()}function V(e,t){return {$el_description:e,$el_description_source:t}}function Hn(e,t,n){if(!t&&n){let i=Pe(e.getAttribute("aria-label"));if(i!==""&&i.length<=F)return V(i,"aria_label");let s=Pe(e.textContent);if(s!==""&&s.length<=F)return V(s,"text")}let r=t?null:e.getAttribute("href"),o=r?X(r,Q()?.href):void 0;if(o)return V(o,"href");let a=Pe(e.getAttribute("role")).toLowerCase();return a===""?V(e.tagName.toLowerCase(),"tag"):V(a,"role")}function Bn(e,t){let n=new Set,r=(d,u)=>{if(n.has(d))return false;try{return u()}catch(l){return n.add(d),t(new a$1("config",`autocapture maskSelectors entry "${d}" is not a valid selector`,{cause:l})),false}},o=(d,u)=>d.matches?r(u,()=>d.matches?.(u)===!0):false,a=d=>{let u=d.querySelector?.bind(d);return u?u(`[${be}], .${ke}`)!==null||e.some(l=>r(l,()=>u(l)!==null)):false},i=d=>{for(let u=d;u;u=u.parentElement){let l=u;if(e.some(x=>o(l,x)))return true}return false},s=d=>{for(let u=d;u;u=u.parentElement)if(Fn(u))return true;return false},c=d=>Se(d)||i(d);return {holdsMasked:a,isMasked:d=>c(d)||s(d),isOptedOut:c}}function qn(e){let t=globalThis.history,n=Mn(),r="",o=()=>{let s=Q(),c=s?`${s.pathname}${s.search}`:"";c!==r&&(r=c,e.capture(V$1.pageview,{properties:Et()}));};if(o(),!t||!n)return ()=>{};let a=t.pushState.bind(t),i=t.replaceState.bind(t);return t.pushState=(...s)=>{a(...s),o();},t.replaceState=(...s)=>{i(...s),o();},n.addEventListener("popstate",o),()=>{t.pushState=a,t.replaceState=i,n.removeEventListener("popstate",o);}}function Kn(e,t){let n=wt();if(!n)return ()=>{};let r=t.onError??(()=>{}),o=Bn(t.maskSelectors??[],r),a=Y(r),i=t.captureElementText??false,s=c=>{let d=c.target;if(!Rn(d)||Ee(d))return;let u=we(d),l=o.isMasked(d)||o.holdsMasked(u),x=o.isOptedOut(d)?{}:Te(u,a),L=x.$el_description===void 0?Hn(u,l,i):{};e.capture(V$1.autocapture,{properties:{...Et(),...Dn(u,l,i),...L,...x}});};return n.addEventListener("click",s,true),()=>n.removeEventListener("click",s,true)}function St(e,t={}){let n=[];(t.pageviews??true)&&n.push(qn(e)),(t.clicks??true)&&n.push(Kn(e,t)),t.collectForms===true&&typeof document<"u"&&n.push(xt(e));let r=t.webVitals===false?void 0:kt();return r!==void 0&&n.push(bt(e,r)),()=>{for(let o of n)o();}}function Vn(){return globalThis.document?.visibilityState==="hidden"}function Gn(e){let t=globalThis.navigator,n=globalThis.Blob;if(!t?.sendBeacon||!n)return false;let r=JSON.stringify({...e.body,api_key:e.projectKey});try{let o=new n([r],{type:"application/json"});return t.sendBeacon(e.url,o)}catch{return false}}var Z=class{constructor(t={}){a(this,"fetchTransport");this.fetchTransport=new Z$1(t);}async send(t){Vn()&&Gn(t)||await this.fetchTransport.send(t);}};var Le="prodantix:consent-ready",Ae="prodantix:consent",Tt="__prodantixConsent";var Ct=(e,t)=>{e.takeCookielessId(t.anonymousId),t.consent!==null?e.setConsent(t.consent):t.rule==="notice"&&e.allowStorage();},Pt=(e,t)=>{let n=t[Tt];n&&Ct(e,n);let r=a=>{let i=a.detail;i&&Ct(e,i);},o=a=>{let i=a.detail;i&&e.setConsent(i);};return t.addEventListener(Le,r),t.addEventListener(Ae,o),()=>{t.removeEventListener(Le,r),t.removeEventListener(Ae,o);}};var Un=/^\d{1,3}(\.\d{1,3}){3}$/,jn=/^[a-z0-9.-]+$/i;function Lt(){return Math.random().toString(36).slice(2,12)}function ee(e,t){let n=`${t}=`,r=[];for(let o of e.cookie.split(";")){let a=o.trim();a.startsWith(n)&&r.push(a.slice(n.length));}return r}function G(e,t,n){let r=["Path=/",`Max-Age=${t}`,"SameSite=Lax"];return e&&r.push(`Domain=${e}`),n&&r.push("Secure"),r.join("; ")}function At(e,t,n,r){try{let o=`pdx_probe_${r()}`,a=r();e.cookie=`${o}=${a}; ${G(t,60,n)}`;let i=ee(e,o).includes(a);e.cookie=`${o}=; ${G(t,0,n)}`;let s=ee(e,o).includes(a);return i&&!s}catch{return false}}function Ne(e){let t=e.replace(/^\[|\]$/g,"").toLowerCase();if(t.includes(":")||Un.test(t)||!t.includes("."))return [];let n=t.split("."),r=[];for(let o=n.length-2;o>=0;o-=1)r.push(n.slice(o).join("."));return r}function It(e,t,n,r=Lt){for(let o of Ne(e))if(At(t,o,n,r))return o}function Wn(e){let t=new Map,n=JSON.parse(decodeURIComponent(e));if(n===null||typeof n!="object"||Array.isArray(n))return t;for(let[r,o]of Object.entries(n))typeof o=="string"&&t.set(r,o);return t}var Ie=class{constructor(t,n,r,o){this.jar=t;this.name=n;this.domain=r;this.secure=o;}getItem(t){return this.read().get(t)??null}setItem(t,n){let r=this.read();r.set(t,n),this.write(r);}removeItem(t){let n=this.read();n.delete(t)&&this.write(n);}read(){try{let t=ee(this.jar,this.name);t.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${G(void 0,0,this.secure)}`,t=ee(this.jar,this.name));let n=t[0];return n?Wn(n):new Map}catch{return new Map}}write(t){try{if(t.size===0){this.jar.cookie=`${this.name}=; ${G(this.domain,0,this.secure)}`;return}let n=encodeURIComponent(JSON.stringify(Object.fromEntries(t)));this.jar.cookie=`${this.name}=${n}; ${G(this.domain,31536e3,this.secure)}`;}catch{return}}};function zn(){return globalThis.document}function Jn(){return globalThis.location?.hostname??""}function Yn(){return globalThis.location?.protocol==="https:"}function Xn(e){if(e===void 0)return;let t=e.startsWith(".")?e.slice(1):e;return jn.test(t)?t.toLowerCase():void 0}function Oe(e){let t="jar"in e?e.jar:zn();if(!t||globalThis.navigator?.cookieEnabled===false)return null;let r=e.random??Lt,o=e.secure??Yn(),a=e.hostname??Jn();try{let i=Xn(e.domain)??It(a,t,o,r);return At(t,i,o,r)?new Ie(t,e.name,i,o):null}catch{return null}}var Qn=["am","ar","bn","de","en","es","et","fil","fr","hi","id","ja","ko","pt","ru","sw","vi","zh"],Nt=e=>{let t=(e??"").toLowerCase().split("-")[0]??"";return Qn.find(n=>n===t)??"en"};var Zn=/^\$(survey|guide|checklist)_/,Ot=()=>({guides:{done:[],settled:[]},surveys:{settled:[]}});function er(e,t){try{let n=e.getItem(t);if(n===null)return Ot();let r=JSON.parse(n);return {guides:{done:r.guides?.done??[],lastShownAt:r.guides?.lastShownAt,settled:r.guides?.settled??[]},surveys:{lastShownAt:r.surveys?.lastShownAt,settled:r.surveys?.settled??[]}}}catch{return Ot()}}function _t(e,t,n){let r=n();return r?Promise.resolve(r):new Promise(o=>{let a=e.document.createElement("script");a.src=t,a.async=true,a.onload=()=>o(n()??null),a.onerror=()=>o(null),e.document.head.append(a);})}function Mt(e,t,n){let r=`pdx_engage_${n.namespace}`,o=er(n.storage,r),a=()=>{try{n.storage.setItem(r,JSON.stringify(o));}catch(g){n.onError(g);}},i=Nt(t.document.documentElement.lang||t.navigator.language),s=[],c=[],d=false,u=false,l=new Map,x=()=>_t(t,`${n.edgeHost}/surveys.js`,()=>t.prodantixSurveys),L$1=()=>_t(t,`${n.edgeHost}/guides.js`,()=>t.prodantixGuides),T=async g=>{if(d)return;let m=s.find(P=>B(P,o.surveys,t.location.href,Date.now(),g));if(!m)return;d=true;let E=await x();if(!E){d=false;return}let w=()=>{o.surveys.settled=[...o.surveys.settled.filter(P=>P!==z(m)),z(m)],a(),d=false;};E.showSurvey(t.document,m,i,{onDismissed:()=>{e.captureSurveyDismissed(m),w();},onSent:P=>{e.captureSurveySent(m,P),w();},onShown:()=>{o.surveys.lastShownAt=Date.now(),a(),e.captureSurveyShown(m);}});},I$1=g=>{o.guides.settled=[...o.guides.settled.filter(m=>m!==L(g)),L(g)],a();},R=async g=>{let m=c.filter(h=>!l.has(h.id)&&N(h,o.guides,t.location.href,Date.now(),g)),E$1=m.filter(h=>h.kind==="checklist"),w=u?void 0:m.find(h=>h.kind!=="checklist");if(E$1.length===0&&!w)return;w&&(u=true);let P=await L$1();if(!P){u=false;return}for(let h of E$1)l.has(h.id)||l.set(h.id,P.showChecklist(t.document,h,i,O(h,o.guides),{onDismissed:()=>{e.captureGuide(I,h),I$1(h),l.delete(h.id);},onShown:()=>e.captureGuide(E,h)}));if(!w)return;(w.kind==="tooltip"?P.showTooltip:P.showTour)(t.document,w,i,{onCompleted:()=>{e.captureGuide(H,w),I$1(w),u=false;},onDismissed:()=>{e.captureGuide(I,w),I$1(w),u=false;},onMissed:h=>e.captureGuide(G$1,w,h),onShown:()=>{o.guides.lastShownAt=Date.now(),a(),e.captureGuide(E,w);},onStep:h=>e.captureGuide(F$1,w,h)});},H$1=g=>{for(let m of c){let E=P(m,g);!E||o.guides.done.includes(M(m,E.id))||o.guides.settled.includes(L(m))||(o.guides.done=[...o.guides.done,M(m,E.id)],e.captureGuide(J,m,E.id),l.get(m.id)?.markDone(E.id),O(m,o.guides).length===m.steps.length&&(e.captureGuide(H,m),I$1(m),l.get(m.id)?.close(),l.delete(m.id)),a());}},N$1=g=>{n.surveys&&T(g).catch(n.onError),n.guides&&R(g).catch(n.onError);},O$1=e.onCapture(g=>{Zn.test(g)||(H$1(g),N$1(g));}),C=()=>N$1();t.addEventListener("popstate",C);let M$1=async()=>{let g=w=>(n.onError(w),[]),[m,E]=await Promise.all([n.surveys?e.getSurveys(t.document.documentElement.lang||t.navigator.language).catch(g):[],n.guides?e.getGuides().catch(g):[]]);s=m,c=E,N$1();};return t.document.readyState==="loading"?t.document.addEventListener("DOMContentLoaded",()=>void M$1(),{once:true}):M$1(),()=>{O$1(),t.removeEventListener("popstate",C);for(let g of l.values())g.close();l.clear();}}var Ft="_pdx",Dt="~",tr=200,nr=/^\d+$/;function Ht(e,t,n,r){let o=or(e.href);if(o===void 0||Me(o.search).some(Re))return;let a=Rt(o.hostname,n);a===void 0||a===Rt(r,n)||(o.search=`${o.search}${o.search?"&":"?"}${Ft}=${rr(t)}`,e.href=o.href);}function rr(e){return [e.anonymousId,e.sessionId,String(e.sessionStartedAt)].map(sr).join(Dt)}function Bt(e){let t=Me(e).find(Re);if(t===void 0)return;let n=ir(t).split(Dt);if(n.length!==3)return;let r=te(n[0]),o=te(n[1]),a=te(n[2]);if(!(!$t(r)||!$t(o)||!ar(a)))return {anonymousId:r,sessionId:o,sessionStartedAt:Number(a)}}function qt(e,t){let n=Me(t.search),r=n.filter(a=>!Re(a));if(r.length===n.length)return;let o=r.length>0?`?${r.join("&")}`:"";e.replaceState(e.state,"",`${t.pathname}${o}${t.hash}`);}function Kt(e){if(e.location===void 0||typeof e.location.search!="string")return;let t=Bt(e.location.search);if(t===void 0)return;let n=S$1(e.storage,e.shared,e.namespace,t.anonymousId);return U(e.shared,e.namespace,{id:t.sessionId,startedAt:t.sessionStartedAt},e.now),e.history!==void 0&&qt(e.history,e.location),n}function _e(e,t,n){if(n.length===0)return ()=>{};let r=o=>{let a=cr(o.target);if(a===void 0)return;let i=dr(t);i!==void 0&&Ht(a,i,n,e.location?.hostname??"");};return e.addEventListener("click",r,true),e.addEventListener("auxclick",r,true),()=>{e.removeEventListener("click",r,true),e.removeEventListener("auxclick",r,true);}}function or(e){try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"?t:void 0}catch{return}}function Rt(e,t){let n=t.map(r=>r.replace(/^\./,"").toLowerCase());return Ne(e).find(r=>n.includes(r))}function Me(e){return e.replace(/^\?/,"").split("&").filter(t=>t!=="")}function Re(e){let t=e.indexOf("=");return te(t===-1?e:e.slice(0,t))===Ft}function ir(e){let t=e.indexOf("=");return t===-1?"":e.slice(t+1)}function sr(e){return encodeURIComponent(e).replace(/~/g,"%7E")}function te(e){try{return decodeURIComponent(e)}catch{return}}function $t(e$1){if(e$1===void 0)return false;let t=e(e$1);return t>=1&&t<=tr}function ar(e){return e!==void 0&&nr.test(e)&&Number.isSafeInteger(Number(e))}function dr(e){if(e.consent?.()?.identityLink===false)return;let t=e.sessionId,n=e.sessionStartedAt;if(!(t===void 0||n===void 0))return {anonymousId:e.anonymousId,sessionId:t,sessionStartedAt:n}}function ur(e){return typeof e.tagName=="string"&&e.tagName.toUpperCase()==="A"&&typeof e.href=="string"}function cr(e){let t=typeof e=="object"?e:null;for(;t;){if(ur(t))return t;t=t.parentElement??null;}}var Vt={maskAllInputs:true,maskAllText:false},lr=new Set(["email","password","tel"]);function Gt(e){return e.replace(/\S/g,"*")}function ne(e,t,n){return pr(t)||n.maskAllInputs?Gt(e):e}function re(e,t){return t.maskAllText?Gt(e):e}function pr(e){return lr.has((e??"").toLowerCase())}var mr=5e3,oe=class{constructor(t){this.options=t;a(this,"buffer",[]);a(this,"seq",0);a(this,"maxEvents");this.maxEvents=Math.min(Math.max(1,t.maxEvents),mr);}add(t){return this.buffer.push(t),this.buffer.length>=this.maxEvents?this.flush():null}flush(){if(this.buffer.length===0)return null;let t=this.buffer;this.buffer=[];let n={distinct_id:this.options.distinctId(),events:t,masked:this.options.masked,schema_version:1,seq:this.seq,session_id:this.options.sessionId,timestamp:new Date(this.options.now()).toISOString()};return this.seq+=1,n}};var $e=1,Fe=3,fr=9,ie=class{constructor(){a(this,"next",1);}allocate(){let t=this.next;return this.next+=1,t}},gr=new Set(["NOSCRIPT","SCRIPT"]);function se(e,t,n,r){if(e.nodeType===Fe){let o=t.allocate();return r?.(e,o),{id:o,textContent:re(e.textValue??"",n),type:"text"}}if(e.nodeType===fr){let o=t.allocate();return r?.(e,o),{childNodes:Ut(e,t,n,r),id:o,type:"document"}}if(e.nodeType===$e){let o=e.tagName??"";if(gr.has(o))return null;let a=t.allocate();return r?.(e,a),{attributes:hr(e,n),childNodes:Ut(e,t,n,r),id:a,tagName:o,type:"element"}}return null}function Ut(e,t,n,r){let o=[];for(let a of e.childNodes??[]){let i=se(a,t,n,r);i&&o.push(i);}return o}function hr(e,t){let n={};for(let r of e.attributes??[])n[r.name]=r.value;return e.inputValue!==void 0&&(n.value=ne(e.inputValue,e.inputType,t)),n}async function jt(e,t){let n=`${h(t.replayHost)}/v1/replay`;return (await t.fetch(n,{body:JSON.stringify(e),headers:{authorization:`Bearer ${t.apiKey}`,"content-type":"application/json"},method:"POST"})).ok}var Wt=new Set(["INPUT","SELECT","TEXTAREA"]),ae=class{constructor(t){this.options=t;a(this,"allocator",new ie);a(this,"mirror",new Map);a(this,"chunker");a(this,"fetchImpl");a(this,"observer");a(this,"timer");a(this,"started",false);this.chunker=new oe({distinctId:t.distinctId,masked:t.mask.maskAllInputs,maxEvents:t.maxEvents,now:t.now,sessionId:t.sessionId}),this.fetchImpl=e$1(t.fetch);}start(){if(this.started)return;let t=yr(),n=t?.documentElement;!t||!n||!this.fetchImpl||(this.started=true,this.captureFullSnapshot(n),this.observeMutations(n),this.observeInteractions(t),this.timer=setInterval(()=>this.upload(this.chunker.flush()),this.options.flushIntervalMs));}stop(){this.started&&(this.started=false,this.observer?.disconnect(),this.timer&&clearInterval(this.timer),this.upload(this.chunker.flush()));}captureFullSnapshot(t){let n=se(this.adapt(t),this.allocator,this.options.mask,(r,o)=>{let a=r.ref;a&&this.mirror.set(a,o);});n&&this.push(2,{node:n});}observeMutations(t){let n=globalThis.MutationObserver;n&&(this.observer=new n(r=>{for(let o of r)this.handleMutation(o);}),this.observer.observe(t,{attributes:true,characterData:true,childList:true,subtree:true}));}handleMutation(t){if(t.type==="characterData"){let n=this.mirror.get(t.target);n!==void 0&&this.push(3,{texts:[{id:n,value:re(t.target.textContent??"",this.options.mask)}]});return}if(t.type==="attributes"&&t.attributeName){let n=this.mirror.get(t.target),r=t.target;n!==void 0&&this.push(3,{attributes:[{attributes:{[t.attributeName]:r.getAttribute(t.attributeName)??""},id:n}]});return}if(t.type==="childList"){let n=this.mirror.get(t.target);if(n===void 0)return;for(let r of Array.from(t.addedNodes)){let o=se(this.adapt(r),this.allocator,this.options.mask,(a,i)=>{let s=a.ref;s&&this.mirror.set(s,i);});o&&this.push(3,{adds:[{node:o,parentId:n}]});}for(let r of Array.from(t.removedNodes)){let o=this.mirror.get(r);o!==void 0&&(this.push(3,{removes:[{id:o,parentId:n}]}),this.mirror.delete(r));}}}observeInteractions(t){t.addEventListener("input",n=>{let r=n.target;if(!r||!Wt.has(r.tagName))return;let o=this.mirror.get(r);o!==void 0&&this.push(3,{input:{id:o,value:ne(r.value??"",r.type,this.options.mask)}});},true),t.addEventListener("scroll",n=>{let r=n.target,o=r?this.mirror.get(r):void 0;this.push(3,{scroll:{id:o??0,x:r?.scrollLeft??0,y:r?.scrollTop??0}});},true);}adapt(t){let n={childNodes:[],nodeType:t.nodeType,ref:t};if(t.nodeType===Fe)return n.textValue=t.textContent??"",n;if(t.nodeType===$e){let r=t;if(n.tagName=r.tagName,n.attributes=Array.from(r.attributes).map(o=>({name:o.name,value:o.value})),Wt.has(r.tagName)){let o=r;n.inputType=o.type,n.inputValue=o.value??"";}}return n.childNodes=Array.from(t.childNodes).map(r=>this.adapt(r)),n}push(t,n){let r=this.chunker.add({data:n,timestamp:this.options.now(),type:t});r&&this.upload(r);}upload(t){!t||!this.fetchImpl||jt(t,{apiKey:this.options.apiKey,fetch:this.fetchImpl,replayHost:this.options.replayHost}).catch(n=>this.options.onError?.(n));}};function yr(){return globalThis.document}function zt(e){let t=new ae({apiKey:e.apiKey,distinctId:e.distinctId,flushIntervalMs:e.flushIntervalMs??5e3,mask:{...Vt,...e.mask},maxEvents:e.maxEvents??200,now:e.now??(()=>Date.now()),onError:e.onError,replayHost:e.replayHost,sessionId:e.sessionId??d()});return t.start(),t}var Jt=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],Yt=["gclid","gbraid","wbraid","fbclid","msclkid","ttclid","li_fat_id","twclid"];var De=(e,t)=>{let n=new URLSearchParams(e),r={};for(let o of [...Jt,...Yt]){let a=n.get(o)?.trim();a&&(r[o]=a.slice(0,255));}return t&&(r.$session_referrer=t),r},vr=e=>{let t={};for(let n of [...Jt,...Yt])e[n]!==void 0&&(t[`$initial_${n}`]=e[n]);return t.$initial_referrer=e.$session_referrer??"$direct",t},xr=(e,t)=>{let n=e.getItem(t);if(n)try{let r=JSON.parse(n);return typeof r.sessionId=="string"&&typeof r.properties=="object"&&r.properties!==null?{properties:r.properties,sessionId:r.sessionId}:void 0}catch{return}},Xt=(e,t)=>{let n=`pdx_${t}_session_touch`,r=`pdx_${t}_first_touch`;return {forSession:(o,a,i)=>{if(o===void 0)return {};let s=xr(e,n);if(s!==void 0&&s.sessionId===o)return s.properties;let c=De(a,i);return e.setItem(n,JSON.stringify({properties:c,sessionId:o})),e.getItem(r)?c:(e.setItem(r,"1"),{...c,$set_once:vr(c)})}}};var de=e=>`prodantix-cta:${e}`,Qt=e=>{try{let t=window.localStorage.getItem(de(e));return t===null?null:Number(t)}catch{return null}},Zt=e=>{try{return window.sessionStorage.getItem(de(e))!==null}catch{return false}},en=(e,t)=>{try{window.localStorage.setItem(de(e),String(t)),window.sessionStorage.setItem(de(e),String(t));}catch{return}},tn=(e,t,n,r)=>t===null?true:e.kind==="once"?false:e.kind==="session"?!n:r-t>=e.value*864e5;var $={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"}},ue=e=>{let t=(e??"").toLowerCase().split("-")[0]??"";return t in $?t:"en"};var v="prodantix-cta",nn="prodantix-cta-style",br=`.${v}{font-family:system-ui,sans-serif;color:var(--pdx-text);background:var(--pdx-background);border-radius:var(--pdx-radius);box-sizing:border-box;padding:16px;display:flex;gap:12px;align-items:center;flex-wrap:wrap}
2
+ .${v} *{box-sizing:border-box}
3
+ .${v} h2{font-size:18px;line-height:1.3;margin:0;font-weight:700}
4
+ .${v} p{margin:0;font-size:15px;line-height:1.5}
5
+ .${v} img{max-width:100%;height:auto;border-radius:var(--pdx-radius)}
6
+ .${v} .pdx-text{display:flex;flex-direction:column;gap:6px;flex:1 1 240px;min-width:0}
7
+ .${v} .pdx-actions{display:flex;gap:8px;flex-wrap:wrap}
8
+ .${v} button{font:inherit;min-height:44px;padding:0 18px;border:0;border-radius:var(--pdx-radius);background:var(--pdx-button);color:var(--pdx-button-text);cursor:pointer}
9
+ .${v} button[data-secondary]{background:transparent;color:inherit;border:1px solid currentColor}
10
+ .${v} .pdx-close{min-width:44px;padding:0;background:transparent;color:inherit;font-size:22px;line-height:1}
11
+ .${v} .pdx-meta{font-size:12px;opacity:.85;flex-basis:100%}
12
+ .${v} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}
13
+ .${v}[data-kind=banner]{position:fixed;left:0;right:0;z-index:2147483000;border-radius:0}
14
+ .${v}[data-kind=banner][data-placement=top]{top:0}
15
+ .${v}[data-kind=banner][data-placement=bottom]{bottom:0}
16
+ .${v}[data-kind=slide_in]{position:fixed;bottom:16px;z-index:2147483000;width:min(360px,calc(100vw - 32px));box-shadow:0 8px 32px rgba(0,0,0,.18)}
17
+ .${v}[data-kind=slide_in][data-placement=bottom_left]{left:16px}
18
+ .${v}[data-kind=slide_in][data-placement=bottom_right]{right:16px}
19
+ dialog.${v}{border:0;max-width:min(480px,calc(100vw - 32px));box-shadow:0 16px 48px rgba(0,0,0,.24)}
20
+ dialog.${v}::backdrop{background:rgba(0,0,0,.45)}
21
+ @media (prefers-reduced-motion:no-preference){.${v}[data-kind=slide_in],.${v}[data-kind=banner],dialog.${v}{animation:pdx-cta-in .2s ease-out}}
22
+ @keyframes pdx-cta-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}`,kr=()=>{if(document.getElementById(nn))return;let e=document.createElement("style");e.id=nn,e.textContent=br,document.head.append(e);},wr=(e,t)=>{let n=t.variant.style;for(let[r,o]of [["--pdx-background",n.background],["--pdx-text",n.text],["--pdx-button",n.button],["--pdx-button-text",n.buttonText],["--pdx-radius",`${n.radius}px`]])e.style.setProperty(r,o);},He=(e,t,n,r)=>{let o=t.variant.content,a=$[n.language];if(e.className=v,e.dataset.kind=t.kind,e.dataset.placement=t.placement,e.dataset.ctaId=t.id,wr(e,t),o.image){let s=document.createElement("img");s.src=o.image,s.alt=o.imageAlt,s.loading="lazy",e.append(s);}let i=document.createElement("div");if(i.className="pdx-text",o.heading){let s=document.createElement("h2");s.textContent=o.heading,i.append(s);}if(o.body){let s=document.createElement("p");s.textContent=o.body,i.append(s);}if(e.append(i),o.buttons.length>0){let s=document.createElement("div");s.className="pdx-actions",o.buttons.forEach((c,d)=>{let u=document.createElement("button");u.type="button",u.textContent=c.label,u.dataset.action=`button-${d}`,d>0&&(u.dataset.secondary=""),u.addEventListener("click",()=>n.onButton(d)),s.append(u);}),e.append(s);}if(r){let s=document.createElement("button");s.type="button",s.className="pdx-close",s.dataset.action="close",s.textContent="\xD7",s.setAttribute("aria-label",a.close),s.title=a.close,s.addEventListener("click",r),e.append(s);}if(t.poweredBy){let s=document.createElement("p");s.className="pdx-meta",s.textContent=a.poweredBy,e.append(s);}},ce=(e,t)=>{kr();let n=e.variant.content.heading||e.variant.content.body;if(e.kind==="embedded"){let i=[...document.querySelectorAll("[data-prodantix-cta]")].filter(s=>s.dataset.prodantixCta===e.id).map(s=>{let c=document.createElement("section");return c.setAttribute("aria-label",n),He(c,e,t,null),s.replaceChildren(c),c});return {destroy:()=>i.forEach(s=>s.remove()),elements:i}}if(e.kind==="popup"){let a=document.activeElement instanceof HTMLElement?document.activeElement:null,i=document.createElement("dialog");i.setAttribute("aria-label",n);let s=false,c=()=>{s||(s=true,i.open&&i.close(),i.remove(),a?.focus());},d=()=>{c(),t.onDismiss();};return He(i,e,t,d),i.addEventListener("cancel",u=>{u.preventDefault(),d();}),document.body.append(i),i.showModal(),{destroy:c,elements:[i]}}let r=document.createElement("section");r.setAttribute("aria-label",n),e.kind==="slide_in"&&(r.setAttribute("role","dialog"),r.setAttribute("aria-modal","false"));let o=()=>r.remove();return He(r,e,t,()=>{o(),t.onDismiss();}),document.body.append(r),{destroy:o,elements:[r]}};var rn=(e,t)=>{let n=false,r=[],o=()=>{n=true;for(let i of r.splice(0))i();},a=()=>{n||(o(),t());};if(e.kind==="load")queueMicrotask(a);else if(e.kind==="delay"){let i=setTimeout(a,e.value*1e3);r.push(()=>clearTimeout(i));}else if(e.kind==="scroll"){let i=()=>{let s=document.documentElement.scrollHeight-window.innerHeight;(s<=0||window.scrollY/s*100>=e.value)&&a();};window.addEventListener("scroll",i,{passive:true}),r.push(()=>window.removeEventListener("scroll",i)),i();}else if(e.kind==="exit"){let i=s=>{s.relatedTarget===null&&s.clientY<=0&&a();};document.addEventListener("mouseout",i),r.push(()=>document.removeEventListener("mouseout",i));}else {let i=e.value,s=d=>{try{return d.closest(i)!==null}catch{return false}},c=d=>{let u=d.target;u instanceof Element&&s(u)&&a();};document.addEventListener("click",c,true),r.push(()=>document.removeEventListener("click",c,true));}return o};var on=e=>`prodantix-form-popup:${e}`,Er=e=>{try{let t=window.localStorage.getItem(on(e));return t===null?null:Number(t)}catch{return null}},Sr=(e,t)=>{try{window.localStorage.setItem(on(e),String(t));}catch{return}},sn=(e,t,n)=>n===null||t-n>=e.periodDays*864e5,an=(e,t,n=Date.now)=>{if(!sn(e,n(),Er(e.formId)))return ()=>{};let r=false,o=[],a=()=>{if(!r){r=true;for(let s of o)s();Sr(e.formId,n()),t();}},i=e.trigger;if(i.kind==="delay"){let s=setTimeout(a,i.seconds*1e3);o.push(()=>clearTimeout(s));}else if(i.kind==="scroll"){let s=()=>{let c=document.documentElement.scrollHeight-window.innerHeight;(c<=0||window.scrollY/c*100>=i.percent)&&a();};window.addEventListener("scroll",s,{passive:true}),o.push(()=>window.removeEventListener("scroll",s));}else {let s=c=>{c.relatedTarget===null&&c.clientY<=0&&a();};document.addEventListener("mouseout",s),o.push(()=>document.removeEventListener("mouseout",s));}return ()=>{r=true;for(let s of o)s();}};var Tr=e=>{let t=0;for(let n of e){if(n!==0)return t+Math.clz32(n)-24;t+=8;}return t},Cr=async e=>new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e))),dn=async e=>{for(let t=0;;t+=1){let n=t.toString(36);if(Tr(await Cr(`${e.nonce}:${n}`))>=e.difficulty)return n}};var S="prodantix-form",Pr=`.${S}{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)}
23
23
  .${S} *{box-sizing:border-box}
24
24
  .${S} .pdx-field{display:flex;flex-direction:column;gap:4px;margin:0 0 12px}
25
25
  .${S} .pdx-field[hidden]{display:none}
@@ -32,6 +32,6 @@ dialog.${y}::backdrop{background:rgba(0,0,0,.45)}
32
32
  .${S} button[data-variant=back]{background:transparent;color:inherit;border:1px solid currentColor}
33
33
  .${S} .pdx-actions{display:flex;gap:8px;justify-content:flex-end}
34
34
  .${S} .pdx-hp{position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden}
35
- .${S} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}`,en=e=>e==null||e===false||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0,tn=(e,t)=>{let n=e.condition;if(!n)return true;let r=t[n.field];return en(r)?false:n.op==="is_set"?true:n.op==="equals"?typeof r=="string"&&r===n.values[0]:(Array.isArray(r)?r:[r]).some(a=>typeof a=="string"&&n.values.includes(a))},mr=e=>{let t=`${encodeURIComponent(e)}=`,n=document.cookie.split("; ").find(r=>r.startsWith(t));return n?decodeURIComponent(n.slice(t.length)):""},fr=e=>{let t=e.hidden;return t?t.source==="fixed"?t.value:t.source==="query"?new URLSearchParams(window.location.search).get(t.value)??"":mr(t.value):""},p=(e,t={},n=[])=>{let r=Object.assign(document.createElement(e),t);return r.append(...n),r},gr=(e,t,n)=>{let r=p("p",{className:"pdx-error",id:`${t}-error`}),o=e.help?p("p",{className:"pdx-help",id:`${t}-help`},[e.help]):null,a=[o?`${t}-help`:"",`${t}-error`].filter(Boolean).join(" "),i=p("div",{className:"pdx-field"});if(i.dataset.field=e.key,e.kind==="rich_text")return i.append(p("p",{},[e.label])),{error:r,field:e,focus:()=>{},read:()=>{},root:i};if(e.kind==="hidden")return i.hidden=true,{error:r,field:e,focus:()=>{},read:()=>fr(e),root:i};if(e.kind==="radio"||e.kind==="checkboxes"){let u=p("fieldset",{});u.setAttribute("aria-describedby",a),e.required&&u.setAttribute("aria-required","true"),u.append(p("legend",{},[e.label]));let l=e.options.filter(L=>!L.archived).map((L,T)=>{let I=p("input",{id:`${t}-${T}`,name:t,type:e.kind==="radio"?"radio":"checkbox",value:L.value});return I.addEventListener("change",n),u.append(p("div",{className:"pdx-choice"},[I,p("label",{htmlFor:`${t}-${T}`},[L.label])])),I});return i.append(u,...o?[o]:[],r),{error:r,field:e,focus:()=>l[0]?.focus(),read:()=>{let L=l.filter(T=>T.checked).map(T=>T.value);return e.kind==="radio"?L[0]??"":L},root:i}}let s=p("label",{htmlFor:t},[e.label]),c;if(e.kind==="textarea")c=p("textarea",{id:t,placeholder:e.placeholder,rows:4});else if(e.kind==="dropdown")c=p("select",{id:t},[p("option",{value:""},[""]),...e.options.filter(u=>!u.archived).map(u=>p("option",{value:u.value},[u.label]))]);else if(e.kind==="checkbox")c=p("input",{id:t,type:"checkbox"});else {let u={date:"date",email:"email",file:"file",number:"number",phone:"tel"};c=p("input",{id:t,placeholder:e.placeholder,type:u[e.kind]??"text"}),e.kind==="email"&&(c.autocomplete="email");}return c.setAttribute("aria-describedby",a),e.required&&c.setAttribute("aria-required","true"),c.addEventListener("input",n),c.addEventListener("change",n),e.kind==="checkbox"?i.append(p("div",{className:"pdx-choice"},[c,s]),...o?[o]:[],r):i.append(s,...o?[o]:[],c,r),{error:r,field:e,focus:()=>c.focus(),read:()=>c instanceof HTMLInputElement&&c.type==="checkbox"?c.checked:e.kind==="number"?c.value===""?"":Number(c.value):c.value,root:i}},hr=(e,t)=>{let n=t.style,r={"--pdx-background":n.background,"--pdx-button":n.button,"--pdx-button-text":n.buttonText,"--pdx-field-background":n.fieldBackground,"--pdx-field-text":n.fieldText,"--pdx-font":n.font,"--pdx-radius":`${n.radius}px`,"--pdx-text":n.text,"--pdx-width":`${n.width}px`};for(let[o,a]of Object.entries(r))e.style.setProperty(o,a);},yr=()=>{document.getElementById("prodantix-form-style")||document.head.append(p("style",{id:"prodantix-form-style",textContent:pr}));},ce=(e,t$1)=>{let{formId:n,host:r,language:o}=t$1,a=$[o],i=l=>a[l],s$1=p("form",{className:S,noValidate:true});s$1.dataset.prodantixForm=n;let c=p("p",{className:"pdx-meta"});c.setAttribute("aria-live","polite"),c.setAttribute("role","status");let d=false,u$1=r.form(n).then(l=>{if(d)return;if(!l.accepting){s$1.replaceChildren(p("p",{className:"pdx-meta"},[i("closed")]));return}yr(),hr(s$1,l);let k=l.challenge?Zt(l.challenge):null,L=false,T=[],I=()=>{let m={};for(let x of T.flat())if(!x.root.hidden||x.field.kind==="hidden"){let P=x.read();P!==void 0&&(m[x.field.key]=P);}return m},O=()=>{let m=I();for(let x of T.flat())x.field.kind!=="hidden"&&(x.root.hidden=!tn(x.field,m));},A=()=>{L||(L=true,r.capture(t,{$form_id:l.id,$form_version:l.version})),O();},N=l.steps.map((m,x)=>{let P=p("div",{});P.dataset.step=String(x),m.title&&P.append(p("p",{className:"pdx-meta"},[m.title]));let v=m.fields.map(M=>gr(M,`pdx-${n}-${M.key}`,A));return T.push(v),P.append(...v.map(M=>M.root)),P}),F=p("input",{autocomplete:"off",name:l.honeypot,tabIndex:-1,type:"text"}),R=p("div",{className:"pdx-hp"},[F]);R.setAttribute("aria-hidden","true");let _=[],h=p("div",{});if(l.consent.processing){let m=p("input",{id:`pdx-${n}-consent`,type:"checkbox"});m.setAttribute("aria-required","true"),_.push({input:m,key:"$consent_processing"}),h.append(p("div",{className:"pdx-choice"},[m,p("label",{htmlFor:m.id},[l.consent.processing])]));}for(let m of l.consent.purposes){let x=p("input",{id:`pdx-${n}-consent-${m.key}`,type:"checkbox"});_.push({input:x,key:`$consent_${m.key}`}),h.append(p("div",{className:"pdx-choice"},[x,p("label",{htmlFor:x.id},[m.label])])),m.notice&&h.append(p("p",{className:"pdx-help"},[m.notice]));}let f=p("p",{className:"pdx-meta"}),E=p("button",{type:"button"},[i("back")]);E.dataset.variant="back";let b=p("button",{type:"button"},[i("next")]),C=p("button",{type:"submit"},[i("submit")]);E.dataset.action="back",b.dataset.action="next",C.dataset.action="submit";let Be=p("div",{className:"pdx-actions"},[E,b,C]),g=0,le=()=>{N.forEach((x,P)=>{x.hidden=P!==g;});let m=g===N.length-1;E.hidden=g===0,b.hidden=m,C.hidden=!m,h.hidden=!m,f.hidden=N.length<2,f.textContent=i("step").replace("{step}",String(g+1)).replace("{total}",String(N.length));},dn=()=>{for(let m of T.flat())m.error.textContent="",m.root.querySelector("[aria-invalid]")?.removeAttribute("aria-invalid");},He=(m,x)=>{m.error.textContent=x,m.root.querySelector("input,select,textarea,fieldset")?.setAttribute("aria-invalid","true");},qe=m=>{dn();let x=I(),P=(T[m]??[]).filter(v=>!v.root.hidden&&v.field.required&&en(x[v.field.key]));for(let v of P)He(v,i("required"));return P.length>0?(c.textContent=i("required"),P[0]?.focus(),false):true};E.addEventListener("click",()=>{g=Math.max(0,g-1),le();}),b.addEventListener("click",()=>{qe(g)&&(g+=1,le());}),s$1.addEventListener("submit",m=>{if(m.preventDefault(),!qe(g))return;let x={...I(),[l.honeypot]:F.value};for(let v of _)x[v.key]=v.input.checked;C.disabled=true,C.textContent=i("sending");let P=l.challenge;if(!P||!k){c.textContent=i("closed");return}k.then(v=>r.submit(n,x,P,v)).then(v=>{if(v.kind==="redirect"&&v.value.startsWith("https://")){window.location.assign(v.value);return}let M=p("p",{},[v.kind==="message"&&v.value?v.value:i("thanks")]);M.setAttribute("role","status"),s$1.replaceChildren(M);}).catch(v=>{C.disabled=false,C.textContent=i("submit");let M=v instanceof u?v.fields:[];for(let Ke of M){let Ge=T.flat().find(un=>un.field.key===Ke.field);Ge&&He(Ge,Ke.rule==="required"?i("required"):i("invalid"));}c.textContent=M.length>0?i("invalid"):i("failed");});}),s$1.append(f,...N,R,h,Be,c),l.poweredBy&&t$1.poweredBy!==false&&s$1.append(p("p",{className:"pdx-meta"},[i("poweredBy")])),le(),O(),r.capture(s,{$form_id:l.id,$form_version:l.version});}).catch(()=>{d||s$1.replaceChildren(p("p",{className:"pdx-meta"},[i("closed")]));});return e.append(s$1),{destroy:()=>{d=true,s$1.remove();},ready:u$1}};var De=e=>({capture:(t,n)=>e.capture(t,{properties:n}),form:t=>e.getForm(t),submit:(t,n,r,o)=>e.submitForm(t,n,r,o)});var nn=e=>({capture:(t,n,r)=>e.captureCta(t,n,r),ctas:t=>e.getCtas(t),forms:De(e),isEnabled:t=>e.isFeatureEnabled(t),variant:async t=>(await e.getVariant(t))?.key??null}),rn=e=>e<768?"mobile":e<1024?"tablet":"desktop",on=async(e,t)=>{let n=t.flag;return n?n.variant?await e.variant(n.key)===n.variant:e.isEnabled(n.key):true},xr=(e,t,n)=>{let r=document.createElement("dialog");r.className="prodantix-form-popup";let o=document.createElement("button");o.type="button",o.textContent="\xD7",o.setAttribute("aria-label",$[n].close),o.title=$[n].close,o.addEventListener("click",()=>r.close()),r.addEventListener("close",()=>r.remove()),r.append(o),document.body.append(r),ce(r,{formId:e,host:t,language:n}),r.showModal();},vr=()=>{let e=window.prodantix;typeof e=="function"&&e("open");},sn=async(e,t)=>{let n=t.now??Date.now,r=t.open??(d=>window.location.assign(d)),o=[],a=[],i$1=false,s=()=>{i$1=true;for(let d of o.splice(0))d();for(let d of a.splice(0))d.destroy();},c=await e.ctas({device:rn(window.innerWidth),language:document.documentElement.lang||t.language,url:window.location.href});for(let d of c)i$1||!Wt(d.frequency,Ut(d.id),Vt(d.id),n())||!await on(e,d)||o.push(Jt(d.trigger,()=>{if(i$1)return;let u=ue(d,{language:t.language,onButton:l=>{e.capture(j,d,l);let k$1=d.variant.content.buttons[l]?.action;k$1&&((k$1.kind!=="url"||d.kind!=="embedded")&&u.destroy(),k$1.kind==="url"?r(k$1.value):k$1.kind==="form"?xr(k$1.value,e.forms,t.language):k$1.kind==="messenger"?vr():e.capture(k,d));},onDismiss:()=>e.capture(k,d)});u.elements.length!==0&&(a.push(u),jt(d.id,n()),e.capture(i,d));}));return s},kr=()=>{},br=(e,t)=>{let n=nn(e),r=de(t??document.documentElement.lang),o=()=>sn(n,{language:r}).catch(u=>(console.error("[prodantix] the CTAs for this page could not be read",u),kr)),a=o(),i=window.location.href,s=()=>{if(window.location.href===i)return;i=window.location.href,a=a.then(l=>(l(),o()));},c=history.pushState.bind(history),d=history.replaceState.bind(history);return history.pushState=(...u)=>{c(...u),s();},history.replaceState=(...u)=>{d(...u),s();},window.addEventListener("popstate",s),()=>{history.pushState=c,history.replaceState=d,window.removeEventListener("popstate",s),a.then(u=>u());}};var B=class{constructor(t){a(this,"fetch");a(this,"host");a(this,"projectKey");a(this,"requestTimeoutMs");this.fetch=e$1(t.fetch),this.host=h(t.host),this.projectKey=t.projectKey,this.requestTimeoutMs=t.requestTimeoutMs??1e4;}async request(t,n){let r=this.fetch;if(!r)throw new d$1("no fetch implementation available in this runtime");let o=f(),a=o?setTimeout(()=>o.abort(),this.requestTimeoutMs):void 0;try{let i={authorization:`Bearer ${this.projectKey}`};n.body!==void 0&&(i["content-type"]="application/json");let s=await r(`${this.host}${t}`,{body:n.body,headers:i,method:n.method,signal:o?.signal});return {status:s.status,text:await s.text()}}finally{a!==void 0&&clearTimeout(a);}}async vapidKey(t){let{status:n,text:r}=await this.request(`/v1/push/vapid?appId=${encodeURIComponent(t)}`,{method:"GET"});if(n<200||n>=300)throw new d$1(`push key request failed with status ${n}`,n);return JSON.parse(r).publicKey}async register(t){let{status:n,text:r}=await this.request("/v1/push/devices",{body:JSON.stringify(t),method:"POST"});if(n<200||n>=300)throw new d$1(`push registration failed with status ${n}`,n);return JSON.parse(r).id}async opened(t){let{status:n}=await this.request("/v1/push/opens",{body:JSON.stringify({sendId:t}),method:"POST"});if(n<200||n>=300)throw new d$1(`push open report failed with status ${n}`,n)}};var an="/prodantix-push-sw.js",wr=()=>{let e=globalThis,t=e.navigator?.serviceWorker,n=e.Notification;return t===void 0||n===void 0||e.PushManager===void 0?null:{register:async r=>(await t.register(r),t.ready),requestPermission:()=>n.requestPermission()}},Er=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/").padEnd(Math.ceil(e.length/4)*4,"="),n=atob(t);return Uint8Array.from(n,r=>r.charCodeAt(0))},Sr=(e,t,n)=>`${e}${e.includes("?")?"&":"?"}host=${encodeURIComponent(t)}&key=${encodeURIComponent(n)}`,Tr=async e=>{let t=e.browser??wr();if(t===null)return {status:"unsupported"};if(await t.requestPermission()!=="granted")return {status:"denied"};let r=new B({fetch:e.fetch,host:e.host,projectKey:e.apiKey}),o=await t.register(Sr(e.serviceWorker??an,e.host,e.apiKey)),a=await o.pushManager.getSubscription()??await o.pushManager.subscribe({applicationServerKey:Er(await r.vapidKey(e.appId)),userVisibleOnly:true});return {deviceId:await r.register({appId:e.appId,distinctId:e.distinctId,permission:"granted",platform:"web",token:JSON.stringify(a.toJSON())}),status:"registered"}};function Cr(){return globalThis.navigator}function Lr(){return globalThis.document}function Pr(){return globalThis.history}function Ar(){return globalThis.location}function Ir(e){let t=e?.userAgentData?.platform??e?.platform;return t?t.slice(0,50):void 0}function Nr(e){let t=()=>{e.flush();};globalThis.document?.addEventListener?.("visibilitychange",t),globalThis.addEventListener?.("pagehide",t);}function Or(e,t,n){try{return Ne({domain:t,name:`pdx_${h$1(e)}`})??n}catch{return n}}function hi(e){let{autocaptureOptions:t,cookieDomain:n,guides:r,linkedDomains:o,replayHost:a,sessionReplay:i,sessionReplayOptions:s,surveys:c$1,...d}=e,u=Cr(),l=b(),k=d.storage??l,L=d.sharedStorage??Or(d.apiKey,n,l),T=Ft({history:Pr(),location:Ar(),namespace:h$1(d.apiKey),now:(d.clock??c).now().getTime(),shared:L,storage:k}),I=J(d.onError??(()=>{})),O={...d,describeElement:d.describeElement??(R=>ft(R,I)),locale:d.locale??(u?.language?u.language.slice(0,20):void 0),os:d.os??Ir(u),sessionTracking:d.sessionTracking??true,sharedStorage:L,storage:k,transport:d.transport??new Q({maxRetries:d.maxRetries,requestTimeoutMs:d.requestTimeoutMs})},A=new _(O);T!==void 0&&A.alias(T),Nr(A),O.consentMode==="banner"&&typeof window<"u"&&wt(A,window),(e.autocapture??true)&&vt(A,{onError:O.onError,...t});let N=Lr();N&&o&&Oe(N,A,o);let F=typeof window>"u"?void 0:window;if(F&&(c$1!==false||r!==false)&&At(A,F,{edgeHost:(d.flagsHost??d.host).replace(/\/+$/,""),guides:r!==false,namespace:h$1(d.apiKey),onError:O.onError??(()=>{}),storage:k,surveys:c$1!==false}),i&&a){let R=()=>{Gt({apiKey:O.apiKey,distinctId:()=>A.distinctId,onError:O.onError,replayHost:a,...s,sessionId:s?.sessionId??A.sessionId});};if(A.isCookieless()){let _=A.onStorageAllowed(()=>{_(),R();});}else R();}return A}
36
- export{pt as ACTION_ATTRIBUTE,lt as ANNOTATION_ATTRIBUTE,D as ANNOTATION_MAX_LENGTH,an as DEFAULT_SERVICE_WORKER,mt as IGNORE_ATTRIBUTE,B as PushClient,Q as WebTransport,Ne as createCookieStorage,hi as createWebClient,nn as ctasHost,Mt as decorateLink,rn as deviceOf,on as flagAllows,de as formLanguage,De as formsHost,vt as installAutocapture,Oe as installLinkCarry,Gt as installSessionReplay,_t as readCarry,Tr as registerPush,ue as renderCta,ce as renderForm,Tt as resolveCookieDomain,sn as runCtas,br as startCtas,$t as stripCarry,Qt as watchPopup};//# sourceMappingURL=web.js.map
35
+ .${S} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}`,un=e=>e==null||e===false||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0,cn=(e,t)=>{let n=e.condition;if(!n)return true;let r=t[n.field];return un(r)?false:n.op==="is_set"?true:n.op==="equals"?typeof r=="string"&&r===n.values[0]:(Array.isArray(r)?r:[r]).some(a=>typeof a=="string"&&n.values.includes(a))},Lr=e=>{let t=`${encodeURIComponent(e)}=`,n=document.cookie.split("; ").find(r=>r.startsWith(t));return n?decodeURIComponent(n.slice(t.length)):""},Ar=e=>{let t=e.hidden;return t?t.source==="fixed"?t.value:t.source==="query"?new URLSearchParams(window.location.search).get(t.value)??"":Lr(t.value):""},p=(e,t={},n=[])=>{let r=Object.assign(document.createElement(e),t);return r.append(...n),r},Ir=(e,t,n)=>{let r=p("p",{className:"pdx-error",id:`${t}-error`}),o=e.help?p("p",{className:"pdx-help",id:`${t}-help`},[e.help]):null,a=[o?`${t}-help`:"",`${t}-error`].filter(Boolean).join(" "),i=p("div",{className:"pdx-field"});if(i.dataset.field=e.key,e.kind==="rich_text")return i.append(p("p",{},[e.label])),{error:r,field:e,focus:()=>{},read:()=>{},root:i};if(e.kind==="hidden")return i.hidden=true,{error:r,field:e,focus:()=>{},read:()=>Ar(e),root:i};if(e.kind==="radio"||e.kind==="checkboxes"){let u=p("fieldset",{});u.setAttribute("aria-describedby",a),e.required&&u.setAttribute("aria-required","true"),u.append(p("legend",{},[e.label]));let l=e.options.filter(L=>!L.archived).map((L,T)=>{let I=p("input",{id:`${t}-${T}`,name:t,type:e.kind==="radio"?"radio":"checkbox",value:L.value});return I.addEventListener("change",n),u.append(p("div",{className:"pdx-choice"},[I,p("label",{htmlFor:`${t}-${T}`},[L.label])])),I});return i.append(u,...o?[o]:[],r),{error:r,field:e,focus:()=>l[0]?.focus(),read:()=>{let L=l.filter(T=>T.checked).map(T=>T.value);return e.kind==="radio"?L[0]??"":L},root:i}}let s=p("label",{htmlFor:t},[e.label]),c;if(e.kind==="textarea")c=p("textarea",{id:t,placeholder:e.placeholder,rows:4});else if(e.kind==="dropdown")c=p("select",{id:t},[p("option",{value:""},[""]),...e.options.filter(u=>!u.archived).map(u=>p("option",{value:u.value},[u.label]))]);else if(e.kind==="checkbox")c=p("input",{id:t,type:"checkbox"});else {let u={date:"date",email:"email",file:"file",number:"number",phone:"tel"};c=p("input",{id:t,placeholder:e.placeholder,type:u[e.kind]??"text"}),e.kind==="email"&&(c.autocomplete="email");}return c.setAttribute("aria-describedby",a),e.required&&c.setAttribute("aria-required","true"),c.addEventListener("input",n),c.addEventListener("change",n),e.kind==="checkbox"?i.append(p("div",{className:"pdx-choice"},[c,s]),...o?[o]:[],r):i.append(s,...o?[o]:[],c,r),{error:r,field:e,focus:()=>c.focus(),read:()=>c instanceof HTMLInputElement&&c.type==="checkbox"?c.checked:e.kind==="number"?c.value===""?"":Number(c.value):c.value,root:i}},Nr=(e,t)=>{let n=t.style,r={"--pdx-background":n.background,"--pdx-button":n.button,"--pdx-button-text":n.buttonText,"--pdx-field-background":n.fieldBackground,"--pdx-field-text":n.fieldText,"--pdx-font":n.font,"--pdx-radius":`${n.radius}px`,"--pdx-text":n.text,"--pdx-width":`${n.width}px`};for(let[o,a]of Object.entries(r))e.style.setProperty(o,a);},Or=()=>{document.getElementById("prodantix-form-style")||document.head.append(p("style",{id:"prodantix-form-style",textContent:Pr}));},le=(e,t$1)=>{let{formId:n,host:r,language:o}=t$1,a=$[o],i=l=>a[l],s$1=p("form",{className:S,noValidate:true});s$1.dataset.prodantixForm=n;let c=p("p",{className:"pdx-meta"});c.setAttribute("aria-live","polite"),c.setAttribute("role","status");let d=false,u$1=r.form(n).then(l=>{if(d)return;if(!l.accepting){s$1.replaceChildren(p("p",{className:"pdx-meta"},[i("closed")]));return}Or(),Nr(s$1,l);let x=l.challenge?dn(l.challenge):null,L=false,T=[],I=()=>{let f={};for(let b of T.flat())if(!b.root.hidden||b.field.kind==="hidden"){let A=b.read();A!==void 0&&(f[b.field.key]=A);}return f},R=()=>{let f=I();for(let b of T.flat())b.field.kind!=="hidden"&&(b.root.hidden=!cn(b.field,f));},H=()=>{L||(L=true,r.capture(t,{$form_id:l.id,$form_version:l.version})),R();},N=l.steps.map((f,b)=>{let A=p("div",{});A.dataset.step=String(b),f.title&&A.append(p("p",{className:"pdx-meta"},[f.title]));let k=f.fields.map(_=>Ir(_,`pdx-${n}-${_.key}`,H));return T.push(k),A.append(...k.map(_=>_.root)),A}),O=p("input",{autocomplete:"off",name:l.honeypot,tabIndex:-1,type:"text"}),C=p("div",{className:"pdx-hp"},[O]);C.setAttribute("aria-hidden","true");let M=[],g=p("div",{});if(l.consent.processing){let f=p("input",{id:`pdx-${n}-consent`,type:"checkbox"});f.setAttribute("aria-required","true"),M.push({input:f,key:"$consent_processing"}),g.append(p("div",{className:"pdx-choice"},[f,p("label",{htmlFor:f.id},[l.consent.processing])]));}for(let f of l.consent.purposes){let b=p("input",{id:`pdx-${n}-consent-${f.key}`,type:"checkbox"});M.push({input:b,key:`$consent_${f.key}`}),g.append(p("div",{className:"pdx-choice"},[b,p("label",{htmlFor:b.id},[f.label])])),f.notice&&g.append(p("p",{className:"pdx-help"},[f.notice]));}let m=p("p",{className:"pdx-meta"}),E=p("button",{type:"button"},[i("back")]);E.dataset.variant="back";let w=p("button",{type:"button"},[i("next")]),P=p("button",{type:"submit"},[i("submit")]);E.dataset.action="back",w.dataset.action="next",P.dataset.action="submit";let Ke=p("div",{className:"pdx-actions"},[E,w,P]),h=0,pe=()=>{N.forEach((b,A)=>{b.hidden=A!==h;});let f=h===N.length-1;E.hidden=h===0,w.hidden=f,P.hidden=!f,g.hidden=!f,m.hidden=N.length<2,m.textContent=i("step").replace("{step}",String(h+1)).replace("{total}",String(N.length));},yn=()=>{for(let f of T.flat())f.error.textContent="",f.root.querySelector("[aria-invalid]")?.removeAttribute("aria-invalid");},Ve=(f,b)=>{f.error.textContent=b,f.root.querySelector("input,select,textarea,fieldset")?.setAttribute("aria-invalid","true");},Ge=f=>{yn();let b=I(),A=(T[f]??[]).filter(k=>!k.root.hidden&&k.field.required&&un(b[k.field.key]));for(let k of A)Ve(k,i("required"));return A.length>0?(c.textContent=i("required"),A[0]?.focus(),false):true};E.addEventListener("click",()=>{h=Math.max(0,h-1),pe();}),w.addEventListener("click",()=>{Ge(h)&&(h+=1,pe());}),s$1.addEventListener("submit",f=>{if(f.preventDefault(),!Ge(h))return;let b={...I(),[l.honeypot]:O.value};for(let k of M)b[k.key]=k.input.checked;P.disabled=true,P.textContent=i("sending");let A=l.challenge;if(!A||!x){c.textContent=i("closed");return}x.then(k=>r.submit(n,b,A,k)).then(k=>{if(k.kind==="redirect"&&k.value.startsWith("https://")){window.location.assign(k.value);return}let _=p("p",{},[k.kind==="message"&&k.value?k.value:i("thanks")]);_.setAttribute("role","status"),s$1.replaceChildren(_);}).catch(k=>{P.disabled=false,P.textContent=i("submit");let _=k instanceof u?k.fields:[];for(let Ue of _){let je=T.flat().find(vn=>vn.field.key===Ue.field);je&&Ve(je,Ue.rule==="required"?i("required"):i("invalid"));}c.textContent=_.length>0?i("invalid"):i("failed");});}),s$1.append(m,...N,C,g,Ke,c),l.poweredBy&&t$1.poweredBy!==false&&s$1.append(p("p",{className:"pdx-meta"},[i("poweredBy")])),pe(),R(),r.capture(s,{$form_id:l.id,$form_version:l.version});}).catch(()=>{d||s$1.replaceChildren(p("p",{className:"pdx-meta"},[i("closed")]));});return e.append(s$1),{destroy:()=>{d=true,s$1.remove();},ready:u$1}};var Be=e=>({capture:(t,n)=>e.capture(t,{properties:n}),form:t=>e.getForm(t),submit:(t,n,r,o)=>e.submitForm(t,n,r,o)});var ln=e=>({capture:(t,n,r)=>e.captureCta(t,n,r),ctas:t=>e.getCtas(t),forms:Be(e),isEnabled:t=>e.isFeatureEnabled(t),variant:async t=>(await e.getVariant(t))?.key??null}),pn=e=>e<768?"mobile":e<1024?"tablet":"desktop",mn=async(e,t)=>{let n=t.flag;return n?n.variant?await e.variant(n.key)===n.variant:e.isEnabled(n.key):true},_r=(e,t,n)=>{let r=document.createElement("dialog");r.className="prodantix-form-popup";let o=document.createElement("button");o.type="button",o.textContent="\xD7",o.setAttribute("aria-label",$[n].close),o.title=$[n].close,o.addEventListener("click",()=>r.close()),r.addEventListener("close",()=>r.remove()),r.append(o),document.body.append(r),le(r,{formId:e,host:t,language:n}),r.showModal();},Mr=()=>{let e=window.prodantix;typeof e=="function"&&e("open");},fn=async(e,t)=>{let n=t.now??Date.now,r=t.open??(d=>window.location.assign(d)),o=[],a=[],i$1=false,s=()=>{i$1=true;for(let d of o.splice(0))d();for(let d of a.splice(0))d.destroy();},c=await e.ctas({device:pn(window.innerWidth),language:document.documentElement.lang||t.language,url:window.location.href});for(let d of c)i$1||!tn(d.frequency,Qt(d.id),Zt(d.id),n())||!await mn(e,d)||o.push(rn(d.trigger,()=>{if(i$1)return;let u=ce(d,{language:t.language,onButton:l=>{e.capture(j,d,l);let x=d.variant.content.buttons[l]?.action;x&&((x.kind!=="url"||d.kind!=="embedded")&&u.destroy(),x.kind==="url"?r(x.value):x.kind==="form"?_r(x.value,e.forms,t.language):x.kind==="messenger"?Mr():e.capture(k,d));},onDismiss:()=>e.capture(k,d)});u.elements.length!==0&&(a.push(u),en(d.id,n()),e.capture(i,d));}));return s},Rr=()=>{},$r=(e,t)=>{let n=ln(e),r=ue(t??document.documentElement.lang),o=()=>fn(n,{language:r}).catch(u=>(console.error("[prodantix] the CTAs for this page could not be read",u),Rr)),a=o(),i=window.location.href,s=()=>{if(window.location.href===i)return;i=window.location.href,a=a.then(l=>(l(),o()));},c=history.pushState.bind(history),d=history.replaceState.bind(history);return history.pushState=(...u)=>{c(...u),s();},history.replaceState=(...u)=>{d(...u),s();},window.addEventListener("popstate",s),()=>{history.pushState=c,history.replaceState=d,window.removeEventListener("popstate",s),a.then(u=>u());}};var D=class{constructor(t){a(this,"fetch");a(this,"host");a(this,"projectKey");a(this,"requestTimeoutMs");this.fetch=e$1(t.fetch),this.host=h(t.host),this.projectKey=t.projectKey,this.requestTimeoutMs=t.requestTimeoutMs??1e4;}async request(t,n){let r=this.fetch;if(!r)throw new d$1("no fetch implementation available in this runtime");let o=f(),a=o?setTimeout(()=>o.abort(),this.requestTimeoutMs):void 0;try{let i={authorization:`Bearer ${this.projectKey}`};n.body!==void 0&&(i["content-type"]="application/json");let s=await r(`${this.host}${t}`,{body:n.body,headers:i,method:n.method,signal:o?.signal});return {status:s.status,text:await s.text()}}finally{a!==void 0&&clearTimeout(a);}}async vapidKey(t){let{status:n,text:r}=await this.request(`/v1/push/vapid?appId=${encodeURIComponent(t)}`,{method:"GET"});if(n<200||n>=300)throw new d$1(`push key request failed with status ${n}`,n);return JSON.parse(r).publicKey}async register(t){let{status:n,text:r}=await this.request("/v1/push/devices",{body:JSON.stringify(t),method:"POST"});if(n<200||n>=300)throw new d$1(`push registration failed with status ${n}`,n);return JSON.parse(r).id}async opened(t){let{status:n}=await this.request("/v1/push/opens",{body:JSON.stringify({sendId:t}),method:"POST"});if(n<200||n>=300)throw new d$1(`push open report failed with status ${n}`,n)}};var gn="/prodantix-push-sw.js",Fr=()=>{let e=globalThis,t=e.navigator?.serviceWorker,n=e.Notification;return t===void 0||n===void 0||e.PushManager===void 0?null:{register:async r=>(await t.register(r),t.ready),requestPermission:()=>n.requestPermission()}},Dr=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/").padEnd(Math.ceil(e.length/4)*4,"="),n=atob(t);return Uint8Array.from(n,r=>r.charCodeAt(0))},Hr=(e,t,n)=>`${e}${e.includes("?")?"&":"?"}host=${encodeURIComponent(t)}&key=${encodeURIComponent(n)}`,Br=async e=>{let t=e.browser??Fr();if(t===null)return {status:"unsupported"};if(await t.requestPermission()!=="granted")return {status:"denied"};let r=new D({fetch:e.fetch,host:e.host,projectKey:e.apiKey}),o=await t.register(Hr(e.serviceWorker??gn,e.host,e.apiKey)),a=await o.pushManager.getSubscription()??await o.pushManager.subscribe({applicationServerKey:Dr(await r.vapidKey(e.appId)),userVisibleOnly:true});return {deviceId:await r.register({appId:e.appId,distinctId:e.distinctId,permission:"granted",platform:"web",token:JSON.stringify(a.toJSON())}),status:"registered"}};function qr(){return globalThis.navigator}function Kr(){return globalThis.document}function Vr(){return globalThis.history}function qe(){return globalThis.location}function hn(){let e=globalThis.document?.referrer;if(e)try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"?`${t.origin}${t.pathname}`:void 0}catch{return}}function Gr(e){let t=e?.userAgentData?.platform??e?.platform;return t?t.slice(0,50):void 0}function Ur(e){let t=()=>{e.flush();};globalThis.document?.addEventListener?.("visibilitychange",t),globalThis.addEventListener?.("pagehide",t);}function jr(e,t,n){try{return Oe({domain:t,name:`pdx_${h$1(e)}`})??n}catch{return n}}function $i(e){let{autocaptureOptions:t,cookieDomain:n,guides:r,linkedDomains:o,replayHost:a,sessionReplay:i,sessionReplayOptions:s,surveys:c$1,...d}=e,u=qr(),l=b(),x=d.storage??l,L=d.sharedStorage??jr(d.apiKey,n,l),T=Kt({history:Vr(),location:qe(),namespace:h$1(d.apiKey),now:(d.clock??c).now().getTime(),shared:L,storage:x}),I=Y(d.onError??(()=>{})),R={},H=Xt(x,h$1(d.apiKey)),N=d.defaultProperties,O={...d,defaultProperties:()=>({...typeof N=="function"?N():N??{},...R.client?.isCookieless()?De(qe()?.search??"",hn()):H.forSession(R.client?.sessionId,qe()?.search??"",hn())}),describeElement:d.describeElement??(m=>yt(m,I)),locale:d.locale??(u?.language?u.language.slice(0,20):void 0),os:d.os??Gr(u),sessionTracking:d.sessionTracking??true,sharedStorage:L,storage:x,transport:d.transport??new Z({maxRetries:d.maxRetries,requestTimeoutMs:d.requestTimeoutMs})},C=new _(O);R.client=C,T!==void 0&&C.alias(T),Ur(C),O.consentMode==="banner"&&typeof window<"u"&&Pt(C,window),(e.autocapture??true)&&St(C,{onError:O.onError,...t});let M=Kr();M&&o&&_e(M,C,o);let g=typeof window>"u"?void 0:window;if(g&&(c$1!==false||r!==false)&&Mt(C,g,{edgeHost:(d.flagsHost??d.host).replace(/\/+$/,""),guides:r!==false,namespace:h$1(d.apiKey),onError:O.onError??(()=>{}),storage:x,surveys:c$1!==false}),i&&a){let m=()=>{zt({apiKey:O.apiKey,distinctId:()=>C.distinctId,onError:O.onError,replayHost:a,...s,sessionId:s?.sessionId??C.sessionId});};if(C.isCookieless()){let E=C.onStorageAllowed(()=>{E(),m();});}else m();}return C}
36
+ export{gt as ACTION_ATTRIBUTE,ft as ANNOTATION_ATTRIBUTE,F as ANNOTATION_MAX_LENGTH,gn as DEFAULT_SERVICE_WORKER,ht as IGNORE_ATTRIBUTE,D as PushClient,Z as WebTransport,Oe as createCookieStorage,$i as createWebClient,ln as ctasHost,Ht as decorateLink,pn as deviceOf,mn as flagAllows,ue as formLanguage,Be as formsHost,St as installAutocapture,_e as installLinkCarry,zt as installSessionReplay,Bt as readCarry,Br as registerPush,ce as renderCta,le as renderForm,It as resolveCookieDomain,fn as runCtas,$r as startCtas,qt as stripCarry,an as watchPopup};//# sourceMappingURL=web.js.map
37
37
  //# sourceMappingURL=web.js.map
package/package.json CHANGED
@@ -2,9 +2,9 @@
2
2
  "description": "Prodantix analytics + feature-flag client SDK (isomorphic, zero-dependency)",
3
3
  "devDependencies": {
4
4
  "@bomdisoft/typescript-config": "0.0.0",
5
- "@happy-dom/global-registrator": "^20.14.5",
6
- "@types/bun": "^1.4.2",
7
- "@types/node": "^26.6.4",
5
+ "@happy-dom/global-registrator": "^20.14.6",
6
+ "@types/bun": "^1.4.4",
7
+ "@types/node": "^26.6.6",
8
8
  "tsup": "8.5.1",
9
9
  "typescript": "^6.0.3"
10
10
  },
@@ -63,5 +63,5 @@
63
63
  "sideEffects": false,
64
64
  "type": "module",
65
65
  "types": "./dist/index.d.ts",
66
- "version": "0.7.0"
66
+ "version": "0.8.0-beta.547"
67
67
  }
@@ -1,2 +0,0 @@
1
- import {c,a as a$2,b as b$2}from'./chunk-V77KYPOF.js';import {e,h,d as d$1,f as f$1,g as g$1,a as a$1,b as b$1,c as c$1}from'./chunk-ODN4ZELX.js';import {a}from'./chunk-5XGN7UAV.js';var g=class{constructor(){a(this,"store",new Map);}getItem(e){return this.store.get(e)??null}removeItem(e){this.store.delete(e);}setItem(e,t){this.store.set(e,t);}},y=class{constructor(e,t=()=>false){this.real=e;this.passes=t;a(this,"held",new g);a(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 Ye(){try{let s=globalThis.localStorage;if(s){let e="__pdx_probe__";return s.setItem(e,"1"),s.removeItem(e),s}}catch{return new g}return new g}var X={now:()=>new Date};function x(s){return s.toISOString()}function Z(){if(typeof window>"u"||typeof Intl>"u")return null;let s=Intl.DateTimeFormat().resolvedOptions().timeZone;return typeof s=="string"&&s!==""?s:null}var Te=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var Ee=/^(?:\$|[a-z])[a-z0-9_.]*$/;function ee(s){let e=0;for(let t of s)e+=1;return e}function te(s){return Te.test(s)}function $e(s){return Ee.test(s)}function se(s){let e=ee(s);if(e<1||e>200)throw new c$1("distinct_id","distinct_id must be between 1 and 200 characters")}function ne(s){let e=ee(s);if(e<1||e>200)throw new c$1("event_name","event_name must be between 1 and 200 characters");if(!$e(s))throw new c$1("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var re="prodantix-js",ie="0.7.0";function Ae(){return globalThis.crypto}function Pe(s){s[6]=s[6]&15|64,s[8]=s[8]&63|128;let e=[];for(let t=0;t<16;t+=1)e.push(s[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 Re(){let s=Ae();if(s?.randomUUID)return s.randomUUID();let e=new Uint8Array(16);if(s?.getRandomValues)s.getRandomValues(e);else for(let t=0;t<16;t+=1)e[t]=Math.floor(Math.random()*256);return Pe(e)}var oe={uuid:Re};var Me=s=>{};function ae(s){if(!s.apiKey||!te(s.apiKey))throw new b$1("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!s.host)throw new b$1("host is required (the ingest base URL)");let e=h(s.host),t=s.defaultProperties,n=s.storage??new g;return {apiKey:s.apiKey,autocapture:s.autocapture??false,clock:s.clock??X,consent:s.consent,consentMode:s.consentMode,defaultProperties:typeof t=="function"?t:()=>t??{},describeElement:s.describeElement,flagsHost:s.flagsHost?h(s.flagsHost):e,flushAt:s.flushAt??20,flushIntervalMs:s.flushIntervalMs??1e4,host:e,ids:s.ids??oe,locale:s.locale,maxQueueSize:s.maxQueueSize??1e3,maxRetries:s.maxRetries??3,namespace:qe(s.apiKey),onError:s.onError??Me,os:s.os,requestTimeoutMs:s.requestTimeoutMs??1e4,sdkName:s.sdkName??re,sdkVersion:s.sdkVersion??ie,sessionTracking:s.sessionTracking??false,sharedStorage:s.sharedStorage??n,socketFactory:s.socketFactory,storage:n,streamFlags:s.streamFlags??false,transport:s.transport}}function qe(s){return s.slice(0,16)}var f=Symbol("absent");function Ke(s,e){if(s==="distinct_id")return e.distinctId;let t=e.properties??{};if(Object.prototype.hasOwnProperty.call(t,s))return t[s];let n=e.attributes??{};return Object.prototype.hasOwnProperty.call(n,s)?n[s]:f}function m(s){return s===f?"undefined":String(s)}function le(s){return s===f?Number.NaN:Number(s)}function ce(s){return s!==f&&s!==null&&s!==""}function de(s,e){if(!Array.isArray(e))return false;let t=m(s);return e.map(n=>String(n)).includes(t)}function ue(s,e){let t=Ke(s.attribute,e),n=s.value;switch(s.op){case "is_set":return ce(t);case "is_not_set":return !ce(t);case "eq":return m(t)===m(n===void 0?f:n);case "neq":return m(t)!==m(n===void 0?f:n);case "contains":return m(t).includes(m(n===void 0?f:n));case "in":return de(t,n);case "not_in":return Array.isArray(n)?!de(t,n):false;case "gt":return w(t,n,(r,i)=>r>i);case "gte":return w(t,n,(r,i)=>r>=i);case "lt":return w(t,n,(r,i)=>r<i);case "lte":return w(t,n,(r,i)=>r<=i);case "in_cohort":return typeof n=="string"&&n!==""&&(e.cohorts??[]).includes(n);case "not_in_cohort":return typeof n=="string"&&n!==""&&!(e.cohorts??[]).includes(n);default:return false}}function w(s,e,t){let n=le(s),r=e===void 0?Number.NaN:le(e);return Number.isNaN(n)||Number.isNaN(r)?false:t(n,r)}function pe(s,e){let t=`${s}:${e}`,n=2166136261;for(let r=0;r<t.length;r++)n^=t.charCodeAt(r),n=Math.imul(n,16777619);return (n>>>0)%100}function N(s,e){return s.targeting.length===0||s.targeting.every(t=>ue(t,e))}function he(s,e){let t=pe(s.key,e.distinctId),n=s.variations??[];if(n.length===0)return s.rolloutPercentage>=100||t<s.rolloutPercentage?"true":"false";let r=0;for(let i=n.length-1;i>=0;i--)if(r+=n[i].weight,t<r)return n[i].key;return n[0].key}function L(s,e,t,n){for(let r of s.prerequisites??[]){if(n.includes(r.flagKey))return false;let i=e.find(c=>c.key===r.flagKey);if(!i||!i.enabled)return false;n.push(i.key);let a=L(i,e,t,n)&&N(i,t)&&he(i,t)===r.variationKey;if(n.pop(),!a)return false}return true}function v(s,e,t){return s.enabled?L(s,e,t,[s.key])?N(s,t)?s.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:pe(s.key,t.distinctId)<s.rolloutPercentage?{enabled:true,reason:"rollout"}:{enabled:false,reason:"rollout_excluded"}:{enabled:false,reason:"targeting"}:{enabled:false,reason:"prerequisite"}:{enabled:false,reason:"disabled"}}function mt(s,e){return v(s,[],e)}function ge(s,e){let t={};for(let n of s)t[n.key]=v(n,s,e).enabled;return t}function b(s,e,t){let n=s.variations??[],r=n[0];if(!r)return null;if(!s.enabled||!L(s,e,t,[s.key])||!N(s,t))return r;let i=he(s,t);return n.find(a=>a.key===i)??r}function ft(s,e){return b(s,[],e)}function yt(s,e,t){let n=s.find(r=>r.key===e);return n?b(n,s,t)?.value??null:null}function me(s){return s.some(e=>e.targeting.some(t=>t.op==="in_cohort"||t.op==="not_in_cohort"))}var _=class{constructor(e$1){a(this,"fetch");a(this,"host");a(this,"projectKey");a(this,"requestTimeoutMs");this.fetch=e(e$1.fetch),this.host=h(e$1.host),this.projectKey=e$1.projectKey,this.requestTimeoutMs=e$1.requestTimeoutMs??1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){let t=this.fetch;if(!t)throw new d$1("no fetch implementation available in this runtime");let n=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,r=f$1(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let a=await t(n,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r?.signal});if(!a.ok)throw new d$1(`flags request failed with status ${a.status}`,a.status);let c=JSON.parse(await a.text());return {flags:c.flags??{},variants:c.variants??{}}}finally{i!==void 0&&clearTimeout(i);}}async snapshot(){let e=this.fetch;if(!e)throw new d$1("no fetch implementation available in this runtime");let t=`${this.host}/v1/flags/snapshot`,n=f$1(),r=n?setTimeout(()=>n.abort(),this.requestTimeoutMs):void 0;try{let i=await e(t,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:n?.signal});if(!i.ok)throw new d$1(`flag snapshot request failed with status ${i.status}`,i.status);let a=JSON.parse(await i.text()),c={flags:a.flags??[],generatedAt:a.generatedAt};return typeof a.socketUrl=="string"&&a.socketUrl!==""&&(c.socketUrl=a.socketUrl),c}finally{r!==void 0&&clearTimeout(r);}}async memberships(e){let t=this.fetch;if(!t)throw new d$1("no fetch implementation available in this runtime");let n=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,r=f$1(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let a=await t(n,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r?.signal});if(!a.ok)throw new d$1(`memberships request failed with status ${a.status}`,a.status);return JSON.parse(await a.text()).cohorts??[]}finally{i!==void 0&&clearTimeout(i);}}};var fe="$survey_shown",ye="$survey_dismissed",ve="$survey_sent",F=class{constructor(e$1){a(this,"fetch");a(this,"host");a(this,"projectKey");a(this,"requestTimeoutMs");this.fetch=e(e$1.fetch),this.host=h(e$1.host),this.projectKey=e$1.projectKey,this.requestTimeoutMs=e$1.requestTimeoutMs??1e4;}async surveys(e,t){let n=this.fetch;if(!n)throw new d$1("no fetch implementation available in this runtime");let r=f$1(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let a=await n(`${this.host}/v1/surveys?distinct_id=${encodeURIComponent(e)}${t?`&lang=${encodeURIComponent(t)}`:""}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r?.signal});if(!a.ok)throw new d$1(`surveys request failed with status ${a.status}`,a.status);return JSON.parse(await a.text()).surveys??[]}finally{i!==void 0&&clearTimeout(i);}}},Oe=864e5,De=s=>`${s.id}:${s.iteration}`;function j(s,e){return s.length===0?true:s.some(t=>{switch(t.matches){case "exact":return e===t.value;case "starts_with":return e.startsWith(t.value);default:return e.includes(t.value)}})}function Ft(s,e,t,n,r){return s.kind!=="popover"||e.settled.includes(De(s))||s.showOnce&&e.settled.some(i=>i.startsWith(`${s.id}:`))||s.waitDays>0&&e.lastShownAt!==void 0&&n-e.lastShownAt<s.waitDays*Oe||s.event&&s.event!==r?false:j(s.urls,t)}function Ne(s,e,t){return s>=(e.minScore??0)&&s<=(e.maxScore??t)}function Ct(s,e,t){let n=e.kind==="nps"?10:e.scale??5,r=e.branches.find(a=>a.choice!=null?t===a.choice:typeof t=="number"&&Ne(t,a,n));if(r)return r.next??null;let i=s.questions.findIndex(a=>a.id===e.id);return s.questions[i+1]?.id??null}function C(s,e){let t={$survey_id:s.id,$survey_iteration:s.iteration,$survey_name:s.name};for(let[n,r]of Object.entries(e))t[`$survey_response_${n}`]=r;return t}var Pt="$guide_shown",Rt="$guide_step_viewed",Mt="$guide_step_missed",qt="$guide_completed",Kt="$guide_dismissed",Ot="$checklist_task_done",I=class{constructor(e$1){a(this,"fetch");a(this,"host");a(this,"projectKey");a(this,"requestTimeoutMs");this.fetch=e(e$1.fetch),this.host=h(e$1.host),this.projectKey=e$1.projectKey,this.requestTimeoutMs=e$1.requestTimeoutMs??1e4;}async guides(e){let t=this.fetch;if(!t)throw new d$1("no fetch implementation available in this runtime");let n=f$1(),r=n?setTimeout(()=>n.abort(),this.requestTimeoutMs):void 0;try{let i=await t(`${this.host}/v1/guides?distinct_id=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:n?.signal});if(!i.ok)throw new d$1(`guides request failed with status ${i.status}`,i.status);return JSON.parse(await i.text()).guides??[]}finally{r!==void 0&&clearTimeout(r);}}},Le=864e5,be=s=>`${s.id}:${s.iteration}`,je=(s,e)=>`${be(s)}:${e}`;function Dt(s,e,t,n,r){return e.settled.includes(be(s))||s.showOnce&&e.settled.some(i=>i.startsWith(`${s.id}:`))||s.kind!=="checklist"&&s.waitDays>0&&e.lastShownAt!==void 0&&n-e.lastShownAt<s.waitDays*Le||s.event&&s.event!==r?false:j(s.urls,t)}var Nt=(s,e)=>s.steps.filter(t=>e.done.includes(je(s,t.id))).map(t=>t.id),Lt=(s,e)=>s.kind==="checklist"?s.steps.find(t=>t.event===e):void 0;function Se(s,e){let t={$guide_id:s.id,$guide_iteration:s.iteration,$guide_name:s.name};return e!==void 0&&(t.$guide_step_id=e),t}function S(s){if(typeof s!="string")return;let e=Array.from(s).length;return e>=1&&e<=200?s:void 0}function E(s,e){return `pdx.${s}.${e}`}var G="consent",Ve=["identityLink","analytics","marketing","functional"];function V(s){if(typeof s!="string")return null;try{let e=JSON.parse(s);if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e,n={};for(let r of Ve){let i=t[r];typeof i=="boolean"&&(n[r]=i);}return typeof t.version=="number"&&Number.isInteger(t.version)&&(n.version=t.version),Array.isArray(t.categories)&&t.categories.every(r=>typeof r=="string")&&(n.categories=t.categories),Object.keys(n).length===0?null:n}catch{return null}}var ke=s=>s.endsWith(`.${G}`);function $(s,e){return V(s.getItem(E(e,G)))}function Ge(s,e,t){let n=E(e,G),r=V(JSON.stringify(t)),i=r===null?null:V(JSON.stringify({...$(s,e)??{},...r}));if(i===null){s.removeItem(n);return}s.setItem(n,JSON.stringify(i));}function Gt(s,e,t,n){let r=E(t,"anonymous_id"),i=S(e.getItem(r))??S(s.getItem(r));return e.setItem(r,n),s.setItem(r,n),i!==void 0&&i!==n?i:void 0}var T=class{constructor(e,t,n,r){this.storage=e;this.shared=t;this.ids=n;this.namespace=r;a(this,"anonymousId");a(this,"distinctId");a(this,"identified");this.refresh();}refresh(){let e=S(this.shared.getItem(this.key("anonymous_id"))),t=S(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 n=S(this.storage.getItem(this.key("distinct_id")));n?(this.distinctId=n,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 $(this.shared,this.namespace)}setConsent(e){Ge(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){let t=!this.identified||this.distinctId!==e,n=this.storage.getItem(this.key("linked_anonymous_id")),r=t||n!==this.anonymousId;return this.distinctId=e,this.identified=true,t&&this.storage.setItem(this.key("distinct_id"),e),!r||this.consent()?.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 E(this.namespace,e)}};var A=class{constructor(e$1){a(this,"fetch");a(this,"host");a(this,"projectKey");a(this,"requestTimeoutMs");this.fetch=e(e$1.fetch),this.host=h(e$1.host),this.projectKey=e$1.projectKey,this.requestTimeoutMs=e$1.requestTimeoutMs??1e4;}async inbox(e){let t=this.requireFetch(),n=`${this.host}/v1/messages?distinct_id=${encodeURIComponent(e)}`,r=await this.request(t,n,{headers:this.authHeaders(),method:"GET"});if(!r.ok)throw new d$1(`inbox request failed with status ${r.status}`,r.status);return JSON.parse(await r.text()).messages??[]}async markRead(e,t){let n=this.requireFetch(),r=`${this.host}/v1/messages/read`,i=await this.request(n,r,{body:JSON.stringify({distinct_id:t,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!i.ok)throw new d$1(`mark-read request failed with status ${i.status}`,i.status)}requireFetch(){if(!this.fetch)throw new d$1("no fetch implementation available in this runtime");return this.fetch}authHeaders(){return {authorization:`Bearer ${this.projectKey}`}}async request(e,t,n){let r=f$1(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{return await e(t,{...n,signal:r?.signal})}finally{i!==void 0&&clearTimeout(i);}}};var d={autocapture:"$autocapture",createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",pageleave:"$pageleave",pageview:"$pageview",screen:"$screen",set:"$set"},Ue=[{emittedBy:"web",meaning:"A click anywhere on the page, with the element that was clicked. The web SDK sends it by default; autocapture: false or autocaptureOptions.clicks: false turns it off.",name:d.autocapture,properties:["$event_type","$el_description","$el_description_source","$el_action","$el_tag","$el_text","$el_id","$el_classes","$el_href","$current_url","$pathname","$host","$title","$referrer"]},{emittedBy:"web",meaning:"A page shown, including every client-side navigation the History API makes: one per distinct path and query.",name:d.pageview,properties:["$current_url","$pathname","$host","$title","$referrer"]},{emittedBy:"web",meaning:"A landing page left the visitor's sight, by a tab switch, a closed tab or a navigation away, with the seconds it was in front of them so far. A page returned to and left again sends it again with the larger total.",name:d.pageleave,properties:["$engaged_seconds","$page_id","$page_view_id","$page_variant"]},{emittedBy:"flutter",meaning:"A named route pushed or replaced in a Flutter app, the mobile counterpart of $pageview.",name:d.screen,properties:["screen"]},{emittedBy:"every",meaning:"A person becomes known by a distinct id. The anonymous trail before it is joined to them, and any traits ride along under $set.",name:d.identify,properties:["$anon_distinct_id","$set"]},{emittedBy:"every",meaning:"A second id for the same person, so events sent under either resolve to one profile.",name:d.createAlias,properties:["alias"]},{emittedBy:"every",meaning:"The person is placed in a group such as a company or a team; group properties ride along under $set.",name:d.group,properties:["$group_type","$group_key","$set"]},{emittedBy:"every",meaning:"Person properties written without an identify: $set overwrites, $set_once fills only what is still empty.",name:d.set,properties:["$set","$set_once"]},{emittedBy:"every",meaning:"A flag was evaluated for this person, sent once per distinct answer. Experiments attribute exposure from it.",name:d.featureFlagCalled,properties:["$feature_flag","$feature_flag_response"]}],Wt=s=>s.startsWith("$"),Yt=s=>Ue.find(e=>e.name===s);function xe(s){return s>=400&&s<500&&s!==429}var P=class{constructor(e$1={}){a(this,"fetch");a(this,"maxRetries");a(this,"requestTimeoutMs");a(this,"baseDelayMs");a(this,"maxDelayMs");a(this,"sleep");a(this,"random");this.fetch=e(e$1.fetch),this.maxRetries=e$1.maxRetries??3,this.requestTimeoutMs=e$1.requestTimeoutMs??1e4,this.baseDelayMs=e$1.baseDelayMs??500,this.maxDelayMs=e$1.maxDelayMs??3e4,this.sleep=e$1.sleep??g$1,this.random=e$1.random??Math.random;}async send(e){let t=this.fetch;if(!t)throw new d$1("no fetch implementation available in this runtime");let n=JSON.stringify(e.body),r;for(let i=0;i<=this.maxRetries;i+=1){try{let a=await this.attempt(t,e,n);if(a.ok)return;if(xe(a.status))throw new d$1(`ingest rejected batch with status ${a.status}`,a.status);r=new d$1(`ingest transient status ${a.status}`,a.status);}catch(a){if(a instanceof d$1&&a.status!==void 0&&xe(a.status))throw a;r=a;}i<this.maxRetries&&await this.sleep(this.backoff(i));}throw new d$1("ingest delivery failed after retries",void 0,{cause:r})}async attempt(e,t,n){let r=f$1(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{return await e(t.url,{body:n,headers:{authorization:`Bearer ${t.projectKey}`,"content-type":"application/json"},method:"POST",signal:r?.signal})}finally{i!==void 0&&clearTimeout(i);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};var is="$cta_viewed",os="$cta_clicked",as="$cta_dismissed",we=(s,e)=>{let t={$cta_id:s.id,$cta_kind:s.kind,$cta_variant:s.variant.key,$cta_version:s.version},n=e===void 0?void 0:s.variant.content.buttons[e];return n&&e!==void 0&&(t.$cta_button=e,t.$cta_button_label=n.label,n.action.kind==="form"&&(t.$cta_form_id=n.action.value)),t},R=class{constructor(e$1){a(this,"fetch");a(this,"host");a(this,"projectKey");a(this,"requestTimeoutMs");this.fetch=e(e$1.fetch),this.host=h(e$1.host),this.projectKey=e$1.projectKey,this.requestTimeoutMs=e$1.requestTimeoutMs??1e4;}async ctas(e){let t=this.fetch;if(!t)throw new d$1("no fetch implementation available in this runtime");let n=new URLSearchParams({anonymous:String(e.anonymous),device:e.device,distinct_id:e.distinctId,language:e.language,url:e.url}),r=f$1(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let a=await t(`${this.host}/v1/ctas?${n.toString()}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r?.signal});if(a.status<200||a.status>=300)throw new d$1(`ctas request failed with status ${a.status}`,a.status);return JSON.parse(await a.text()).ctas}finally{i!==void 0&&clearTimeout(i);}}};function _e(s,e,t){ne(s.eventName),se(s.distinctId);let n={distinct_id:s.distinctId,event_id:s.eventId??t.uuid(),event_name:s.eventName,properties:s.properties??{},schema_version:1,timestamp:x(s.timestamp??e.now())};return s.context&&(n.context=s.context),s.sessionId&&(n.session_id=s.sessionId),n}var Be="/socket.io/?EIO=4&transport=websocket",He=250,M=class{constructor(e){this.options=e;a(this,"socket",null);a(this,"heartbeat",null);a(this,"pending",null);a(this,"lastKey","");a(this,"ready",false);a(this,"closed",false);a(this,"heartbeatWindow",45e3);a(this,"factory");a(this,"setTimer");a(this,"clearTimer");this.factory=e.socketFactory??Je,this.setTimer=e.setTimer??((t,n)=>setTimeout(t,n)),this.clearTimer=e.clearTimer??(t=>clearTimeout(t));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${Be}`,t;try{t=this.factory(e);}catch{this.options.onClosed(false);return}this.socket=t,t.onmessage=n=>this.receive(String(n.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?.close();}receive(e){let t=c(e);if(t.kind==="open"){this.armHeartbeat(t.pingInterval+t.pingTimeout),this.socket?.send(a$2({projectKey:this.options.projectKey}));return}if(t.kind==="ping"){this.armHeartbeat(),this.socket?.send(b$2());return}if(t.kind==="connectError"||t.kind==="disconnect"){this.stopHeartbeat(),this.socket?.close();return}if(t.kind==="event"){if(t.name==="ready"){this.ready=true;return}if(t.name==="flagChange"){let n=t.payload?.key;this.lastKey=typeof n=="string"?n:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},He));}}}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(()=>this.socket?.close(),this.heartbeatWindow);}stopHeartbeat(){this.heartbeat!==null&&this.clearTimer(this.heartbeat),this.heartbeat=null;}};function Je(s){let e=globalThis.WebSocket;if(!e)throw new d$1("no WebSocket");return new e(s)}var bs="$form_viewed",Ss="$form_started",U=class extends Error{constructor(t,n,r){super(r);a(this,"fields");a(this,"status");this.name="FormRefusedError",this.status=t,this.fields=n;}},q=class{constructor(e$1){a(this,"fetch");a(this,"host");a(this,"projectKey");a(this,"requestTimeoutMs");this.fetch=e(e$1.fetch),this.host=h(e$1.host),this.projectKey=e$1.projectKey,this.requestTimeoutMs=e$1.requestTimeoutMs??1e4;}async request(e,t){let n=this.fetch;if(!n)throw new d$1("no fetch implementation available in this runtime");let r=f$1(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let a={authorization:`Bearer ${this.projectKey}`};t.body!==void 0&&(a["content-type"]="application/json");let c=await n(`${this.host}${e}`,{body:t.body,headers:a,method:t.method,signal:r?.signal});return {status:c.status,text:await c.text()}}finally{i!==void 0&&clearTimeout(i);}}async form(e,t){let{status:n,text:r}=await this.request(`/v1/forms/${encodeURIComponent(e)}?distinct_id=${encodeURIComponent(t)}`,{method:"GET"});if(n<200||n>=300)throw new d$1(`form request failed with status ${n}`,n);return JSON.parse(r)}async submit(e,t){let{status:n,text:r}=await this.request(`/v1/forms/${encodeURIComponent(e)}/submissions`,{body:JSON.stringify(t),method:"POST"});if(n>=200&&n<300)return JSON.parse(r).afterSubmit;let i=[],a=`form submission failed with status ${n}`;try{let c=JSON.parse(r);i=c.error?.fields??[],a=c.error?.message??a;}catch{i=[];}throw new U(n,i,a)}};var K=class{constructor(e,t){this.maxSize=e;this.onOverflow=t;a(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(){if(this.events.length<=this.maxSize)return;let e=this.events.splice(0,this.events.length-this.maxSize);this.onOverflow?.({dropped:e});}};var ze={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function Fe(s){return `pdx.${s}.session`}function Fs(s,e,t,n){let r={id:t.id,lastActivityAt:n,startedAt:t.startedAt};s.setItem(Fe(e),JSON.stringify(r));}var O=class{constructor(e,t,n,r,i=ze){this.storage=e;this.ids=t;this.clock=n;this.namespace=r;this.options=i;}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 n=this.live(this.read(),e),r=n!==void 0&&n.id!==t.id?n:t;return this.write({...r,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{return}}key(){return Fe(this.namespace)}};var Qe="queue",We=1e3,Ce=3e4,B=s=>{let e={};return s.avatar!==void 0&&(e.$avatar=s.avatar),s.email!==void 0&&(e.$email=s.email),s.name!==void 0&&(e.$name=s.name),s.phone!==void 0&&(e.$phone=s.phone),e},H=class{constructor(e){a(this,"config");a(this,"identity");a(this,"session");a(this,"queue");a(this,"transport");a(this,"flagsClient");a(this,"messagesClient");a(this,"surveysClient");a(this,"guidesClient");a(this,"captureListeners",new Set);a(this,"formsClient");a(this,"ctasClient");a(this,"context");a(this,"flushTimer");a(this,"flushing",false);a(this,"cachedFlags");a(this,"cachedSnapshot");a(this,"membershipCache");a(this,"stream");a(this,"shutDown",false);a(this,"exposures",new Set);a(this,"gates");a(this,"cookielessId");a(this,"storageListeners",new Set);let t=ae(e),n=$(t.sharedStorage,t.namespace)??t.consent??null;if(this.gates=[new y(t.storage),new y(t.sharedStorage,ke)],t.consentMode!=="banner"||n?.analytics===true)for(let a of this.gates)a.open();let[r,i]=this.gates;this.config={...t,sharedStorage:i,storage:r},this.identity=new T(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 O(this.config.sharedStorage,this.config.ids,this.config.clock,this.config.namespace):void 0,this.queue=new K(this.config.maxQueueSize,({dropped:a})=>{this.config.onError(new a$1("queue_overflow",`event queue overflow: dropped ${a.length} oldest event(s)`));}),this.transport=this.config.transport??new P({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new _({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new A({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.surveysClient=new F({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.guidesClient=new I({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.formsClient=new q({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.ctasClient=new R({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(){return this.session?.current()}get sessionStartedAt(){return this.session?.startedAt()}capture(e,t={}){try{this.identity.refresh();let n={...this.config.defaultProperties(),...t.element===void 0?{}:this.config.describeElement?.(t.element)??{},...t.properties??{}},r=_e({context:this.context,distinctId:t.distinctId??this.identity.getDistinctId(),eventName:e,properties:n,sessionId:t.sessionId??this.session?.current(),timestamp:t.timestamp},this.config.clock,this.config.ids);this.enqueue(r);}catch(n){this.config.onError(n);}for(let n of this.captureListeners)try{n(e);}catch(r){this.config.onError(r);}}onCapture(e){return this.captureListeners.add(e),()=>{this.captureListeners.delete(e);}}identify(e,t={}){if(this.isCookieless())return;this.identity.refresh();let n=this.identity.identify(e),r={};n.anonymousToLink!==void 0&&(r.$anon_distinct_id=n.anonymousToLink);let i=Z(),a={...i===null?{}:{$timezone:i},...B(t.traits??{}),...t.set??{}};Object.keys(a).length>0&&(r.$set=a),this.capture(d.identify,{properties:r});}link(e,t,n){if(this.isCookieless())return;let r={$anon_distinct_id:t},i=B(n??{});Object.keys(i).length>0&&(r.$set=i),this.capture(d.identify,{distinctId:e,properties:r});}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(d.createAlias,{properties:{alias:e}});}group(e,t,n){let r={$group_key:t,$group_type:e};n&&(r.$set=n),this.capture(d.group,{properties:r});}setPersonProperties(e,t){if(this.isCookieless())return;let n={};e&&(n.$set=e),t&&(n.$set_once=t),this.capture(d.set,{properties:n});}setPersonTraits(e){if(this.isCookieless())return;let t=B(e);Object.keys(t).length!==0&&this.capture(d.set,{properties:{$set:t}});}async getAllFlags(){let e=this.identity.getDistinctId(),t=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:t.flags,variants:t.variants??{}},t.flags}async isFeatureEnabled(e){let n=(await this.getAllFlags())[e]??false;return this.recordExposure(e,this.cachedFlags?.variants[e]?.key??String(n)),n}async getVariant(e){let t=await this.getAllFlags(),n=this.cachedFlags?.variants[e]??null;return this.recordExposure(e,n?.key??String(t[e]??false)),n}async getVariantLocal(e,t={}){let n=await this.flagSnapshot(),r=n.flags.find(Ie=>Ie.key===e),i=await this.localContext(t,n.flags),a=r?b(r,n.flags,i):null,c=r?v(r,n.flags,i).enabled:false;return this.recordExposure(e,a?.key??String(c)),a?{key:a.key,value:a.value}:null}recordExposure(e,t){let n=`${this.identity.getDistinctId()} ${e} ${t}`;this.exposures.has(n)||(this.exposures.add(n),this.capture(d.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={}){let n=await this.flagSnapshot(),r=n.flags.find(c=>c.key===e),i=await this.localContext(t,n.flags),a=r?v(r,n.flags,i).enabled:false;return this.recordExposure(e,(r?b(r,n.flags,i)?.key:void 0)??String(a)),a}async localContext(e,t){let n=this.identity.getDistinctId(),r=e.cohorts;if(r===void 0&&me(t)){let i=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===n&&i-this.membershipCache.fetchedAt<Ce?r=this.membershipCache.cohorts:(r=await this.flagsClient.memberships(n),this.membershipCache={cohorts:r,distinctId:n,fetchedAt:i});}return {attributes:e.attributes,cohorts:r,distinctId:n,properties:e.properties}}async flagSnapshot(){let e=this.config.clock.now().getTime();if(this.cachedSnapshot&&e-this.cachedSnapshot.fetchedAt<Ce)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 M({host:e.socketUrl,onChange:()=>{this.cachedSnapshot=void 0,this.flagSnapshot().catch(n=>this.config.onError(n));},onClosed:n=>{this.stream=void 0,n&&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??this.config.locale)}captureSurveyShown(e){this.capture(fe,{properties:C(e,{})});}captureSurveyDismissed(e){this.capture(ye,{properties:C(e,{})});}captureSurveySent(e,t){this.capture(ve,{properties:C(e,t)});}async getGuides(){return this.guidesClient.guides(this.identity.getDistinctId())}captureGuide(e,t,n){this.capture(e,{properties:Se(t,n)});}async getForm(e){return this.formsClient.form(e,this.identity.getDistinctId())}async submitForm(e,t,n,r){let{$page_id:i,$page_variant:a}=this.config.defaultProperties();return this.formsClient.submit(e,{answers:t,challenge:n,distinctId:this.identity.getDistinctId(),isAnonymous:!this.identity.isIdentified(),pageUrl:typeof window>"u"?"":window.location.href,solution:r,...typeof i=="string"&&typeof a=="string"?{pageId:i,pageVariant:a}:{}})}async getCtas(e){return this.ctasClient.ctas({...e,anonymous:!this.identity.isIdentified(),distinctId:this.identity.getDistinctId()})}captureCta(e,t,n){this.capture(e,{properties:we(t,n)});}async flush(){if(this.flushing||this.queue.size===0)return;this.flushing=true;let e=this.queue.drain(We);try{await this.transport.send({body:{events:e,sent_at:x(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(){this.session?.reset(),this.identity.reset(),this.cachedFlags=void 0,this.cachedSnapshot=void 0,this.membershipCache=void 0;}async shutdown(){this.shutDown=true,this.stopTimer(),this.stream?.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}.${Qe}`}};function Bs(s){return new H(s)}export{Bs as $,j as A,Ft as B,Ct as C,C as D,Pt as E,Rt as F,Mt as G,qt as H,Kt as I,Ot as J,I as K,be as L,je as M,Dt as N,Nt as O,Lt as P,Se as Q,V as R,Gt as S,A as T,Fs as U,d as V,Ue as W,Wt as X,Yt as Y,P as Z,H as _,g as a,Ye as b,X as c,Re as d,ee as e,re as f,ie as g,qe as h,is as i,os as j,as as k,ue as l,pe as m,mt as n,ge as o,ft as p,yt as q,_ as r,bs as s,Ss as t,U as u,fe as v,ye as w,ve as x,F as y,De as z};//# sourceMappingURL=chunk-L4P6GMBC.js.map
2
- //# sourceMappingURL=chunk-L4P6GMBC.js.map