@prodantix/sdk 0.8.0 → 0.9.0-beta.777
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/README.md +2 -2
- package/dist/chat.cjs +3 -5
- package/dist/chat.d.cts +6 -6
- package/dist/chat.d.ts +6 -6
- package/dist/chat.js +3 -5
- package/dist/chunk-3S3BR7QH.js +2 -0
- package/dist/{chunk-ODN4ZELX.js → chunk-5WTMO52O.js} +2 -2
- package/dist/{client-vogZuHfD.d.cts → client-C8r0UAth.d.cts} +1 -1
- package/dist/{client-Cz7M6XJC.d.ts → client-DnfOdWQo.d.ts} +1 -1
- package/dist/{config-Bhwwo-uC.d.ts → config-C-Di5fAj.d.ts} +4 -1
- package/dist/{config-C8WD1Pge.d.cts → config-D1TSuSTZ.d.cts} +4 -1
- package/dist/consent.iife.js +45 -14
- package/dist/ctas.iife.js +3 -3
- package/dist/forms.iife.js +2 -2
- package/dist/{http-BCh716Vs.d.cts → http-CAOViYSh.d.cts} +1 -0
- package/dist/{http-BCh716Vs.d.ts → http-CAOViYSh.d.ts} +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/messenger-help.iife.js +1 -1
- package/dist/messenger-tickets.iife.js +1 -1
- package/dist/messenger.cjs +1 -1
- package/dist/messenger.d.cts +2 -2
- package/dist/messenger.d.ts +2 -2
- package/dist/messenger.iife.js +2 -4
- package/dist/messenger.js +1 -1
- package/dist/node.cjs +1 -1
- package/dist/node.d.cts +2 -2
- package/dist/node.d.ts +2 -2
- package/dist/node.js +1 -1
- package/dist/pages.iife.js +1 -1
- package/dist/prodantix-push-sw.js +1 -1
- package/dist/{transport-C9C4hqlF.d.cts → transport-BBYpAuVK.d.cts} +4 -2
- package/dist/{transport-C4mkCaix.d.ts → transport-BZDcmleq.d.ts} +4 -2
- package/dist/web.cjs +4 -4
- package/dist/web.d.cts +3 -3
- package/dist/web.d.ts +3 -3
- package/dist/web.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-YHIIKYUP.js +0 -2
package/dist/ctas.iife.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){'use strict';var zt=Object.defineProperty;var Jt=(t,e,n)=>e in t?zt(t,e,{enumerable:true,configurable:true,writable:true,value:n}):t[e]=n;var d=(t,e,n)=>Jt(t,typeof e!="symbol"?e+"":e,n);var L=class extends Error{constructor(n,r,i){super(r,i);d(this,"code");this.code=n,this.name="ProdantixError";}},V=class extends L{constructor(e){super("config",e),this.name="ConfigError";}},B=class extends L{constructor(n,r){super("validation",r);d(this,"field");this.field=n,this.name="ValidationError";}},h=class extends L{constructor(n,r,i){super("transport",n,i);d(this,"status");this.status=r,this.name="TransportError";}};function T(t){if(t)return t;let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}function w(){let t=globalThis.AbortController;return t?new t:void 0}var Ke=t=>new Promise(e=>{setTimeout(e,t);});function E(t){return t.replace(/\/+$/,"")}var q=class{constructor(){d(this,"store",new Map);}getItem(e){var n;return (n=this.store.get(e))!=null?n:null}removeItem(e){this.store.delete(e);}setItem(e,n){this.store.set(e,n);}},U=class{constructor(e,n=()=>false){this.real=e;this.passes=n;d(this,"held",new q);d(this,"opened",false);}get isOpen(){return this.opened}open(){this.opened=true;}close(){this.opened=false;}target(e){return this.opened||this.passes(e)?this.real:this.held}getItem(e){return this.target(e).getItem(e)}removeItem(e){this.target(e).removeItem(e);}setItem(e,n){this.target(e).setItem(e,n);}};function Be(){try{let t=globalThis.localStorage;if(t){let e="__pdx_probe__";return t.setItem(e,"1"),t.removeItem(e),t}}catch(t){return new q}return new q}var je={now:()=>new Date};function Q(t){return t.toISOString()}function He(){if(typeof window=="undefined"||typeof Intl=="undefined")return null;let t=Intl.DateTimeFormat().resolvedOptions().timeZone;return typeof t=="string"&&t!==""?t:null}function Wt(){return globalThis.crypto}function Yt(t){t[6]=t[6]&15|64,t[8]=t[8]&63|128;let e=[];for(let n=0;n<16;n+=1)e.push(t[n].toString(16).padStart(2,"0"));return `${e[0]}${e[1]}${e[2]}${e[3]}-${e[4]}${e[5]}-${e[6]}${e[7]}-${e[8]}${e[9]}-${e[10]}${e[11]}${e[12]}${e[13]}${e[14]}${e[15]}`}function Qt(){let t=Wt();if(t!=null&&t.randomUUID)return t.randomUUID();let e=new Uint8Array(16);if(t!=null&&t.getRandomValues)t.getRandomValues(e);else for(let n=0;n<16;n+=1)e[n]=Math.floor(Math.random()*256);return Yt(e)}var Ge={uuid:Qt};var Xt=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var Zt=/^(?:\$|[a-z])[a-z0-9_.]*$/;function Ve(t){let e=0;for(let n of t)e+=1;return e}function Ue(t){return Xt.test(t)}function en(t){return Zt.test(t)}function ze(t){let e=Ve(t);if(e<1||e>200)throw new B("distinct_id","distinct_id must be between 1 and 200 characters")}function Je(t){let e=Ve(t);if(e<1||e>200)throw new B("event_name","event_name must be between 1 and 200 characters");if(!en(t))throw new B("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var We="prodantix-js",Ye="0.8.0";var tn=t=>{};function Qe(t){var i,o,s,a,c,u,p,l,I,A,f,C,F,W,R;if(!t.apiKey||!Ue(t.apiKey))throw new V("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!t.host)throw new V("host is required (the ingest base URL)");let e=E(t.host),n=t.defaultProperties,r=(i=t.storage)!=null?i:new q;return {apiKey:t.apiKey,autocapture:(o=t.autocapture)!=null?o:false,clock:(s=t.clock)!=null?s:je,consent:t.consent,consentMode:t.consentMode,defaultProperties:typeof n=="function"?n:()=>n!=null?n:{},describeElement:t.describeElement,flagsHost:t.flagsHost?E(t.flagsHost):e,flushAt:(a=t.flushAt)!=null?a:20,flushIntervalMs:(c=t.flushIntervalMs)!=null?c:1e4,host:e,ids:(u=t.ids)!=null?u:Ge,locale:t.locale,maxQueueSize:(p=t.maxQueueSize)!=null?p:1e3,maxRetries:(l=t.maxRetries)!=null?l:3,namespace:be(t.apiKey),onError:(I=t.onError)!=null?I:tn,os:t.os,requestTimeoutMs:(A=t.requestTimeoutMs)!=null?A:1e4,sdkName:(f=t.sdkName)!=null?f:We,sdkVersion:(C=t.sdkVersion)!=null?C:Ye,sessionTracking:(F=t.sessionTracking)!=null?F:false,sharedStorage:(W=t.sharedStorage)!=null?W:r,socketFactory:t.socketFactory,storage:r,streamFlags:(R=t.streamFlags)!=null?R:false,transport:t.transport}}function be(t){return t.slice(0,16)}var Xe="$cta_viewed",Ze="$cta_clicked",xe="$cta_dismissed",et=(t,e)=>{let n={$cta_id:t.id,$cta_kind:t.kind,$cta_variant:t.variant.key,$cta_version:t.version},r=e===void 0?void 0:t.variant.content.buttons[e];return r&&e!==void 0&&(n.$cta_button=e,n.$cta_button_label=r.label,r.action.kind==="form"&&(n.$cta_form_id=r.action.value)),n},X=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async ctas(e){let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=new URLSearchParams({anonymous:String(e.anonymous),device:e.device,distinct_id:e.distinctId,language:e.language,url:e.url}),i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s=await n(`${this.host}/v1/ctas?${r.toString()}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(s.status<200||s.status>=300)throw new h(`ctas request failed with status ${s.status}`,s.status);return JSON.parse(await s.text()).ctas}finally{o!==void 0&&clearTimeout(o);}}};function tt(t,e,n){var i,o,s;Je(t.eventName),ze(t.distinctId);let r={distinct_id:t.distinctId,event_id:(i=t.eventId)!=null?i:n.uuid(),event_name:t.eventName,properties:(o=t.properties)!=null?o:{},schema_version:1,timestamp:Q((s=t.timestamp)!=null?s:e.now())};return t.context&&(r.context=t.context),t.sessionId&&(r.session_id=t.sessionId),r}var K=Symbol("absent");function nn(t,e){var i,o;if(t==="distinct_id")return e.distinctId;let n=(i=e.properties)!=null?i:{};if(Object.prototype.hasOwnProperty.call(n,t))return n[t];let r=(o=e.attributes)!=null?o:{};return Object.prototype.hasOwnProperty.call(r,t)?r[t]:K}function D(t){return t===K?"undefined":String(t)}function nt(t){return t===K?Number.NaN:Number(t)}function rt(t){return t!==K&&t!==null&&t!==""}function it(t,e){if(!Array.isArray(e))return false;let n=D(t);return e.map(r=>String(r)).includes(n)}function st(t,e){var i,o;let n=nn(t.attribute,e),r=t.value;switch(t.op){case "is_set":return rt(n);case "is_not_set":return !rt(n);case "eq":return D(n)===D(r===void 0?K:r);case "neq":return D(n)!==D(r===void 0?K:r);case "contains":return D(n).includes(D(r===void 0?K:r));case "in":return it(n,r);case "not_in":return Array.isArray(r)?!it(n,r):false;case "gt":return Z(n,r,(s,a)=>s>a);case "gte":return Z(n,r,(s,a)=>s>=a);case "lt":return Z(n,r,(s,a)=>s<a);case "lte":return Z(n,r,(s,a)=>s<=a);case "in_cohort":return typeof r=="string"&&r!==""&&((i=e.cohorts)!=null?i:[]).includes(r);case "not_in_cohort":return typeof r=="string"&&r!==""&&!((o=e.cohorts)!=null?o:[]).includes(r);default:return false}}function Z(t,e,n){let r=nt(t),i=e===void 0?Number.NaN:nt(e);return Number.isNaN(r)||Number.isNaN(i)?false:n(r,i)}function ot(t,e){let n=`${t}:${e}`,r=2166136261;for(let i=0;i<n.length;i++)r^=n.charCodeAt(i),r=Math.imul(r,16777619);return (r>>>0)%100}function ke(t,e){return t.targeting.length===0||t.targeting.every(n=>st(n,e))}function at(t,e){var o;let n=ot(t.key,e.distinctId),r=(o=t.variations)!=null?o:[];if(r.length===0)return t.rolloutPercentage>=100||n<t.rolloutPercentage?"true":"false";let i=0;for(let s=r.length-1;s>=0;s--)if(i+=r[s].weight,n<i)return r[s].key;return r[0].key}function Se(t,e,n,r){var i;for(let o of (i=t.prerequisites)!=null?i:[]){if(r.includes(o.flagKey))return false;let s=e.find(c=>c.key===o.flagKey);if(!s||!s.enabled)return false;r.push(s.key);let a=Se(s,e,n,r)&&ke(s,n)&&at(s,n)===o.variationKey;if(r.pop(),!a)return false}return true}function ee(t,e,n){return t.enabled?Se(t,e,n,[t.key])?ke(t,n)?t.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:ot(t.key,n.distinctId)<t.rolloutPercentage?{enabled:true,reason:"rollout"}:{enabled:false,reason:"rollout_excluded"}:{enabled:false,reason:"targeting"}:{enabled:false,reason:"prerequisite"}:{enabled:false,reason:"disabled"}}function dt(t,e){let n={};for(let r of t)n[r.key]=ee(r,t,e).enabled;return n}function we(t,e,n){var s,a;let r=(s=t.variations)!=null?s:[],i=r[0];if(!i)return null;if(!t.enabled||!Se(t,e,n,[t.key])||!ke(t,n))return i;let o=at(t,n);return (a=r.find(c=>c.key===o))!=null?a:i}function ct(t){return t.some(e=>e.targeting.some(n=>n.op==="in_cohort"||n.op==="not_in_cohort"))}function lt(t){return `40${JSON.stringify(t)}`}function ut(){return "3"}function pt(t){let e=t.charAt(0),n=t.slice(1);if(e==="2")return {kind:"ping"};if(e==="1")return {kind:"disconnect"};if(e==="0"){let s=Ce(n);return {kind:"open",pingInterval:typeof(s==null?void 0:s.pingInterval)=="number"?s.pingInterval:25e3,pingTimeout:typeof(s==null?void 0:s.pingTimeout)=="number"?s.pingTimeout:2e4}}if(e!=="4")return {kind:"other"};let r=n.charAt(0),i=n.slice(1);if(r==="0")return {kind:"connected"};if(r==="1")return {kind:"disconnect"};if(r==="4"){let s=Ce(i);return {kind:"connectError",message:typeof(s==null?void 0:s.message)=="string"?s.message:"refused"}}if(r!=="2")return {kind:"other"};let o=Ce(i);return !Array.isArray(o)||typeof o[0]!="string"?{kind:"other"}:{kind:"event",name:o[0],payload:o[1]}}function Ce(t){try{return JSON.parse(t)}catch(e){return null}}var rn="/socket.io/?EIO=4&transport=websocket",sn=250,te=class{constructor(e){this.options=e;d(this,"socket",null);d(this,"heartbeat",null);d(this,"pending",null);d(this,"lastKey","");d(this,"ready",false);d(this,"closed",false);d(this,"heartbeatWindow",45e3);d(this,"factory");d(this,"setTimer");d(this,"clearTimer");var n,r,i;this.factory=(n=e.socketFactory)!=null?n:on,this.setTimer=(r=e.setTimer)!=null?r:((o,s)=>setTimeout(o,s)),this.clearTimer=(i=e.clearTimer)!=null?i:(o=>clearTimeout(o));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${rn}`,n;try{n=this.factory(e);}catch(r){this.options.onClosed(false);return}this.socket=n,n.onmessage=r=>this.receive(String(r.data)),n.onerror=()=>n.close(),n.onclose=()=>this.fell();}close(){this.closed=true,this.stopHeartbeat(),this.pending!==null&&this.clearTimer(this.pending),this.pending=null;let e=this.socket;this.socket=null,e==null||e.close();}receive(e){var r,i,o,s;let n=pt(e);if(n.kind==="open"){this.armHeartbeat(n.pingInterval+n.pingTimeout),(r=this.socket)==null||r.send(lt({projectKey:this.options.projectKey}));return}if(n.kind==="ping"){this.armHeartbeat(),(i=this.socket)==null||i.send(ut());return}if(n.kind==="connectError"||n.kind==="disconnect"){this.stopHeartbeat(),(o=this.socket)==null||o.close();return}if(n.kind==="event"){if(n.name==="ready"){this.ready=true;return}if(n.name==="flagChange"){let a=(s=n.payload)==null?void 0:s.key;this.lastKey=typeof a=="string"?a:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},sn));}}}fell(){this.stopHeartbeat();let e=this.ready;this.socket=null,this.ready=false,this.closed||this.options.onClosed(e);}armHeartbeat(e){e!==void 0&&(this.heartbeatWindow=e),this.stopHeartbeat(),this.heartbeat=this.setTimer(()=>{var n;return (n=this.socket)==null?void 0:n.close()},this.heartbeatWindow);}stopHeartbeat(){this.heartbeat!==null&&this.clearTimer(this.heartbeat),this.heartbeat=null;}};function on(t){let e=globalThis.WebSocket;if(!e)throw new h("no WebSocket");return new e(t)}var ne=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){var s,a;let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let c=await n(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!c.ok)throw new h(`flags request failed with status ${c.status}`,c.status);let u=JSON.parse(await c.text());return {flags:(s=u.flags)!=null?s:{},variants:(a=u.variants)!=null?a:{}}}finally{o!==void 0&&clearTimeout(o);}}async snapshot(){var o;let e=this.fetch;if(!e)throw new h("no fetch implementation available in this runtime");let n=`${this.host}/v1/flags/snapshot`,r=w(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await e(n,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new h(`flag snapshot request failed with status ${s.status}`,s.status);let a=JSON.parse(await s.text()),c={flags:(o=a.flags)!=null?o:[],generatedAt:a.generatedAt};return typeof a.socketUrl=="string"&&a.socketUrl!==""&&(c.socketUrl=a.socketUrl),c}finally{i!==void 0&&clearTimeout(i);}}async memberships(e){var s;let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await n(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new h(`memberships request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).cohorts)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};var mt="$form_viewed",gt="$form_started",z=class extends Error{constructor(n,r,i){super(i);d(this,"fields");d(this,"status");this.name="FormRefusedError",this.status=n,this.fields=r;}},re=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async request(e,n){let r=this.fetch;if(!r)throw new h("no fetch implementation available in this runtime");let i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s={authorization:`Bearer ${this.projectKey}`};n.body!==void 0&&(s["content-type"]="application/json");let a=await r(`${this.host}${e}`,{body:n.body,headers:s,method:n.method,signal:i==null?void 0:i.signal});return {status:a.status,text:await a.text()}}finally{o!==void 0&&clearTimeout(o);}}async form(e,n){let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}?distinct_id=${encodeURIComponent(n)}`,{method:"GET"});if(r<200||r>=300)throw new h(`form request failed with status ${r}`,r);return JSON.parse(i)}async submit(e,n){var a,c,u,p;let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}/submissions`,{body:JSON.stringify(n),method:"POST"});if(r>=200&&r<300)return JSON.parse(i).afterSubmit;let o=[],s=`form submission failed with status ${r}`;try{let l=JSON.parse(i);o=(c=(a=l.error)==null?void 0:a.fields)!=null?c:[],s=(p=(u=l.error)==null?void 0:u.message)!=null?p:s;}catch(l){o=[];}throw new z(r,o,s)}};var ht="$survey_shown",ft="$survey_dismissed",yt="$survey_sent",ie=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async surveys(e,n){var s;let r=this.fetch;if(!r)throw new h("no fetch implementation available in this runtime");let i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await r(`${this.host}/v1/surveys?distinct_id=${encodeURIComponent(e)}${n?`&lang=${encodeURIComponent(n)}`:""}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new h(`surveys request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).surveys)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};function se(t,e){let n={$survey_id:t.id,$survey_iteration:t.iteration,$survey_name:t.name};for(let[r,i]of Object.entries(e))n[`$survey_response_${r}`]=i;return n}var oe=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async guides(e){var o;let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=w(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await n(`${this.host}/v1/guides?distinct_id=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new h(`guides request failed with status ${s.status}`,s.status);return (o=JSON.parse(await s.text()).guides)!=null?o:[]}finally{i!==void 0&&clearTimeout(i);}}};function vt(t,e){let n={$guide_id:t.id,$guide_iteration:t.iteration,$guide_name:t.name};return e!==void 0&&(n.$guide_step_id=e),n}function Ee(t){if(typeof t!="string")return;let e=Array.from(t).length;return e>=1&&e<=200?t:void 0}function Fe(t,e){return `pdx.${t}.${e}`}var _e="consent",an=["identityLink","analytics","marketing","functional"];function Te(t){if(typeof t!="string")return null;try{let e=JSON.parse(t);if(e===null||typeof e!="object"||Array.isArray(e))return null;let n=e,r={};for(let i of an){let o=n[i];typeof o=="boolean"&&(r[i]=o);}return typeof n.version=="number"&&Number.isInteger(n.version)&&(r.version=n.version),Array.isArray(n.categories)&&n.categories.every(i=>typeof i=="string")&&(r.categories=n.categories),Object.keys(r).length===0?null:r}catch(e){return null}}var bt=t=>t.endsWith(`.${_e}`);function de(t,e){return Te(t.getItem(Fe(e,_e)))}function dn(t,e,n){var s;let r=Fe(e,_e),i=Te(JSON.stringify(n)),o=i===null?null:Te(JSON.stringify({...(s=de(t,e))!=null?s:{},...i}));if(o===null){t.removeItem(r);return}t.setItem(r,JSON.stringify(o));}var ae=class{constructor(e,n,r,i){this.storage=e;this.shared=n;this.ids=r;this.namespace=i;d(this,"anonymousId");d(this,"distinctId");d(this,"identified");this.refresh();}refresh(){let e=Ee(this.shared.getItem(this.key("anonymous_id"))),n=Ee(this.storage.getItem(this.key("anonymous_id")));e?(this.anonymousId=e,n!==e&&this.storage.setItem(this.key("anonymous_id"),e)):n?(this.anonymousId=n,this.shared.setItem(this.key("anonymous_id"),n)):(this.anonymousId=this.ids.uuid(),this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId));let r=Ee(this.storage.getItem(this.key("distinct_id")));r?(this.distinctId=r,this.identified=true):(this.distinctId=this.anonymousId,this.identified=false);}getAnonymousId(){return this.anonymousId}getDistinctId(){return this.distinctId}isIdentified(){return this.identified}snapshot(){return {anonymousId:this.anonymousId,distinctId:this.distinctId,identified:this.identified}}consent(){return de(this.shared,this.namespace)}setConsent(e){dn(this.shared,this.namespace,e);}assumeAnonymousId(e){this.anonymousId=e,this.shared.setItem(this.key("anonymous_id"),e),this.storage.setItem(this.key("anonymous_id"),e),this.identified||(this.distinctId=e);}identify(e){var o;let n=!this.identified||this.distinctId!==e,r=this.storage.getItem(this.key("linked_anonymous_id")),i=n||r!==this.anonymousId;return this.distinctId=e,this.identified=true,n&&this.storage.setItem(this.key("distinct_id"),e),!i||((o=this.consent())==null?void 0:o.identityLink)===false?{changed:n}:(this.storage.setItem(this.key("linked_anonymous_id"),this.anonymousId),{anonymousToLink:this.anonymousId,changed:n})}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 Fe(this.namespace,e)}};var ce=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async inbox(e){var s;let n=this.requireFetch(),r=`${this.host}/v1/messages?distinct_id=${encodeURIComponent(e)}`,i=await this.request(n,r,{headers:this.authHeaders(),method:"GET"});if(!i.ok)throw new h(`inbox request failed with status ${i.status}`,i.status);return (s=JSON.parse(await i.text()).messages)!=null?s:[]}async markRead(e,n){let r=this.requireFetch(),i=`${this.host}/v1/messages/read`,o=await this.request(r,i,{body:JSON.stringify({distinct_id:n,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!o.ok)throw new h(`mark-read request failed with status ${o.status}`,o.status)}requireFetch(){if(!this.fetch)throw new h("no fetch implementation available in this runtime");return this.fetch}authHeaders(){return {authorization:`Bearer ${this.projectKey}`}}async request(e,n,r){let i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(n,{...r,signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}};var le=class{constructor(e,n){this.maxSize=e;this.onOverflow=n;d(this,"events",[]);}get size(){return this.events.length}enqueue(e){this.events.push(e),this.enforceCap();}restore(e){this.events.push(...e),this.enforceCap();}requeue(e){this.events.unshift(...e),this.enforceCap();}drain(e){let n=e===void 0?this.events.length:Math.min(e,this.events.length);return this.events.splice(0,n)}snapshot(){return [...this.events]}enforceCap(){var n;if(this.events.length<=this.maxSize)return;let e=this.events.splice(0,this.events.length-this.maxSize);(n=this.onOverflow)==null||n.call(this,{dropped:e});}};var cn={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function ln(t){return `pdx.${t}.session`}var ue=class{constructor(e,n,r,i,o=cn){this.storage=e;this.ids=n;this.clock=r;this.namespace=i;this.options=o;}current(){return this.touch().id}startedAt(){return this.touch().startedAt}reset(){this.storage.removeItem(this.key());}touch(){let e=this.clock.now().getTime(),n=this.live(this.read(),e);if(n===void 0)return this.write({id:this.ids.uuid(),lastActivityAt:e,startedAt:e});if(e-n.lastActivityAt<=this.options.throttleMs)return n;let r=this.live(this.read(),e),i=r!==void 0&&r.id!==n.id?r:n;return this.write({...i,lastActivityAt:e})}live(e,n){if(e!==void 0&&!(n-e.lastActivityAt>this.options.idleMs||n-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 n=JSON.parse(e);return typeof n.id=="string"&&typeof n.startedAt=="number"&&typeof n.lastActivityAt=="number"?{id:n.id,lastActivityAt:n.lastActivityAt,startedAt:n.startedAt}:void 0}catch(n){return}}key(){return ln(this.namespace)}};var S={createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",set:"$set"};function xt(t){return t>=400&&t<500&&t!==429}var j=class{constructor(e={}){d(this,"fetch");d(this,"maxRetries");d(this,"requestTimeoutMs");d(this,"baseDelayMs");d(this,"maxDelayMs");d(this,"sleep");d(this,"random");var n,r,i,o,s,a;this.fetch=T(e.fetch),this.maxRetries=(n=e.maxRetries)!=null?n:3,this.requestTimeoutMs=(r=e.requestTimeoutMs)!=null?r:1e4,this.baseDelayMs=(i=e.baseDelayMs)!=null?i:500,this.maxDelayMs=(o=e.maxDelayMs)!=null?o:3e4,this.sleep=(s=e.sleep)!=null?s:Ke,this.random=(a=e.random)!=null?a:Math.random;}async send(e){let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=JSON.stringify(e.body),i;for(let o=0;o<=this.maxRetries;o+=1){try{let s=await this.attempt(n,e,r);if(s.ok)return;if(xt(s.status))throw new h(`ingest rejected batch with status ${s.status}`,s.status);i=new h(`ingest transient status ${s.status}`,s.status);}catch(s){if(s instanceof h&&s.status!==void 0&&xt(s.status))throw s;i=s;}o<this.maxRetries&&await this.sleep(this.backoff(o));}throw new h("ingest delivery failed after retries",void 0,{cause:i})}async attempt(e,n,r){let i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(n.url,{body:r,headers:{authorization:`Bearer ${n.projectKey}`,"content-type":"application/json"},method:"POST",signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};var un="queue",pn=1e3,kt=3e4,Ie=t=>{let e={};return t.avatar!==void 0&&(e.$avatar=t.avatar),t.email!==void 0&&(e.$email=t.email),t.name!==void 0&&(e.$name=t.name),t.phone!==void 0&&(e.$phone=t.phone),e},pe=class{constructor(e){d(this,"config");d(this,"identity");d(this,"session");d(this,"queue");d(this,"transport");d(this,"flagsClient");d(this,"messagesClient");d(this,"surveysClient");d(this,"guidesClient");d(this,"captureListeners",new Set);d(this,"formsClient");d(this,"ctasClient");d(this,"context");d(this,"flushTimer");d(this,"flushing",false);d(this,"cachedFlags");d(this,"cachedSnapshot");d(this,"membershipCache");d(this,"stream");d(this,"shutDown",false);d(this,"exposures",new Set);d(this,"gates");d(this,"cookielessId");d(this,"storageListeners",new Set);var s,a,c;let n=Qe(e),r=(a=(s=de(n.sharedStorage,n.namespace))!=null?s:n.consent)!=null?a:null;if(this.gates=[new U(n.storage),new U(n.sharedStorage,bt)],n.consentMode!=="banner"||(r==null?void 0:r.analytics)===true)for(let u of this.gates)u.open();let[i,o]=this.gates;this.config={...n,sharedStorage:o,storage:i},this.identity=new ae(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 ue(this.config.sharedStorage,this.config.ids,this.config.clock,this.config.namespace):void 0,this.queue=new le(this.config.maxQueueSize,({dropped:u})=>{this.config.onError(new L("queue_overflow",`event queue overflow: dropped ${u.length} oldest event(s)`));}),this.transport=(c=this.config.transport)!=null?c:new j({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new ne({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new ce({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.surveysClient=new ie({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.guidesClient=new oe({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.formsClient=new re({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.ctasClient=new X({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.context={sdk:this.config.sdkName,sdk_version:this.config.sdkVersion},this.config.os&&(this.context.os=this.config.os),this.config.locale&&(this.context.locale=this.config.locale),this.restoreQueue(),this.startTimer();}get distinctId(){return this.identity.getDistinctId()}get anonymousId(){return this.identity.getAnonymousId()}get isIdentified(){return this.identity.isIdentified()}get sessionId(){var e;return (e=this.session)==null?void 0:e.current()}get sessionStartedAt(){var e;return (e=this.session)==null?void 0:e.startedAt()}capture(e,n={}){var r,i,o,s,a,c,u;try{this.identity.refresh();let p={...this.config.defaultProperties(),...n.element===void 0?{}:(o=(i=(r=this.config).describeElement)==null?void 0:i.call(r,n.element))!=null?o:{},...(s=n.properties)!=null?s:{}},l=tt({context:this.context,distinctId:(a=n.distinctId)!=null?a:this.identity.getDistinctId(),eventName:e,properties:p,sessionId:(u=n.sessionId)!=null?u:(c=this.session)==null?void 0:c.current(),timestamp:n.timestamp},this.config.clock,this.config.ids);this.enqueue(l);}catch(p){this.config.onError(p);}for(let p of this.captureListeners)try{p(e);}catch(l){this.config.onError(l);}}onCapture(e){return this.captureListeners.add(e),()=>{this.captureListeners.delete(e);}}identify(e,n={}){var a,c;if(this.isCookieless())return;this.identity.refresh();let r=this.identity.identify(e),i={};r.anonymousToLink!==void 0&&(i.$anon_distinct_id=r.anonymousToLink);let o=He(),s={...o===null?{}:{$timezone:o},...Ie((a=n.traits)!=null?a:{}),...(c=n.set)!=null?c:{}};Object.keys(s).length>0&&(i.$set=s),this.capture(S.identify,{properties:i});}link(e,n,r){if(this.isCookieless())return;let i={$anon_distinct_id:n},o=Ie(r!=null?r:{});Object.keys(o).length>0&&(i.$set=o),this.capture(S.identify,{distinctId:e,properties:i});}setConsent(e){this.identity.setConsent(e),e.analytics===true&&this.allowStorage(),e.analytics===false&&this.config.consentMode==="banner"&&this.forbidStorage();}isCookieless(){return !this.gates[0].isOpen}takeCookielessId(e){this.cookielessId=e,this.isCookieless()&&this.identity.assumeAnonymousId(e);}allowStorage(){if(this.isCookieless()){for(let e of this.gates)e.open();this.identity.refresh();for(let e of [...this.storageListeners])e();}}onStorageAllowed(e){return this.storageListeners.add(e),()=>{this.storageListeners.delete(e);}}forbidStorage(){if(!this.isCookieless()){for(let e of ["anonymous_id","distinct_id","linked_anonymous_id","session"])this.config.storage.removeItem(`pdx.${this.config.namespace}.${e}`),this.config.sharedStorage.removeItem(`pdx.${this.config.namespace}.${e}`);for(let e of this.gates)e.close();this.identity.refresh(),this.cookielessId!==void 0&&this.identity.assumeAnonymousId(this.cookielessId);}}consent(){return this.identity.consent()}alias(e){this.capture(S.createAlias,{properties:{alias:e}});}group(e,n,r){let i={$group_key:n,$group_type:e};r&&(i.$set=r),this.capture(S.group,{properties:i});}setPersonProperties(e,n){if(this.isCookieless())return;let r={};e&&(r.$set=e),n&&(r.$set_once=n),this.capture(S.set,{properties:r});}setPersonTraits(e){if(this.isCookieless())return;let n=Ie(e);Object.keys(n).length!==0&&this.capture(S.set,{properties:{$set:n}});}async getAllFlags(){var r;let e=this.identity.getDistinctId(),n=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:n.flags,variants:(r=n.variants)!=null?r:{}},n.flags}async isFeatureEnabled(e){var i,o,s,a;let r=(i=(await this.getAllFlags())[e])!=null?i:false;return this.recordExposure(e,(a=(s=(o=this.cachedFlags)==null?void 0:o.variants[e])==null?void 0:s.key)!=null?a:String(r)),r}async getVariant(e){var i,o,s,a;let n=await this.getAllFlags(),r=(o=(i=this.cachedFlags)==null?void 0:i.variants[e])!=null?o:null;return this.recordExposure(e,(a=r==null?void 0:r.key)!=null?a:String((s=n[e])!=null?s:false)),r}async getVariantLocal(e,n={}){var c;let r=await this.flagSnapshot(),i=r.flags.find(u=>u.key===e),o=await this.localContext(n,r.flags),s=i?we(i,r.flags,o):null,a=i?ee(i,r.flags,o).enabled:false;return this.recordExposure(e,(c=s==null?void 0:s.key)!=null?c:String(a)),s?{key:s.key,value:s.value}:null}recordExposure(e,n){let r=`${this.identity.getDistinctId()} ${e} ${n}`;this.exposures.has(r)||(this.exposures.add(r),this.capture(S.featureFlagCalled,{properties:{$feature_flag:e,$feature_flag_response:n}}));}getCachedFlag(e){if(!(!this.cachedFlags||this.cachedFlags.distinctId!==this.distinctId))return this.cachedFlags.flags[e]}async getLocalFlags(e={}){let n=await this.flagSnapshot();return dt(n.flags,await this.localContext(e,n.flags))}async isFeatureEnabledLocal(e,n={}){var a,c;let r=await this.flagSnapshot(),i=r.flags.find(u=>u.key===e),o=await this.localContext(n,r.flags),s=i?ee(i,r.flags,o).enabled:false;return this.recordExposure(e,(c=i?(a=we(i,r.flags,o))==null?void 0:a.key:void 0)!=null?c:String(s)),s}async localContext(e,n){let r=this.identity.getDistinctId(),i=e.cohorts;if(i===void 0&&ct(n)){let o=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===r&&o-this.membershipCache.fetchedAt<kt?i=this.membershipCache.cohorts:(i=await this.flagsClient.memberships(r),this.membershipCache={cohorts:i,distinctId:r,fetchedAt:o});}return {attributes:e.attributes,cohorts:i,distinctId:r,properties:e.properties}}async flagSnapshot(){let e=this.config.clock.now().getTime();if(this.cachedSnapshot&&e-this.cachedSnapshot.fetchedAt<kt)return this.cachedSnapshot.snapshot;let n=await this.flagsClient.snapshot();return this.cachedSnapshot={fetchedAt:e,snapshot:n},this.maybeStream(n),n}maybeStream(e){if(!this.config.streamFlags||this.shutDown||this.stream||!e.socketUrl)return;let n=new te({host:e.socketUrl,onChange:()=>{this.cachedSnapshot=void 0,this.flagSnapshot().catch(r=>this.config.onError(r));},onClosed:r=>{this.stream=void 0,r&&this.maybeStream(e);},projectKey:this.config.apiKey,socketFactory:this.config.socketFactory});this.stream=n,n.open();}async getInbox(){return this.messagesClient.inbox(this.identity.getDistinctId())}async markMessageRead(e){await this.messagesClient.markRead(e,this.identity.getDistinctId());}async getSurveys(e){return this.surveysClient.surveys(this.identity.getDistinctId(),e!=null?e:this.config.locale)}captureSurveyShown(e){this.capture(ht,{properties:se(e,{})});}captureSurveyDismissed(e){this.capture(ft,{properties:se(e,{})});}captureSurveySent(e,n){this.capture(yt,{properties:se(e,n)});}async getGuides(){return this.guidesClient.guides(this.identity.getDistinctId())}captureGuide(e,n,r){this.capture(e,{properties:vt(n,r)});}async getForm(e){return this.formsClient.form(e,this.identity.getDistinctId())}async submitForm(e,n,r,i){let{$page_id:o,$page_variant:s}=this.config.defaultProperties();return this.formsClient.submit(e,{answers:n,challenge:r,distinctId:this.identity.getDistinctId(),isAnonymous:!this.identity.isIdentified(),pageUrl:typeof window=="undefined"?"":window.location.href,solution:i,...typeof o=="string"&&typeof s=="string"?{pageId:o,pageVariant:s}:{}})}async getCtas(e){return this.ctasClient.ctas({...e,anonymous:!this.identity.isIdentified(),distinctId:this.identity.getDistinctId()})}captureCta(e,n,r){this.capture(e,{properties:et(n,r)});}async flush(){if(this.flushing||this.queue.size===0)return;this.flushing=true;let e=this.queue.drain(pn);try{await this.transport.send({body:{events:e,sent_at:Q(this.config.clock.now())},projectKey:this.config.apiKey,url:`${this.config.host}/v1/events`}),this.persistQueue();}catch(n){this.queue.requeue(e),this.persistQueue(),this.config.onError(n);}finally{this.flushing=false;}}reset(){var e;(e=this.session)==null||e.reset(),this.identity.reset(),this.cachedFlags=void 0,this.cachedSnapshot=void 0,this.membershipCache=void 0;}async shutdown(){var e;this.shutDown=true,this.stopTimer(),(e=this.stream)==null||e.close(),this.stream=void 0,await this.flush();}enqueue(e){this.queue.enqueue(e),this.persistQueue(),this.queue.size>=this.config.flushAt&&this.flush();}persistQueue(){try{this.config.storage.setItem(this.persistKey(),JSON.stringify(this.queue.snapshot()));}catch(e){this.config.onError(e);}}restoreQueue(){try{let e=this.config.storage.getItem(this.persistKey());if(!e)return;let n=JSON.parse(e);Array.isArray(n)&&this.queue.restore(n);}catch(e){this.config.onError(e);}}startTimer(){if(this.config.flushIntervalMs<=0)return;let e=setInterval(()=>{this.flush();},this.config.flushIntervalMs),n=e;typeof n.unref=="function"&&n.unref(),this.flushTimer=e;}stopTimer(){this.flushTimer!==void 0&&(clearInterval(this.flushTimer),this.flushTimer=void 0);}persistKey(){return `pdx.${this.config.namespace}.${un}`}};function mn(){let t=globalThis.document;return (t==null?void 0:t.visibilityState)==="hidden"}function gn(t){let e=globalThis.navigator,n=globalThis.Blob;if(!(e!=null&&e.sendBeacon)||!n)return false;let r=JSON.stringify({...t.body,api_key:t.projectKey});try{let i=new n([r],{type:"application/json"});return e.sendBeacon(t.url,i)}catch(i){return false}}var me=class{constructor(e={}){d(this,"fetchTransport");this.fetchTransport=new j(e);}async send(e){mn()&&gn(e)||await this.fetchTransport.send(e);}};var $e="prodantix:consent-ready",Ae="prodantix:consent",St="__prodantixConsent";var wt=(t,e)=>{t.takeCookielessId(e.anonymousId),e.consent!==null?t.setConsent(e.consent):e.rule==="notice"&&t.allowStorage();},Ct=(t,e)=>{let n=e[St];n&&wt(t,n);let r=o=>{let s=o.detail;s&&wt(t,s);},i=o=>{let s=o.detail;s&&t.setConsent(s);};return e.addEventListener($e,r),e.addEventListener(Ae,i),()=>{e.removeEventListener($e,r),e.removeEventListener(Ae,i);}};var hn=/^\d{1,3}(\.\d{1,3}){3}$/,fn=/^[a-z0-9.-]+$/i;function Et(){return Math.random().toString(36).slice(2,12)}function ge(t,e){let n=`${e}=`,r=[];for(let i of t.cookie.split(";")){let o=i.trim();o.startsWith(n)&&r.push(o.slice(n.length));}return r}function J(t,e,n){let r=["Path=/",`Max-Age=${e}`,"SameSite=Lax"];return t&&r.push(`Domain=${t}`),n&&r.push("Secure"),r.join("; ")}function Tt(t,e,n,r){try{let i=`pdx_probe_${r()}`,o=r();t.cookie=`${i}=${o}; ${J(e,60,n)}`;let s=ge(t,i).includes(o);t.cookie=`${i}=; ${J(e,0,n)}`;let a=ge(t,i).includes(o);return s&&!a}catch(i){return false}}function yn(t){let e=t.replace(/^\[|\]$/g,"").toLowerCase();if(e.includes(":")||hn.test(e)||!e.includes("."))return [];let n=e.split("."),r=[];for(let i=n.length-2;i>=0;i-=1)r.push(n.slice(i).join("."));return r}function vn(t,e,n,r=Et){for(let i of yn(t))if(Tt(e,i,n,r))return i}function bn(t){let e=new Map,n=JSON.parse(decodeURIComponent(t));if(n===null||typeof n!="object"||Array.isArray(n))return e;for(let[r,i]of Object.entries(n))typeof i=="string"&&e.set(r,i);return e}var Pe=class{constructor(e,n,r,i){this.jar=e;this.name=n;this.domain=r;this.secure=i;}getItem(e){var n;return (n=this.read().get(e))!=null?n:null}setItem(e,n){let r=this.read();r.set(e,n),this.write(r);}removeItem(e){let n=this.read();n.delete(e)&&this.write(n);}read(){try{let e=ge(this.jar,this.name);e.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${J(void 0,0,this.secure)}`,e=ge(this.jar,this.name));let n=e[0];return n?bn(n):new Map}catch(e){return new Map}}write(e){try{if(e.size===0){this.jar.cookie=`${this.name}=; ${J(this.domain,0,this.secure)}`;return}let n=encodeURIComponent(JSON.stringify(Object.fromEntries(e)));this.jar.cookie=`${this.name}=${n}; ${J(this.domain,31536e3,this.secure)}`;}catch(n){return}}};function xn(){return globalThis.document}function kn(){var t,e;return (e=(t=globalThis.location)==null?void 0:t.hostname)!=null?e:""}function Sn(){var t;return ((t=globalThis.location)==null?void 0:t.protocol)==="https:"}function wn(t){if(t===void 0)return;let e=t.startsWith(".")?t.slice(1):t;return fn.test(e)?e.toLowerCase():void 0}function Ft(t){var s,a,c,u,p;let e="jar"in t?t.jar:xn();if(!e||((s=globalThis.navigator)==null?void 0:s.cookieEnabled)===false)return null;let r=(a=t.random)!=null?a:Et,i=(c=t.secure)!=null?c:Sn(),o=(u=t.hostname)!=null?u:kn();try{let l=(p=wn(t.domain))!=null?p:vn(o,e,i,r);return Tt(e,l,i,r)?new Pe(e,t.name,l,i):null}catch(l){return null}}var he=t=>`prodantix-cta:${t}`,_t=t=>{try{let e=window.localStorage.getItem(he(t));return e===null?null:Number(e)}catch(e){return null}},It=t=>{try{return window.sessionStorage.getItem(he(t))!==null}catch(e){return false}},$t=(t,e)=>{try{window.localStorage.setItem(he(t),String(e)),window.sessionStorage.setItem(he(t),String(e));}catch(n){return}},At=(t,e,n,r)=>e===null?true:t.kind==="once"?false:t.kind==="session"?!n:r-e>=t.value*864e5;var N={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"}},Pt=t=>{var n;let e=(n=(t!=null?t:"").toLowerCase().split("-")[0])!=null?n:"";return e in N?e:"en"};var v="prodantix-cta",Rt="prodantix-cta-style",Cn=`.${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}
|
|
1
|
+
(function(){'use strict';var Jt=Object.defineProperty;var Wt=(t,e,n)=>e in t?Jt(t,e,{enumerable:true,configurable:true,writable:true,value:n}):t[e]=n;var c=(t,e,n)=>Wt(t,typeof e!="symbol"?e+"":e,n);var O=class extends Error{constructor(n,r,i){super(r,i);c(this,"code");this.code=n,this.name="ProdantixError";}},V=class extends O{constructor(e){super("config",e),this.name="ConfigError";}},B=class extends O{constructor(n,r){super("validation",r);c(this,"field");this.field=n,this.name="ValidationError";}},h=class extends O{constructor(n,r,i){super("transport",n,i);c(this,"status");this.status=r,this.name="TransportError";}};function T(t){if(t)return t;let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}function w(){let t=globalThis.AbortController;return t?new t:void 0}var Ke=t=>new Promise(e=>{setTimeout(e,t);});function E(t){return t.replace(/\/+$/,"")}var q=class{constructor(){c(this,"store",new Map);}getItem(e){var n;return (n=this.store.get(e))!=null?n:null}removeItem(e){this.store.delete(e);}setItem(e,n){this.store.set(e,n);}},U=class{constructor(e,n=()=>false){this.real=e;this.passes=n;c(this,"held",new q);c(this,"opened",false);}get isOpen(){return this.opened}open(){this.opened=true;}close(){this.opened=false;}target(e){return this.opened||this.passes(e)?this.real:this.held}getItem(e){return this.target(e).getItem(e)}removeItem(e){this.target(e).removeItem(e);}setItem(e,n){this.target(e).setItem(e,n);}};function Be(){try{let t=globalThis.localStorage;if(t){let e="__pdx_probe__";return t.setItem(e,"1"),t.removeItem(e),t}}catch(t){return new q}return new q}var je={now:()=>new Date};function Q(t){return t.toISOString()}function He(){if(typeof window=="undefined"||typeof Intl=="undefined")return null;let t=Intl.DateTimeFormat().resolvedOptions().timeZone;return typeof t=="string"&&t!==""?t:null}function Yt(){return globalThis.crypto}function Qt(t){t[6]=t[6]&15|64,t[8]=t[8]&63|128;let e=[];for(let n=0;n<16;n+=1)e.push(t[n].toString(16).padStart(2,"0"));return `${e[0]}${e[1]}${e[2]}${e[3]}-${e[4]}${e[5]}-${e[6]}${e[7]}-${e[8]}${e[9]}-${e[10]}${e[11]}${e[12]}${e[13]}${e[14]}${e[15]}`}function Xt(){let t=Yt();if(t!=null&&t.randomUUID)return t.randomUUID();let e=new Uint8Array(16);if(t!=null&&t.getRandomValues)t.getRandomValues(e);else for(let n=0;n<16;n+=1)e[n]=Math.floor(Math.random()*256);return Qt(e)}var Ge={uuid:Xt};var Zt=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var en=/^(?:\$|[a-z])[a-z0-9_.]*$/;function Ve(t){let e=0;for(let n of t)e+=1;return e}function Ue(t){return Zt.test(t)}function tn(t){return en.test(t)}function ze(t){let e=Ve(t);if(e<1||e>200)throw new B("distinct_id","distinct_id must be between 1 and 200 characters")}function Je(t){let e=Ve(t);if(e<1||e>200)throw new B("event_name","event_name must be between 1 and 200 characters");if(!tn(t))throw new B("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var We="prodantix-js",Ye="0.9.0";var nn=t=>{};function Qe(t){var i,o,s,a,d,u,p,l,I,A,f,C,F,W,R;if(!t.apiKey||!Ue(t.apiKey))throw new V("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!t.host)throw new V("host is required (the ingest base URL)");let e=E(t.host),n=t.defaultProperties,r=(i=t.storage)!=null?i:new q;return {apiKey:t.apiKey,autocapture:(o=t.autocapture)!=null?o:false,clock:(s=t.clock)!=null?s:je,consent:t.consent,consentMode:t.consentMode,defaultProperties:typeof n=="function"?n:()=>n!=null?n:{},describeElement:t.describeElement,flagsHost:t.flagsHost?E(t.flagsHost):e,flushAt:(a=t.flushAt)!=null?a:20,flushIntervalMs:(d=t.flushIntervalMs)!=null?d:1e4,host:e,ids:(u=t.ids)!=null?u:Ge,locale:t.locale,maxQueueSize:(p=t.maxQueueSize)!=null?p:1e3,maxRetries:(l=t.maxRetries)!=null?l:3,namespace:be(t.apiKey),onError:(I=t.onError)!=null?I:nn,os:t.os,requestTimeoutMs:(A=t.requestTimeoutMs)!=null?A:1e4,sdkName:(f=t.sdkName)!=null?f:We,sdkVersion:(C=t.sdkVersion)!=null?C:Ye,sessionTracking:(F=t.sessionTracking)!=null?F:false,sharedStorage:(W=t.sharedStorage)!=null?W:r,socketFactory:t.socketFactory,storage:r,streamFlags:(R=t.streamFlags)!=null?R:false,transport:t.transport}}function be(t){return t.slice(0,16)}var Xe="$cta_viewed",Ze="$cta_clicked",xe="$cta_dismissed",et=(t,e)=>{let n={$cta_id:t.id,$cta_kind:t.kind,$cta_variant:t.variant.key,$cta_version:t.version},r=e===void 0?void 0:t.variant.content.buttons[e];return r&&e!==void 0&&(n.$cta_button=e,n.$cta_button_label=r.label,r.action.kind==="form"&&(n.$cta_form_id=r.action.value)),n},X=class{constructor(e){c(this,"fetch");c(this,"host");c(this,"projectKey");c(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async ctas(e){let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=new URLSearchParams({anonymous:String(e.anonymous),device:e.device,distinct_id:e.distinctId,language:e.language,url:e.url}),i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s=await n(`${this.host}/v1/ctas?${r.toString()}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(s.status<200||s.status>=300)throw new h(`ctas request failed with status ${s.status}`,s.status);return JSON.parse(await s.text()).ctas}finally{o!==void 0&&clearTimeout(o);}}};function tt(t,e,n){var i,o,s;Je(t.eventName),ze(t.distinctId);let r={distinct_id:t.distinctId,event_id:(i=t.eventId)!=null?i:n.uuid(),event_name:t.eventName,properties:(o=t.properties)!=null?o:{},schema_version:1,timestamp:Q((s=t.timestamp)!=null?s:e.now())};return t.context&&(r.context=t.context),t.sessionId&&(r.session_id=t.sessionId),r}var K=Symbol("absent");function rn(t,e){var i,o;if(t==="distinct_id")return e.distinctId;let n=(i=e.properties)!=null?i:{};if(Object.prototype.hasOwnProperty.call(n,t))return n[t];let r=(o=e.attributes)!=null?o:{};return Object.prototype.hasOwnProperty.call(r,t)?r[t]:K}function D(t){return t===K?"undefined":String(t)}function nt(t){return t===K?Number.NaN:Number(t)}function rt(t){return t!==K&&t!==null&&t!==""}function it(t,e){if(!Array.isArray(e))return false;let n=D(t);return e.map(r=>String(r)).includes(n)}function st(t,e){var i,o;let n=rn(t.attribute,e),r=t.value;switch(t.op){case "is_set":return rt(n);case "is_not_set":return !rt(n);case "eq":return D(n)===D(r===void 0?K:r);case "neq":return D(n)!==D(r===void 0?K:r);case "contains":return D(n).includes(D(r===void 0?K:r));case "in":return it(n,r);case "not_in":return Array.isArray(r)?!it(n,r):false;case "gt":return Z(n,r,(s,a)=>s>a);case "gte":return Z(n,r,(s,a)=>s>=a);case "lt":return Z(n,r,(s,a)=>s<a);case "lte":return Z(n,r,(s,a)=>s<=a);case "in_cohort":return typeof r=="string"&&r!==""&&((i=e.cohorts)!=null?i:[]).includes(r);case "not_in_cohort":return typeof r=="string"&&r!==""&&!((o=e.cohorts)!=null?o:[]).includes(r);default:return false}}function Z(t,e,n){let r=nt(t),i=e===void 0?Number.NaN:nt(e);return Number.isNaN(r)||Number.isNaN(i)?false:n(r,i)}function ot(t,e){let n=`${t}:${e}`,r=2166136261;for(let i=0;i<n.length;i++)r^=n.charCodeAt(i),r=Math.imul(r,16777619);return (r>>>0)%100}function ke(t,e){return t.targeting.length===0||t.targeting.every(n=>st(n,e))}function at(t,e){var o;let n=ot(t.key,e.distinctId),r=(o=t.variations)!=null?o:[];if(r.length===0)return t.rolloutPercentage>=100||n<t.rolloutPercentage?"true":"false";let i=0;for(let s=r.length-1;s>=0;s--)if(i+=r[s].weight,n<i)return r[s].key;return r[0].key}function Se(t,e,n,r){var i;for(let o of (i=t.prerequisites)!=null?i:[]){if(r.includes(o.flagKey))return false;let s=e.find(d=>d.key===o.flagKey);if(!s||!s.enabled)return false;r.push(s.key);let a=Se(s,e,n,r)&&ke(s,n)&&at(s,n)===o.variationKey;if(r.pop(),!a)return false}return true}function ee(t,e,n){return t.enabled?Se(t,e,n,[t.key])?ke(t,n)?t.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:ot(t.key,n.distinctId)<t.rolloutPercentage?{enabled:true,reason:"rollout"}:{enabled:false,reason:"rollout_excluded"}:{enabled:false,reason:"targeting"}:{enabled:false,reason:"prerequisite"}:{enabled:false,reason:"disabled"}}function dt(t,e){let n={};for(let r of t)n[r.key]=ee(r,t,e).enabled;return n}function we(t,e,n){var s,a;let r=(s=t.variations)!=null?s:[],i=r[0];if(!i)return null;if(!t.enabled||!Se(t,e,n,[t.key])||!ke(t,n))return i;let o=at(t,n);return (a=r.find(d=>d.key===o))!=null?a:i}function ct(t){return t.some(e=>e.targeting.some(n=>n.op==="in_cohort"||n.op==="not_in_cohort"))}function lt(t){return `40${JSON.stringify(t)}`}function ut(){return "3"}function pt(t){let e=t.charAt(0),n=t.slice(1);if(e==="2")return {kind:"ping"};if(e==="1")return {kind:"disconnect"};if(e==="0"){let s=Ce(n);return {kind:"open",pingInterval:typeof(s==null?void 0:s.pingInterval)=="number"?s.pingInterval:25e3,pingTimeout:typeof(s==null?void 0:s.pingTimeout)=="number"?s.pingTimeout:2e4}}if(e!=="4")return {kind:"other"};let r=n.charAt(0),i=n.slice(1);if(r==="0")return {kind:"connected"};if(r==="1")return {kind:"disconnect"};if(r==="4"){let s=Ce(i);return {kind:"connectError",message:typeof(s==null?void 0:s.message)=="string"?s.message:"refused"}}if(r!=="2")return {kind:"other"};let o=Ce(i);return !Array.isArray(o)||typeof o[0]!="string"?{kind:"other"}:{kind:"event",name:o[0],payload:o[1]}}function Ce(t){try{return JSON.parse(t)}catch(e){return null}}var sn="/socket.io/?EIO=4&transport=websocket",on=250,te=class{constructor(e){this.options=e;c(this,"socket",null);c(this,"heartbeat",null);c(this,"pending",null);c(this,"lastKey","");c(this,"ready",false);c(this,"closed",false);c(this,"heartbeatWindow",45e3);c(this,"factory");c(this,"setTimer");c(this,"clearTimer");var n,r,i;this.factory=(n=e.socketFactory)!=null?n:an,this.setTimer=(r=e.setTimer)!=null?r:((o,s)=>setTimeout(o,s)),this.clearTimer=(i=e.clearTimer)!=null?i:(o=>clearTimeout(o));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${sn}`,n;try{n=this.factory(e);}catch(r){this.options.onClosed(false);return}this.socket=n,n.onmessage=r=>this.receive(String(r.data)),n.onerror=()=>n.close(),n.onclose=()=>this.fell();}close(){this.closed=true,this.stopHeartbeat(),this.pending!==null&&this.clearTimer(this.pending),this.pending=null;let e=this.socket;this.socket=null,e==null||e.close();}receive(e){var r,i,o,s;let n=pt(e);if(n.kind==="open"){this.armHeartbeat(n.pingInterval+n.pingTimeout),(r=this.socket)==null||r.send(lt({projectKey:this.options.projectKey}));return}if(n.kind==="ping"){this.armHeartbeat(),(i=this.socket)==null||i.send(ut());return}if(n.kind==="connectError"||n.kind==="disconnect"){this.stopHeartbeat(),(o=this.socket)==null||o.close();return}if(n.kind==="event"){if(n.name==="ready"){this.ready=true;return}if(n.name==="flagChange"){let a=(s=n.payload)==null?void 0:s.key;this.lastKey=typeof a=="string"?a:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},on));}}}fell(){this.stopHeartbeat();let e=this.ready;this.socket=null,this.ready=false,this.closed||this.options.onClosed(e);}armHeartbeat(e){e!==void 0&&(this.heartbeatWindow=e),this.stopHeartbeat(),this.heartbeat=this.setTimer(()=>{var n;return (n=this.socket)==null?void 0:n.close()},this.heartbeatWindow);}stopHeartbeat(){this.heartbeat!==null&&this.clearTimer(this.heartbeat),this.heartbeat=null;}};function an(t){let e=globalThis.WebSocket;if(!e)throw new h("no WebSocket");return new e(t)}var ne=class{constructor(e){c(this,"fetch");c(this,"host");c(this,"projectKey");c(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){var s,a;let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let d=await n(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!d.ok)throw new h(`flags request failed with status ${d.status}`,d.status);let u=JSON.parse(await d.text());return {flags:(s=u.flags)!=null?s:{},variants:(a=u.variants)!=null?a:{}}}finally{o!==void 0&&clearTimeout(o);}}async snapshot(){var o;let e=this.fetch;if(!e)throw new h("no fetch implementation available in this runtime");let n=`${this.host}/v1/flags/snapshot`,r=w(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await e(n,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new h(`flag snapshot request failed with status ${s.status}`,s.status);let a=JSON.parse(await s.text()),d={flags:(o=a.flags)!=null?o:[],generatedAt:a.generatedAt};return typeof a.socketUrl=="string"&&a.socketUrl!==""&&(d.socketUrl=a.socketUrl),d}finally{i!==void 0&&clearTimeout(i);}}async memberships(e){var s;let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await n(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new h(`memberships request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).cohorts)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};var mt="$form_viewed",gt="$form_started",z=class extends Error{constructor(n,r,i){super(i);c(this,"fields");c(this,"status");this.name="FormRefusedError",this.status=n,this.fields=r;}},re=class{constructor(e){c(this,"fetch");c(this,"host");c(this,"projectKey");c(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async request(e,n){let r=this.fetch;if(!r)throw new h("no fetch implementation available in this runtime");let i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s={authorization:`Bearer ${this.projectKey}`};n.body!==void 0&&(s["content-type"]="application/json");let a=await r(`${this.host}${e}`,{body:n.body,headers:s,method:n.method,signal:i==null?void 0:i.signal});return {status:a.status,text:await a.text()}}finally{o!==void 0&&clearTimeout(o);}}async form(e,n){let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}?distinct_id=${encodeURIComponent(n)}`,{method:"GET"});if(r<200||r>=300)throw new h(`form request failed with status ${r}`,r);return JSON.parse(i)}async submit(e,n){var a,d,u,p;let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}/submissions`,{body:JSON.stringify(n),method:"POST"});if(r>=200&&r<300)return JSON.parse(i).afterSubmit;let o=[],s=`form submission failed with status ${r}`;try{let l=JSON.parse(i);o=(d=(a=l.error)==null?void 0:a.fields)!=null?d:[],s=(p=(u=l.error)==null?void 0:u.message)!=null?p:s;}catch(l){o=[];}throw new z(r,o,s)}};var ht="$survey_shown",ft="$survey_dismissed",yt="$survey_sent",ie=class{constructor(e){c(this,"fetch");c(this,"host");c(this,"projectKey");c(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async surveys(e,n){var s;let r=this.fetch;if(!r)throw new h("no fetch implementation available in this runtime");let i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await r(`${this.host}/v1/surveys?distinct_id=${encodeURIComponent(e)}${n?`&lang=${encodeURIComponent(n)}`:""}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new h(`surveys request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).surveys)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};function se(t,e){let n={$survey_id:t.id,$survey_iteration:t.iteration,$survey_name:t.name};for(let[r,i]of Object.entries(e))n[`$survey_response_${r}`]=i;return n}var oe=class{constructor(e){c(this,"fetch");c(this,"host");c(this,"projectKey");c(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async guides(e){var o;let n=this.fetch;if(!n)throw new h("no fetch implementation available in this runtime");let r=w(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await n(`${this.host}/v1/guides?distinct_id=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new h(`guides request failed with status ${s.status}`,s.status);return (o=JSON.parse(await s.text()).guides)!=null?o:[]}finally{i!==void 0&&clearTimeout(i);}}};function vt(t,e){let n={$guide_id:t.id,$guide_iteration:t.iteration,$guide_name:t.name};return e!==void 0&&(n.$guide_step_id=e),n}function Ee(t){if(typeof t!="string")return;let e=Array.from(t).length;return e>=1&&e<=200?t:void 0}function Fe(t,e){return `pdx.${t}.${e}`}var _e="consent",dn=["identityLink","analytics","marketing","functional"];function Te(t){if(typeof t!="string")return null;try{let e=JSON.parse(t);if(e===null||typeof e!="object"||Array.isArray(e))return null;let n=e,r={};for(let i of dn){let o=n[i];typeof o=="boolean"&&(r[i]=o);}return typeof n.version=="number"&&Number.isInteger(n.version)&&(r.version=n.version),Array.isArray(n.categories)&&n.categories.every(i=>typeof i=="string")&&(r.categories=n.categories),Object.keys(r).length===0?null:r}catch(e){return null}}var bt=t=>t.endsWith(`.${_e}`);function de(t,e){return Te(t.getItem(Fe(e,_e)))}function cn(t,e,n){var s;let r=Fe(e,_e),i=Te(JSON.stringify(n)),o=i===null?null:Te(JSON.stringify({...(s=de(t,e))!=null?s:{},...i}));if(o===null){t.removeItem(r);return}t.setItem(r,JSON.stringify(o));}var ae=class{constructor(e,n,r,i){this.storage=e;this.shared=n;this.ids=r;this.namespace=i;c(this,"anonymousId");c(this,"distinctId");c(this,"identified");this.refresh();}refresh(){let e=Ee(this.shared.getItem(this.key("anonymous_id"))),n=Ee(this.storage.getItem(this.key("anonymous_id")));e?(this.anonymousId=e,n!==e&&this.storage.setItem(this.key("anonymous_id"),e)):n?(this.anonymousId=n,this.shared.setItem(this.key("anonymous_id"),n)):(this.anonymousId=this.ids.uuid(),this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId));let r=Ee(this.storage.getItem(this.key("distinct_id")));r?(this.distinctId=r,this.identified=true):(this.distinctId=this.anonymousId,this.identified=false);}getAnonymousId(){return this.anonymousId}getDistinctId(){return this.distinctId}isIdentified(){return this.identified}snapshot(){return {anonymousId:this.anonymousId,distinctId:this.distinctId,identified:this.identified}}consent(){return de(this.shared,this.namespace)}setConsent(e){cn(this.shared,this.namespace,e);}assumeAnonymousId(e){this.anonymousId=e,this.shared.setItem(this.key("anonymous_id"),e),this.storage.setItem(this.key("anonymous_id"),e),this.identified||(this.distinctId=e);}identify(e){var o;let n=!this.identified||this.distinctId!==e,r=this.storage.getItem(this.key("linked_anonymous_id")),i=n||r!==this.anonymousId;return this.distinctId=e,this.identified=true,n&&this.storage.setItem(this.key("distinct_id"),e),!i||((o=this.consent())==null?void 0:o.identityLink)===false?{changed:n}:(this.storage.setItem(this.key("linked_anonymous_id"),this.anonymousId),{anonymousToLink:this.anonymousId,changed:n})}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 Fe(this.namespace,e)}};var ce=class{constructor(e){c(this,"fetch");c(this,"host");c(this,"projectKey");c(this,"requestTimeoutMs");var n;this.fetch=T(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(n=e.requestTimeoutMs)!=null?n:1e4;}async inbox(e){var s;let n=this.requireFetch(),r=`${this.host}/v1/messages?distinct_id=${encodeURIComponent(e)}`,i=await this.request(n,r,{headers:this.authHeaders(),method:"GET"});if(!i.ok)throw new h(`inbox request failed with status ${i.status}`,i.status);return (s=JSON.parse(await i.text()).messages)!=null?s:[]}async markRead(e,n){let r=this.requireFetch(),i=`${this.host}/v1/messages/read`,o=await this.request(r,i,{body:JSON.stringify({distinct_id:n,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!o.ok)throw new h(`mark-read request failed with status ${o.status}`,o.status)}requireFetch(){if(!this.fetch)throw new h("no fetch implementation available in this runtime");return this.fetch}authHeaders(){return {authorization:`Bearer ${this.projectKey}`}}async request(e,n,r){let i=w(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(n,{...r,signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}};var le=class{constructor(e,n){this.maxSize=e;this.onOverflow=n;c(this,"events",[]);}get size(){return this.events.length}enqueue(e){this.events.push(e),this.enforceCap();}restore(e){this.events.push(...e),this.enforceCap();}requeue(e){this.events.unshift(...e),this.enforceCap();}drain(e){let n=e===void 0?this.events.length:Math.min(e,this.events.length);return this.events.splice(0,n)}snapshot(){return [...this.events]}enforceCap(){var n;if(this.events.length<=this.maxSize)return;let e=this.events.splice(0,this.events.length-this.maxSize);(n=this.onOverflow)==null||n.call(this,{dropped:e});}};var ln={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function un(t){return `pdx.${t}.session`}var ue=class{constructor(e,n,r,i,o=ln){this.storage=e;this.ids=n;this.clock=r;this.namespace=i;this.options=o;}current(){return this.touch().id}startedAt(){return this.touch().startedAt}reset(){this.storage.removeItem(this.key());}touch(){let e=this.clock.now().getTime(),n=this.live(this.read(),e);if(n===void 0)return this.write({id:this.ids.uuid(),lastActivityAt:e,startedAt:e});if(e-n.lastActivityAt<=this.options.throttleMs)return n;let r=this.live(this.read(),e),i=r!==void 0&&r.id!==n.id?r:n;return this.write({...i,lastActivityAt:e})}live(e,n){if(e!==void 0&&!(n-e.lastActivityAt>this.options.idleMs||n-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 n=JSON.parse(e);return typeof n.id=="string"&&typeof n.startedAt=="number"&&typeof n.lastActivityAt=="number"?{id:n.id,lastActivityAt:n.lastActivityAt,startedAt:n.startedAt}:void 0}catch(n){return}}key(){return un(this.namespace)}};var S={createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",set:"$set"};var xt=6e4;function pn(t){return t.length*3<=xt||new TextEncoder().encode(t).length<=xt}function kt(t){return t>=400&&t<500&&t!==429}var j=class{constructor(e={}){c(this,"fetch");c(this,"maxRetries");c(this,"requestTimeoutMs");c(this,"baseDelayMs");c(this,"maxDelayMs");c(this,"sleep");c(this,"random");var n,r,i,o,s,a;this.fetch=T(e.fetch),this.maxRetries=(n=e.maxRetries)!=null?n:3,this.requestTimeoutMs=(r=e.requestTimeoutMs)!=null?r:1e4,this.baseDelayMs=(i=e.baseDelayMs)!=null?i:500,this.maxDelayMs=(o=e.maxDelayMs)!=null?o:3e4,this.sleep=(s=e.sleep)!=null?s:Ke,this.random=(a=e.random)!=null?a:Math.random;}async send(e,n={}){let r=this.fetch;if(!r)throw new h("no fetch implementation available in this runtime");let i=JSON.stringify(e.body),o=n.keepalive===true&&pn(i),s;for(let a=0;a<=this.maxRetries;a+=1){try{let d=await this.attempt(r,e,i,o);if(d.ok)return;if(kt(d.status))throw new h(`ingest rejected batch with status ${d.status}`,d.status);s=new h(`ingest transient status ${d.status}`,d.status);}catch(d){if(d instanceof h&&d.status!==void 0&&kt(d.status))throw d;s=d;}a<this.maxRetries&&await this.sleep(this.backoff(a));}throw new h("ingest delivery failed after retries",void 0,{cause:s})}async attempt(e,n,r,i){let o=w(),s=o?setTimeout(()=>o.abort(),this.requestTimeoutMs):void 0;try{return await e(n.url,{body:r,headers:{authorization:`Bearer ${n.projectKey}`,"content-type":"application/json"},...i?{keepalive:!0}:{},method:"POST",signal:o==null?void 0:o.signal})}finally{s!==void 0&&clearTimeout(s);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};var mn="queue",gn=1e3,St=3e4,Ie=t=>{let e={};return t.avatar!==void 0&&(e.$avatar=t.avatar),t.email!==void 0&&(e.$email=t.email),t.name!==void 0&&(e.$name=t.name),t.phone!==void 0&&(e.$phone=t.phone),e},pe=class{constructor(e){c(this,"config");c(this,"identity");c(this,"session");c(this,"queue");c(this,"transport");c(this,"flagsClient");c(this,"messagesClient");c(this,"surveysClient");c(this,"guidesClient");c(this,"captureListeners",new Set);c(this,"formsClient");c(this,"ctasClient");c(this,"context");c(this,"flushTimer");c(this,"flushing",false);c(this,"cachedFlags");c(this,"cachedSnapshot");c(this,"membershipCache");c(this,"stream");c(this,"shutDown",false);c(this,"exposures",new Set);c(this,"gates");c(this,"cookielessId");c(this,"storageListeners",new Set);var s,a,d;let n=Qe(e),r=(a=(s=de(n.sharedStorage,n.namespace))!=null?s:n.consent)!=null?a:null;if(this.gates=[new U(n.storage),new U(n.sharedStorage,bt)],n.consentMode!=="banner"||(r==null?void 0:r.analytics)===true)for(let u of this.gates)u.open();let[i,o]=this.gates;this.config={...n,sharedStorage:o,storage:i},this.identity=new ae(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 ue(this.config.sharedStorage,this.config.ids,this.config.clock,this.config.namespace):void 0,this.queue=new le(this.config.maxQueueSize,({dropped:u})=>{this.config.onError(new O("queue_overflow",`event queue overflow: dropped ${u.length} oldest event(s)`));}),this.transport=(d=this.config.transport)!=null?d:new j({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new ne({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new ce({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.surveysClient=new ie({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.guidesClient=new oe({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.formsClient=new re({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.ctasClient=new X({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.context={sdk:this.config.sdkName,sdk_version:this.config.sdkVersion},this.config.os&&(this.context.os=this.config.os),this.config.locale&&(this.context.locale=this.config.locale),this.restoreQueue(),this.startTimer();}get distinctId(){return this.identity.getDistinctId()}get anonymousId(){return this.identity.getAnonymousId()}get isIdentified(){return this.identity.isIdentified()}get sessionId(){var e;return (e=this.session)==null?void 0:e.current()}get sessionStartedAt(){var e;return (e=this.session)==null?void 0:e.startedAt()}capture(e,n={}){var r,i,o,s,a,d,u;try{this.identity.refresh();let p={...this.config.defaultProperties(),...n.element===void 0?{}:(o=(i=(r=this.config).describeElement)==null?void 0:i.call(r,n.element))!=null?o:{},...(s=n.properties)!=null?s:{}},l=tt({context:this.context,distinctId:(a=n.distinctId)!=null?a:this.identity.getDistinctId(),eventName:e,properties:p,sessionId:(u=n.sessionId)!=null?u:(d=this.session)==null?void 0:d.current(),timestamp:n.timestamp},this.config.clock,this.config.ids);this.enqueue(l);}catch(p){this.config.onError(p);}for(let p of this.captureListeners)try{p(e);}catch(l){this.config.onError(l);}}onCapture(e){return this.captureListeners.add(e),()=>{this.captureListeners.delete(e);}}identify(e,n={}){var a,d;if(this.isCookieless())return;this.identity.refresh();let r=this.identity.identify(e),i={};r.anonymousToLink!==void 0&&(i.$anon_distinct_id=r.anonymousToLink);let o=He(),s={...o===null?{}:{$timezone:o},...Ie((a=n.traits)!=null?a:{}),...(d=n.set)!=null?d:{}};Object.keys(s).length>0&&(i.$set=s),this.capture(S.identify,{properties:i});}link(e,n,r){if(this.isCookieless())return;let i={$anon_distinct_id:n},o=Ie(r!=null?r:{});Object.keys(o).length>0&&(i.$set=o),this.capture(S.identify,{distinctId:e,properties:i});}setConsent(e){this.identity.setConsent(e),e.analytics===true&&this.allowStorage(),e.analytics===false&&this.config.consentMode==="banner"&&this.forbidStorage();}isCookieless(){return !this.gates[0].isOpen}takeCookielessId(e){this.cookielessId=e,this.isCookieless()&&this.identity.assumeAnonymousId(e);}allowStorage(){if(this.isCookieless()){for(let e of this.gates)e.open();this.identity.refresh();for(let e of [...this.storageListeners])e();}}onStorageAllowed(e){return this.storageListeners.add(e),()=>{this.storageListeners.delete(e);}}forbidStorage(){if(!this.isCookieless()){for(let e of ["anonymous_id","distinct_id","linked_anonymous_id","session"])this.config.storage.removeItem(`pdx.${this.config.namespace}.${e}`),this.config.sharedStorage.removeItem(`pdx.${this.config.namespace}.${e}`);for(let e of this.gates)e.close();this.identity.refresh(),this.cookielessId!==void 0&&this.identity.assumeAnonymousId(this.cookielessId);}}consent(){return this.identity.consent()}alias(e){this.capture(S.createAlias,{properties:{alias:e}});}group(e,n,r){let i={$group_key:n,$group_type:e};r&&(i.$set=r),this.capture(S.group,{properties:i});}setPersonProperties(e,n){if(this.isCookieless())return;let r={};e&&(r.$set=e),n&&(r.$set_once=n),this.capture(S.set,{properties:r});}setPersonTraits(e){if(this.isCookieless())return;let n=Ie(e);Object.keys(n).length!==0&&this.capture(S.set,{properties:{$set:n}});}async getAllFlags(){var r;let e=this.identity.getDistinctId(),n=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:n.flags,variants:(r=n.variants)!=null?r:{}},n.flags}async isFeatureEnabled(e){var i,o,s,a;let r=(i=(await this.getAllFlags())[e])!=null?i:false;return this.recordExposure(e,(a=(s=(o=this.cachedFlags)==null?void 0:o.variants[e])==null?void 0:s.key)!=null?a:String(r)),r}async getVariant(e){var i,o,s,a;let n=await this.getAllFlags(),r=(o=(i=this.cachedFlags)==null?void 0:i.variants[e])!=null?o:null;return this.recordExposure(e,(a=r==null?void 0:r.key)!=null?a:String((s=n[e])!=null?s:false)),r}async getVariantLocal(e,n={}){var d;let r=await this.flagSnapshot(),i=r.flags.find(u=>u.key===e),o=await this.localContext(n,r.flags),s=i?we(i,r.flags,o):null,a=i?ee(i,r.flags,o).enabled:false;return this.recordExposure(e,(d=s==null?void 0:s.key)!=null?d:String(a)),s?{key:s.key,value:s.value}:null}recordExposure(e,n){let r=`${this.identity.getDistinctId()} ${e} ${n}`;this.exposures.has(r)||(this.exposures.add(r),this.capture(S.featureFlagCalled,{properties:{$feature_flag:e,$feature_flag_response:n}}));}getCachedFlag(e){if(!(!this.cachedFlags||this.cachedFlags.distinctId!==this.distinctId))return this.cachedFlags.flags[e]}async getLocalFlags(e={}){let n=await this.flagSnapshot();return dt(n.flags,await this.localContext(e,n.flags))}async isFeatureEnabledLocal(e,n={}){var a,d;let r=await this.flagSnapshot(),i=r.flags.find(u=>u.key===e),o=await this.localContext(n,r.flags),s=i?ee(i,r.flags,o).enabled:false;return this.recordExposure(e,(d=i?(a=we(i,r.flags,o))==null?void 0:a.key:void 0)!=null?d:String(s)),s}async localContext(e,n){let r=this.identity.getDistinctId(),i=e.cohorts;if(i===void 0&&ct(n)){let o=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===r&&o-this.membershipCache.fetchedAt<St?i=this.membershipCache.cohorts:(i=await this.flagsClient.memberships(r),this.membershipCache={cohorts:i,distinctId:r,fetchedAt:o});}return {attributes:e.attributes,cohorts:i,distinctId:r,properties:e.properties}}async flagSnapshot(){let e=this.config.clock.now().getTime();if(this.cachedSnapshot&&e-this.cachedSnapshot.fetchedAt<St)return this.cachedSnapshot.snapshot;let n=await this.flagsClient.snapshot();return this.cachedSnapshot={fetchedAt:e,snapshot:n},this.maybeStream(n),n}maybeStream(e){if(!this.config.streamFlags||this.shutDown||this.stream||!e.socketUrl)return;let n=new te({host:e.socketUrl,onChange:()=>{this.cachedSnapshot=void 0,this.flagSnapshot().catch(r=>this.config.onError(r));},onClosed:r=>{this.stream=void 0,r&&this.maybeStream(e);},projectKey:this.config.apiKey,socketFactory:this.config.socketFactory});this.stream=n,n.open();}async getInbox(){return this.messagesClient.inbox(this.identity.getDistinctId())}async markMessageRead(e){await this.messagesClient.markRead(e,this.identity.getDistinctId());}async getSurveys(e){return this.surveysClient.surveys(this.identity.getDistinctId(),e!=null?e:this.config.locale)}captureSurveyShown(e){this.capture(ht,{properties:se(e,{})});}captureSurveyDismissed(e){this.capture(ft,{properties:se(e,{})});}captureSurveySent(e,n){this.capture(yt,{properties:se(e,n)});}async getGuides(){return this.guidesClient.guides(this.identity.getDistinctId())}captureGuide(e,n,r){this.capture(e,{properties:vt(n,r)});}async getForm(e){return this.formsClient.form(e,this.identity.getDistinctId())}async submitForm(e,n,r,i){let{$page_id:o,$page_variant:s}=this.config.defaultProperties();return this.formsClient.submit(e,{answers:n,challenge:r,distinctId:this.identity.getDistinctId(),isAnonymous:!this.identity.isIdentified(),pageUrl:typeof window=="undefined"?"":window.location.href,solution:i,...typeof o=="string"&&typeof s=="string"?{pageId:o,pageVariant:s}:{}})}async getCtas(e){return this.ctasClient.ctas({...e,anonymous:!this.identity.isIdentified(),distinctId:this.identity.getDistinctId()})}captureCta(e,n,r){this.capture(e,{properties:et(n,r)});}async flush(){if(this.flushing||this.queue.size===0)return;this.flushing=true;let e=this.queue.drain(gn);try{await this.transport.send({body:{events:e,sent_at:Q(this.config.clock.now())},projectKey:this.config.apiKey,url:`${this.config.host}/v1/events`}),this.persistQueue();}catch(n){this.queue.requeue(e),this.persistQueue(),this.config.onError(n);}finally{this.flushing=false;}}reset(){var e;(e=this.session)==null||e.reset(),this.identity.reset(),this.cachedFlags=void 0,this.cachedSnapshot=void 0,this.membershipCache=void 0;}async shutdown(){var e;this.shutDown=true,this.stopTimer(),(e=this.stream)==null||e.close(),this.stream=void 0,await this.flush();}enqueue(e){this.queue.enqueue(e),this.persistQueue(),this.queue.size>=this.config.flushAt&&this.flush();}persistQueue(){try{this.config.storage.setItem(this.persistKey(),JSON.stringify(this.queue.snapshot()));}catch(e){this.config.onError(e);}}restoreQueue(){try{let e=this.config.storage.getItem(this.persistKey());if(!e)return;let n=JSON.parse(e);Array.isArray(n)&&this.queue.restore(n);}catch(e){this.config.onError(e);}}startTimer(){if(this.config.flushIntervalMs<=0)return;let e=setInterval(()=>{this.flush();},this.config.flushIntervalMs),n=e;typeof n.unref=="function"&&n.unref(),this.flushTimer=e;}stopTimer(){this.flushTimer!==void 0&&(clearInterval(this.flushTimer),this.flushTimer=void 0);}persistKey(){return `pdx.${this.config.namespace}.${mn}`}};function hn(){let t=globalThis.document;return (t==null?void 0:t.visibilityState)==="hidden"}var me=class{constructor(e={}){c(this,"fetchTransport");this.fetchTransport=new j(e);}async send(e){await this.fetchTransport.send(e,{keepalive:hn()});}};var $e="prodantix:consent-ready",Ae="prodantix:consent",wt="__prodantixConsent";var Ct=(t,e)=>{t.takeCookielessId(e.anonymousId),e.consent!==null?t.setConsent(e.consent):e.rule==="notice"&&t.allowStorage();},Et=(t,e)=>{let n=e[wt];n&&Ct(t,n);let r=o=>{let s=o.detail;s&&Ct(t,s);},i=o=>{let s=o.detail;s&&t.setConsent(s);};return e.addEventListener($e,r),e.addEventListener(Ae,i),()=>{e.removeEventListener($e,r),e.removeEventListener(Ae,i);}};var fn=/^\d{1,3}(\.\d{1,3}){3}$/,yn=/^[a-z0-9.-]+$/i;function Tt(){return Math.random().toString(36).slice(2,12)}function ge(t,e){let n=`${e}=`,r=[];for(let i of t.cookie.split(";")){let o=i.trim();o.startsWith(n)&&r.push(o.slice(n.length));}return r}function J(t,e,n){let r=["Path=/",`Max-Age=${e}`,"SameSite=Lax"];return t&&r.push(`Domain=${t}`),n&&r.push("Secure"),r.join("; ")}function Ft(t,e,n,r){try{let i=`pdx_probe_${r()}`,o=r();t.cookie=`${i}=${o}; ${J(e,60,n)}`;let s=ge(t,i).includes(o);t.cookie=`${i}=; ${J(e,0,n)}`;let a=ge(t,i).includes(o);return s&&!a}catch(i){return false}}function vn(t){let e=t.replace(/^\[|\]$/g,"").toLowerCase();if(e.includes(":")||fn.test(e)||!e.includes("."))return [];let n=e.split("."),r=[];for(let i=n.length-2;i>=0;i-=1)r.push(n.slice(i).join("."));return r}function bn(t,e,n,r=Tt){for(let i of vn(t))if(Ft(e,i,n,r))return i}function xn(t){let e=new Map,n=JSON.parse(decodeURIComponent(t));if(n===null||typeof n!="object"||Array.isArray(n))return e;for(let[r,i]of Object.entries(n))typeof i=="string"&&e.set(r,i);return e}var Pe=class{constructor(e,n,r,i){this.jar=e;this.name=n;this.domain=r;this.secure=i;}getItem(e){var n;return (n=this.read().get(e))!=null?n:null}setItem(e,n){let r=this.read();r.set(e,n),this.write(r);}removeItem(e){let n=this.read();n.delete(e)&&this.write(n);}read(){try{let e=ge(this.jar,this.name);e.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${J(void 0,0,this.secure)}`,e=ge(this.jar,this.name));let n=e[0];return n?xn(n):new Map}catch(e){return new Map}}write(e){try{if(e.size===0){this.jar.cookie=`${this.name}=; ${J(this.domain,0,this.secure)}`;return}let n=encodeURIComponent(JSON.stringify(Object.fromEntries(e)));this.jar.cookie=`${this.name}=${n}; ${J(this.domain,31536e3,this.secure)}`;}catch(n){return}}};function kn(){return globalThis.document}function Sn(){var t,e;return (e=(t=globalThis.location)==null?void 0:t.hostname)!=null?e:""}function wn(){var t;return ((t=globalThis.location)==null?void 0:t.protocol)==="https:"}function Cn(t){if(t===void 0)return;let e=t.startsWith(".")?t.slice(1):t;return yn.test(e)?e.toLowerCase():void 0}function _t(t){var s,a,d,u,p;let e="jar"in t?t.jar:kn();if(!e||((s=globalThis.navigator)==null?void 0:s.cookieEnabled)===false)return null;let r=(a=t.random)!=null?a:Tt,i=(d=t.secure)!=null?d:wn(),o=(u=t.hostname)!=null?u:Sn();try{let l=(p=Cn(t.domain))!=null?p:bn(o,e,i,r);return Ft(e,l,i,r)?new Pe(e,t.name,l,i):null}catch(l){return null}}var he=t=>`prodantix-cta:${t}`,It=t=>{try{let e=window.localStorage.getItem(he(t));return e===null?null:Number(e)}catch(e){return null}},$t=t=>{try{return window.sessionStorage.getItem(he(t))!==null}catch(e){return false}},At=(t,e)=>{try{window.localStorage.setItem(he(t),String(e)),window.sessionStorage.setItem(he(t),String(e));}catch(n){return}},Pt=(t,e,n,r)=>e===null?true:t.kind==="once"?false:t.kind==="session"?!n:r-e>=t.value*864e5;var N={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"}},Rt=t=>{var n;let e=(n=(t!=null?t:"").toLowerCase().split("-")[0])!=null?n:"";return e in N?e:"en"};var v="prodantix-cta",Mt="prodantix-cta-style",En=`.${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
2
|
.${v} *{box-sizing:border-box}
|
|
3
3
|
.${v} h2{font-size:18px;line-height:1.3;margin:0;font-weight:700}
|
|
4
4
|
.${v} p{margin:0;font-size:15px;line-height:1.5}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
dialog.${v}{border:0;max-width:min(480px,calc(100vw - 32px));box-shadow:0 16px 48px rgba(0,0,0,.24)}
|
|
20
20
|
dialog.${v}::backdrop{background:rgba(0,0,0,.45)}
|
|
21
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}}`,
|
|
22
|
+
@keyframes pdx-cta-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}`,Tn=()=>{if(document.getElementById(Mt))return;let t=document.createElement("style");t.id=Mt,t.textContent=En,document.head.append(t);},Fn=(t,e)=>{let n=e.variant.style;for(let[r,i]of [["--pdx-background",n.background],["--pdx-text",n.text],["--pdx-button",n.button],["--pdx-button-text",n.buttonText],["--pdx-radius",`${n.radius}px`]])t.style.setProperty(r,i);},Re=(t,e,n,r)=>{let i=e.variant.content,o=N[n.language];if(t.className=v,t.dataset.kind=e.kind,t.dataset.placement=e.placement,t.dataset.ctaId=e.id,Fn(t,e),i.image){let a=document.createElement("img");a.src=i.image,a.alt=i.imageAlt,a.loading="lazy",t.append(a);}let s=document.createElement("div");if(s.className="pdx-text",i.heading){let a=document.createElement("h2");a.textContent=i.heading,s.append(a);}if(i.body){let a=document.createElement("p");a.textContent=i.body,s.append(a);}if(t.append(s),i.buttons.length>0){let a=document.createElement("div");a.className="pdx-actions",i.buttons.forEach((d,u)=>{let p=document.createElement("button");p.type="button",p.textContent=d.label,p.dataset.action=`button-${u}`,u>0&&(p.dataset.secondary=""),p.addEventListener("click",()=>n.onButton(u)),a.append(p);}),t.append(a);}if(r){let a=document.createElement("button");a.type="button",a.className="pdx-close",a.dataset.action="close",a.textContent="\xD7",a.setAttribute("aria-label",o.close),a.title=o.close,a.addEventListener("click",r),t.append(a);}if(e.poweredBy){let a=document.createElement("p");a.className="pdx-meta",a.textContent=o.poweredBy,t.append(a);}},Nt=(t,e)=>{Tn();let n=t.variant.content.heading||t.variant.content.body;if(t.kind==="embedded"){let s=[...document.querySelectorAll("[data-prodantix-cta]")].filter(a=>a.dataset.prodantixCta===t.id).map(a=>{let d=document.createElement("section");return d.setAttribute("aria-label",n),Re(d,t,e,null),a.replaceChildren(d),d});return {destroy:()=>s.forEach(a=>a.remove()),elements:s}}if(t.kind==="popup"){let o=document.activeElement instanceof HTMLElement?document.activeElement:null,s=document.createElement("dialog");s.setAttribute("aria-label",n);let a=false,d=()=>{a||(a=true,s.open&&s.close(),s.remove(),o==null||o.focus());},u=()=>{d(),e.onDismiss();};return Re(s,t,e,u),s.addEventListener("cancel",p=>{p.preventDefault(),u();}),document.body.append(s),s.showModal(),{destroy:d,elements:[s]}}let r=document.createElement("section");r.setAttribute("aria-label",n),t.kind==="slide_in"&&(r.setAttribute("role","dialog"),r.setAttribute("aria-modal","false"));let i=()=>r.remove();return Re(r,t,e,()=>{i(),e.onDismiss();}),document.body.append(r),{destroy:i,elements:[r]}};var Lt=(t,e)=>{let n=false,r=[],i=()=>{n=true;for(let s of r.splice(0))s();},o=()=>{n||(i(),e());};if(t.kind==="load")queueMicrotask(o);else if(t.kind==="delay"){let s=setTimeout(o,t.value*1e3);r.push(()=>clearTimeout(s));}else if(t.kind==="scroll"){let s=()=>{let a=document.documentElement.scrollHeight-window.innerHeight;(a<=0||window.scrollY/a*100>=t.value)&&o();};window.addEventListener("scroll",s,{passive:true}),r.push(()=>window.removeEventListener("scroll",s)),s();}else if(t.kind==="exit"){let s=a=>{a.relatedTarget===null&&a.clientY<=0&&o();};document.addEventListener("mouseout",s),r.push(()=>document.removeEventListener("mouseout",s));}else {let s=t.value,a=u=>{try{return u.closest(s)!==null}catch(p){return false}},d=u=>{let p=u.target;p instanceof Element&&a(p)&&o();};document.addEventListener("click",d,true),r.push(()=>document.removeEventListener("click",d,true));}return i};var _n=t=>{let e=0;for(let n of t){if(n!==0)return e+Math.clz32(n)-24;e+=8;}return e},In=async t=>new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t))),Ot=async t=>{for(let e=0;;e+=1){let n=e.toString(36);if(_n(await In(`${t.nonce}:${n}`))>=t.difficulty)return n}};var k="prodantix-form",$n=`.${k}{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
|
.${k} *{box-sizing:border-box}
|
|
24
24
|
.${k} .pdx-field{display:flex;flex-direction:column;gap:4px;margin:0 0 12px}
|
|
25
25
|
.${k} .pdx-field[hidden]{display:none}
|
|
@@ -32,6 +32,6 @@ dialog.${v}::backdrop{background:rgba(0,0,0,.45)}
|
|
|
32
32
|
.${k} button[data-variant=back]{background:transparent;color:inherit;border:1px solid currentColor}
|
|
33
33
|
.${k} .pdx-actions{display:flex;gap:8px;justify-content:flex-end}
|
|
34
34
|
.${k} .pdx-hp{position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden}
|
|
35
|
-
.${k} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}`,Lt=t=>t==null||t===false||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0,$n=(t,e)=>{let n=t.condition;if(!n)return true;let r=e[n.field];return Lt(r)?false:n.op==="is_set"?true:n.op==="equals"?typeof r=="string"&&r===n.values[0]:(Array.isArray(r)?r:[r]).some(o=>typeof o=="string"&&n.values.includes(o))},An=t=>{let e=`${encodeURIComponent(t)}=`,n=document.cookie.split("; ").find(r=>r.startsWith(e));return n?decodeURIComponent(n.slice(e.length)):""},Pn=t=>{var n;let e=t.hidden;return e?e.source==="fixed"?e.value:e.source==="query"?(n=new URLSearchParams(window.location.search).get(e.value))!=null?n:"":An(e.value):""},m=(t,e={},n=[])=>{let r=Object.assign(document.createElement(t),e);return r.append(...n),r},Rn=(t,e,n)=>{var p;let r=m("p",{className:"pdx-error",id:`${e}-error`}),i=t.help?m("p",{className:"pdx-help",id:`${e}-help`},[t.help]):null,o=[i?`${e}-help`:"",`${e}-error`].filter(Boolean).join(" "),s=m("div",{className:"pdx-field"});if(s.dataset.field=t.key,t.kind==="rich_text")return s.append(m("p",{},[t.label])),{error:r,field:t,focus:()=>{},read:()=>{},root:s};if(t.kind==="hidden")return s.hidden=true,{error:r,field:t,focus:()=>{},read:()=>Pn(t),root:s};if(t.kind==="radio"||t.kind==="checkboxes"){let l=m("fieldset",{});l.setAttribute("aria-describedby",o),t.required&&l.setAttribute("aria-required","true"),l.append(m("legend",{},[t.label]));let I=t.options.filter(f=>!f.archived).map((f,C)=>{let F=m("input",{id:`${e}-${C}`,name:e,type:t.kind==="radio"?"radio":"checkbox",value:f.value});return F.addEventListener("change",n),l.append(m("div",{className:"pdx-choice"},[F,m("label",{htmlFor:`${e}-${C}`},[f.label])])),F});return s.append(l,...i?[i]:[],r),{error:r,field:t,focus:()=>{var f;return (f=I[0])==null?void 0:f.focus()},read:()=>{var C;let f=I.filter(F=>F.checked).map(F=>F.value);return t.kind==="radio"?(C=f[0])!=null?C:"":f},root:s}}let a=m("label",{htmlFor:e},[t.label]),c;if(t.kind==="textarea")c=m("textarea",{id:e,placeholder:t.placeholder,rows:4});else if(t.kind==="dropdown")c=m("select",{id:e},[m("option",{value:""},[""]),...t.options.filter(l=>!l.archived).map(l=>m("option",{value:l.value},[l.label]))]);else if(t.kind==="checkbox")c=m("input",{id:e,type:"checkbox"});else {let l={date:"date",email:"email",file:"file",number:"number",phone:"tel"};c=m("input",{id:e,placeholder:t.placeholder,type:(p=l[t.kind])!=null?p:"text"}),t.kind==="email"&&(c.autocomplete="email");}return c.setAttribute("aria-describedby",o),t.required&&c.setAttribute("aria-required","true"),c.addEventListener("input",n),c.addEventListener("change",n),t.kind==="checkbox"?s.append(m("div",{className:"pdx-choice"},[c,a]),...i?[i]:[],r):s.append(a,...i?[i]:[],c,r),{error:r,field:t,focus:()=>c.focus(),read:()=>c instanceof HTMLInputElement&&c.type==="checkbox"?c.checked:t.kind==="number"?c.value===""?"":Number(c.value):c.value,root:s}},Mn=(t,e)=>{let n=e.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[i,o]of Object.entries(r))t.style.setProperty(i,o);},Nn=()=>{document.getElementById("prodantix-form-style")||document.head.append(m("style",{id:"prodantix-form-style",textContent:In}));},qt=(t,e)=>{let{formId:n,host:r,language:i}=e,o=N[i],s=l=>o[l],a=m("form",{className:k,noValidate:true});a.dataset.prodantixForm=n;let c=m("p",{className:"pdx-meta"});c.setAttribute("aria-live","polite"),c.setAttribute("role","status");let u=false,p=r.form(n).then(l=>{if(u)return;if(!l.accepting){a.replaceChildren(m("p",{className:"pdx-meta"},[s("closed")]));return}Nn(),Mn(a,l);let I=l.challenge?Ot(l.challenge):null,A=false,f=[],C=()=>{let g={};for(let y of f.flat())if(!y.root.hidden||y.field.kind==="hidden"){let x=y.read();x!==void 0&&(g[y.field.key]=x);}return g},F=()=>{let g=C();for(let y of f.flat())y.field.kind!=="hidden"&&(y.root.hidden=!$n(y.field,g));},W=()=>{A||(A=true,r.capture(gt,{$form_id:l.id,$form_version:l.version})),F();},R=l.steps.map((g,y)=>{let x=m("div",{});x.dataset.step=String(y),g.title&&x.append(m("p",{className:"pdx-meta"},[g.title]));let b=g.fields.map(_=>Rn(_,`pdx-${n}-${_.key}`,W));return f.push(b),x.append(...b.map(_=>_.root)),x}),Ne=m("input",{autocomplete:"off",name:l.honeypot,tabIndex:-1,type:"text"}),Oe=m("div",{className:"pdx-hp"},[Ne]);Oe.setAttribute("aria-hidden","true");let fe=[],H=m("div",{});if(l.consent.processing){let g=m("input",{id:`pdx-${n}-consent`,type:"checkbox"});g.setAttribute("aria-required","true"),fe.push({input:g,key:"$consent_processing"}),H.append(m("div",{className:"pdx-choice"},[g,m("label",{htmlFor:g.id},[l.consent.processing])]));}for(let g of l.consent.purposes){let y=m("input",{id:`pdx-${n}-consent-${g.key}`,type:"checkbox"});fe.push({input:y,key:`$consent_${g.key}`}),H.append(m("div",{className:"pdx-choice"},[y,m("label",{htmlFor:y.id},[g.label])])),g.notice&&H.append(m("p",{className:"pdx-help"},[g.notice]));}let ye=m("p",{className:"pdx-meta"}),G=m("button",{type:"button"},[s("back")]);G.dataset.variant="back";let Y=m("button",{type:"button"},[s("next")]),O=m("button",{type:"submit"},[s("submit")]);G.dataset.action="back",Y.dataset.action="next",O.dataset.action="submit";let Gt=m("div",{className:"pdx-actions"},[G,Y,O]),P=0,ve=()=>{R.forEach((y,x)=>{y.hidden=x!==P;});let g=P===R.length-1;G.hidden=P===0,Y.hidden=g,O.hidden=!g,H.hidden=!g,ye.hidden=R.length<2,ye.textContent=s("step").replace("{step}",String(P+1)).replace("{total}",String(R.length));},Vt=()=>{var g;for(let y of f.flat())y.error.textContent="",(g=y.root.querySelector("[aria-invalid]"))==null||g.removeAttribute("aria-invalid");},Le=(g,y)=>{var x;g.error.textContent=y,(x=g.root.querySelector("input,select,textarea,fieldset"))==null||x.setAttribute("aria-invalid","true");},qe=g=>{var b,_;Vt();let y=C(),x=((b=f[g])!=null?b:[]).filter(M=>!M.root.hidden&&M.field.required&&Lt(y[M.field.key]));for(let M of x)Le(M,s("required"));return x.length>0?(c.textContent=s("required"),(_=x[0])==null||_.focus(),false):true};G.addEventListener("click",()=>{P=Math.max(0,P-1),ve();}),Y.addEventListener("click",()=>{qe(P)&&(P+=1,ve());}),a.addEventListener("submit",g=>{if(g.preventDefault(),!qe(P))return;let y={...C(),[l.honeypot]:Ne.value};for(let b of fe)y[b.key]=b.input.checked;O.disabled=true,O.textContent=s("sending");let x=l.challenge;if(!x||!I){c.textContent=s("closed");return}I.then(b=>r.submit(n,y,x,b)).then(b=>{if(b.kind==="redirect"&&b.value.startsWith("https://")){window.location.assign(b.value);return}let _=m("p",{},[b.kind==="message"&&b.value?b.value:s("thanks")]);_.setAttribute("role","status"),a.replaceChildren(_);}).catch(b=>{O.disabled=false,O.textContent=s("submit");let _=b instanceof z?b.fields:[];for(let M of _){let De=f.flat().find(Ut=>Ut.field.key===M.field);De&&Le(De,M.rule==="required"?s("required"):s("invalid"));}c.textContent=_.length>0?s("invalid"):s("failed");});}),a.append(ye,...R,Oe,H,Gt,c),l.poweredBy&&e.poweredBy!==false&&a.append(m("p",{className:"pdx-meta"},[s("poweredBy")])),ve(),F(),r.capture(mt,{$form_id:l.id,$form_version:l.version});}).catch(()=>{u||a.replaceChildren(m("p",{className:"pdx-meta"},[s("closed")]));});return t.append(a),{destroy:()=>{u=true,a.remove();},ready:p}};var Dt=t=>({capture:(e,n)=>t.capture(e,{properties:n}),form:e=>t.getForm(e),submit:(e,n,r,i)=>t.submitForm(e,n,r,i)});var On=t=>({capture:(e,n,r)=>t.captureCta(e,n,r),ctas:e=>t.getCtas(e),forms:Dt(t),isEnabled:e=>t.isFeatureEnabled(e),variant:async e=>{var n,r;return (r=(n=await t.getVariant(e))==null?void 0:n.key)!=null?r:null}}),Ln=t=>t<768?"mobile":t<1024?"tablet":"desktop",qn=async(t,e)=>{let n=e.flag;return n?n.variant?await t.variant(n.key)===n.variant:t.isEnabled(n.key):true},Dn=(t,e,n)=>{let r=document.createElement("dialog");r.className="prodantix-form-popup";let i=document.createElement("button");i.type="button",i.textContent="\xD7",i.setAttribute("aria-label",N[n].close),i.title=N[n].close,i.addEventListener("click",()=>r.close()),r.addEventListener("close",()=>r.remove()),r.append(i),document.body.append(r),qt(r,{formId:t,host:e,language:n}),r.showModal();},Kn=()=>{let t=window.prodantix;typeof t=="function"&&t("open");},Bn=async(t,e)=>{var u,p;let n=(u=e.now)!=null?u:Date.now,r=(p=e.open)!=null?p:(l=>window.location.assign(l)),i=[],o=[],s=false,a=()=>{s=true;for(let l of i.splice(0))l();for(let l of o.splice(0))l.destroy();},c=await t.ctas({device:Ln(window.innerWidth),language:document.documentElement.lang||e.language,url:window.location.href});for(let l of c)s||!At(l.frequency,_t(l.id),It(l.id),n())||!await qn(t,l)||i.push(Nt(l.trigger,()=>{if(s)return;let I=Mt(l,{language:e.language,onButton:A=>{var C;t.capture(Ze,l,A);let f=(C=l.variant.content.buttons[A])==null?void 0:C.action;f&&((f.kind!=="url"||l.kind!=="embedded")&&I.destroy(),f.kind==="url"?r(f.value):f.kind==="form"?Dn(f.value,t.forms,e.language):f.kind==="messenger"?Kn():t.capture(xe,l));},onDismiss:()=>t.capture(xe,l)});I.elements.length!==0&&(o.push(I),$t(l.id,n()),t.capture(Xe,l));}));return a},jn=()=>{},Kt=(t,e)=>{let n=On(t),r=Pt(e!=null?e:document.documentElement.lang),i=()=>Bn(n,{language:r}).catch(p=>(console.error("[prodantix] the CTAs for this page could not be read",p),jn)),o=i(),s=window.location.href,a=()=>{if(window.location.href===s)return;s=window.location.href,o=o.then(l=>(l(),i()));},c=history.pushState.bind(history),u=history.replaceState.bind(history);return history.pushState=(...p)=>{c(...p),a();},history.replaceState=(...p)=>{u(...p),a();},window.addEventListener("popstate",a),()=>{history.pushState=c,history.replaceState=u,window.removeEventListener("popstate",a),o.then(p=>p());}};var Bt=(t,e)=>({...t.page?{$page_id:t.page}:{},...t.page&&e?{$page_view_id:e}:{},...t.variant?{$page_variant:t.variant}:{}});var Hn=(t,e)=>{var n;try{return (n=Ft({name:`pdx_${be(t)}`}))!=null?n:e}catch(r){return e}},$=document.currentScript,Me=$==null?void 0:$.dataset.key,jt,Ht;if($&&Me){let t=new URL($.src,window.location.href).origin,e=Be(),n=$.dataset.consent==="banner",r=new pe({apiKey:Me,...n?{consentMode:"banner"}:{},defaultProperties:Bt($.dataset),flagsHost:(jt=$.dataset.edge)!=null?jt:t,host:(Ht=$.dataset.host)!=null?Ht:t,sessionTracking:false,sharedStorage:Hn(Me,e),storage:e,transport:new me({})});n&&Ct(r,window),Kt(r,$.dataset.language);}
|
|
35
|
+
.${k} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}`,qt=t=>t==null||t===false||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0,An=(t,e)=>{let n=t.condition;if(!n)return true;let r=e[n.field];return qt(r)?false:n.op==="is_set"?true:n.op==="equals"?typeof r=="string"&&r===n.values[0]:(Array.isArray(r)?r:[r]).some(o=>typeof o=="string"&&n.values.includes(o))},Pn=t=>{let e=`${encodeURIComponent(t)}=`,n=document.cookie.split("; ").find(r=>r.startsWith(e));return n?decodeURIComponent(n.slice(e.length)):""},Rn=t=>{var n;let e=t.hidden;return e?e.source==="fixed"?e.value:e.source==="query"?(n=new URLSearchParams(window.location.search).get(e.value))!=null?n:"":Pn(e.value):""},m=(t,e={},n=[])=>{let r=Object.assign(document.createElement(t),e);return r.append(...n),r},Mn=(t,e,n)=>{var p;let r=m("p",{className:"pdx-error",id:`${e}-error`}),i=t.help?m("p",{className:"pdx-help",id:`${e}-help`},[t.help]):null,o=[i?`${e}-help`:"",`${e}-error`].filter(Boolean).join(" "),s=m("div",{className:"pdx-field"});if(s.dataset.field=t.key,t.kind==="rich_text")return s.append(m("p",{},[t.label])),{error:r,field:t,focus:()=>{},read:()=>{},root:s};if(t.kind==="hidden")return s.hidden=true,{error:r,field:t,focus:()=>{},read:()=>Rn(t),root:s};if(t.kind==="radio"||t.kind==="checkboxes"){let l=m("fieldset",{});l.setAttribute("aria-describedby",o),t.required&&l.setAttribute("aria-required","true"),l.append(m("legend",{},[t.label]));let I=t.options.filter(f=>!f.archived).map((f,C)=>{let F=m("input",{id:`${e}-${C}`,name:e,type:t.kind==="radio"?"radio":"checkbox",value:f.value});return F.addEventListener("change",n),l.append(m("div",{className:"pdx-choice"},[F,m("label",{htmlFor:`${e}-${C}`},[f.label])])),F});return s.append(l,...i?[i]:[],r),{error:r,field:t,focus:()=>{var f;return (f=I[0])==null?void 0:f.focus()},read:()=>{var C;let f=I.filter(F=>F.checked).map(F=>F.value);return t.kind==="radio"?(C=f[0])!=null?C:"":f},root:s}}let a=m("label",{htmlFor:e},[t.label]),d;if(t.kind==="textarea")d=m("textarea",{id:e,placeholder:t.placeholder,rows:4});else if(t.kind==="dropdown")d=m("select",{id:e},[m("option",{value:""},[""]),...t.options.filter(l=>!l.archived).map(l=>m("option",{value:l.value},[l.label]))]);else if(t.kind==="checkbox")d=m("input",{id:e,type:"checkbox"});else {let l={date:"date",email:"email",file:"file",number:"number",phone:"tel"};d=m("input",{id:e,placeholder:t.placeholder,type:(p=l[t.kind])!=null?p:"text"}),t.kind==="email"&&(d.autocomplete="email");}return d.setAttribute("aria-describedby",o),t.required&&d.setAttribute("aria-required","true"),d.addEventListener("input",n),d.addEventListener("change",n),t.kind==="checkbox"?s.append(m("div",{className:"pdx-choice"},[d,a]),...i?[i]:[],r):s.append(a,...i?[i]:[],d,r),{error:r,field:t,focus:()=>d.focus(),read:()=>d instanceof HTMLInputElement&&d.type==="checkbox"?d.checked:t.kind==="number"?d.value===""?"":Number(d.value):d.value,root:s}},Nn=(t,e)=>{let n=e.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[i,o]of Object.entries(r))t.style.setProperty(i,o);},Ln=()=>{document.getElementById("prodantix-form-style")||document.head.append(m("style",{id:"prodantix-form-style",textContent:$n}));},Dt=(t,e)=>{let{formId:n,host:r,language:i}=e,o=N[i],s=l=>o[l],a=m("form",{className:k,noValidate:true});a.dataset.prodantixForm=n;let d=m("p",{className:"pdx-meta"});d.setAttribute("aria-live","polite"),d.setAttribute("role","status");let u=false,p=r.form(n).then(l=>{if(u)return;if(!l.accepting){a.replaceChildren(m("p",{className:"pdx-meta"},[s("closed")]));return}Ln(),Nn(a,l);let I=l.challenge?Ot(l.challenge):null,A=false,f=[],C=()=>{let g={};for(let y of f.flat())if(!y.root.hidden||y.field.kind==="hidden"){let x=y.read();x!==void 0&&(g[y.field.key]=x);}return g},F=()=>{let g=C();for(let y of f.flat())y.field.kind!=="hidden"&&(y.root.hidden=!An(y.field,g));},W=()=>{A||(A=true,r.capture(gt,{$form_id:l.id,$form_version:l.version})),F();},R=l.steps.map((g,y)=>{let x=m("div",{});x.dataset.step=String(y),g.title&&x.append(m("p",{className:"pdx-meta"},[g.title]));let b=g.fields.map(_=>Mn(_,`pdx-${n}-${_.key}`,W));return f.push(b),x.append(...b.map(_=>_.root)),x}),Ne=m("input",{autocomplete:"off",name:l.honeypot,tabIndex:-1,type:"text"}),Le=m("div",{className:"pdx-hp"},[Ne]);Le.setAttribute("aria-hidden","true");let fe=[],H=m("div",{});if(l.consent.processing){let g=m("input",{id:`pdx-${n}-consent`,type:"checkbox"});g.setAttribute("aria-required","true"),fe.push({input:g,key:"$consent_processing"}),H.append(m("div",{className:"pdx-choice"},[g,m("label",{htmlFor:g.id},[l.consent.processing])]));}for(let g of l.consent.purposes){let y=m("input",{id:`pdx-${n}-consent-${g.key}`,type:"checkbox"});fe.push({input:y,key:`$consent_${g.key}`}),H.append(m("div",{className:"pdx-choice"},[y,m("label",{htmlFor:y.id},[g.label])])),g.notice&&H.append(m("p",{className:"pdx-help"},[g.notice]));}let ye=m("p",{className:"pdx-meta"}),G=m("button",{type:"button"},[s("back")]);G.dataset.variant="back";let Y=m("button",{type:"button"},[s("next")]),L=m("button",{type:"submit"},[s("submit")]);G.dataset.action="back",Y.dataset.action="next",L.dataset.action="submit";let Vt=m("div",{className:"pdx-actions"},[G,Y,L]),P=0,ve=()=>{R.forEach((y,x)=>{y.hidden=x!==P;});let g=P===R.length-1;G.hidden=P===0,Y.hidden=g,L.hidden=!g,H.hidden=!g,ye.hidden=R.length<2,ye.textContent=s("step").replace("{step}",String(P+1)).replace("{total}",String(R.length));},Ut=()=>{var g;for(let y of f.flat())y.error.textContent="",(g=y.root.querySelector("[aria-invalid]"))==null||g.removeAttribute("aria-invalid");},Oe=(g,y)=>{var x;g.error.textContent=y,(x=g.root.querySelector("input,select,textarea,fieldset"))==null||x.setAttribute("aria-invalid","true");},qe=g=>{var b,_;Ut();let y=C(),x=((b=f[g])!=null?b:[]).filter(M=>!M.root.hidden&&M.field.required&&qt(y[M.field.key]));for(let M of x)Oe(M,s("required"));return x.length>0?(d.textContent=s("required"),(_=x[0])==null||_.focus(),false):true};G.addEventListener("click",()=>{P=Math.max(0,P-1),ve();}),Y.addEventListener("click",()=>{qe(P)&&(P+=1,ve());}),a.addEventListener("submit",g=>{if(g.preventDefault(),!qe(P))return;let y={...C(),[l.honeypot]:Ne.value};for(let b of fe)y[b.key]=b.input.checked;L.disabled=true,L.textContent=s("sending");let x=l.challenge;if(!x||!I){d.textContent=s("closed");return}I.then(b=>r.submit(n,y,x,b)).then(b=>{if(b.kind==="redirect"&&b.value.startsWith("https://")){window.location.assign(b.value);return}let _=m("p",{},[b.kind==="message"&&b.value?b.value:s("thanks")]);_.setAttribute("role","status"),a.replaceChildren(_);}).catch(b=>{L.disabled=false,L.textContent=s("submit");let _=b instanceof z?b.fields:[];for(let M of _){let De=f.flat().find(zt=>zt.field.key===M.field);De&&Oe(De,M.rule==="required"?s("required"):s("invalid"));}d.textContent=_.length>0?s("invalid"):s("failed");});}),a.append(ye,...R,Le,H,Vt,d),l.poweredBy&&e.poweredBy!==false&&a.append(m("p",{className:"pdx-meta"},[s("poweredBy")])),ve(),F(),r.capture(mt,{$form_id:l.id,$form_version:l.version});}).catch(()=>{u||a.replaceChildren(m("p",{className:"pdx-meta"},[s("closed")]));});return t.append(a),{destroy:()=>{u=true,a.remove();},ready:p}};var Kt=t=>({capture:(e,n)=>t.capture(e,{properties:n}),form:e=>t.getForm(e),submit:(e,n,r,i)=>t.submitForm(e,n,r,i)});var On=t=>({capture:(e,n,r)=>t.captureCta(e,n,r),ctas:e=>t.getCtas(e),forms:Kt(t),isEnabled:e=>t.isFeatureEnabled(e),variant:async e=>{var n,r;return (r=(n=await t.getVariant(e))==null?void 0:n.key)!=null?r:null}}),qn=t=>t<768?"mobile":t<1024?"tablet":"desktop",Dn=async(t,e)=>{let n=e.flag;return n?n.variant?await t.variant(n.key)===n.variant:t.isEnabled(n.key):true},Kn=(t,e,n)=>{let r=document.createElement("dialog");r.className="prodantix-form-popup";let i=document.createElement("button");i.type="button",i.textContent="\xD7",i.setAttribute("aria-label",N[n].close),i.title=N[n].close,i.addEventListener("click",()=>r.close()),r.addEventListener("close",()=>r.remove()),r.append(i),document.body.append(r),Dt(r,{formId:t,host:e,language:n}),r.showModal();},Bn=()=>{let t=window.prodantix;typeof t=="function"&&t("open");},jn=async(t,e)=>{var u,p;let n=(u=e.now)!=null?u:Date.now,r=(p=e.open)!=null?p:(l=>window.location.assign(l)),i=[],o=[],s=false,a=()=>{s=true;for(let l of i.splice(0))l();for(let l of o.splice(0))l.destroy();},d=await t.ctas({device:qn(window.innerWidth),language:document.documentElement.lang||e.language,url:window.location.href});for(let l of d)s||!Pt(l.frequency,It(l.id),$t(l.id),n())||!await Dn(t,l)||i.push(Lt(l.trigger,()=>{if(s)return;let I=Nt(l,{language:e.language,onButton:A=>{var C;t.capture(Ze,l,A);let f=(C=l.variant.content.buttons[A])==null?void 0:C.action;f&&((f.kind!=="url"||l.kind!=="embedded")&&I.destroy(),f.kind==="url"?r(f.value):f.kind==="form"?Kn(f.value,t.forms,e.language):f.kind==="messenger"?Bn():t.capture(xe,l));},onDismiss:()=>t.capture(xe,l)});I.elements.length!==0&&(o.push(I),At(l.id,n()),t.capture(Xe,l));}));return a},Hn=()=>{},Bt=(t,e)=>{let n=On(t),r=Rt(e!=null?e:document.documentElement.lang),i=()=>jn(n,{language:r}).catch(p=>(console.error("[prodantix] the CTAs for this page could not be read",p),Hn)),o=i(),s=window.location.href,a=()=>{if(window.location.href===s)return;s=window.location.href,o=o.then(l=>(l(),i()));},d=history.pushState.bind(history),u=history.replaceState.bind(history);return history.pushState=(...p)=>{d(...p),a();},history.replaceState=(...p)=>{u(...p),a();},window.addEventListener("popstate",a),()=>{history.pushState=d,history.replaceState=u,window.removeEventListener("popstate",a),o.then(p=>p());}};var jt=(t,e)=>({...t.page?{$page_id:t.page}:{},...t.page&&e?{$page_view_id:e}:{},...t.variant?{$page_variant:t.variant}:{}});var Gn=(t,e)=>{var n;try{return (n=_t({name:`pdx_${be(t)}`}))!=null?n:e}catch(r){return e}},$=document.currentScript,Me=$==null?void 0:$.dataset.key,Ht,Gt;if($&&Me){let t=new URL($.src,window.location.href).origin,e=Be(),n=$.dataset.consent==="banner",r=new pe({apiKey:Me,...n?{consentMode:"banner"}:{},defaultProperties:jt($.dataset),flagsHost:(Ht=$.dataset.edge)!=null?Ht:t,host:(Gt=$.dataset.host)!=null?Gt:t,sessionTracking:false,sharedStorage:Gn(Me,e),storage:e,transport:new me({})});n&&Et(r,window),Bt(r,$.dataset.language);}
|
|
36
36
|
})();//# sourceMappingURL=ctas.iife.js.map
|
|
37
37
|
//# sourceMappingURL=ctas.iife.js.map
|