@prodantix/sdk 0.7.0 → 0.8.0-beta.651

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(){'use strict';var Bt=Object.defineProperty;var jt=(n,e,t)=>e in n?Bt(n,e,{enumerable:true,configurable:true,writable:true,value:t}):n[e]=t;var d=(n,e,t)=>jt(n,typeof e!="symbol"?e+"":e,t);var M=class extends Error{constructor(t,r,i){super(r,i);d(this,"code");this.code=t,this.name="ProdantixError";}},V=class extends M{constructor(e){super("config",e),this.name="ConfigError";}},D=class extends M{constructor(t,r){super("validation",r);d(this,"field");this.field=t,this.name="ValidationError";}},m=class extends M{constructor(t,r,i){super("transport",t,i);d(this,"status");this.status=r,this.name="TransportError";}};function C(n){if(n)return n;let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}function S(){let n=globalThis.AbortController;return n?new n:void 0}var Be=n=>new Promise(e=>{setTimeout(e,n);});function E(n){return n.replace(/\/+$/,"")}var N=class{constructor(){d(this,"store",new Map);}getItem(e){var t;return (t=this.store.get(e))!=null?t:null}removeItem(e){this.store.delete(e);}setItem(e,t){this.store.set(e,t);}},H=class{constructor(e,t=()=>false){this.real=e;this.passes=t;d(this,"held",new N);d(this,"opened",false);}get isOpen(){return this.opened}open(){this.opened=true;}close(){this.opened=false;}target(e){return this.opened||this.passes(e)?this.real:this.held}getItem(e){return this.target(e).getItem(e)}removeItem(e){this.target(e).removeItem(e);}setItem(e,t){this.target(e).setItem(e,t);}};function je(){try{let n=globalThis.localStorage;if(n){let e="__pdx_probe__";return n.setItem(e,"1"),n.removeItem(e),n}}catch(n){return new N}return new N}var Ge={now:()=>new Date};function Y(n){return n.toISOString()}function Ve(){if(typeof window=="undefined"||typeof Intl=="undefined")return null;let n=Intl.DateTimeFormat().resolvedOptions().timeZone;return typeof n=="string"&&n!==""?n:null}function Gt(){return globalThis.crypto}function Vt(n){n[6]=n[6]&15|64,n[8]=n[8]&63|128;let e=[];for(let t=0;t<16;t+=1)e.push(n[t].toString(16).padStart(2,"0"));return `${e[0]}${e[1]}${e[2]}${e[3]}-${e[4]}${e[5]}-${e[6]}${e[7]}-${e[8]}${e[9]}-${e[10]}${e[11]}${e[12]}${e[13]}${e[14]}${e[15]}`}function Ht(){let n=Gt();if(n!=null&&n.randomUUID)return n.randomUUID();let e=new Uint8Array(16);if(n!=null&&n.getRandomValues)n.getRandomValues(e);else for(let t=0;t<16;t+=1)e[t]=Math.floor(Math.random()*256);return Vt(e)}var He={uuid:Ht};var Ut=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var Jt=/^(?:\$|[a-z])[a-z0-9_.]*$/;function Ue(n){let e=0;for(let t of n)e+=1;return e}function Je(n){return Ut.test(n)}function zt(n){return Jt.test(n)}function ze(n){let e=Ue(n);if(e<1||e>200)throw new D("distinct_id","distinct_id must be between 1 and 200 characters")}function We(n){let e=Ue(n);if(e<1||e>200)throw new D("event_name","event_name must be between 1 and 200 characters");if(!zt(n))throw new D("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var Ye="prodantix-js",Qe="0.7.0";var Wt=n=>{};function Xe(n){var i,o,s,a,l,g,v,c,$,L,f,_,T,z,A;if(!n.apiKey||!Je(n.apiKey))throw new V("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!n.host)throw new V("host is required (the ingest base URL)");let e=E(n.host),t=n.defaultProperties,r=(i=n.storage)!=null?i:new N;return {apiKey:n.apiKey,autocapture:(o=n.autocapture)!=null?o:false,clock:(s=n.clock)!=null?s:Ge,consent:n.consent,consentMode:n.consentMode,defaultProperties:typeof t=="function"?t:()=>t!=null?t:{},describeElement:n.describeElement,flagsHost:n.flagsHost?E(n.flagsHost):e,flushAt:(a=n.flushAt)!=null?a:20,flushIntervalMs:(l=n.flushIntervalMs)!=null?l:1e4,host:e,ids:(g=n.ids)!=null?g:He,locale:n.locale,maxQueueSize:(v=n.maxQueueSize)!=null?v:1e3,maxRetries:(c=n.maxRetries)!=null?c:3,namespace:be(n.apiKey),onError:($=n.onError)!=null?$:Wt,os:n.os,requestTimeoutMs:(L=n.requestTimeoutMs)!=null?L:1e4,sdkName:(f=n.sdkName)!=null?f:Ye,sdkVersion:(_=n.sdkVersion)!=null?_:Qe,sessionTracking:(T=n.sessionTracking)!=null?T:false,sharedStorage:(z=n.sharedStorage)!=null?z:r,socketFactory:n.socketFactory,storage:r,streamFlags:(A=n.streamFlags)!=null?A:false,transport:n.transport}}function be(n){return n.slice(0,16)}var Ze=(n,e)=>{let t={$cta_id:n.id,$cta_kind:n.kind,$cta_variant:n.variant.key,$cta_version:n.version},r=e===void 0?void 0:n.variant.content.buttons[e];return r&&e!==void 0&&(t.$cta_button=e,t.$cta_button_label=r.label,r.action.kind==="form"&&(t.$cta_form_id=r.action.value)),t},Q=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=C(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async ctas(e){let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=new URLSearchParams({anonymous:String(e.anonymous),device:e.device,distinct_id:e.distinctId,language:e.language,url:e.url}),i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s=await t(`${this.host}/v1/ctas?${r.toString()}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(s.status<200||s.status>=300)throw new m(`ctas request failed with status ${s.status}`,s.status);return JSON.parse(await s.text()).ctas}finally{o!==void 0&&clearTimeout(o);}}};function et(n,e,t){var i,o,s;We(n.eventName),ze(n.distinctId);let r={distinct_id:n.distinctId,event_id:(i=n.eventId)!=null?i:t.uuid(),event_name:n.eventName,properties:(o=n.properties)!=null?o:{},schema_version:1,timestamp:Y((s=n.timestamp)!=null?s:e.now())};return n.context&&(r.context=n.context),n.sessionId&&(r.session_id=n.sessionId),r}var q=Symbol("absent");function Yt(n,e){var i,o;if(n==="distinct_id")return e.distinctId;let t=(i=e.properties)!=null?i:{};if(Object.prototype.hasOwnProperty.call(t,n))return t[n];let r=(o=e.attributes)!=null?o:{};return Object.prototype.hasOwnProperty.call(r,n)?r[n]:q}function O(n){return n===q?"undefined":String(n)}function tt(n){return n===q?Number.NaN:Number(n)}function nt(n){return n!==q&&n!==null&&n!==""}function rt(n,e){if(!Array.isArray(e))return false;let t=O(n);return e.map(r=>String(r)).includes(t)}function it(n,e){var i,o;let t=Yt(n.attribute,e),r=n.value;switch(n.op){case "is_set":return nt(t);case "is_not_set":return !nt(t);case "eq":return O(t)===O(r===void 0?q:r);case "neq":return O(t)!==O(r===void 0?q:r);case "contains":return O(t).includes(O(r===void 0?q:r));case "in":return rt(t,r);case "not_in":return Array.isArray(r)?!rt(t,r):false;case "gt":return X(t,r,(s,a)=>s>a);case "gte":return X(t,r,(s,a)=>s>=a);case "lt":return X(t,r,(s,a)=>s<a);case "lte":return X(t,r,(s,a)=>s<=a);case "in_cohort":return typeof r=="string"&&r!==""&&((i=e.cohorts)!=null?i:[]).includes(r);case "not_in_cohort":return typeof r=="string"&&r!==""&&!((o=e.cohorts)!=null?o:[]).includes(r);default:return false}}function X(n,e,t){let r=tt(n),i=e===void 0?Number.NaN:tt(e);return Number.isNaN(r)||Number.isNaN(i)?false:t(r,i)}function st(n,e){let t=`${n}:${e}`,r=2166136261;for(let i=0;i<t.length;i++)r^=t.charCodeAt(i),r=Math.imul(r,16777619);return (r>>>0)%100}function xe(n,e){return n.targeting.length===0||n.targeting.every(t=>it(t,e))}function ot(n,e){var o;let t=st(n.key,e.distinctId),r=(o=n.variations)!=null?o:[];if(r.length===0)return n.rolloutPercentage>=100||t<n.rolloutPercentage?"true":"false";let i=0;for(let s=r.length-1;s>=0;s--)if(i+=r[s].weight,t<i)return r[s].key;return r[0].key}function ke(n,e,t,r){var i;for(let o of (i=n.prerequisites)!=null?i:[]){if(r.includes(o.flagKey))return false;let s=e.find(l=>l.key===o.flagKey);if(!s||!s.enabled)return false;r.push(s.key);let a=ke(s,e,t,r)&&xe(s,t)&&ot(s,t)===o.variationKey;if(r.pop(),!a)return false}return true}function Z(n,e,t){return n.enabled?ke(n,e,t,[n.key])?xe(n,t)?n.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:st(n.key,t.distinctId)<n.rolloutPercentage?{enabled:true,reason:"rollout"}:{enabled:false,reason:"rollout_excluded"}:{enabled:false,reason:"targeting"}:{enabled:false,reason:"prerequisite"}:{enabled:false,reason:"disabled"}}function at(n,e){let t={};for(let r of n)t[r.key]=Z(r,n,e).enabled;return t}function Se(n,e,t){var s,a;let r=(s=n.variations)!=null?s:[],i=r[0];if(!i)return null;if(!n.enabled||!ke(n,e,t,[n.key])||!xe(n,t))return i;let o=ot(n,t);return (a=r.find(l=>l.key===o))!=null?a:i}function dt(n){return n.some(e=>e.targeting.some(t=>t.op==="in_cohort"||t.op==="not_in_cohort"))}function lt(n){return `40${JSON.stringify(n)}`}function ct(){return "3"}function ut(n){let e=n.charAt(0),t=n.slice(1);if(e==="2")return {kind:"ping"};if(e==="1")return {kind:"disconnect"};if(e==="0"){let s=we(t);return {kind:"open",pingInterval:typeof(s==null?void 0:s.pingInterval)=="number"?s.pingInterval:25e3,pingTimeout:typeof(s==null?void 0:s.pingTimeout)=="number"?s.pingTimeout:2e4}}if(e!=="4")return {kind:"other"};let r=t.charAt(0),i=t.slice(1);if(r==="0")return {kind:"connected"};if(r==="1")return {kind:"disconnect"};if(r==="4"){let s=we(i);return {kind:"connectError",message:typeof(s==null?void 0:s.message)=="string"?s.message:"refused"}}if(r!=="2")return {kind:"other"};let o=we(i);return !Array.isArray(o)||typeof o[0]!="string"?{kind:"other"}:{kind:"event",name:o[0],payload:o[1]}}function we(n){try{return JSON.parse(n)}catch(e){return null}}var Qt="/socket.io/?EIO=4&transport=websocket",Xt=250,ee=class{constructor(e){this.options=e;d(this,"socket",null);d(this,"heartbeat",null);d(this,"pending",null);d(this,"lastKey","");d(this,"ready",false);d(this,"closed",false);d(this,"heartbeatWindow",45e3);d(this,"factory");d(this,"setTimer");d(this,"clearTimer");var t,r,i;this.factory=(t=e.socketFactory)!=null?t:Zt,this.setTimer=(r=e.setTimer)!=null?r:((o,s)=>setTimeout(o,s)),this.clearTimer=(i=e.clearTimer)!=null?i:(o=>clearTimeout(o));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${Qt}`,t;try{t=this.factory(e);}catch(r){this.options.onClosed(false);return}this.socket=t,t.onmessage=r=>this.receive(String(r.data)),t.onerror=()=>t.close(),t.onclose=()=>this.fell();}close(){this.closed=true,this.stopHeartbeat(),this.pending!==null&&this.clearTimer(this.pending),this.pending=null;let e=this.socket;this.socket=null,e==null||e.close();}receive(e){var r,i,o,s;let t=ut(e);if(t.kind==="open"){this.armHeartbeat(t.pingInterval+t.pingTimeout),(r=this.socket)==null||r.send(lt({projectKey:this.options.projectKey}));return}if(t.kind==="ping"){this.armHeartbeat(),(i=this.socket)==null||i.send(ct());return}if(t.kind==="connectError"||t.kind==="disconnect"){this.stopHeartbeat(),(o=this.socket)==null||o.close();return}if(t.kind==="event"){if(t.name==="ready"){this.ready=true;return}if(t.name==="flagChange"){let a=(s=t.payload)==null?void 0:s.key;this.lastKey=typeof a=="string"?a:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},Xt));}}}fell(){this.stopHeartbeat();let e=this.ready;this.socket=null,this.ready=false,this.closed||this.options.onClosed(e);}armHeartbeat(e){e!==void 0&&(this.heartbeatWindow=e),this.stopHeartbeat(),this.heartbeat=this.setTimer(()=>{var t;return (t=this.socket)==null?void 0:t.close()},this.heartbeatWindow);}stopHeartbeat(){this.heartbeat!==null&&this.clearTimer(this.heartbeat),this.heartbeat=null;}};function Zt(n){let e=globalThis.WebSocket;if(!e)throw new m("no WebSocket");return new e(n)}var te=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=C(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){var s,a;let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let l=await t(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!l.ok)throw new m(`flags request failed with status ${l.status}`,l.status);let g=JSON.parse(await l.text());return {flags:(s=g.flags)!=null?s:{},variants:(a=g.variants)!=null?a:{}}}finally{o!==void 0&&clearTimeout(o);}}async snapshot(){var o;let e=this.fetch;if(!e)throw new m("no fetch implementation available in this runtime");let t=`${this.host}/v1/flags/snapshot`,r=S(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await e(t,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new m(`flag snapshot request failed with status ${s.status}`,s.status);let a=JSON.parse(await s.text()),l={flags:(o=a.flags)!=null?o:[],generatedAt:a.generatedAt};return typeof a.socketUrl=="string"&&a.socketUrl!==""&&(l.socketUrl=a.socketUrl),l}finally{i!==void 0&&clearTimeout(i);}}async memberships(e){var s;let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await t(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new m(`memberships request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).cohorts)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};var pt="$form_viewed",mt="$form_started",U=class extends Error{constructor(t,r,i){super(i);d(this,"fields");d(this,"status");this.name="FormRefusedError",this.status=t,this.fields=r;}},ne=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=C(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async request(e,t){let r=this.fetch;if(!r)throw new m("no fetch implementation available in this runtime");let i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s={authorization:`Bearer ${this.projectKey}`};t.body!==void 0&&(s["content-type"]="application/json");let a=await r(`${this.host}${e}`,{body:t.body,headers:s,method:t.method,signal:i==null?void 0:i.signal});return {status:a.status,text:await a.text()}}finally{o!==void 0&&clearTimeout(o);}}async form(e,t){let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}?distinct_id=${encodeURIComponent(t)}`,{method:"GET"});if(r<200||r>=300)throw new m(`form request failed with status ${r}`,r);return JSON.parse(i)}async submit(e,t){var a,l,g,v;let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}/submissions`,{body:JSON.stringify(t),method:"POST"});if(r>=200&&r<300)return JSON.parse(i).afterSubmit;let o=[],s=`form submission failed with status ${r}`;try{let c=JSON.parse(i);o=(l=(a=c.error)==null?void 0:a.fields)!=null?l:[],s=(v=(g=c.error)==null?void 0:g.message)!=null?v:s;}catch(c){o=[];}throw new U(r,o,s)}};var gt="$survey_shown",ht="$survey_dismissed",ft="$survey_sent",re=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=C(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async surveys(e,t){var s;let r=this.fetch;if(!r)throw new m("no fetch implementation available in this runtime");let i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await r(`${this.host}/v1/surveys?distinct_id=${encodeURIComponent(e)}${t?`&lang=${encodeURIComponent(t)}`:""}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new m(`surveys request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).surveys)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};function ie(n,e){let t={$survey_id:n.id,$survey_iteration:n.iteration,$survey_name:n.name};for(let[r,i]of Object.entries(e))t[`$survey_response_${r}`]=i;return t}var se=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=C(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async guides(e){var o;let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=S(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await t(`${this.host}/v1/guides?distinct_id=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new m(`guides request failed with status ${s.status}`,s.status);return (o=JSON.parse(await s.text()).guides)!=null?o:[]}finally{i!==void 0&&clearTimeout(i);}}};function yt(n,e){let t={$guide_id:n.id,$guide_iteration:n.iteration,$guide_name:n.name};return e!==void 0&&(t.$guide_step_id=e),t}function Ee(n){if(typeof n!="string")return;let e=Array.from(n).length;return e>=1&&e<=200?n:void 0}function Te(n,e){return `pdx.${n}.${e}`}var Fe="consent",en=["identityLink","analytics","marketing","functional"];function Ce(n){if(typeof n!="string")return null;try{let e=JSON.parse(n);if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e,r={};for(let i of en){let o=t[i];typeof o=="boolean"&&(r[i]=o);}return typeof t.version=="number"&&Number.isInteger(t.version)&&(r.version=t.version),Array.isArray(t.categories)&&t.categories.every(i=>typeof i=="string")&&(r.categories=t.categories),Object.keys(r).length===0?null:r}catch(e){return null}}var vt=n=>n.endsWith(`.${Fe}`);function ae(n,e){return Ce(n.getItem(Te(e,Fe)))}function tn(n,e,t){var s;let r=Te(e,Fe),i=Ce(JSON.stringify(t)),o=i===null?null:Ce(JSON.stringify({...(s=ae(n,e))!=null?s:{},...i}));if(o===null){n.removeItem(r);return}n.setItem(r,JSON.stringify(o));}var oe=class{constructor(e,t,r,i){this.storage=e;this.shared=t;this.ids=r;this.namespace=i;d(this,"anonymousId");d(this,"distinctId");d(this,"identified");this.refresh();}refresh(){let e=Ee(this.shared.getItem(this.key("anonymous_id"))),t=Ee(this.storage.getItem(this.key("anonymous_id")));e?(this.anonymousId=e,t!==e&&this.storage.setItem(this.key("anonymous_id"),e)):t?(this.anonymousId=t,this.shared.setItem(this.key("anonymous_id"),t)):(this.anonymousId=this.ids.uuid(),this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId));let r=Ee(this.storage.getItem(this.key("distinct_id")));r?(this.distinctId=r,this.identified=true):(this.distinctId=this.anonymousId,this.identified=false);}getAnonymousId(){return this.anonymousId}getDistinctId(){return this.distinctId}isIdentified(){return this.identified}snapshot(){return {anonymousId:this.anonymousId,distinctId:this.distinctId,identified:this.identified}}consent(){return ae(this.shared,this.namespace)}setConsent(e){tn(this.shared,this.namespace,e);}assumeAnonymousId(e){this.anonymousId=e,this.shared.setItem(this.key("anonymous_id"),e),this.storage.setItem(this.key("anonymous_id"),e),this.identified||(this.distinctId=e);}identify(e){var o;let t=!this.identified||this.distinctId!==e,r=this.storage.getItem(this.key("linked_anonymous_id")),i=t||r!==this.anonymousId;return this.distinctId=e,this.identified=true,t&&this.storage.setItem(this.key("distinct_id"),e),!i||((o=this.consent())==null?void 0:o.identityLink)===false?{changed:t}:(this.storage.setItem(this.key("linked_anonymous_id"),this.anonymousId),{anonymousToLink:this.anonymousId,changed:t})}reset(){this.anonymousId=this.ids.uuid(),this.distinctId=this.anonymousId,this.identified=false,this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.removeItem(this.key("distinct_id")),this.storage.removeItem(this.key("linked_anonymous_id"));}key(e){return Te(this.namespace,e)}};var de=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=C(e.fetch),this.host=E(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async inbox(e){var s;let t=this.requireFetch(),r=`${this.host}/v1/messages?distinct_id=${encodeURIComponent(e)}`,i=await this.request(t,r,{headers:this.authHeaders(),method:"GET"});if(!i.ok)throw new m(`inbox request failed with status ${i.status}`,i.status);return (s=JSON.parse(await i.text()).messages)!=null?s:[]}async markRead(e,t){let r=this.requireFetch(),i=`${this.host}/v1/messages/read`,o=await this.request(r,i,{body:JSON.stringify({distinct_id:t,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!o.ok)throw new m(`mark-read request failed with status ${o.status}`,o.status)}requireFetch(){if(!this.fetch)throw new m("no fetch implementation available in this runtime");return this.fetch}authHeaders(){return {authorization:`Bearer ${this.projectKey}`}}async request(e,t,r){let i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(t,{...r,signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}};var le=class{constructor(e,t){this.maxSize=e;this.onOverflow=t;d(this,"events",[]);}get size(){return this.events.length}enqueue(e){this.events.push(e),this.enforceCap();}restore(e){this.events.push(...e),this.enforceCap();}requeue(e){this.events.unshift(...e),this.enforceCap();}drain(e){let t=e===void 0?this.events.length:Math.min(e,this.events.length);return this.events.splice(0,t)}snapshot(){return [...this.events]}enforceCap(){var t;if(this.events.length<=this.maxSize)return;let e=this.events.splice(0,this.events.length-this.maxSize);(t=this.onOverflow)==null||t.call(this,{dropped:e});}};var nn={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function rn(n){return `pdx.${n}.session`}var ce=class{constructor(e,t,r,i,o=nn){this.storage=e;this.ids=t;this.clock=r;this.namespace=i;this.options=o;}current(){return this.touch().id}startedAt(){return this.touch().startedAt}reset(){this.storage.removeItem(this.key());}touch(){let e=this.clock.now().getTime(),t=this.live(this.read(),e);if(t===void 0)return this.write({id:this.ids.uuid(),lastActivityAt:e,startedAt:e});if(e-t.lastActivityAt<=this.options.throttleMs)return t;let r=this.live(this.read(),e),i=r!==void 0&&r.id!==t.id?r:t;return this.write({...i,lastActivityAt:e})}live(e,t){if(e!==void 0&&!(t-e.lastActivityAt>this.options.idleMs||t-e.startedAt>this.options.maxMs))return e}write(e){return this.storage.setItem(this.key(),JSON.stringify(e)),e}read(){let e=this.storage.getItem(this.key());if(e)try{let t=JSON.parse(e);return typeof t.id=="string"&&typeof t.startedAt=="number"&&typeof t.lastActivityAt=="number"?{id:t.id,lastActivityAt:t.lastActivityAt,startedAt:t.startedAt}:void 0}catch(t){return}}key(){return rn(this.namespace)}};var k={createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",set:"$set"};function bt(n){return n>=400&&n<500&&n!==429}var K=class{constructor(e={}){d(this,"fetch");d(this,"maxRetries");d(this,"requestTimeoutMs");d(this,"baseDelayMs");d(this,"maxDelayMs");d(this,"sleep");d(this,"random");var t,r,i,o,s,a;this.fetch=C(e.fetch),this.maxRetries=(t=e.maxRetries)!=null?t:3,this.requestTimeoutMs=(r=e.requestTimeoutMs)!=null?r:1e4,this.baseDelayMs=(i=e.baseDelayMs)!=null?i:500,this.maxDelayMs=(o=e.maxDelayMs)!=null?o:3e4,this.sleep=(s=e.sleep)!=null?s:Be,this.random=(a=e.random)!=null?a:Math.random;}async send(e){let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=JSON.stringify(e.body),i;for(let o=0;o<=this.maxRetries;o+=1){try{let s=await this.attempt(t,e,r);if(s.ok)return;if(bt(s.status))throw new m(`ingest rejected batch with status ${s.status}`,s.status);i=new m(`ingest transient status ${s.status}`,s.status);}catch(s){if(s instanceof m&&s.status!==void 0&&bt(s.status))throw s;i=s;}o<this.maxRetries&&await this.sleep(this.backoff(o));}throw new m("ingest delivery failed after retries",void 0,{cause:i})}async attempt(e,t,r){let i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(t.url,{body:r,headers:{authorization:`Bearer ${t.projectKey}`,"content-type":"application/json"},method:"POST",signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};var sn="queue",on=1e3,xt=3e4,_e=n=>{let e={};return n.avatar!==void 0&&(e.$avatar=n.avatar),n.email!==void 0&&(e.$email=n.email),n.name!==void 0&&(e.$name=n.name),n.phone!==void 0&&(e.$phone=n.phone),e},ue=class{constructor(e){d(this,"config");d(this,"identity");d(this,"session");d(this,"queue");d(this,"transport");d(this,"flagsClient");d(this,"messagesClient");d(this,"surveysClient");d(this,"guidesClient");d(this,"captureListeners",new Set);d(this,"formsClient");d(this,"ctasClient");d(this,"context");d(this,"flushTimer");d(this,"flushing",false);d(this,"cachedFlags");d(this,"cachedSnapshot");d(this,"membershipCache");d(this,"stream");d(this,"shutDown",false);d(this,"exposures",new Set);d(this,"gates");d(this,"cookielessId");d(this,"storageListeners",new Set);var s,a,l;let t=Xe(e),r=(a=(s=ae(t.sharedStorage,t.namespace))!=null?s:t.consent)!=null?a:null;if(this.gates=[new H(t.storage),new H(t.sharedStorage,vt)],t.consentMode!=="banner"||(r==null?void 0:r.analytics)===true)for(let g of this.gates)g.open();let[i,o]=this.gates;this.config={...t,sharedStorage:o,storage:i},this.identity=new oe(this.config.storage,this.config.sharedStorage,this.config.ids,this.config.namespace),this.config.consent!==void 0&&this.identity.setConsent(this.config.consent),this.session=this.config.sessionTracking?new ce(this.config.sharedStorage,this.config.ids,this.config.clock,this.config.namespace):void 0,this.queue=new le(this.config.maxQueueSize,({dropped:g})=>{this.config.onError(new M("queue_overflow",`event queue overflow: dropped ${g.length} oldest event(s)`));}),this.transport=(l=this.config.transport)!=null?l:new K({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new te({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new de({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.surveysClient=new re({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.guidesClient=new se({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.formsClient=new ne({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.ctasClient=new Q({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.context={sdk:this.config.sdkName,sdk_version:this.config.sdkVersion},this.config.os&&(this.context.os=this.config.os),this.config.locale&&(this.context.locale=this.config.locale),this.restoreQueue(),this.startTimer();}get distinctId(){return this.identity.getDistinctId()}get anonymousId(){return this.identity.getAnonymousId()}get isIdentified(){return this.identity.isIdentified()}get sessionId(){var e;return (e=this.session)==null?void 0:e.current()}get sessionStartedAt(){var e;return (e=this.session)==null?void 0:e.startedAt()}capture(e,t={}){var r,i,o,s,a,l,g;try{this.identity.refresh();let v={...this.config.defaultProperties(),...t.element===void 0?{}:(o=(i=(r=this.config).describeElement)==null?void 0:i.call(r,t.element))!=null?o:{},...(s=t.properties)!=null?s:{}},c=et({context:this.context,distinctId:(a=t.distinctId)!=null?a:this.identity.getDistinctId(),eventName:e,properties:v,sessionId:(g=t.sessionId)!=null?g:(l=this.session)==null?void 0:l.current(),timestamp:t.timestamp},this.config.clock,this.config.ids);this.enqueue(c);}catch(v){this.config.onError(v);}for(let v of this.captureListeners)try{v(e);}catch(c){this.config.onError(c);}}onCapture(e){return this.captureListeners.add(e),()=>{this.captureListeners.delete(e);}}identify(e,t={}){var a,l;if(this.isCookieless())return;this.identity.refresh();let r=this.identity.identify(e),i={};r.anonymousToLink!==void 0&&(i.$anon_distinct_id=r.anonymousToLink);let o=Ve(),s={...o===null?{}:{$timezone:o},..._e((a=t.traits)!=null?a:{}),...(l=t.set)!=null?l:{}};Object.keys(s).length>0&&(i.$set=s),this.capture(k.identify,{properties:i});}link(e,t,r){if(this.isCookieless())return;let i={$anon_distinct_id:t},o=_e(r!=null?r:{});Object.keys(o).length>0&&(i.$set=o),this.capture(k.identify,{distinctId:e,properties:i});}setConsent(e){this.identity.setConsent(e),e.analytics===true&&this.allowStorage(),e.analytics===false&&this.config.consentMode==="banner"&&this.forbidStorage();}isCookieless(){return !this.gates[0].isOpen}takeCookielessId(e){this.cookielessId=e,this.isCookieless()&&this.identity.assumeAnonymousId(e);}allowStorage(){if(this.isCookieless()){for(let e of this.gates)e.open();this.identity.refresh();for(let e of [...this.storageListeners])e();}}onStorageAllowed(e){return this.storageListeners.add(e),()=>{this.storageListeners.delete(e);}}forbidStorage(){if(!this.isCookieless()){for(let e of ["anonymous_id","distinct_id","linked_anonymous_id","session"])this.config.storage.removeItem(`pdx.${this.config.namespace}.${e}`),this.config.sharedStorage.removeItem(`pdx.${this.config.namespace}.${e}`);for(let e of this.gates)e.close();this.identity.refresh(),this.cookielessId!==void 0&&this.identity.assumeAnonymousId(this.cookielessId);}}consent(){return this.identity.consent()}alias(e){this.capture(k.createAlias,{properties:{alias:e}});}group(e,t,r){let i={$group_key:t,$group_type:e};r&&(i.$set=r),this.capture(k.group,{properties:i});}setPersonProperties(e,t){if(this.isCookieless())return;let r={};e&&(r.$set=e),t&&(r.$set_once=t),this.capture(k.set,{properties:r});}setPersonTraits(e){if(this.isCookieless())return;let t=_e(e);Object.keys(t).length!==0&&this.capture(k.set,{properties:{$set:t}});}async getAllFlags(){var r;let e=this.identity.getDistinctId(),t=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:t.flags,variants:(r=t.variants)!=null?r:{}},t.flags}async isFeatureEnabled(e){var i,o,s,a;let r=(i=(await this.getAllFlags())[e])!=null?i:false;return this.recordExposure(e,(a=(s=(o=this.cachedFlags)==null?void 0:o.variants[e])==null?void 0:s.key)!=null?a:String(r)),r}async getVariant(e){var i,o,s,a;let t=await this.getAllFlags(),r=(o=(i=this.cachedFlags)==null?void 0:i.variants[e])!=null?o:null;return this.recordExposure(e,(a=r==null?void 0:r.key)!=null?a:String((s=t[e])!=null?s:false)),r}async getVariantLocal(e,t={}){var l;let r=await this.flagSnapshot(),i=r.flags.find(g=>g.key===e),o=await this.localContext(t,r.flags),s=i?Se(i,r.flags,o):null,a=i?Z(i,r.flags,o).enabled:false;return this.recordExposure(e,(l=s==null?void 0:s.key)!=null?l:String(a)),s?{key:s.key,value:s.value}:null}recordExposure(e,t){let r=`${this.identity.getDistinctId()} ${e} ${t}`;this.exposures.has(r)||(this.exposures.add(r),this.capture(k.featureFlagCalled,{properties:{$feature_flag:e,$feature_flag_response:t}}));}getCachedFlag(e){if(!(!this.cachedFlags||this.cachedFlags.distinctId!==this.distinctId))return this.cachedFlags.flags[e]}async getLocalFlags(e={}){let t=await this.flagSnapshot();return at(t.flags,await this.localContext(e,t.flags))}async isFeatureEnabledLocal(e,t={}){var a,l;let r=await this.flagSnapshot(),i=r.flags.find(g=>g.key===e),o=await this.localContext(t,r.flags),s=i?Z(i,r.flags,o).enabled:false;return this.recordExposure(e,(l=i?(a=Se(i,r.flags,o))==null?void 0:a.key:void 0)!=null?l:String(s)),s}async localContext(e,t){let r=this.identity.getDistinctId(),i=e.cohorts;if(i===void 0&&dt(t)){let o=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===r&&o-this.membershipCache.fetchedAt<xt?i=this.membershipCache.cohorts:(i=await this.flagsClient.memberships(r),this.membershipCache={cohorts:i,distinctId:r,fetchedAt:o});}return {attributes:e.attributes,cohorts:i,distinctId:r,properties:e.properties}}async flagSnapshot(){let e=this.config.clock.now().getTime();if(this.cachedSnapshot&&e-this.cachedSnapshot.fetchedAt<xt)return this.cachedSnapshot.snapshot;let t=await this.flagsClient.snapshot();return this.cachedSnapshot={fetchedAt:e,snapshot:t},this.maybeStream(t),t}maybeStream(e){if(!this.config.streamFlags||this.shutDown||this.stream||!e.socketUrl)return;let t=new ee({host:e.socketUrl,onChange:()=>{this.cachedSnapshot=void 0,this.flagSnapshot().catch(r=>this.config.onError(r));},onClosed:r=>{this.stream=void 0,r&&this.maybeStream(e);},projectKey:this.config.apiKey,socketFactory:this.config.socketFactory});this.stream=t,t.open();}async getInbox(){return this.messagesClient.inbox(this.identity.getDistinctId())}async markMessageRead(e){await this.messagesClient.markRead(e,this.identity.getDistinctId());}async getSurveys(e){return this.surveysClient.surveys(this.identity.getDistinctId(),e!=null?e:this.config.locale)}captureSurveyShown(e){this.capture(gt,{properties:ie(e,{})});}captureSurveyDismissed(e){this.capture(ht,{properties:ie(e,{})});}captureSurveySent(e,t){this.capture(ft,{properties:ie(e,t)});}async getGuides(){return this.guidesClient.guides(this.identity.getDistinctId())}captureGuide(e,t,r){this.capture(e,{properties:yt(t,r)});}async getForm(e){return this.formsClient.form(e,this.identity.getDistinctId())}async submitForm(e,t,r,i){let{$page_id:o,$page_variant:s}=this.config.defaultProperties();return this.formsClient.submit(e,{answers:t,challenge:r,distinctId:this.identity.getDistinctId(),isAnonymous:!this.identity.isIdentified(),pageUrl:typeof window=="undefined"?"":window.location.href,solution:i,...typeof o=="string"&&typeof s=="string"?{pageId:o,pageVariant:s}:{}})}async getCtas(e){return this.ctasClient.ctas({...e,anonymous:!this.identity.isIdentified(),distinctId:this.identity.getDistinctId()})}captureCta(e,t,r){this.capture(e,{properties:Ze(t,r)});}async flush(){if(this.flushing||this.queue.size===0)return;this.flushing=true;let e=this.queue.drain(on);try{await this.transport.send({body:{events:e,sent_at:Y(this.config.clock.now())},projectKey:this.config.apiKey,url:`${this.config.host}/v1/events`}),this.persistQueue();}catch(t){this.queue.requeue(e),this.persistQueue(),this.config.onError(t);}finally{this.flushing=false;}}reset(){var e;(e=this.session)==null||e.reset(),this.identity.reset(),this.cachedFlags=void 0,this.cachedSnapshot=void 0,this.membershipCache=void 0;}async shutdown(){var e;this.shutDown=true,this.stopTimer(),(e=this.stream)==null||e.close(),this.stream=void 0,await this.flush();}enqueue(e){this.queue.enqueue(e),this.persistQueue(),this.queue.size>=this.config.flushAt&&this.flush();}persistQueue(){try{this.config.storage.setItem(this.persistKey(),JSON.stringify(this.queue.snapshot()));}catch(e){this.config.onError(e);}}restoreQueue(){try{let e=this.config.storage.getItem(this.persistKey());if(!e)return;let t=JSON.parse(e);Array.isArray(t)&&this.queue.restore(t);}catch(e){this.config.onError(e);}}startTimer(){if(this.config.flushIntervalMs<=0)return;let e=setInterval(()=>{this.flush();},this.config.flushIntervalMs),t=e;typeof t.unref=="function"&&t.unref(),this.flushTimer=e;}stopTimer(){this.flushTimer!==void 0&&(clearInterval(this.flushTimer),this.flushTimer=void 0);}persistKey(){return `pdx.${this.config.namespace}.${sn}`}};function an(){let n=globalThis.document;return (n==null?void 0:n.visibilityState)==="hidden"}function dn(n){let e=globalThis.navigator,t=globalThis.Blob;if(!(e!=null&&e.sendBeacon)||!t)return false;let r=JSON.stringify({...n.body,api_key:n.projectKey});try{let i=new t([r],{type:"application/json"});return e.sendBeacon(n.url,i)}catch(i){return false}}var pe=class{constructor(e={}){d(this,"fetchTransport");this.fetchTransport=new K(e);}async send(e){an()&&dn(e)||await this.fetchTransport.send(e);}};var Ie="prodantix:consent-ready",$e="prodantix:consent",kt="__prodantixConsent";var St=(n,e)=>{n.takeCookielessId(e.anonymousId),e.consent!==null?n.setConsent(e.consent):e.rule==="notice"&&n.allowStorage();},wt=(n,e)=>{let t=e[kt];t&&St(n,t);let r=o=>{let s=o.detail;s&&St(n,s);},i=o=>{let s=o.detail;s&&n.setConsent(s);};return e.addEventListener(Ie,r),e.addEventListener($e,i),()=>{e.removeEventListener(Ie,r),e.removeEventListener($e,i);}};var ln=/^\d{1,3}(\.\d{1,3}){3}$/,cn=/^[a-z0-9.-]+$/i;function Et(){return Math.random().toString(36).slice(2,12)}function me(n,e){let t=`${e}=`,r=[];for(let i of n.cookie.split(";")){let o=i.trim();o.startsWith(t)&&r.push(o.slice(t.length));}return r}function J(n,e,t){let r=["Path=/",`Max-Age=${e}`,"SameSite=Lax"];return n&&r.push(`Domain=${n}`),t&&r.push("Secure"),r.join("; ")}function Ct(n,e,t,r){try{let i=`pdx_probe_${r()}`,o=r();n.cookie=`${i}=${o}; ${J(e,60,t)}`;let s=me(n,i).includes(o);n.cookie=`${i}=; ${J(e,0,t)}`;let a=me(n,i).includes(o);return s&&!a}catch(i){return false}}function un(n){let e=n.replace(/^\[|\]$/g,"").toLowerCase();if(e.includes(":")||ln.test(e)||!e.includes("."))return [];let t=e.split("."),r=[];for(let i=t.length-2;i>=0;i-=1)r.push(t.slice(i).join("."));return r}function pn(n,e,t,r=Et){for(let i of un(n))if(Ct(e,i,t,r))return i}function mn(n){let e=new Map,t=JSON.parse(decodeURIComponent(n));if(t===null||typeof t!="object"||Array.isArray(t))return e;for(let[r,i]of Object.entries(t))typeof i=="string"&&e.set(r,i);return e}var Ae=class{constructor(e,t,r,i){this.jar=e;this.name=t;this.domain=r;this.secure=i;}getItem(e){var t;return (t=this.read().get(e))!=null?t:null}setItem(e,t){let r=this.read();r.set(e,t),this.write(r);}removeItem(e){let t=this.read();t.delete(e)&&this.write(t);}read(){try{let e=me(this.jar,this.name);e.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${J(void 0,0,this.secure)}`,e=me(this.jar,this.name));let t=e[0];return t?mn(t):new Map}catch(e){return new Map}}write(e){try{if(e.size===0){this.jar.cookie=`${this.name}=; ${J(this.domain,0,this.secure)}`;return}let t=encodeURIComponent(JSON.stringify(Object.fromEntries(e)));this.jar.cookie=`${this.name}=${t}; ${J(this.domain,31536e3,this.secure)}`;}catch(t){return}}};function gn(){return globalThis.document}function hn(){var n,e;return (e=(n=globalThis.location)==null?void 0:n.hostname)!=null?e:""}function fn(){var n;return ((n=globalThis.location)==null?void 0:n.protocol)==="https:"}function yn(n){if(n===void 0)return;let e=n.startsWith(".")?n.slice(1):n;return cn.test(e)?e.toLowerCase():void 0}function Tt(n){var s,a,l,g,v;let e="jar"in n?n.jar:gn();if(!e||((s=globalThis.navigator)==null?void 0:s.cookieEnabled)===false)return null;let r=(a=n.random)!=null?a:Et,i=(l=n.secure)!=null?l:fn(),o=(g=n.hostname)!=null?g:hn();try{let c=(v=yn(n.domain))!=null?v:pn(o,e,i,r);return Ct(e,c,i,r)?new Ae(e,n.name,c,i):null}catch(c){return null}}var Ft=n=>`prodantix-form-popup:${n}`,vn=n=>{try{let e=window.localStorage.getItem(Ft(n));return e===null?null:Number(e)}catch(e){return null}},bn=(n,e)=>{try{window.localStorage.setItem(Ft(n),String(e));}catch(t){return}},_t=(n,e,t)=>t===null||e-t>=n.periodDays*864e5,Pe=(n,e,t=Date.now)=>{if(!_t(n,t(),vn(n.formId)))return ()=>{};let r=false,i=[],o=()=>{if(!r){r=true;for(let a of i)a();bn(n.formId,t()),e();}},s=n.trigger;if(s.kind==="delay"){let a=setTimeout(o,s.seconds*1e3);i.push(()=>clearTimeout(a));}else if(s.kind==="scroll"){let a=()=>{let l=document.documentElement.scrollHeight-window.innerHeight;(l<=0||window.scrollY/l*100>=s.percent)&&o();};window.addEventListener("scroll",a,{passive:true}),i.push(()=>window.removeEventListener("scroll",a));}else {let a=l=>{l.relatedTarget===null&&l.clientY<=0&&o();};document.addEventListener("mouseout",a),i.push(()=>document.removeEventListener("mouseout",a));}return ()=>{r=true;for(let a of i)a();}},Re=n=>{if(!n)return null;if(n==="exit")return {kind:"exit"};let[e,t]=n.split(":"),r=Number(t);return !Number.isFinite(r)||r<0?null:e==="delay"?{kind:"delay",seconds:r}:e==="scroll"?{kind:"scroll",percent:Math.min(100,r)}:null};var xn=n=>{let e=0;for(let t of n){if(t!==0)return e+Math.clz32(t)-24;e+=8;}return e},kn=async n=>new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(n))),It=async n=>{for(let e=0;;e+=1){let t=e.toString(36);if(xn(await kn(`${n.nonce}:${t}`))>=n.difficulty)return t}};var B={am:{back:"\u1270\u1218\u1208\u1235",close:"\u12DD\u130B",closed:"\u12ED\u1205 \u1245\u133D \u12A0\u1201\u1295 \u121D\u120B\u123E\u127D\u1295 \u12A0\u12ED\u1240\u1260\u120D\u121D\u1362",failed:"\u1218\u120B\u12AD \u12A0\u120D\u1270\u127B\u1208\u121D\u1362 \u12A5\u1295\u12F0\u1308\u1293 \u12ED\u121E\u12AD\u1229\u1362",invalid:"\u12ED\u1205 \u1218\u120D\u1235 \u12A0\u12ED\u1240\u1260\u120D\u121D\u1362",next:"\u1240\u1323\u12ED",poweredBy:"\u1260Prodantix \u12E8\u1270\u1230\u122B",required:"\u12ED\u1205 \u12EB\u1235\u1348\u120D\u130B\u120D\u1362",sending:"\u1260\u1218\u120B\u12AD \u120B\u12ED\u2026",step:"\u12F0\u1228\u1303 {step} \u12A8{total}",submit:"\u120B\u12AD",thanks:"\u12A5\u1293\u1218\u1230\u130D\u1293\u1208\u1295\u1362"},ar:{back:"\u0631\u062C\u0648\u0639",close:"\u0625\u063A\u0644\u0627\u0642",closed:"\u0644\u0627 \u064A\u0642\u0628\u0644 \u0647\u0630\u0627 \u0627\u0644\u0646\u0645\u0648\u0630\u062C \u0631\u062F\u0648\u062F\u064B\u0627 \u0627\u0644\u0622\u0646.",failed:"\u062A\u0639\u0630\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644. \u062D\u0627\u0648\u0644 \u0645\u0631\u0629 \u0623\u062E\u0631\u0649.",invalid:"\u0647\u0630\u0647 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629.",next:"\u0627\u0644\u062A\u0627\u0644\u064A",poweredBy:"\u0645\u062F\u0639\u0648\u0645 \u0645\u0646 Prodantix",required:"\u0647\u0630\u0627 \u0627\u0644\u062D\u0642\u0644 \u0645\u0637\u0644\u0648\u0628.",sending:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u2026",step:"\u0627\u0644\u062E\u0637\u0648\u0629 {step} \u0645\u0646 {total}",submit:"\u0625\u0631\u0633\u0627\u0644",thanks:"\u0634\u0643\u0631\u064B\u0627 \u0644\u0643."},bn:{back:"\u09AA\u09C7\u099B\u09A8\u09C7",close:"\u09AC\u09A8\u09CD\u09A7 \u0995\u09B0\u09C1\u09A8",closed:"\u098F\u0987 \u09AB\u09B0\u09CD\u09AE\u099F\u09BF \u098F\u0996\u09A8 \u0989\u09A4\u09CD\u09A4\u09B0 \u09A8\u09BF\u099A\u09CD\u099B\u09C7 \u09A8\u09BE\u0964",failed:"\u09AA\u09BE\u09A0\u09BE\u09A8\u09CB \u09AF\u09BE\u09AF\u09BC\u09A8\u09BF\u0964 \u0986\u09AC\u09BE\u09B0 \u099A\u09C7\u09B7\u09CD\u099F\u09BE \u0995\u09B0\u09C1\u09A8\u0964",invalid:"\u098F\u0987 \u0989\u09A4\u09CD\u09A4\u09B0\u099F\u09BF \u0997\u09CD\u09B0\u09B9\u09A3\u09AF\u09CB\u0997\u09CD\u09AF \u09A8\u09AF\u09BC\u0964",next:"\u09AA\u09B0\u09AC\u09B0\u09CD\u09A4\u09C0",poweredBy:"Prodantix \u09A6\u09CD\u09AC\u09BE\u09B0\u09BE \u099A\u09BE\u09B2\u09BF\u09A4",required:"\u098F\u099F\u09BF \u0986\u09AC\u09B6\u09CD\u09AF\u0995\u0964",sending:"\u09AA\u09BE\u09A0\u09BE\u09A8\u09CB \u09B9\u099A\u09CD\u099B\u09C7\u2026",step:"\u09A7\u09BE\u09AA {step} / {total}",submit:"\u099C\u09AE\u09BE \u09A6\u09BF\u09A8",thanks:"\u09A7\u09A8\u09CD\u09AF\u09AC\u09BE\u09A6\u0964"},de:{back:"Zur\xFCck",close:"Schlie\xDFen",closed:"Dieses Formular nimmt gerade keine Antworten an.",failed:"Senden fehlgeschlagen. Bitte erneut versuchen.",invalid:"Diese Antwort wird nicht angenommen.",next:"Weiter",poweredBy:"Bereitgestellt von Prodantix",required:"Dieses Feld ist erforderlich.",sending:"Wird gesendet\u2026",step:"Schritt {step} von {total}",submit:"Absenden",thanks:"Vielen Dank."},en:{back:"Back",close:"Close",closed:"This form is not accepting responses right now.",failed:"This could not be sent. Try again.",invalid:"This answer is not accepted.",next:"Next",poweredBy:"Powered by Prodantix",required:"This is required.",sending:"Sending\u2026",step:"Step {step} of {total}",submit:"Submit",thanks:"Thank you."},es:{back:"Atr\xE1s",close:"Cerrar",closed:"Este formulario no acepta respuestas ahora.",failed:"No se pudo enviar. Int\xE9ntalo de nuevo.",invalid:"Esta respuesta no se acepta.",next:"Siguiente",poweredBy:"Con la tecnolog\xEDa de Prodantix",required:"Este campo es obligatorio.",sending:"Enviando\u2026",step:"Paso {step} de {total}",submit:"Enviar",thanks:"Gracias."},et:{back:"Tagasi",close:"Sulge",closed:"See vorm ei v\xF5ta praegu vastuseid vastu.",failed:"Saatmine eba\xF5nnestus. Proovi uuesti.",invalid:"Seda vastust ei v\xF5eta vastu.",next:"Edasi",poweredBy:"Toetab Prodantix",required:"See on kohustuslik.",sending:"Saatmine\u2026",step:"Samm {step}/{total}",submit:"Saada",thanks:"Ait\xE4h."},fil:{back:"Bumalik",close:"Isara",closed:"Hindi tumatanggap ng sagot ang form na ito ngayon.",failed:"Hindi naipadala. Subukan ulit.",invalid:"Hindi tinatanggap ang sagot na ito.",next:"Susunod",poweredBy:"Pinapagana ng Prodantix",required:"Kailangan ito.",sending:"Ipinapadala\u2026",step:"Hakbang {step} sa {total}",submit:"Ipadala",thanks:"Salamat."},fr:{back:"Retour",close:"Fermer",closed:"Ce formulaire n\u2019accepte plus de r\xE9ponses pour le moment.",failed:"L\u2019envoi a \xE9chou\xE9. R\xE9essayez.",invalid:"Cette r\xE9ponse n\u2019est pas accept\xE9e.",next:"Suivant",poweredBy:"Propuls\xE9 par Prodantix",required:"Ce champ est obligatoire.",sending:"Envoi\u2026",step:"\xC9tape {step} sur {total}",submit:"Envoyer",thanks:"Merci."},hi:{back:"\u092A\u0940\u091B\u0947",close:"\u092C\u0902\u0926 \u0915\u0930\u0947\u0902",closed:"\u092F\u0939 \u092B\u093C\u0949\u0930\u094D\u092E \u0905\u092D\u0940 \u091C\u0935\u093E\u092C \u0928\u0939\u0940\u0902 \u0932\u0947 \u0930\u0939\u093E \u0939\u0948\u0964",failed:"\u092D\u0947\u091C\u093E \u0928\u0939\u0940\u0902 \u091C\u093E \u0938\u0915\u093E\u0964 \u092B\u093F\u0930 \u0915\u094B\u0936\u093F\u0936 \u0915\u0930\u0947\u0902\u0964",invalid:"\u092F\u0939 \u091C\u0935\u093E\u092C \u0938\u094D\u0935\u0940\u0915\u093E\u0930 \u0928\u0939\u0940\u0902 \u0939\u0948\u0964",next:"\u0906\u0917\u0947",poweredBy:"Prodantix \u0926\u094D\u0935\u093E\u0930\u093E \u0938\u0902\u091A\u093E\u0932\u093F\u0924",required:"\u092F\u0939 \u091C\u093C\u0930\u0942\u0930\u0940 \u0939\u0948\u0964",sending:"\u092D\u0947\u091C\u093E \u091C\u093E \u0930\u0939\u093E \u0939\u0948\u2026",step:"\u091A\u0930\u0923 {step} / {total}",submit:"\u092D\u0947\u091C\u0947\u0902",thanks:"\u0927\u0928\u094D\u092F\u0935\u093E\u0926\u0964"},id:{back:"Kembali",close:"Tutup",closed:"Formulir ini sedang tidak menerima tanggapan.",failed:"Gagal mengirim. Coba lagi.",invalid:"Jawaban ini tidak diterima.",next:"Berikutnya",poweredBy:"Didukung oleh Prodantix",required:"Wajib diisi.",sending:"Mengirim\u2026",step:"Langkah {step} dari {total}",submit:"Kirim",thanks:"Terima kasih."},ja:{back:"\u623B\u308B",close:"\u9589\u3058\u308B",closed:"\u3053\u306E\u30D5\u30A9\u30FC\u30E0\u306F\u73FE\u5728\u56DE\u7B54\u3092\u53D7\u3051\u4ED8\u3051\u3066\u3044\u307E\u305B\u3093\u3002",failed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",invalid:"\u3053\u306E\u56DE\u7B54\u306F\u53D7\u3051\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3002",next:"\u6B21\u3078",poweredBy:"Powered by Prodantix",required:"\u5FC5\u9808\u9805\u76EE\u3067\u3059\u3002",sending:"\u9001\u4FE1\u4E2D\u2026",step:"\u30B9\u30C6\u30C3\u30D7 {step}/{total}",submit:"\u9001\u4FE1",thanks:"\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3057\u305F\u3002"},ko:{back:"\uC774\uC804",close:"\uB2EB\uAE30",closed:"\uC774 \uC591\uC2DD\uC740 \uC9C0\uAE08 \uC751\uB2F5\uC744 \uBC1B\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",failed:"\uBCF4\uB0B4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694.",invalid:"\uC774 \uB2F5\uBCC0\uC740 \uBC1B\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",next:"\uB2E4\uC74C",poweredBy:"Prodantix \uC81C\uACF5",required:"\uD544\uC218 \uD56D\uBAA9\uC785\uB2C8\uB2E4.",sending:"\uBCF4\uB0B4\uB294 \uC911\u2026",step:"{total}\uB2E8\uACC4 \uC911 {step}\uB2E8\uACC4",submit:"\uC81C\uCD9C",thanks:"\uAC10\uC0AC\uD569\uB2C8\uB2E4."},pt:{back:"Voltar",close:"Fechar",closed:"Este formul\xE1rio n\xE3o est\xE1 a aceitar respostas neste momento.",failed:"N\xE3o foi poss\xEDvel enviar. Tente novamente.",invalid:"Esta resposta n\xE3o \xE9 aceite.",next:"Seguinte",poweredBy:"Com tecnologia Prodantix",required:"Este campo \xE9 obrigat\xF3rio.",sending:"A enviar\u2026",step:"Passo {step} de {total}",submit:"Enviar",thanks:"Obrigado."},ru:{back:"\u041D\u0430\u0437\u0430\u0434",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",closed:"\u042D\u0442\u0430 \u0444\u043E\u0440\u043C\u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u043D\u0435 \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442 \u043E\u0442\u0432\u0435\u0442\u044B.",failed:"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437.",invalid:"\u042D\u0442\u043E\u0442 \u043E\u0442\u0432\u0435\u0442 \u043D\u0435 \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442\u0441\u044F.",next:"\u0414\u0430\u043B\u0435\u0435",poweredBy:"\u0420\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u043D\u0430 Prodantix",required:"\u042D\u0442\u043E \u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u043F\u043E\u043B\u0435.",sending:"\u041E\u0442\u043F\u0440\u0430\u0432\u043A\u0430\u2026",step:"\u0428\u0430\u0433 {step} \u0438\u0437 {total}",submit:"\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C",thanks:"\u0421\u043F\u0430\u0441\u0438\u0431\u043E."},sw:{back:"Rudi",close:"Funga",closed:"Fomu hii haipokei majibu kwa sasa.",failed:"Imeshindwa kutuma. Jaribu tena.",invalid:"Jibu hili halikubaliki.",next:"Endelea",poweredBy:"Inaendeshwa na Prodantix",required:"Hii inahitajika.",sending:"Inatuma\u2026",step:"Hatua {step} kati ya {total}",submit:"Tuma",thanks:"Asante."},vi:{back:"Quay l\u1EA1i",close:"\u0110\xF3ng",closed:"Bi\u1EC3u m\u1EABu n\xE0y hi\u1EC7n kh\xF4ng nh\u1EADn c\xE2u tr\u1EA3 l\u1EDDi.",failed:"Kh\xF4ng g\u1EEDi \u0111\u01B0\u1EE3c. H\xE3y th\u1EED l\u1EA1i.",invalid:"C\xE2u tr\u1EA3 l\u1EDDi n\xE0y kh\xF4ng \u0111\u01B0\u1EE3c ch\u1EA5p nh\u1EADn.",next:"Ti\u1EBFp",poweredBy:"\u0110\u01B0\u1EE3c h\u1ED7 tr\u1EE3 b\u1EDFi Prodantix",required:"Tr\u01B0\u1EDDng n\xE0y l\xE0 b\u1EAFt bu\u1ED9c.",sending:"\u0110ang g\u1EEDi\u2026",step:"B\u01B0\u1EDBc {step}/{total}",submit:"G\u1EEDi",thanks:"C\u1EA3m \u01A1n b\u1EA1n."},zh:{back:"\u4E0A\u4E00\u6B65",close:"\u5173\u95ED",closed:"\u6B64\u8868\u5355\u76EE\u524D\u4E0D\u63A5\u53D7\u56DE\u590D\u3002",failed:"\u53D1\u9001\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002",invalid:"\u6B64\u56DE\u7B54\u65E0\u6548\u3002",next:"\u4E0B\u4E00\u6B65",poweredBy:"\u7531 Prodantix \u63D0\u4F9B\u652F\u6301",required:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879\u3002",sending:"\u6B63\u5728\u53D1\u9001\u2026",step:"\u7B2C {step} \u6B65\uFF0C\u5171 {total} \u6B65",submit:"\u63D0\u4EA4",thanks:"\u8C22\u8C22\u3002"}},Me=n=>{var t;let e=(t=(n!=null?n:"").toLowerCase().split("-")[0])!=null?t:"";return e in B?e:"en"};var x="prodantix-form",Sn=`.${x}{font-family:var(--pdx-font);color:var(--pdx-text);background:var(--pdx-background);max-width:var(--pdx-width);box-sizing:border-box;padding:16px;border-radius:var(--pdx-radius)}
1
+ (function(){'use strict';var Bt=Object.defineProperty;var jt=(n,e,t)=>e in n?Bt(n,e,{enumerable:true,configurable:true,writable:true,value:t}):n[e]=t;var d=(n,e,t)=>jt(n,typeof e!="symbol"?e+"":e,t);var M=class extends Error{constructor(t,r,i){super(r,i);d(this,"code");this.code=t,this.name="ProdantixError";}},V=class extends M{constructor(e){super("config",e),this.name="ConfigError";}},D=class extends M{constructor(t,r){super("validation",r);d(this,"field");this.field=t,this.name="ValidationError";}},m=class extends M{constructor(t,r,i){super("transport",t,i);d(this,"status");this.status=r,this.name="TransportError";}};function E(n){if(n)return n;let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}function S(){let n=globalThis.AbortController;return n?new n:void 0}var Be=n=>new Promise(e=>{setTimeout(e,n);});function C(n){return n.replace(/\/+$/,"")}var N=class{constructor(){d(this,"store",new Map);}getItem(e){var t;return (t=this.store.get(e))!=null?t:null}removeItem(e){this.store.delete(e);}setItem(e,t){this.store.set(e,t);}},H=class{constructor(e,t=()=>false){this.real=e;this.passes=t;d(this,"held",new N);d(this,"opened",false);}get isOpen(){return this.opened}open(){this.opened=true;}close(){this.opened=false;}target(e){return this.opened||this.passes(e)?this.real:this.held}getItem(e){return this.target(e).getItem(e)}removeItem(e){this.target(e).removeItem(e);}setItem(e,t){this.target(e).setItem(e,t);}};function je(){try{let n=globalThis.localStorage;if(n){let e="__pdx_probe__";return n.setItem(e,"1"),n.removeItem(e),n}}catch(n){return new N}return new N}var Ge={now:()=>new Date};function Y(n){return n.toISOString()}function Ve(){if(typeof window=="undefined"||typeof Intl=="undefined")return null;let n=Intl.DateTimeFormat().resolvedOptions().timeZone;return typeof n=="string"&&n!==""?n:null}function Gt(){return globalThis.crypto}function Vt(n){n[6]=n[6]&15|64,n[8]=n[8]&63|128;let e=[];for(let t=0;t<16;t+=1)e.push(n[t].toString(16).padStart(2,"0"));return `${e[0]}${e[1]}${e[2]}${e[3]}-${e[4]}${e[5]}-${e[6]}${e[7]}-${e[8]}${e[9]}-${e[10]}${e[11]}${e[12]}${e[13]}${e[14]}${e[15]}`}function Ht(){let n=Gt();if(n!=null&&n.randomUUID)return n.randomUUID();let e=new Uint8Array(16);if(n!=null&&n.getRandomValues)n.getRandomValues(e);else for(let t=0;t<16;t+=1)e[t]=Math.floor(Math.random()*256);return Vt(e)}var He={uuid:Ht};var Ut=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var Jt=/^(?:\$|[a-z])[a-z0-9_.]*$/;function Ue(n){let e=0;for(let t of n)e+=1;return e}function Je(n){return Ut.test(n)}function zt(n){return Jt.test(n)}function ze(n){let e=Ue(n);if(e<1||e>200)throw new D("distinct_id","distinct_id must be between 1 and 200 characters")}function We(n){let e=Ue(n);if(e<1||e>200)throw new D("event_name","event_name must be between 1 and 200 characters");if(!zt(n))throw new D("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var Ye="prodantix-js",Qe="0.8.0";var Wt=n=>{};function Xe(n){var i,o,s,a,l,g,v,c,$,L,f,_,T,z,A;if(!n.apiKey||!Je(n.apiKey))throw new V("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!n.host)throw new V("host is required (the ingest base URL)");let e=C(n.host),t=n.defaultProperties,r=(i=n.storage)!=null?i:new N;return {apiKey:n.apiKey,autocapture:(o=n.autocapture)!=null?o:false,clock:(s=n.clock)!=null?s:Ge,consent:n.consent,consentMode:n.consentMode,defaultProperties:typeof t=="function"?t:()=>t!=null?t:{},describeElement:n.describeElement,flagsHost:n.flagsHost?C(n.flagsHost):e,flushAt:(a=n.flushAt)!=null?a:20,flushIntervalMs:(l=n.flushIntervalMs)!=null?l:1e4,host:e,ids:(g=n.ids)!=null?g:He,locale:n.locale,maxQueueSize:(v=n.maxQueueSize)!=null?v:1e3,maxRetries:(c=n.maxRetries)!=null?c:3,namespace:be(n.apiKey),onError:($=n.onError)!=null?$:Wt,os:n.os,requestTimeoutMs:(L=n.requestTimeoutMs)!=null?L:1e4,sdkName:(f=n.sdkName)!=null?f:Ye,sdkVersion:(_=n.sdkVersion)!=null?_:Qe,sessionTracking:(T=n.sessionTracking)!=null?T:false,sharedStorage:(z=n.sharedStorage)!=null?z:r,socketFactory:n.socketFactory,storage:r,streamFlags:(A=n.streamFlags)!=null?A:false,transport:n.transport}}function be(n){return n.slice(0,16)}var Ze=(n,e)=>{let t={$cta_id:n.id,$cta_kind:n.kind,$cta_variant:n.variant.key,$cta_version:n.version},r=e===void 0?void 0:n.variant.content.buttons[e];return r&&e!==void 0&&(t.$cta_button=e,t.$cta_button_label=r.label,r.action.kind==="form"&&(t.$cta_form_id=r.action.value)),t},Q=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=E(e.fetch),this.host=C(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async ctas(e){let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=new URLSearchParams({anonymous:String(e.anonymous),device:e.device,distinct_id:e.distinctId,language:e.language,url:e.url}),i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s=await t(`${this.host}/v1/ctas?${r.toString()}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(s.status<200||s.status>=300)throw new m(`ctas request failed with status ${s.status}`,s.status);return JSON.parse(await s.text()).ctas}finally{o!==void 0&&clearTimeout(o);}}};function et(n,e,t){var i,o,s;We(n.eventName),ze(n.distinctId);let r={distinct_id:n.distinctId,event_id:(i=n.eventId)!=null?i:t.uuid(),event_name:n.eventName,properties:(o=n.properties)!=null?o:{},schema_version:1,timestamp:Y((s=n.timestamp)!=null?s:e.now())};return n.context&&(r.context=n.context),n.sessionId&&(r.session_id=n.sessionId),r}var q=Symbol("absent");function Yt(n,e){var i,o;if(n==="distinct_id")return e.distinctId;let t=(i=e.properties)!=null?i:{};if(Object.prototype.hasOwnProperty.call(t,n))return t[n];let r=(o=e.attributes)!=null?o:{};return Object.prototype.hasOwnProperty.call(r,n)?r[n]:q}function O(n){return n===q?"undefined":String(n)}function tt(n){return n===q?Number.NaN:Number(n)}function nt(n){return n!==q&&n!==null&&n!==""}function rt(n,e){if(!Array.isArray(e))return false;let t=O(n);return e.map(r=>String(r)).includes(t)}function it(n,e){var i,o;let t=Yt(n.attribute,e),r=n.value;switch(n.op){case "is_set":return nt(t);case "is_not_set":return !nt(t);case "eq":return O(t)===O(r===void 0?q:r);case "neq":return O(t)!==O(r===void 0?q:r);case "contains":return O(t).includes(O(r===void 0?q:r));case "in":return rt(t,r);case "not_in":return Array.isArray(r)?!rt(t,r):false;case "gt":return X(t,r,(s,a)=>s>a);case "gte":return X(t,r,(s,a)=>s>=a);case "lt":return X(t,r,(s,a)=>s<a);case "lte":return X(t,r,(s,a)=>s<=a);case "in_cohort":return typeof r=="string"&&r!==""&&((i=e.cohorts)!=null?i:[]).includes(r);case "not_in_cohort":return typeof r=="string"&&r!==""&&!((o=e.cohorts)!=null?o:[]).includes(r);default:return false}}function X(n,e,t){let r=tt(n),i=e===void 0?Number.NaN:tt(e);return Number.isNaN(r)||Number.isNaN(i)?false:t(r,i)}function st(n,e){let t=`${n}:${e}`,r=2166136261;for(let i=0;i<t.length;i++)r^=t.charCodeAt(i),r=Math.imul(r,16777619);return (r>>>0)%100}function xe(n,e){return n.targeting.length===0||n.targeting.every(t=>it(t,e))}function ot(n,e){var o;let t=st(n.key,e.distinctId),r=(o=n.variations)!=null?o:[];if(r.length===0)return n.rolloutPercentage>=100||t<n.rolloutPercentage?"true":"false";let i=0;for(let s=r.length-1;s>=0;s--)if(i+=r[s].weight,t<i)return r[s].key;return r[0].key}function ke(n,e,t,r){var i;for(let o of (i=n.prerequisites)!=null?i:[]){if(r.includes(o.flagKey))return false;let s=e.find(l=>l.key===o.flagKey);if(!s||!s.enabled)return false;r.push(s.key);let a=ke(s,e,t,r)&&xe(s,t)&&ot(s,t)===o.variationKey;if(r.pop(),!a)return false}return true}function Z(n,e,t){return n.enabled?ke(n,e,t,[n.key])?xe(n,t)?n.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:st(n.key,t.distinctId)<n.rolloutPercentage?{enabled:true,reason:"rollout"}:{enabled:false,reason:"rollout_excluded"}:{enabled:false,reason:"targeting"}:{enabled:false,reason:"prerequisite"}:{enabled:false,reason:"disabled"}}function at(n,e){let t={};for(let r of n)t[r.key]=Z(r,n,e).enabled;return t}function Se(n,e,t){var s,a;let r=(s=n.variations)!=null?s:[],i=r[0];if(!i)return null;if(!n.enabled||!ke(n,e,t,[n.key])||!xe(n,t))return i;let o=ot(n,t);return (a=r.find(l=>l.key===o))!=null?a:i}function dt(n){return n.some(e=>e.targeting.some(t=>t.op==="in_cohort"||t.op==="not_in_cohort"))}function lt(n){return `40${JSON.stringify(n)}`}function ct(){return "3"}function ut(n){let e=n.charAt(0),t=n.slice(1);if(e==="2")return {kind:"ping"};if(e==="1")return {kind:"disconnect"};if(e==="0"){let s=we(t);return {kind:"open",pingInterval:typeof(s==null?void 0:s.pingInterval)=="number"?s.pingInterval:25e3,pingTimeout:typeof(s==null?void 0:s.pingTimeout)=="number"?s.pingTimeout:2e4}}if(e!=="4")return {kind:"other"};let r=t.charAt(0),i=t.slice(1);if(r==="0")return {kind:"connected"};if(r==="1")return {kind:"disconnect"};if(r==="4"){let s=we(i);return {kind:"connectError",message:typeof(s==null?void 0:s.message)=="string"?s.message:"refused"}}if(r!=="2")return {kind:"other"};let o=we(i);return !Array.isArray(o)||typeof o[0]!="string"?{kind:"other"}:{kind:"event",name:o[0],payload:o[1]}}function we(n){try{return JSON.parse(n)}catch(e){return null}}var Qt="/socket.io/?EIO=4&transport=websocket",Xt=250,ee=class{constructor(e){this.options=e;d(this,"socket",null);d(this,"heartbeat",null);d(this,"pending",null);d(this,"lastKey","");d(this,"ready",false);d(this,"closed",false);d(this,"heartbeatWindow",45e3);d(this,"factory");d(this,"setTimer");d(this,"clearTimer");var t,r,i;this.factory=(t=e.socketFactory)!=null?t:Zt,this.setTimer=(r=e.setTimer)!=null?r:((o,s)=>setTimeout(o,s)),this.clearTimer=(i=e.clearTimer)!=null?i:(o=>clearTimeout(o));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${Qt}`,t;try{t=this.factory(e);}catch(r){this.options.onClosed(false);return}this.socket=t,t.onmessage=r=>this.receive(String(r.data)),t.onerror=()=>t.close(),t.onclose=()=>this.fell();}close(){this.closed=true,this.stopHeartbeat(),this.pending!==null&&this.clearTimer(this.pending),this.pending=null;let e=this.socket;this.socket=null,e==null||e.close();}receive(e){var r,i,o,s;let t=ut(e);if(t.kind==="open"){this.armHeartbeat(t.pingInterval+t.pingTimeout),(r=this.socket)==null||r.send(lt({projectKey:this.options.projectKey}));return}if(t.kind==="ping"){this.armHeartbeat(),(i=this.socket)==null||i.send(ct());return}if(t.kind==="connectError"||t.kind==="disconnect"){this.stopHeartbeat(),(o=this.socket)==null||o.close();return}if(t.kind==="event"){if(t.name==="ready"){this.ready=true;return}if(t.name==="flagChange"){let a=(s=t.payload)==null?void 0:s.key;this.lastKey=typeof a=="string"?a:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},Xt));}}}fell(){this.stopHeartbeat();let e=this.ready;this.socket=null,this.ready=false,this.closed||this.options.onClosed(e);}armHeartbeat(e){e!==void 0&&(this.heartbeatWindow=e),this.stopHeartbeat(),this.heartbeat=this.setTimer(()=>{var t;return (t=this.socket)==null?void 0:t.close()},this.heartbeatWindow);}stopHeartbeat(){this.heartbeat!==null&&this.clearTimer(this.heartbeat),this.heartbeat=null;}};function Zt(n){let e=globalThis.WebSocket;if(!e)throw new m("no WebSocket");return new e(n)}var te=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=E(e.fetch),this.host=C(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){var s,a;let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let l=await t(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!l.ok)throw new m(`flags request failed with status ${l.status}`,l.status);let g=JSON.parse(await l.text());return {flags:(s=g.flags)!=null?s:{},variants:(a=g.variants)!=null?a:{}}}finally{o!==void 0&&clearTimeout(o);}}async snapshot(){var o;let e=this.fetch;if(!e)throw new m("no fetch implementation available in this runtime");let t=`${this.host}/v1/flags/snapshot`,r=S(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await e(t,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new m(`flag snapshot request failed with status ${s.status}`,s.status);let a=JSON.parse(await s.text()),l={flags:(o=a.flags)!=null?o:[],generatedAt:a.generatedAt};return typeof a.socketUrl=="string"&&a.socketUrl!==""&&(l.socketUrl=a.socketUrl),l}finally{i!==void 0&&clearTimeout(i);}}async memberships(e){var s;let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await t(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new m(`memberships request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).cohorts)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};var pt="$form_viewed",mt="$form_started",U=class extends Error{constructor(t,r,i){super(i);d(this,"fields");d(this,"status");this.name="FormRefusedError",this.status=t,this.fields=r;}},ne=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=E(e.fetch),this.host=C(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async request(e,t){let r=this.fetch;if(!r)throw new m("no fetch implementation available in this runtime");let i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let s={authorization:`Bearer ${this.projectKey}`};t.body!==void 0&&(s["content-type"]="application/json");let a=await r(`${this.host}${e}`,{body:t.body,headers:s,method:t.method,signal:i==null?void 0:i.signal});return {status:a.status,text:await a.text()}}finally{o!==void 0&&clearTimeout(o);}}async form(e,t){let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}?distinct_id=${encodeURIComponent(t)}`,{method:"GET"});if(r<200||r>=300)throw new m(`form request failed with status ${r}`,r);return JSON.parse(i)}async submit(e,t){var a,l,g,v;let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}/submissions`,{body:JSON.stringify(t),method:"POST"});if(r>=200&&r<300)return JSON.parse(i).afterSubmit;let o=[],s=`form submission failed with status ${r}`;try{let c=JSON.parse(i);o=(l=(a=c.error)==null?void 0:a.fields)!=null?l:[],s=(v=(g=c.error)==null?void 0:g.message)!=null?v:s;}catch(c){o=[];}throw new U(r,o,s)}};var gt="$survey_shown",ht="$survey_dismissed",ft="$survey_sent",re=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=E(e.fetch),this.host=C(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async surveys(e,t){var s;let r=this.fetch;if(!r)throw new m("no fetch implementation available in this runtime");let i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await r(`${this.host}/v1/surveys?distinct_id=${encodeURIComponent(e)}${t?`&lang=${encodeURIComponent(t)}`:""}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i==null?void 0:i.signal});if(!a.ok)throw new m(`surveys request failed with status ${a.status}`,a.status);return (s=JSON.parse(await a.text()).surveys)!=null?s:[]}finally{o!==void 0&&clearTimeout(o);}}};function ie(n,e){let t={$survey_id:n.id,$survey_iteration:n.iteration,$survey_name:n.name};for(let[r,i]of Object.entries(e))t[`$survey_response_${r}`]=i;return t}var se=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=E(e.fetch),this.host=C(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async guides(e){var o;let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=S(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await t(`${this.host}/v1/guides?distinct_id=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r==null?void 0:r.signal});if(!s.ok)throw new m(`guides request failed with status ${s.status}`,s.status);return (o=JSON.parse(await s.text()).guides)!=null?o:[]}finally{i!==void 0&&clearTimeout(i);}}};function yt(n,e){let t={$guide_id:n.id,$guide_iteration:n.iteration,$guide_name:n.name};return e!==void 0&&(t.$guide_step_id=e),t}function Ce(n){if(typeof n!="string")return;let e=Array.from(n).length;return e>=1&&e<=200?n:void 0}function Te(n,e){return `pdx.${n}.${e}`}var Fe="consent",en=["identityLink","analytics","marketing","functional"];function Ee(n){if(typeof n!="string")return null;try{let e=JSON.parse(n);if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e,r={};for(let i of en){let o=t[i];typeof o=="boolean"&&(r[i]=o);}return typeof t.version=="number"&&Number.isInteger(t.version)&&(r.version=t.version),Array.isArray(t.categories)&&t.categories.every(i=>typeof i=="string")&&(r.categories=t.categories),Object.keys(r).length===0?null:r}catch(e){return null}}var vt=n=>n.endsWith(`.${Fe}`);function ae(n,e){return Ee(n.getItem(Te(e,Fe)))}function tn(n,e,t){var s;let r=Te(e,Fe),i=Ee(JSON.stringify(t)),o=i===null?null:Ee(JSON.stringify({...(s=ae(n,e))!=null?s:{},...i}));if(o===null){n.removeItem(r);return}n.setItem(r,JSON.stringify(o));}var oe=class{constructor(e,t,r,i){this.storage=e;this.shared=t;this.ids=r;this.namespace=i;d(this,"anonymousId");d(this,"distinctId");d(this,"identified");this.refresh();}refresh(){let e=Ce(this.shared.getItem(this.key("anonymous_id"))),t=Ce(this.storage.getItem(this.key("anonymous_id")));e?(this.anonymousId=e,t!==e&&this.storage.setItem(this.key("anonymous_id"),e)):t?(this.anonymousId=t,this.shared.setItem(this.key("anonymous_id"),t)):(this.anonymousId=this.ids.uuid(),this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId));let r=Ce(this.storage.getItem(this.key("distinct_id")));r?(this.distinctId=r,this.identified=true):(this.distinctId=this.anonymousId,this.identified=false);}getAnonymousId(){return this.anonymousId}getDistinctId(){return this.distinctId}isIdentified(){return this.identified}snapshot(){return {anonymousId:this.anonymousId,distinctId:this.distinctId,identified:this.identified}}consent(){return ae(this.shared,this.namespace)}setConsent(e){tn(this.shared,this.namespace,e);}assumeAnonymousId(e){this.anonymousId=e,this.shared.setItem(this.key("anonymous_id"),e),this.storage.setItem(this.key("anonymous_id"),e),this.identified||(this.distinctId=e);}identify(e){var o;let t=!this.identified||this.distinctId!==e,r=this.storage.getItem(this.key("linked_anonymous_id")),i=t||r!==this.anonymousId;return this.distinctId=e,this.identified=true,t&&this.storage.setItem(this.key("distinct_id"),e),!i||((o=this.consent())==null?void 0:o.identityLink)===false?{changed:t}:(this.storage.setItem(this.key("linked_anonymous_id"),this.anonymousId),{anonymousToLink:this.anonymousId,changed:t})}reset(){this.anonymousId=this.ids.uuid(),this.distinctId=this.anonymousId,this.identified=false,this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.removeItem(this.key("distinct_id")),this.storage.removeItem(this.key("linked_anonymous_id"));}key(e){return Te(this.namespace,e)}};var de=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");var t;this.fetch=E(e.fetch),this.host=C(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=(t=e.requestTimeoutMs)!=null?t:1e4;}async inbox(e){var s;let t=this.requireFetch(),r=`${this.host}/v1/messages?distinct_id=${encodeURIComponent(e)}`,i=await this.request(t,r,{headers:this.authHeaders(),method:"GET"});if(!i.ok)throw new m(`inbox request failed with status ${i.status}`,i.status);return (s=JSON.parse(await i.text()).messages)!=null?s:[]}async markRead(e,t){let r=this.requireFetch(),i=`${this.host}/v1/messages/read`,o=await this.request(r,i,{body:JSON.stringify({distinct_id:t,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!o.ok)throw new m(`mark-read request failed with status ${o.status}`,o.status)}requireFetch(){if(!this.fetch)throw new m("no fetch implementation available in this runtime");return this.fetch}authHeaders(){return {authorization:`Bearer ${this.projectKey}`}}async request(e,t,r){let i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(t,{...r,signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}};var le=class{constructor(e,t){this.maxSize=e;this.onOverflow=t;d(this,"events",[]);}get size(){return this.events.length}enqueue(e){this.events.push(e),this.enforceCap();}restore(e){this.events.push(...e),this.enforceCap();}requeue(e){this.events.unshift(...e),this.enforceCap();}drain(e){let t=e===void 0?this.events.length:Math.min(e,this.events.length);return this.events.splice(0,t)}snapshot(){return [...this.events]}enforceCap(){var t;if(this.events.length<=this.maxSize)return;let e=this.events.splice(0,this.events.length-this.maxSize);(t=this.onOverflow)==null||t.call(this,{dropped:e});}};var nn={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function rn(n){return `pdx.${n}.session`}var ce=class{constructor(e,t,r,i,o=nn){this.storage=e;this.ids=t;this.clock=r;this.namespace=i;this.options=o;}current(){return this.touch().id}startedAt(){return this.touch().startedAt}reset(){this.storage.removeItem(this.key());}touch(){let e=this.clock.now().getTime(),t=this.live(this.read(),e);if(t===void 0)return this.write({id:this.ids.uuid(),lastActivityAt:e,startedAt:e});if(e-t.lastActivityAt<=this.options.throttleMs)return t;let r=this.live(this.read(),e),i=r!==void 0&&r.id!==t.id?r:t;return this.write({...i,lastActivityAt:e})}live(e,t){if(e!==void 0&&!(t-e.lastActivityAt>this.options.idleMs||t-e.startedAt>this.options.maxMs))return e}write(e){return this.storage.setItem(this.key(),JSON.stringify(e)),e}read(){let e=this.storage.getItem(this.key());if(e)try{let t=JSON.parse(e);return typeof t.id=="string"&&typeof t.startedAt=="number"&&typeof t.lastActivityAt=="number"?{id:t.id,lastActivityAt:t.lastActivityAt,startedAt:t.startedAt}:void 0}catch(t){return}}key(){return rn(this.namespace)}};var k={createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",set:"$set"};function bt(n){return n>=400&&n<500&&n!==429}var K=class{constructor(e={}){d(this,"fetch");d(this,"maxRetries");d(this,"requestTimeoutMs");d(this,"baseDelayMs");d(this,"maxDelayMs");d(this,"sleep");d(this,"random");var t,r,i,o,s,a;this.fetch=E(e.fetch),this.maxRetries=(t=e.maxRetries)!=null?t:3,this.requestTimeoutMs=(r=e.requestTimeoutMs)!=null?r:1e4,this.baseDelayMs=(i=e.baseDelayMs)!=null?i:500,this.maxDelayMs=(o=e.maxDelayMs)!=null?o:3e4,this.sleep=(s=e.sleep)!=null?s:Be,this.random=(a=e.random)!=null?a:Math.random;}async send(e){let t=this.fetch;if(!t)throw new m("no fetch implementation available in this runtime");let r=JSON.stringify(e.body),i;for(let o=0;o<=this.maxRetries;o+=1){try{let s=await this.attempt(t,e,r);if(s.ok)return;if(bt(s.status))throw new m(`ingest rejected batch with status ${s.status}`,s.status);i=new m(`ingest transient status ${s.status}`,s.status);}catch(s){if(s instanceof m&&s.status!==void 0&&bt(s.status))throw s;i=s;}o<this.maxRetries&&await this.sleep(this.backoff(o));}throw new m("ingest delivery failed after retries",void 0,{cause:i})}async attempt(e,t,r){let i=S(),o=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(t.url,{body:r,headers:{authorization:`Bearer ${t.projectKey}`,"content-type":"application/json"},method:"POST",signal:i==null?void 0:i.signal})}finally{o!==void 0&&clearTimeout(o);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};var sn="queue",on=1e3,xt=3e4,_e=n=>{let e={};return n.avatar!==void 0&&(e.$avatar=n.avatar),n.email!==void 0&&(e.$email=n.email),n.name!==void 0&&(e.$name=n.name),n.phone!==void 0&&(e.$phone=n.phone),e},ue=class{constructor(e){d(this,"config");d(this,"identity");d(this,"session");d(this,"queue");d(this,"transport");d(this,"flagsClient");d(this,"messagesClient");d(this,"surveysClient");d(this,"guidesClient");d(this,"captureListeners",new Set);d(this,"formsClient");d(this,"ctasClient");d(this,"context");d(this,"flushTimer");d(this,"flushing",false);d(this,"cachedFlags");d(this,"cachedSnapshot");d(this,"membershipCache");d(this,"stream");d(this,"shutDown",false);d(this,"exposures",new Set);d(this,"gates");d(this,"cookielessId");d(this,"storageListeners",new Set);var s,a,l;let t=Xe(e),r=(a=(s=ae(t.sharedStorage,t.namespace))!=null?s:t.consent)!=null?a:null;if(this.gates=[new H(t.storage),new H(t.sharedStorage,vt)],t.consentMode!=="banner"||(r==null?void 0:r.analytics)===true)for(let g of this.gates)g.open();let[i,o]=this.gates;this.config={...t,sharedStorage:o,storage:i},this.identity=new oe(this.config.storage,this.config.sharedStorage,this.config.ids,this.config.namespace),this.config.consent!==void 0&&this.identity.setConsent(this.config.consent),this.session=this.config.sessionTracking?new ce(this.config.sharedStorage,this.config.ids,this.config.clock,this.config.namespace):void 0,this.queue=new le(this.config.maxQueueSize,({dropped:g})=>{this.config.onError(new M("queue_overflow",`event queue overflow: dropped ${g.length} oldest event(s)`));}),this.transport=(l=this.config.transport)!=null?l:new K({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new te({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new de({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.surveysClient=new re({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.guidesClient=new se({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.formsClient=new ne({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.ctasClient=new Q({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.context={sdk:this.config.sdkName,sdk_version:this.config.sdkVersion},this.config.os&&(this.context.os=this.config.os),this.config.locale&&(this.context.locale=this.config.locale),this.restoreQueue(),this.startTimer();}get distinctId(){return this.identity.getDistinctId()}get anonymousId(){return this.identity.getAnonymousId()}get isIdentified(){return this.identity.isIdentified()}get sessionId(){var e;return (e=this.session)==null?void 0:e.current()}get sessionStartedAt(){var e;return (e=this.session)==null?void 0:e.startedAt()}capture(e,t={}){var r,i,o,s,a,l,g;try{this.identity.refresh();let v={...this.config.defaultProperties(),...t.element===void 0?{}:(o=(i=(r=this.config).describeElement)==null?void 0:i.call(r,t.element))!=null?o:{},...(s=t.properties)!=null?s:{}},c=et({context:this.context,distinctId:(a=t.distinctId)!=null?a:this.identity.getDistinctId(),eventName:e,properties:v,sessionId:(g=t.sessionId)!=null?g:(l=this.session)==null?void 0:l.current(),timestamp:t.timestamp},this.config.clock,this.config.ids);this.enqueue(c);}catch(v){this.config.onError(v);}for(let v of this.captureListeners)try{v(e);}catch(c){this.config.onError(c);}}onCapture(e){return this.captureListeners.add(e),()=>{this.captureListeners.delete(e);}}identify(e,t={}){var a,l;if(this.isCookieless())return;this.identity.refresh();let r=this.identity.identify(e),i={};r.anonymousToLink!==void 0&&(i.$anon_distinct_id=r.anonymousToLink);let o=Ve(),s={...o===null?{}:{$timezone:o},..._e((a=t.traits)!=null?a:{}),...(l=t.set)!=null?l:{}};Object.keys(s).length>0&&(i.$set=s),this.capture(k.identify,{properties:i});}link(e,t,r){if(this.isCookieless())return;let i={$anon_distinct_id:t},o=_e(r!=null?r:{});Object.keys(o).length>0&&(i.$set=o),this.capture(k.identify,{distinctId:e,properties:i});}setConsent(e){this.identity.setConsent(e),e.analytics===true&&this.allowStorage(),e.analytics===false&&this.config.consentMode==="banner"&&this.forbidStorage();}isCookieless(){return !this.gates[0].isOpen}takeCookielessId(e){this.cookielessId=e,this.isCookieless()&&this.identity.assumeAnonymousId(e);}allowStorage(){if(this.isCookieless()){for(let e of this.gates)e.open();this.identity.refresh();for(let e of [...this.storageListeners])e();}}onStorageAllowed(e){return this.storageListeners.add(e),()=>{this.storageListeners.delete(e);}}forbidStorage(){if(!this.isCookieless()){for(let e of ["anonymous_id","distinct_id","linked_anonymous_id","session"])this.config.storage.removeItem(`pdx.${this.config.namespace}.${e}`),this.config.sharedStorage.removeItem(`pdx.${this.config.namespace}.${e}`);for(let e of this.gates)e.close();this.identity.refresh(),this.cookielessId!==void 0&&this.identity.assumeAnonymousId(this.cookielessId);}}consent(){return this.identity.consent()}alias(e){this.capture(k.createAlias,{properties:{alias:e}});}group(e,t,r){let i={$group_key:t,$group_type:e};r&&(i.$set=r),this.capture(k.group,{properties:i});}setPersonProperties(e,t){if(this.isCookieless())return;let r={};e&&(r.$set=e),t&&(r.$set_once=t),this.capture(k.set,{properties:r});}setPersonTraits(e){if(this.isCookieless())return;let t=_e(e);Object.keys(t).length!==0&&this.capture(k.set,{properties:{$set:t}});}async getAllFlags(){var r;let e=this.identity.getDistinctId(),t=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:t.flags,variants:(r=t.variants)!=null?r:{}},t.flags}async isFeatureEnabled(e){var i,o,s,a;let r=(i=(await this.getAllFlags())[e])!=null?i:false;return this.recordExposure(e,(a=(s=(o=this.cachedFlags)==null?void 0:o.variants[e])==null?void 0:s.key)!=null?a:String(r)),r}async getVariant(e){var i,o,s,a;let t=await this.getAllFlags(),r=(o=(i=this.cachedFlags)==null?void 0:i.variants[e])!=null?o:null;return this.recordExposure(e,(a=r==null?void 0:r.key)!=null?a:String((s=t[e])!=null?s:false)),r}async getVariantLocal(e,t={}){var l;let r=await this.flagSnapshot(),i=r.flags.find(g=>g.key===e),o=await this.localContext(t,r.flags),s=i?Se(i,r.flags,o):null,a=i?Z(i,r.flags,o).enabled:false;return this.recordExposure(e,(l=s==null?void 0:s.key)!=null?l:String(a)),s?{key:s.key,value:s.value}:null}recordExposure(e,t){let r=`${this.identity.getDistinctId()} ${e} ${t}`;this.exposures.has(r)||(this.exposures.add(r),this.capture(k.featureFlagCalled,{properties:{$feature_flag:e,$feature_flag_response:t}}));}getCachedFlag(e){if(!(!this.cachedFlags||this.cachedFlags.distinctId!==this.distinctId))return this.cachedFlags.flags[e]}async getLocalFlags(e={}){let t=await this.flagSnapshot();return at(t.flags,await this.localContext(e,t.flags))}async isFeatureEnabledLocal(e,t={}){var a,l;let r=await this.flagSnapshot(),i=r.flags.find(g=>g.key===e),o=await this.localContext(t,r.flags),s=i?Z(i,r.flags,o).enabled:false;return this.recordExposure(e,(l=i?(a=Se(i,r.flags,o))==null?void 0:a.key:void 0)!=null?l:String(s)),s}async localContext(e,t){let r=this.identity.getDistinctId(),i=e.cohorts;if(i===void 0&&dt(t)){let o=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===r&&o-this.membershipCache.fetchedAt<xt?i=this.membershipCache.cohorts:(i=await this.flagsClient.memberships(r),this.membershipCache={cohorts:i,distinctId:r,fetchedAt:o});}return {attributes:e.attributes,cohorts:i,distinctId:r,properties:e.properties}}async flagSnapshot(){let e=this.config.clock.now().getTime();if(this.cachedSnapshot&&e-this.cachedSnapshot.fetchedAt<xt)return this.cachedSnapshot.snapshot;let t=await this.flagsClient.snapshot();return this.cachedSnapshot={fetchedAt:e,snapshot:t},this.maybeStream(t),t}maybeStream(e){if(!this.config.streamFlags||this.shutDown||this.stream||!e.socketUrl)return;let t=new ee({host:e.socketUrl,onChange:()=>{this.cachedSnapshot=void 0,this.flagSnapshot().catch(r=>this.config.onError(r));},onClosed:r=>{this.stream=void 0,r&&this.maybeStream(e);},projectKey:this.config.apiKey,socketFactory:this.config.socketFactory});this.stream=t,t.open();}async getInbox(){return this.messagesClient.inbox(this.identity.getDistinctId())}async markMessageRead(e){await this.messagesClient.markRead(e,this.identity.getDistinctId());}async getSurveys(e){return this.surveysClient.surveys(this.identity.getDistinctId(),e!=null?e:this.config.locale)}captureSurveyShown(e){this.capture(gt,{properties:ie(e,{})});}captureSurveyDismissed(e){this.capture(ht,{properties:ie(e,{})});}captureSurveySent(e,t){this.capture(ft,{properties:ie(e,t)});}async getGuides(){return this.guidesClient.guides(this.identity.getDistinctId())}captureGuide(e,t,r){this.capture(e,{properties:yt(t,r)});}async getForm(e){return this.formsClient.form(e,this.identity.getDistinctId())}async submitForm(e,t,r,i){let{$page_id:o,$page_variant:s}=this.config.defaultProperties();return this.formsClient.submit(e,{answers:t,challenge:r,distinctId:this.identity.getDistinctId(),isAnonymous:!this.identity.isIdentified(),pageUrl:typeof window=="undefined"?"":window.location.href,solution:i,...typeof o=="string"&&typeof s=="string"?{pageId:o,pageVariant:s}:{}})}async getCtas(e){return this.ctasClient.ctas({...e,anonymous:!this.identity.isIdentified(),distinctId:this.identity.getDistinctId()})}captureCta(e,t,r){this.capture(e,{properties:Ze(t,r)});}async flush(){if(this.flushing||this.queue.size===0)return;this.flushing=true;let e=this.queue.drain(on);try{await this.transport.send({body:{events:e,sent_at:Y(this.config.clock.now())},projectKey:this.config.apiKey,url:`${this.config.host}/v1/events`}),this.persistQueue();}catch(t){this.queue.requeue(e),this.persistQueue(),this.config.onError(t);}finally{this.flushing=false;}}reset(){var e;(e=this.session)==null||e.reset(),this.identity.reset(),this.cachedFlags=void 0,this.cachedSnapshot=void 0,this.membershipCache=void 0;}async shutdown(){var e;this.shutDown=true,this.stopTimer(),(e=this.stream)==null||e.close(),this.stream=void 0,await this.flush();}enqueue(e){this.queue.enqueue(e),this.persistQueue(),this.queue.size>=this.config.flushAt&&this.flush();}persistQueue(){try{this.config.storage.setItem(this.persistKey(),JSON.stringify(this.queue.snapshot()));}catch(e){this.config.onError(e);}}restoreQueue(){try{let e=this.config.storage.getItem(this.persistKey());if(!e)return;let t=JSON.parse(e);Array.isArray(t)&&this.queue.restore(t);}catch(e){this.config.onError(e);}}startTimer(){if(this.config.flushIntervalMs<=0)return;let e=setInterval(()=>{this.flush();},this.config.flushIntervalMs),t=e;typeof t.unref=="function"&&t.unref(),this.flushTimer=e;}stopTimer(){this.flushTimer!==void 0&&(clearInterval(this.flushTimer),this.flushTimer=void 0);}persistKey(){return `pdx.${this.config.namespace}.${sn}`}};function an(){let n=globalThis.document;return (n==null?void 0:n.visibilityState)==="hidden"}function dn(n){let e=globalThis.navigator,t=globalThis.Blob;if(!(e!=null&&e.sendBeacon)||!t)return false;let r=JSON.stringify({...n.body,api_key:n.projectKey});try{let i=new t([r],{type:"application/json"});return e.sendBeacon(n.url,i)}catch(i){return false}}var pe=class{constructor(e={}){d(this,"fetchTransport");this.fetchTransport=new K(e);}async send(e){an()&&dn(e)||await this.fetchTransport.send(e);}};var Ie="prodantix:consent-ready",$e="prodantix:consent",kt="__prodantixConsent";var St=(n,e)=>{n.takeCookielessId(e.anonymousId),e.consent!==null?n.setConsent(e.consent):e.rule==="notice"&&n.allowStorage();},wt=(n,e)=>{let t=e[kt];t&&St(n,t);let r=o=>{let s=o.detail;s&&St(n,s);},i=o=>{let s=o.detail;s&&n.setConsent(s);};return e.addEventListener(Ie,r),e.addEventListener($e,i),()=>{e.removeEventListener(Ie,r),e.removeEventListener($e,i);}};var ln=/^\d{1,3}(\.\d{1,3}){3}$/,cn=/^[a-z0-9.-]+$/i;function Ct(){return Math.random().toString(36).slice(2,12)}function me(n,e){let t=`${e}=`,r=[];for(let i of n.cookie.split(";")){let o=i.trim();o.startsWith(t)&&r.push(o.slice(t.length));}return r}function J(n,e,t){let r=["Path=/",`Max-Age=${e}`,"SameSite=Lax"];return n&&r.push(`Domain=${n}`),t&&r.push("Secure"),r.join("; ")}function Et(n,e,t,r){try{let i=`pdx_probe_${r()}`,o=r();n.cookie=`${i}=${o}; ${J(e,60,t)}`;let s=me(n,i).includes(o);n.cookie=`${i}=; ${J(e,0,t)}`;let a=me(n,i).includes(o);return s&&!a}catch(i){return false}}function un(n){let e=n.replace(/^\[|\]$/g,"").toLowerCase();if(e.includes(":")||ln.test(e)||!e.includes("."))return [];let t=e.split("."),r=[];for(let i=t.length-2;i>=0;i-=1)r.push(t.slice(i).join("."));return r}function pn(n,e,t,r=Ct){for(let i of un(n))if(Et(e,i,t,r))return i}function mn(n){let e=new Map,t=JSON.parse(decodeURIComponent(n));if(t===null||typeof t!="object"||Array.isArray(t))return e;for(let[r,i]of Object.entries(t))typeof i=="string"&&e.set(r,i);return e}var Ae=class{constructor(e,t,r,i){this.jar=e;this.name=t;this.domain=r;this.secure=i;}getItem(e){var t;return (t=this.read().get(e))!=null?t:null}setItem(e,t){let r=this.read();r.set(e,t),this.write(r);}removeItem(e){let t=this.read();t.delete(e)&&this.write(t);}read(){try{let e=me(this.jar,this.name);e.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${J(void 0,0,this.secure)}`,e=me(this.jar,this.name));let t=e[0];return t?mn(t):new Map}catch(e){return new Map}}write(e){try{if(e.size===0){this.jar.cookie=`${this.name}=; ${J(this.domain,0,this.secure)}`;return}let t=encodeURIComponent(JSON.stringify(Object.fromEntries(e)));this.jar.cookie=`${this.name}=${t}; ${J(this.domain,31536e3,this.secure)}`;}catch(t){return}}};function gn(){return globalThis.document}function hn(){var n,e;return (e=(n=globalThis.location)==null?void 0:n.hostname)!=null?e:""}function fn(){var n;return ((n=globalThis.location)==null?void 0:n.protocol)==="https:"}function yn(n){if(n===void 0)return;let e=n.startsWith(".")?n.slice(1):n;return cn.test(e)?e.toLowerCase():void 0}function Tt(n){var s,a,l,g,v;let e="jar"in n?n.jar:gn();if(!e||((s=globalThis.navigator)==null?void 0:s.cookieEnabled)===false)return null;let r=(a=n.random)!=null?a:Ct,i=(l=n.secure)!=null?l:fn(),o=(g=n.hostname)!=null?g:hn();try{let c=(v=yn(n.domain))!=null?v:pn(o,e,i,r);return Et(e,c,i,r)?new Ae(e,n.name,c,i):null}catch(c){return null}}var Ft=n=>`prodantix-form-popup:${n}`,vn=n=>{try{let e=window.localStorage.getItem(Ft(n));return e===null?null:Number(e)}catch(e){return null}},bn=(n,e)=>{try{window.localStorage.setItem(Ft(n),String(e));}catch(t){return}},_t=(n,e,t)=>t===null||e-t>=n.periodDays*864e5,Pe=(n,e,t=Date.now)=>{if(!_t(n,t(),vn(n.formId)))return ()=>{};let r=false,i=[],o=()=>{if(!r){r=true;for(let a of i)a();bn(n.formId,t()),e();}},s=n.trigger;if(s.kind==="delay"){let a=setTimeout(o,s.seconds*1e3);i.push(()=>clearTimeout(a));}else if(s.kind==="scroll"){let a=()=>{let l=document.documentElement.scrollHeight-window.innerHeight;(l<=0||window.scrollY/l*100>=s.percent)&&o();};window.addEventListener("scroll",a,{passive:true}),i.push(()=>window.removeEventListener("scroll",a));}else {let a=l=>{l.relatedTarget===null&&l.clientY<=0&&o();};document.addEventListener("mouseout",a),i.push(()=>document.removeEventListener("mouseout",a));}return ()=>{r=true;for(let a of i)a();}},Re=n=>{if(!n)return null;if(n==="exit")return {kind:"exit"};let[e,t]=n.split(":"),r=Number(t);return !Number.isFinite(r)||r<0?null:e==="delay"?{kind:"delay",seconds:r}:e==="scroll"?{kind:"scroll",percent:Math.min(100,r)}:null};var xn=n=>{let e=0;for(let t of n){if(t!==0)return e+Math.clz32(t)-24;e+=8;}return e},kn=async n=>new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(n))),It=async n=>{for(let e=0;;e+=1){let t=e.toString(36);if(xn(await kn(`${n.nonce}:${t}`))>=n.difficulty)return t}};var B={am:{back:"\u1270\u1218\u1208\u1235",close:"\u12DD\u130B",closed:"\u12ED\u1205 \u1245\u133D \u12A0\u1201\u1295 \u121D\u120B\u123E\u127D\u1295 \u12A0\u12ED\u1240\u1260\u120D\u121D\u1362",failed:"\u1218\u120B\u12AD \u12A0\u120D\u1270\u127B\u1208\u121D\u1362 \u12A5\u1295\u12F0\u1308\u1293 \u12ED\u121E\u12AD\u1229\u1362",invalid:"\u12ED\u1205 \u1218\u120D\u1235 \u12A0\u12ED\u1240\u1260\u120D\u121D\u1362",next:"\u1240\u1323\u12ED",poweredBy:"\u1260Prodantix \u12E8\u1270\u1230\u122B",required:"\u12ED\u1205 \u12EB\u1235\u1348\u120D\u130B\u120D\u1362",sending:"\u1260\u1218\u120B\u12AD \u120B\u12ED\u2026",step:"\u12F0\u1228\u1303 {step} \u12A8{total}",submit:"\u120B\u12AD",thanks:"\u12A5\u1293\u1218\u1230\u130D\u1293\u1208\u1295\u1362"},ar:{back:"\u0631\u062C\u0648\u0639",close:"\u0625\u063A\u0644\u0627\u0642",closed:"\u0644\u0627 \u064A\u0642\u0628\u0644 \u0647\u0630\u0627 \u0627\u0644\u0646\u0645\u0648\u0630\u062C \u0631\u062F\u0648\u062F\u064B\u0627 \u0627\u0644\u0622\u0646.",failed:"\u062A\u0639\u0630\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644. \u062D\u0627\u0648\u0644 \u0645\u0631\u0629 \u0623\u062E\u0631\u0649.",invalid:"\u0647\u0630\u0647 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629.",next:"\u0627\u0644\u062A\u0627\u0644\u064A",poweredBy:"\u0645\u062F\u0639\u0648\u0645 \u0645\u0646 Prodantix",required:"\u0647\u0630\u0627 \u0627\u0644\u062D\u0642\u0644 \u0645\u0637\u0644\u0648\u0628.",sending:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u2026",step:"\u0627\u0644\u062E\u0637\u0648\u0629 {step} \u0645\u0646 {total}",submit:"\u0625\u0631\u0633\u0627\u0644",thanks:"\u0634\u0643\u0631\u064B\u0627 \u0644\u0643."},bn:{back:"\u09AA\u09C7\u099B\u09A8\u09C7",close:"\u09AC\u09A8\u09CD\u09A7 \u0995\u09B0\u09C1\u09A8",closed:"\u098F\u0987 \u09AB\u09B0\u09CD\u09AE\u099F\u09BF \u098F\u0996\u09A8 \u0989\u09A4\u09CD\u09A4\u09B0 \u09A8\u09BF\u099A\u09CD\u099B\u09C7 \u09A8\u09BE\u0964",failed:"\u09AA\u09BE\u09A0\u09BE\u09A8\u09CB \u09AF\u09BE\u09AF\u09BC\u09A8\u09BF\u0964 \u0986\u09AC\u09BE\u09B0 \u099A\u09C7\u09B7\u09CD\u099F\u09BE \u0995\u09B0\u09C1\u09A8\u0964",invalid:"\u098F\u0987 \u0989\u09A4\u09CD\u09A4\u09B0\u099F\u09BF \u0997\u09CD\u09B0\u09B9\u09A3\u09AF\u09CB\u0997\u09CD\u09AF \u09A8\u09AF\u09BC\u0964",next:"\u09AA\u09B0\u09AC\u09B0\u09CD\u09A4\u09C0",poweredBy:"Prodantix \u09A6\u09CD\u09AC\u09BE\u09B0\u09BE \u099A\u09BE\u09B2\u09BF\u09A4",required:"\u098F\u099F\u09BF \u0986\u09AC\u09B6\u09CD\u09AF\u0995\u0964",sending:"\u09AA\u09BE\u09A0\u09BE\u09A8\u09CB \u09B9\u099A\u09CD\u099B\u09C7\u2026",step:"\u09A7\u09BE\u09AA {step} / {total}",submit:"\u099C\u09AE\u09BE \u09A6\u09BF\u09A8",thanks:"\u09A7\u09A8\u09CD\u09AF\u09AC\u09BE\u09A6\u0964"},de:{back:"Zur\xFCck",close:"Schlie\xDFen",closed:"Dieses Formular nimmt gerade keine Antworten an.",failed:"Senden fehlgeschlagen. Bitte erneut versuchen.",invalid:"Diese Antwort wird nicht angenommen.",next:"Weiter",poweredBy:"Bereitgestellt von Prodantix",required:"Dieses Feld ist erforderlich.",sending:"Wird gesendet\u2026",step:"Schritt {step} von {total}",submit:"Absenden",thanks:"Vielen Dank."},en:{back:"Back",close:"Close",closed:"This form is not accepting responses right now.",failed:"This could not be sent. Try again.",invalid:"This answer is not accepted.",next:"Next",poweredBy:"Powered by Prodantix",required:"This is required.",sending:"Sending\u2026",step:"Step {step} of {total}",submit:"Submit",thanks:"Thank you."},es:{back:"Atr\xE1s",close:"Cerrar",closed:"Este formulario no acepta respuestas ahora.",failed:"No se pudo enviar. Int\xE9ntalo de nuevo.",invalid:"Esta respuesta no se acepta.",next:"Siguiente",poweredBy:"Con la tecnolog\xEDa de Prodantix",required:"Este campo es obligatorio.",sending:"Enviando\u2026",step:"Paso {step} de {total}",submit:"Enviar",thanks:"Gracias."},et:{back:"Tagasi",close:"Sulge",closed:"See vorm ei v\xF5ta praegu vastuseid vastu.",failed:"Saatmine eba\xF5nnestus. Proovi uuesti.",invalid:"Seda vastust ei v\xF5eta vastu.",next:"Edasi",poweredBy:"Toetab Prodantix",required:"See on kohustuslik.",sending:"Saatmine\u2026",step:"Samm {step}/{total}",submit:"Saada",thanks:"Ait\xE4h."},fil:{back:"Bumalik",close:"Isara",closed:"Hindi tumatanggap ng sagot ang form na ito ngayon.",failed:"Hindi naipadala. Subukan ulit.",invalid:"Hindi tinatanggap ang sagot na ito.",next:"Susunod",poweredBy:"Pinapagana ng Prodantix",required:"Kailangan ito.",sending:"Ipinapadala\u2026",step:"Hakbang {step} sa {total}",submit:"Ipadala",thanks:"Salamat."},fr:{back:"Retour",close:"Fermer",closed:"Ce formulaire n\u2019accepte plus de r\xE9ponses pour le moment.",failed:"L\u2019envoi a \xE9chou\xE9. R\xE9essayez.",invalid:"Cette r\xE9ponse n\u2019est pas accept\xE9e.",next:"Suivant",poweredBy:"Propuls\xE9 par Prodantix",required:"Ce champ est obligatoire.",sending:"Envoi\u2026",step:"\xC9tape {step} sur {total}",submit:"Envoyer",thanks:"Merci."},hi:{back:"\u092A\u0940\u091B\u0947",close:"\u092C\u0902\u0926 \u0915\u0930\u0947\u0902",closed:"\u092F\u0939 \u092B\u093C\u0949\u0930\u094D\u092E \u0905\u092D\u0940 \u091C\u0935\u093E\u092C \u0928\u0939\u0940\u0902 \u0932\u0947 \u0930\u0939\u093E \u0939\u0948\u0964",failed:"\u092D\u0947\u091C\u093E \u0928\u0939\u0940\u0902 \u091C\u093E \u0938\u0915\u093E\u0964 \u092B\u093F\u0930 \u0915\u094B\u0936\u093F\u0936 \u0915\u0930\u0947\u0902\u0964",invalid:"\u092F\u0939 \u091C\u0935\u093E\u092C \u0938\u094D\u0935\u0940\u0915\u093E\u0930 \u0928\u0939\u0940\u0902 \u0939\u0948\u0964",next:"\u0906\u0917\u0947",poweredBy:"Prodantix \u0926\u094D\u0935\u093E\u0930\u093E \u0938\u0902\u091A\u093E\u0932\u093F\u0924",required:"\u092F\u0939 \u091C\u093C\u0930\u0942\u0930\u0940 \u0939\u0948\u0964",sending:"\u092D\u0947\u091C\u093E \u091C\u093E \u0930\u0939\u093E \u0939\u0948\u2026",step:"\u091A\u0930\u0923 {step} / {total}",submit:"\u092D\u0947\u091C\u0947\u0902",thanks:"\u0927\u0928\u094D\u092F\u0935\u093E\u0926\u0964"},id:{back:"Kembali",close:"Tutup",closed:"Formulir ini sedang tidak menerima tanggapan.",failed:"Gagal mengirim. Coba lagi.",invalid:"Jawaban ini tidak diterima.",next:"Berikutnya",poweredBy:"Didukung oleh Prodantix",required:"Wajib diisi.",sending:"Mengirim\u2026",step:"Langkah {step} dari {total}",submit:"Kirim",thanks:"Terima kasih."},ja:{back:"\u623B\u308B",close:"\u9589\u3058\u308B",closed:"\u3053\u306E\u30D5\u30A9\u30FC\u30E0\u306F\u73FE\u5728\u56DE\u7B54\u3092\u53D7\u3051\u4ED8\u3051\u3066\u3044\u307E\u305B\u3093\u3002",failed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",invalid:"\u3053\u306E\u56DE\u7B54\u306F\u53D7\u3051\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3002",next:"\u6B21\u3078",poweredBy:"Powered by Prodantix",required:"\u5FC5\u9808\u9805\u76EE\u3067\u3059\u3002",sending:"\u9001\u4FE1\u4E2D\u2026",step:"\u30B9\u30C6\u30C3\u30D7 {step}/{total}",submit:"\u9001\u4FE1",thanks:"\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3057\u305F\u3002"},ko:{back:"\uC774\uC804",close:"\uB2EB\uAE30",closed:"\uC774 \uC591\uC2DD\uC740 \uC9C0\uAE08 \uC751\uB2F5\uC744 \uBC1B\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",failed:"\uBCF4\uB0B4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694.",invalid:"\uC774 \uB2F5\uBCC0\uC740 \uBC1B\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",next:"\uB2E4\uC74C",poweredBy:"Prodantix \uC81C\uACF5",required:"\uD544\uC218 \uD56D\uBAA9\uC785\uB2C8\uB2E4.",sending:"\uBCF4\uB0B4\uB294 \uC911\u2026",step:"{total}\uB2E8\uACC4 \uC911 {step}\uB2E8\uACC4",submit:"\uC81C\uCD9C",thanks:"\uAC10\uC0AC\uD569\uB2C8\uB2E4."},pt:{back:"Voltar",close:"Fechar",closed:"Este formul\xE1rio n\xE3o est\xE1 a aceitar respostas neste momento.",failed:"N\xE3o foi poss\xEDvel enviar. Tente novamente.",invalid:"Esta resposta n\xE3o \xE9 aceite.",next:"Seguinte",poweredBy:"Com tecnologia Prodantix",required:"Este campo \xE9 obrigat\xF3rio.",sending:"A enviar\u2026",step:"Passo {step} de {total}",submit:"Enviar",thanks:"Obrigado."},ru:{back:"\u041D\u0430\u0437\u0430\u0434",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",closed:"\u042D\u0442\u0430 \u0444\u043E\u0440\u043C\u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u043D\u0435 \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442 \u043E\u0442\u0432\u0435\u0442\u044B.",failed:"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437.",invalid:"\u042D\u0442\u043E\u0442 \u043E\u0442\u0432\u0435\u0442 \u043D\u0435 \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442\u0441\u044F.",next:"\u0414\u0430\u043B\u0435\u0435",poweredBy:"\u0420\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u043D\u0430 Prodantix",required:"\u042D\u0442\u043E \u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u043F\u043E\u043B\u0435.",sending:"\u041E\u0442\u043F\u0440\u0430\u0432\u043A\u0430\u2026",step:"\u0428\u0430\u0433 {step} \u0438\u0437 {total}",submit:"\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C",thanks:"\u0421\u043F\u0430\u0441\u0438\u0431\u043E."},sw:{back:"Rudi",close:"Funga",closed:"Fomu hii haipokei majibu kwa sasa.",failed:"Imeshindwa kutuma. Jaribu tena.",invalid:"Jibu hili halikubaliki.",next:"Endelea",poweredBy:"Inaendeshwa na Prodantix",required:"Hii inahitajika.",sending:"Inatuma\u2026",step:"Hatua {step} kati ya {total}",submit:"Tuma",thanks:"Asante."},vi:{back:"Quay l\u1EA1i",close:"\u0110\xF3ng",closed:"Bi\u1EC3u m\u1EABu n\xE0y hi\u1EC7n kh\xF4ng nh\u1EADn c\xE2u tr\u1EA3 l\u1EDDi.",failed:"Kh\xF4ng g\u1EEDi \u0111\u01B0\u1EE3c. H\xE3y th\u1EED l\u1EA1i.",invalid:"C\xE2u tr\u1EA3 l\u1EDDi n\xE0y kh\xF4ng \u0111\u01B0\u1EE3c ch\u1EA5p nh\u1EADn.",next:"Ti\u1EBFp",poweredBy:"\u0110\u01B0\u1EE3c h\u1ED7 tr\u1EE3 b\u1EDFi Prodantix",required:"Tr\u01B0\u1EDDng n\xE0y l\xE0 b\u1EAFt bu\u1ED9c.",sending:"\u0110ang g\u1EEDi\u2026",step:"B\u01B0\u1EDBc {step}/{total}",submit:"G\u1EEDi",thanks:"C\u1EA3m \u01A1n b\u1EA1n."},zh:{back:"\u4E0A\u4E00\u6B65",close:"\u5173\u95ED",closed:"\u6B64\u8868\u5355\u76EE\u524D\u4E0D\u63A5\u53D7\u56DE\u590D\u3002",failed:"\u53D1\u9001\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002",invalid:"\u6B64\u56DE\u7B54\u65E0\u6548\u3002",next:"\u4E0B\u4E00\u6B65",poweredBy:"\u7531 Prodantix \u63D0\u4F9B\u652F\u6301",required:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879\u3002",sending:"\u6B63\u5728\u53D1\u9001\u2026",step:"\u7B2C {step} \u6B65\uFF0C\u5171 {total} \u6B65",submit:"\u63D0\u4EA4",thanks:"\u8C22\u8C22\u3002"}},Me=n=>{var t;let e=(t=(n!=null?n:"").toLowerCase().split("-")[0])!=null?t:"";return e in B?e:"en"};var x="prodantix-form",Sn=`.${x}{font-family:var(--pdx-font);color:var(--pdx-text);background:var(--pdx-background);max-width:var(--pdx-width);box-sizing:border-box;padding:16px;border-radius:var(--pdx-radius)}
2
2
  .${x} *{box-sizing:border-box}
3
3
  .${x} .pdx-field{display:flex;flex-direction:column;gap:4px;margin:0 0 12px}
4
4
  .${x} .pdx-field[hidden]{display:none}
@@ -11,6 +11,6 @@
11
11
  .${x} button[data-variant=back]{background:transparent;color:inherit;border:1px solid currentColor}
12
12
  .${x} .pdx-actions{display:flex;gap:8px;justify-content:flex-end}
13
13
  .${x} .pdx-hp{position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden}
14
- .${x} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}`,$t=n=>n==null||n===false||typeof n=="string"&&n.trim()===""||Array.isArray(n)&&n.length===0,At=(n,e)=>{let t=n.condition;if(!t)return true;let r=e[t.field];return $t(r)?false:t.op==="is_set"?true:t.op==="equals"?typeof r=="string"&&r===t.values[0]:(Array.isArray(r)?r:[r]).some(o=>typeof o=="string"&&t.values.includes(o))},wn=n=>{let e=`${encodeURIComponent(n)}=`,t=document.cookie.split("; ").find(r=>r.startsWith(e));return t?decodeURIComponent(t.slice(e.length)):""},En=n=>{var t;let e=n.hidden;return e?e.source==="fixed"?e.value:e.source==="query"?(t=new URLSearchParams(window.location.search).get(e.value))!=null?t:"":wn(e.value):""},u=(n,e={},t=[])=>{let r=Object.assign(document.createElement(n),e);return r.append(...t),r},Cn=(n,e,t)=>{var v;let r=u("p",{className:"pdx-error",id:`${e}-error`}),i=n.help?u("p",{className:"pdx-help",id:`${e}-help`},[n.help]):null,o=[i?`${e}-help`:"",`${e}-error`].filter(Boolean).join(" "),s=u("div",{className:"pdx-field"});if(s.dataset.field=n.key,n.kind==="rich_text")return s.append(u("p",{},[n.label])),{error:r,field:n,focus:()=>{},read:()=>{},root:s};if(n.kind==="hidden")return s.hidden=true,{error:r,field:n,focus:()=>{},read:()=>En(n),root:s};if(n.kind==="radio"||n.kind==="checkboxes"){let c=u("fieldset",{});c.setAttribute("aria-describedby",o),n.required&&c.setAttribute("aria-required","true"),c.append(u("legend",{},[n.label]));let $=n.options.filter(f=>!f.archived).map((f,_)=>{let T=u("input",{id:`${e}-${_}`,name:e,type:n.kind==="radio"?"radio":"checkbox",value:f.value});return T.addEventListener("change",t),c.append(u("div",{className:"pdx-choice"},[T,u("label",{htmlFor:`${e}-${_}`},[f.label])])),T});return s.append(c,...i?[i]:[],r),{error:r,field:n,focus:()=>{var f;return (f=$[0])==null?void 0:f.focus()},read:()=>{var _;let f=$.filter(T=>T.checked).map(T=>T.value);return n.kind==="radio"?(_=f[0])!=null?_:"":f},root:s}}let a=u("label",{htmlFor:e},[n.label]),l;if(n.kind==="textarea")l=u("textarea",{id:e,placeholder:n.placeholder,rows:4});else if(n.kind==="dropdown")l=u("select",{id:e},[u("option",{value:""},[""]),...n.options.filter(c=>!c.archived).map(c=>u("option",{value:c.value},[c.label]))]);else if(n.kind==="checkbox")l=u("input",{id:e,type:"checkbox"});else {let c={date:"date",email:"email",file:"file",number:"number",phone:"tel"};l=u("input",{id:e,placeholder:n.placeholder,type:(v=c[n.kind])!=null?v:"text"}),n.kind==="email"&&(l.autocomplete="email");}return l.setAttribute("aria-describedby",o),n.required&&l.setAttribute("aria-required","true"),l.addEventListener("input",t),l.addEventListener("change",t),n.kind==="checkbox"?s.append(u("div",{className:"pdx-choice"},[l,a]),...i?[i]:[],r):s.append(a,...i?[i]:[],l,r),{error:r,field:n,focus:()=>l.focus(),read:()=>l instanceof HTMLInputElement&&l.type==="checkbox"?l.checked:n.kind==="number"?l.value===""?"":Number(l.value):l.value,root:s}},Tn=(n,e)=>{let t=e.style,r={"--pdx-background":t.background,"--pdx-button":t.button,"--pdx-button-text":t.buttonText,"--pdx-field-background":t.fieldBackground,"--pdx-field-text":t.fieldText,"--pdx-font":t.font,"--pdx-radius":`${t.radius}px`,"--pdx-text":t.text,"--pdx-width":`${t.width}px`};for(let[i,o]of Object.entries(r))n.style.setProperty(i,o);},Fn=()=>{document.getElementById("prodantix-form-style")||document.head.append(u("style",{id:"prodantix-form-style",textContent:Sn}));},ge=(n,e)=>{let{formId:t,host:r,language:i}=e,o=B[i],s=c=>o[c],a=u("form",{className:x,noValidate:true});a.dataset.prodantixForm=t;let l=u("p",{className:"pdx-meta"});l.setAttribute("aria-live","polite"),l.setAttribute("role","status");let g=false,v=r.form(t).then(c=>{if(g)return;if(!c.accepting){a.replaceChildren(u("p",{className:"pdx-meta"},[s("closed")]));return}Fn(),Tn(a,c);let $=c.challenge?It(c.challenge):null,L=false,f=[],_=()=>{let p={};for(let h of f.flat())if(!h.root.hidden||h.field.kind==="hidden"){let b=h.read();b!==void 0&&(p[h.field.key]=b);}return p},T=()=>{let p=_();for(let h of f.flat())h.field.kind!=="hidden"&&(h.root.hidden=!At(h.field,p));},z=()=>{L||(L=true,r.capture(mt,{$form_id:c.id,$form_version:c.version})),T();},A=c.steps.map((p,h)=>{let b=u("div",{});b.dataset.step=String(h),p.title&&b.append(u("p",{className:"pdx-meta"},[p.title]));let y=p.fields.map(F=>Cn(F,`pdx-${t}-${F.key}`,z));return f.push(y),b.append(...y.map(F=>F.root)),b}),Oe=u("input",{autocomplete:"off",name:c.honeypot,tabIndex:-1,type:"text"}),qe=u("div",{className:"pdx-hp"},[Oe]);qe.setAttribute("aria-hidden","true");let fe=[],j=u("div",{});if(c.consent.processing){let p=u("input",{id:`pdx-${t}-consent`,type:"checkbox"});p.setAttribute("aria-required","true"),fe.push({input:p,key:"$consent_processing"}),j.append(u("div",{className:"pdx-choice"},[p,u("label",{htmlFor:p.id},[c.consent.processing])]));}for(let p of c.consent.purposes){let h=u("input",{id:`pdx-${t}-consent-${p.key}`,type:"checkbox"});fe.push({input:h,key:`$consent_${p.key}`}),j.append(u("div",{className:"pdx-choice"},[h,u("label",{htmlFor:h.id},[p.label])])),p.notice&&j.append(u("p",{className:"pdx-help"},[p.notice]));}let ye=u("p",{className:"pdx-meta"}),G=u("button",{type:"button"},[s("back")]);G.dataset.variant="back";let W=u("button",{type:"button"},[s("next")]),R=u("button",{type:"submit"},[s("submit")]);G.dataset.action="back",W.dataset.action="next",R.dataset.action="submit";let Lt=u("div",{className:"pdx-actions"},[G,W,R]),I=0,ve=()=>{A.forEach((h,b)=>{h.hidden=b!==I;});let p=I===A.length-1;G.hidden=I===0,W.hidden=p,R.hidden=!p,j.hidden=!p,ye.hidden=A.length<2,ye.textContent=s("step").replace("{step}",String(I+1)).replace("{total}",String(A.length));},Dt=()=>{var p;for(let h of f.flat())h.error.textContent="",(p=h.root.querySelector("[aria-invalid]"))==null||p.removeAttribute("aria-invalid");},Le=(p,h)=>{var b;p.error.textContent=h,(b=p.root.querySelector("input,select,textarea,fieldset"))==null||b.setAttribute("aria-invalid","true");},De=p=>{var y,F;Dt();let h=_(),b=((y=f[p])!=null?y:[]).filter(P=>!P.root.hidden&&P.field.required&&$t(h[P.field.key]));for(let P of b)Le(P,s("required"));return b.length>0?(l.textContent=s("required"),(F=b[0])==null||F.focus(),false):true};G.addEventListener("click",()=>{I=Math.max(0,I-1),ve();}),W.addEventListener("click",()=>{De(I)&&(I+=1,ve());}),a.addEventListener("submit",p=>{if(p.preventDefault(),!De(I))return;let h={..._(),[c.honeypot]:Oe.value};for(let y of fe)h[y.key]=y.input.checked;R.disabled=true,R.textContent=s("sending");let b=c.challenge;if(!b||!$){l.textContent=s("closed");return}$.then(y=>r.submit(t,h,b,y)).then(y=>{if(y.kind==="redirect"&&y.value.startsWith("https://")){window.location.assign(y.value);return}let F=u("p",{},[y.kind==="message"&&y.value?y.value:s("thanks")]);F.setAttribute("role","status"),a.replaceChildren(F);}).catch(y=>{R.disabled=false,R.textContent=s("submit");let F=y instanceof U?y.fields:[];for(let P of F){let Ke=f.flat().find(Kt=>Kt.field.key===P.field);Ke&&Le(Ke,P.rule==="required"?s("required"):s("invalid"));}l.textContent=F.length>0?s("invalid"):s("failed");});}),a.append(ye,...A,qe,j,Lt,l),c.poweredBy&&e.poweredBy!==false&&a.append(u("p",{className:"pdx-meta"},[s("poweredBy")])),ve(),T(),r.capture(pt,{$form_id:c.id,$form_version:c.version});}).catch(()=>{g||a.replaceChildren(u("p",{className:"pdx-meta"},[s("closed")]));});return n.append(a),{destroy:()=>{g=true,a.remove();},ready:v}};var Pt=n=>({capture:(e,t)=>n.capture(e,{properties:t}),form:e=>n.getForm(e),submit:(e,t,r,i)=>n.submitForm(e,t,r,i)});var Rt=(n,e)=>({...n.page?{$page_id:n.page}:{},...n.page&&e?{$page_view_id:e}:{},...n.variant?{$page_variant:n.variant}:{}});var _n=(n,e)=>{var t;try{return (t=Tt({name:`pdx_${be(n)}`}))!=null?t:e}catch(r){return e}},w=document.currentScript,he=w==null?void 0:w.dataset.form,Ne=w==null?void 0:w.dataset.key,Mt,Nt,Ot,qt;if(w&&he&&Ne){let n=new URL(w.src,window.location.href).origin,e=je(),t=w.dataset.consent==="banner",r=new ue({apiKey:Ne,...t?{consentMode:"banner"}:{},defaultProperties:Rt(w.dataset),flagsHost:(Mt=w.dataset.edge)!=null?Mt:n,host:(Nt=w.dataset.host)!=null?Nt:n,sessionTracking:false,sharedStorage:_n(Ne,e),storage:e,transport:new pe({})});t&&wt(r,window);let i=Pt(r),o=Me((Ot=w.dataset.language)!=null?Ot:document.documentElement.lang),s=Re(w.dataset.popup);if(s)Pe({formId:he,periodDays:Number((qt=w.dataset.periodDays)!=null?qt:7),trigger:s},()=>{let a=document.createElement("dialog");a.className="prodantix-form-popup";let l=document.createElement("button");l.type="button",l.textContent="\xD7",l.setAttribute("aria-label",B[o].close),l.title=B[o].close,l.addEventListener("click",()=>a.close()),a.append(l),document.body.append(a),ge(a,{formId:he,host:i,language:o}),a.showModal();});else {let a=document.createElement("div");w.after(a),ge(a,{formId:he,host:i,language:o});}}
14
+ .${x} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}`,$t=n=>n==null||n===false||typeof n=="string"&&n.trim()===""||Array.isArray(n)&&n.length===0,At=(n,e)=>{let t=n.condition;if(!t)return true;let r=e[t.field];return $t(r)?false:t.op==="is_set"?true:t.op==="equals"?typeof r=="string"&&r===t.values[0]:(Array.isArray(r)?r:[r]).some(o=>typeof o=="string"&&t.values.includes(o))},wn=n=>{let e=`${encodeURIComponent(n)}=`,t=document.cookie.split("; ").find(r=>r.startsWith(e));return t?decodeURIComponent(t.slice(e.length)):""},Cn=n=>{var t;let e=n.hidden;return e?e.source==="fixed"?e.value:e.source==="query"?(t=new URLSearchParams(window.location.search).get(e.value))!=null?t:"":wn(e.value):""},u=(n,e={},t=[])=>{let r=Object.assign(document.createElement(n),e);return r.append(...t),r},En=(n,e,t)=>{var v;let r=u("p",{className:"pdx-error",id:`${e}-error`}),i=n.help?u("p",{className:"pdx-help",id:`${e}-help`},[n.help]):null,o=[i?`${e}-help`:"",`${e}-error`].filter(Boolean).join(" "),s=u("div",{className:"pdx-field"});if(s.dataset.field=n.key,n.kind==="rich_text")return s.append(u("p",{},[n.label])),{error:r,field:n,focus:()=>{},read:()=>{},root:s};if(n.kind==="hidden")return s.hidden=true,{error:r,field:n,focus:()=>{},read:()=>Cn(n),root:s};if(n.kind==="radio"||n.kind==="checkboxes"){let c=u("fieldset",{});c.setAttribute("aria-describedby",o),n.required&&c.setAttribute("aria-required","true"),c.append(u("legend",{},[n.label]));let $=n.options.filter(f=>!f.archived).map((f,_)=>{let T=u("input",{id:`${e}-${_}`,name:e,type:n.kind==="radio"?"radio":"checkbox",value:f.value});return T.addEventListener("change",t),c.append(u("div",{className:"pdx-choice"},[T,u("label",{htmlFor:`${e}-${_}`},[f.label])])),T});return s.append(c,...i?[i]:[],r),{error:r,field:n,focus:()=>{var f;return (f=$[0])==null?void 0:f.focus()},read:()=>{var _;let f=$.filter(T=>T.checked).map(T=>T.value);return n.kind==="radio"?(_=f[0])!=null?_:"":f},root:s}}let a=u("label",{htmlFor:e},[n.label]),l;if(n.kind==="textarea")l=u("textarea",{id:e,placeholder:n.placeholder,rows:4});else if(n.kind==="dropdown")l=u("select",{id:e},[u("option",{value:""},[""]),...n.options.filter(c=>!c.archived).map(c=>u("option",{value:c.value},[c.label]))]);else if(n.kind==="checkbox")l=u("input",{id:e,type:"checkbox"});else {let c={date:"date",email:"email",file:"file",number:"number",phone:"tel"};l=u("input",{id:e,placeholder:n.placeholder,type:(v=c[n.kind])!=null?v:"text"}),n.kind==="email"&&(l.autocomplete="email");}return l.setAttribute("aria-describedby",o),n.required&&l.setAttribute("aria-required","true"),l.addEventListener("input",t),l.addEventListener("change",t),n.kind==="checkbox"?s.append(u("div",{className:"pdx-choice"},[l,a]),...i?[i]:[],r):s.append(a,...i?[i]:[],l,r),{error:r,field:n,focus:()=>l.focus(),read:()=>l instanceof HTMLInputElement&&l.type==="checkbox"?l.checked:n.kind==="number"?l.value===""?"":Number(l.value):l.value,root:s}},Tn=(n,e)=>{let t=e.style,r={"--pdx-background":t.background,"--pdx-button":t.button,"--pdx-button-text":t.buttonText,"--pdx-field-background":t.fieldBackground,"--pdx-field-text":t.fieldText,"--pdx-font":t.font,"--pdx-radius":`${t.radius}px`,"--pdx-text":t.text,"--pdx-width":`${t.width}px`};for(let[i,o]of Object.entries(r))n.style.setProperty(i,o);},Fn=()=>{document.getElementById("prodantix-form-style")||document.head.append(u("style",{id:"prodantix-form-style",textContent:Sn}));},ge=(n,e)=>{let{formId:t,host:r,language:i}=e,o=B[i],s=c=>o[c],a=u("form",{className:x,noValidate:true});a.dataset.prodantixForm=t;let l=u("p",{className:"pdx-meta"});l.setAttribute("aria-live","polite"),l.setAttribute("role","status");let g=false,v=r.form(t).then(c=>{if(g)return;if(!c.accepting){a.replaceChildren(u("p",{className:"pdx-meta"},[s("closed")]));return}Fn(),Tn(a,c);let $=c.challenge?It(c.challenge):null,L=false,f=[],_=()=>{let p={};for(let h of f.flat())if(!h.root.hidden||h.field.kind==="hidden"){let b=h.read();b!==void 0&&(p[h.field.key]=b);}return p},T=()=>{let p=_();for(let h of f.flat())h.field.kind!=="hidden"&&(h.root.hidden=!At(h.field,p));},z=()=>{L||(L=true,r.capture(mt,{$form_id:c.id,$form_version:c.version})),T();},A=c.steps.map((p,h)=>{let b=u("div",{});b.dataset.step=String(h),p.title&&b.append(u("p",{className:"pdx-meta"},[p.title]));let y=p.fields.map(F=>En(F,`pdx-${t}-${F.key}`,z));return f.push(y),b.append(...y.map(F=>F.root)),b}),Oe=u("input",{autocomplete:"off",name:c.honeypot,tabIndex:-1,type:"text"}),qe=u("div",{className:"pdx-hp"},[Oe]);qe.setAttribute("aria-hidden","true");let fe=[],j=u("div",{});if(c.consent.processing){let p=u("input",{id:`pdx-${t}-consent`,type:"checkbox"});p.setAttribute("aria-required","true"),fe.push({input:p,key:"$consent_processing"}),j.append(u("div",{className:"pdx-choice"},[p,u("label",{htmlFor:p.id},[c.consent.processing])]));}for(let p of c.consent.purposes){let h=u("input",{id:`pdx-${t}-consent-${p.key}`,type:"checkbox"});fe.push({input:h,key:`$consent_${p.key}`}),j.append(u("div",{className:"pdx-choice"},[h,u("label",{htmlFor:h.id},[p.label])])),p.notice&&j.append(u("p",{className:"pdx-help"},[p.notice]));}let ye=u("p",{className:"pdx-meta"}),G=u("button",{type:"button"},[s("back")]);G.dataset.variant="back";let W=u("button",{type:"button"},[s("next")]),R=u("button",{type:"submit"},[s("submit")]);G.dataset.action="back",W.dataset.action="next",R.dataset.action="submit";let Lt=u("div",{className:"pdx-actions"},[G,W,R]),I=0,ve=()=>{A.forEach((h,b)=>{h.hidden=b!==I;});let p=I===A.length-1;G.hidden=I===0,W.hidden=p,R.hidden=!p,j.hidden=!p,ye.hidden=A.length<2,ye.textContent=s("step").replace("{step}",String(I+1)).replace("{total}",String(A.length));},Dt=()=>{var p;for(let h of f.flat())h.error.textContent="",(p=h.root.querySelector("[aria-invalid]"))==null||p.removeAttribute("aria-invalid");},Le=(p,h)=>{var b;p.error.textContent=h,(b=p.root.querySelector("input,select,textarea,fieldset"))==null||b.setAttribute("aria-invalid","true");},De=p=>{var y,F;Dt();let h=_(),b=((y=f[p])!=null?y:[]).filter(P=>!P.root.hidden&&P.field.required&&$t(h[P.field.key]));for(let P of b)Le(P,s("required"));return b.length>0?(l.textContent=s("required"),(F=b[0])==null||F.focus(),false):true};G.addEventListener("click",()=>{I=Math.max(0,I-1),ve();}),W.addEventListener("click",()=>{De(I)&&(I+=1,ve());}),a.addEventListener("submit",p=>{if(p.preventDefault(),!De(I))return;let h={..._(),[c.honeypot]:Oe.value};for(let y of fe)h[y.key]=y.input.checked;R.disabled=true,R.textContent=s("sending");let b=c.challenge;if(!b||!$){l.textContent=s("closed");return}$.then(y=>r.submit(t,h,b,y)).then(y=>{if(y.kind==="redirect"&&y.value.startsWith("https://")){window.location.assign(y.value);return}let F=u("p",{},[y.kind==="message"&&y.value?y.value:s("thanks")]);F.setAttribute("role","status"),a.replaceChildren(F);}).catch(y=>{R.disabled=false,R.textContent=s("submit");let F=y instanceof U?y.fields:[];for(let P of F){let Ke=f.flat().find(Kt=>Kt.field.key===P.field);Ke&&Le(Ke,P.rule==="required"?s("required"):s("invalid"));}l.textContent=F.length>0?s("invalid"):s("failed");});}),a.append(ye,...A,qe,j,Lt,l),c.poweredBy&&e.poweredBy!==false&&a.append(u("p",{className:"pdx-meta"},[s("poweredBy")])),ve(),T(),r.capture(pt,{$form_id:c.id,$form_version:c.version});}).catch(()=>{g||a.replaceChildren(u("p",{className:"pdx-meta"},[s("closed")]));});return n.append(a),{destroy:()=>{g=true,a.remove();},ready:v}};var Pt=n=>({capture:(e,t)=>n.capture(e,{properties:t}),form:e=>n.getForm(e),submit:(e,t,r,i)=>n.submitForm(e,t,r,i)});var Rt=(n,e)=>({...n.page?{$page_id:n.page}:{},...n.page&&e?{$page_view_id:e}:{},...n.variant?{$page_variant:n.variant}:{}});var _n=(n,e)=>{var t;try{return (t=Tt({name:`pdx_${be(n)}`}))!=null?t:e}catch(r){return e}},w=document.currentScript,he=w==null?void 0:w.dataset.form,Ne=w==null?void 0:w.dataset.key,Mt,Nt,Ot,qt;if(w&&he&&Ne){let n=new URL(w.src,window.location.href).origin,e=je(),t=w.dataset.consent==="banner",r=new ue({apiKey:Ne,...t?{consentMode:"banner"}:{},defaultProperties:Rt(w.dataset),flagsHost:(Mt=w.dataset.edge)!=null?Mt:n,host:(Nt=w.dataset.host)!=null?Nt:n,sessionTracking:false,sharedStorage:_n(Ne,e),storage:e,transport:new pe({})});t&&wt(r,window);let i=Pt(r),o=Me((Ot=w.dataset.language)!=null?Ot:document.documentElement.lang),s=Re(w.dataset.popup);if(s)Pe({formId:he,periodDays:Number((qt=w.dataset.periodDays)!=null?qt:7),trigger:s},()=>{let a=document.createElement("dialog");a.className="prodantix-form-popup";let l=document.createElement("button");l.type="button",l.textContent="\xD7",l.setAttribute("aria-label",B[o].close),l.title=B[o].close,l.addEventListener("click",()=>a.close()),a.append(l),document.body.append(a),ge(a,{formId:he,host:i,language:o}),a.showModal();});else {let a=document.createElement("div");w.after(a),ge(a,{formId:he,host:i,language:o});}}
15
15
  })();//# sourceMappingURL=forms.iife.js.map
16
16
  //# sourceMappingURL=forms.iife.js.map
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var Ae=Object.defineProperty;var Pe=(n,e,t)=>e in n?Ae(n,e,{enumerable:true,configurable:true,writable:true,value:t}):n[e]=t;var o=(n,e,t)=>Pe(n,typeof e!="symbol"?e+"":e,t);var g=class extends Error{constructor(t,r,s){super(r,s);o(this,"code");this.code=t,this.name="ProdantixError";}},v=class extends g{constructor(e){super("config",e),this.name="ConfigError";}},m=class extends g{constructor(t,r){super("validation",r);o(this,"field");this.field=t,this.name="ValidationError";}},l=class extends g{constructor(t,r,s){super("transport",t,s);o(this,"status");this.status=r,this.name="TransportError";}};function h(n){if(n)return n;let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}function d(){let n=globalThis.AbortController;return n?new n:void 0}var ie=n=>new Promise(e=>{setTimeout(e,n);});function p(n){return n.replace(/\/+$/,"")}var S=class{constructor(){o(this,"store",new Map);}getItem(e){return this.store.get(e)??null}removeItem(e){this.store.delete(e);}setItem(e,t){this.store.set(e,t);}},b=class{constructor(e,t=()=>false){this.real=e;this.passes=t;o(this,"held",new S);o(this,"opened",false);}get isOpen(){return this.opened}open(){this.opened=true;}close(){this.opened=false;}target(e){return this.opened||this.passes(e)?this.real:this.held}getItem(e){return this.target(e).getItem(e)}removeItem(e){this.target(e).removeItem(e);}setItem(e,t){this.target(e).setItem(e,t);}};var oe={now:()=>new Date};function T(n){return n.toISOString()}function ae(){if(typeof window>"u"||typeof Intl>"u")return null;let n=Intl.DateTimeFormat().resolvedOptions().timeZone;return typeof n=="string"&&n!==""?n:null}function Re(){return globalThis.crypto}function Me(n){n[6]=n[6]&15|64,n[8]=n[8]&63|128;let e=[];for(let t=0;t<16;t+=1)e.push(n[t].toString(16).padStart(2,"0"));return `${e[0]}${e[1]}${e[2]}${e[3]}-${e[4]}${e[5]}-${e[6]}${e[7]}-${e[8]}${e[9]}-${e[10]}${e[11]}${e[12]}${e[13]}${e[14]}${e[15]}`}function Ne(){let n=Re();if(n?.randomUUID)return n.randomUUID();let e=new Uint8Array(16);if(n?.getRandomValues)n.getRandomValues(e);else for(let t=0;t<16;t+=1)e[t]=Math.floor(Math.random()*256);return Me(e)}var le={uuid:Ne};var Oe=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var Ke=/^(?:\$|[a-z])[a-z0-9_.]*$/;function ce(n){let e=0;for(let t of n)e+=1;return e}function ue(n){return Oe.test(n)}function qe(n){return Ke.test(n)}function de(n){let e=ce(n);if(e<1||e>200)throw new m("distinct_id","distinct_id must be between 1 and 200 characters")}function pe(n){let e=ce(n);if(e<1||e>200)throw new m("event_name","event_name must be between 1 and 200 characters");if(!qe(n))throw new m("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var L="prodantix-js",G="0.7.0";var De=n=>{};function he(n){if(!n.apiKey||!ue(n.apiKey))throw new v("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!n.host)throw new v("host is required (the ingest base URL)");let e=p(n.host),t=n.defaultProperties,r=n.storage??new S;return {apiKey:n.apiKey,autocapture:n.autocapture??false,clock:n.clock??oe,consent:n.consent,consentMode:n.consentMode,defaultProperties:typeof t=="function"?t:()=>t??{},describeElement:n.describeElement,flagsHost:n.flagsHost?p(n.flagsHost):e,flushAt:n.flushAt??20,flushIntervalMs:n.flushIntervalMs??1e4,host:e,ids:n.ids??le,locale:n.locale,maxQueueSize:n.maxQueueSize??1e3,maxRetries:n.maxRetries??3,namespace:Le(n.apiKey),onError:n.onError??De,os:n.os,requestTimeoutMs:n.requestTimeoutMs??1e4,sdkName:n.sdkName??L,sdkVersion:n.sdkVersion??G,sessionTracking:n.sessionTracking??false,sharedStorage:n.sharedStorage??r,socketFactory:n.socketFactory,storage:r,streamFlags:n.streamFlags??false,transport:n.transport}}function Le(n){return n.slice(0,16)}var ge=(n,e)=>{let t={$cta_id:n.id,$cta_kind:n.kind,$cta_variant:n.variant.key,$cta_version:n.version},r=e===void 0?void 0:n.variant.content.buttons[e];return r&&e!==void 0&&(t.$cta_button=e,t.$cta_button_label=r.label,r.action.kind==="form"&&(t.$cta_form_id=r.action.value)),t},$=class{constructor(e){o(this,"fetch");o(this,"host");o(this,"projectKey");o(this,"requestTimeoutMs");this.fetch=h(e.fetch),this.host=p(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async ctas(e){let t=this.fetch;if(!t)throw new l("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}),s=d(),i=s?setTimeout(()=>s.abort(),this.requestTimeoutMs):void 0;try{let a=await t(`${this.host}/v1/ctas?${r.toString()}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:s?.signal});if(a.status<200||a.status>=300)throw new l(`ctas request failed with status ${a.status}`,a.status);return JSON.parse(await a.text()).ctas}finally{i!==void 0&&clearTimeout(i);}}};function me(n,e,t){pe(n.eventName),de(n.distinctId);let r={distinct_id:n.distinctId,event_id:n.eventId??t.uuid(),event_name:n.eventName,properties:n.properties??{},schema_version:1,timestamp:T(n.timestamp??e.now())};return n.context&&(r.context=n.context),n.sessionId&&(r.session_id=n.sessionId),r}var y=Symbol("absent");function Ge(n,e){if(n==="distinct_id")return e.distinctId;let t=e.properties??{};if(Object.prototype.hasOwnProperty.call(t,n))return t[n];let r=e.attributes??{};return Object.prototype.hasOwnProperty.call(r,n)?r[n]:y}function f(n){return n===y?"undefined":String(n)}function fe(n){return n===y?Number.NaN:Number(n)}function ye(n){return n!==y&&n!==null&&n!==""}function ve(n,e){if(!Array.isArray(e))return false;let t=f(n);return e.map(r=>String(r)).includes(t)}function V(n,e){let t=Ge(n.attribute,e),r=n.value;switch(n.op){case "is_set":return ye(t);case "is_not_set":return !ye(t);case "eq":return f(t)===f(r===void 0?y:r);case "neq":return f(t)!==f(r===void 0?y:r);case "contains":return f(t).includes(f(r===void 0?y:r));case "in":return ve(t,r);case "not_in":return Array.isArray(r)?!ve(t,r):false;case "gt":return A(t,r,(s,i)=>s>i);case "gte":return A(t,r,(s,i)=>s>=i);case "lt":return A(t,r,(s,i)=>s<i);case "lte":return A(t,r,(s,i)=>s<=i);case "in_cohort":return typeof r=="string"&&r!==""&&(e.cohorts??[]).includes(r);case "not_in_cohort":return typeof r=="string"&&r!==""&&!(e.cohorts??[]).includes(r);default:return false}}function A(n,e,t){let r=fe(n),s=e===void 0?Number.NaN:fe(e);return Number.isNaN(r)||Number.isNaN(s)?false:t(r,s)}function j(n,e){let t=`${n}:${e}`,r=2166136261;for(let s=0;s<t.length;s++)r^=t.charCodeAt(s),r=Math.imul(r,16777619);return (r>>>0)%100}function U(n,e){return n.targeting.length===0||n.targeting.every(t=>V(t,e))}function Se(n,e){let t=j(n.key,e.distinctId),r=n.variations??[];if(r.length===0)return n.rolloutPercentage>=100||t<n.rolloutPercentage?"true":"false";let s=0;for(let i=r.length-1;i>=0;i--)if(s+=r[i].weight,t<s)return r[i].key;return r[0].key}function B(n,e,t,r){for(let s of n.prerequisites??[]){if(r.includes(s.flagKey))return false;let i=e.find(c=>c.key===s.flagKey);if(!i||!i.enabled)return false;r.push(i.key);let a=B(i,e,t,r)&&U(i,t)&&Se(i,t)===s.variationKey;if(r.pop(),!a)return false}return true}function k(n,e,t){return n.enabled?B(n,e,t,[n.key])?U(n,t)?n.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:j(n.key,t.distinctId)<n.rolloutPercentage?{enabled:true,reason:"rollout"}:{enabled:false,reason:"rollout_excluded"}:{enabled:false,reason:"targeting"}:{enabled:false,reason:"prerequisite"}:{enabled:false,reason:"disabled"}}function Ve(n,e){return k(n,[],e)}function H(n,e){let t={};for(let r of n)t[r.key]=k(r,n,e).enabled;return t}function x(n,e,t){let r=n.variations??[],s=r[0];if(!s)return null;if(!n.enabled||!B(n,e,t,[n.key])||!U(n,t))return s;let i=Se(n,t);return r.find(a=>a.key===i)??s}function je(n,e){return x(n,[],e)}function Ue(n,e,t){let r=n.find(s=>s.key===e);return r?x(r,n,t)?.value??null:null}function be(n){return n.some(e=>e.targeting.some(t=>t.op==="in_cohort"||t.op==="not_in_cohort"))}function ke(n){return `40${JSON.stringify(n)}`}function xe(){return "3"}function Ee(n){let e=n.charAt(0),t=n.slice(1);if(e==="2")return {kind:"ping"};if(e==="1")return {kind:"disconnect"};if(e==="0"){let a=J(t);return {kind:"open",pingInterval:typeof a?.pingInterval=="number"?a.pingInterval:25e3,pingTimeout:typeof a?.pingTimeout=="number"?a.pingTimeout:2e4}}if(e!=="4")return {kind:"other"};let r=t.charAt(0),s=t.slice(1);if(r==="0")return {kind:"connected"};if(r==="1")return {kind:"disconnect"};if(r==="4"){let a=J(s);return {kind:"connectError",message:typeof a?.message=="string"?a.message:"refused"}}if(r!=="2")return {kind:"other"};let i=J(s);return !Array.isArray(i)||typeof i[0]!="string"?{kind:"other"}:{kind:"event",name:i[0],payload:i[1]}}function J(n){try{return JSON.parse(n)}catch{return null}}var Be="/socket.io/?EIO=4&transport=websocket",He=250,P=class{constructor(e){this.options=e;o(this,"socket",null);o(this,"heartbeat",null);o(this,"pending",null);o(this,"lastKey","");o(this,"ready",false);o(this,"closed",false);o(this,"heartbeatWindow",45e3);o(this,"factory");o(this,"setTimer");o(this,"clearTimer");this.factory=e.socketFactory??Je,this.setTimer=e.setTimer??((t,r)=>setTimeout(t,r)),this.clearTimer=e.clearTimer??(t=>clearTimeout(t));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${Be}`,t;try{t=this.factory(e);}catch{this.options.onClosed(false);return}this.socket=t,t.onmessage=r=>this.receive(String(r.data)),t.onerror=()=>t.close(),t.onclose=()=>this.fell();}close(){this.closed=true,this.stopHeartbeat(),this.pending!==null&&this.clearTimer(this.pending),this.pending=null;let e=this.socket;this.socket=null,e?.close();}receive(e){let t=Ee(e);if(t.kind==="open"){this.armHeartbeat(t.pingInterval+t.pingTimeout),this.socket?.send(ke({projectKey:this.options.projectKey}));return}if(t.kind==="ping"){this.armHeartbeat(),this.socket?.send(xe());return}if(t.kind==="connectError"||t.kind==="disconnect"){this.stopHeartbeat(),this.socket?.close();return}if(t.kind==="event"){if(t.name==="ready"){this.ready=true;return}if(t.name==="flagChange"){let r=t.payload?.key;this.lastKey=typeof r=="string"?r:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},He));}}}fell(){this.stopHeartbeat();let e=this.ready;this.socket=null,this.ready=false,this.closed||this.options.onClosed(e);}armHeartbeat(e){e!==void 0&&(this.heartbeatWindow=e),this.stopHeartbeat(),this.heartbeat=this.setTimer(()=>this.socket?.close(),this.heartbeatWindow);}stopHeartbeat(){this.heartbeat!==null&&this.clearTimer(this.heartbeat),this.heartbeat=null;}};function Je(n){let e=globalThis.WebSocket;if(!e)throw new l("no WebSocket");return new e(n)}var E=class{constructor(e){o(this,"fetch");o(this,"host");o(this,"projectKey");o(this,"requestTimeoutMs");this.fetch=h(e.fetch),this.host=p(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){let t=this.fetch;if(!t)throw new l("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,s=d(),i=s?setTimeout(()=>s.abort(),this.requestTimeoutMs):void 0;try{let a=await t(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:s?.signal});if(!a.ok)throw new l(`flags request failed with status ${a.status}`,a.status);let c=JSON.parse(await a.text());return {flags:c.flags??{},variants:c.variants??{}}}finally{i!==void 0&&clearTimeout(i);}}async snapshot(){let e=this.fetch;if(!e)throw new l("no fetch implementation available in this runtime");let t=`${this.host}/v1/flags/snapshot`,r=d(),s=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let i=await e(t,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r?.signal});if(!i.ok)throw new l(`flag snapshot request failed with status ${i.status}`,i.status);let a=JSON.parse(await i.text()),c={flags:a.flags??[],generatedAt:a.generatedAt};return typeof a.socketUrl=="string"&&a.socketUrl!==""&&(c.socketUrl=a.socketUrl),c}finally{s!==void 0&&clearTimeout(s);}}async memberships(e){let t=this.fetch;if(!t)throw new l("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,s=d(),i=s?setTimeout(()=>s.abort(),this.requestTimeoutMs):void 0;try{let a=await t(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:s?.signal});if(!a.ok)throw new l(`memberships request failed with status ${a.status}`,a.status);return JSON.parse(await a.text()).cohorts??[]}finally{i!==void 0&&clearTimeout(i);}}};var z=class extends Error{constructor(t,r,s){super(s);o(this,"fields");o(this,"status");this.name="FormRefusedError",this.status=t,this.fields=r;}},R=class{constructor(e){o(this,"fetch");o(this,"host");o(this,"projectKey");o(this,"requestTimeoutMs");this.fetch=h(e.fetch),this.host=p(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async request(e,t){let r=this.fetch;if(!r)throw new l("no fetch implementation available in this runtime");let s=d(),i=s?setTimeout(()=>s.abort(),this.requestTimeoutMs):void 0;try{let a={authorization:`Bearer ${this.projectKey}`};t.body!==void 0&&(a["content-type"]="application/json");let c=await r(`${this.host}${e}`,{body:t.body,headers:a,method:t.method,signal:s?.signal});return {status:c.status,text:await c.text()}}finally{i!==void 0&&clearTimeout(i);}}async form(e,t){let{status:r,text:s}=await this.request(`/v1/forms/${encodeURIComponent(e)}?distinct_id=${encodeURIComponent(t)}`,{method:"GET"});if(r<200||r>=300)throw new l(`form request failed with status ${r}`,r);return JSON.parse(s)}async submit(e,t){let{status:r,text:s}=await this.request(`/v1/forms/${encodeURIComponent(e)}/submissions`,{body:JSON.stringify(t),method:"POST"});if(r>=200&&r<300)return JSON.parse(s).afterSubmit;let i=[],a=`form submission failed with status ${r}`;try{let c=JSON.parse(s);i=c.error?.fields??[],a=c.error?.message??a;}catch{i=[];}throw new z(r,i,a)}};var Q="$survey_shown",W="$survey_dismissed",Y="$survey_sent",C=class{constructor(e){o(this,"fetch");o(this,"host");o(this,"projectKey");o(this,"requestTimeoutMs");this.fetch=h(e.fetch),this.host=p(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async surveys(e,t){let r=this.fetch;if(!r)throw new l("no fetch implementation available in this runtime");let s=d(),i=s?setTimeout(()=>s.abort(),this.requestTimeoutMs):void 0;try{let a=await r(`${this.host}/v1/surveys?distinct_id=${encodeURIComponent(e)}${t?`&lang=${encodeURIComponent(t)}`:""}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:s?.signal});if(!a.ok)throw new l(`surveys request failed with status ${a.status}`,a.status);return JSON.parse(await a.text()).surveys??[]}finally{i!==void 0&&clearTimeout(i);}}},ze=864e5,Ce=n=>`${n.id}:${n.iteration}`;function M(n,e){return n.length===0?true:n.some(t=>{switch(t.matches){case "exact":return e===t.value;case "starts_with":return e.startsWith(t.value);default:return e.includes(t.value)}})}function Qe(n,e,t,r,s){return n.kind!=="popover"||e.settled.includes(Ce(n))||n.showOnce&&e.settled.some(i=>i.startsWith(`${n.id}:`))||n.waitDays>0&&e.lastShownAt!==void 0&&r-e.lastShownAt<n.waitDays*ze||n.event&&n.event!==s?false:M(n.urls,t)}function We(n,e,t){return n>=(e.minScore??0)&&n<=(e.maxScore??t)}function Ye(n,e,t){let r=e.kind==="nps"?10:e.scale??5,s=e.branches.find(a=>a.choice!=null?t===a.choice:typeof t=="number"&&We(t,a,r));if(s)return s.next??null;let i=n.questions.findIndex(a=>a.id===e.id);return n.questions[i+1]?.id??null}function _(n,e){let t={$survey_id:n.id,$survey_iteration:n.iteration,$survey_name:n.name};for(let[r,s]of Object.entries(e))t[`$survey_response_${r}`]=s;return t}var Xe="$guide_shown",Ze="$guide_step_viewed",et="$guide_step_missed",tt="$guide_completed",nt="$guide_dismissed",rt="$checklist_task_done",w=class{constructor(e){o(this,"fetch");o(this,"host");o(this,"projectKey");o(this,"requestTimeoutMs");this.fetch=h(e.fetch),this.host=p(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async guides(e){let t=this.fetch;if(!t)throw new l("no fetch implementation available in this runtime");let r=d(),s=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let i=await t(`${this.host}/v1/guides?distinct_id=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r?.signal});if(!i.ok)throw new l(`guides request failed with status ${i.status}`,i.status);return JSON.parse(await i.text()).guides??[]}finally{s!==void 0&&clearTimeout(s);}}},st=864e5,X=n=>`${n.id}:${n.iteration}`,_e=(n,e)=>`${X(n)}:${e}`;function it(n,e,t,r,s){return e.settled.includes(X(n))||n.showOnce&&e.settled.some(i=>i.startsWith(`${n.id}:`))||n.kind!=="checklist"&&n.waitDays>0&&e.lastShownAt!==void 0&&r-e.lastShownAt<n.waitDays*st||n.event&&n.event!==s?false:M(n.urls,t)}var ot=(n,e)=>n.steps.filter(t=>e.done.includes(_e(n,t.id))).map(t=>t.id),at=(n,e)=>n.kind==="checklist"?n.steps.find(t=>t.event===e):void 0;function Z(n,e){let t={$guide_id:n.id,$guide_iteration:n.iteration,$guide_name:n.name};return e!==void 0&&(t.$guide_step_id=e),t}function ee(n){if(typeof n!="string")return;let e=Array.from(n).length;return e>=1&&e<=200?n:void 0}function ne(n,e){return `pdx.${n}.${e}`}var re="consent",lt=["identityLink","analytics","marketing","functional"];function te(n){if(typeof n!="string")return null;try{let e=JSON.parse(n);if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e,r={};for(let s of lt){let i=t[s];typeof i=="boolean"&&(r[s]=i);}return typeof t.version=="number"&&Number.isInteger(t.version)&&(r.version=t.version),Array.isArray(t.categories)&&t.categories.every(s=>typeof s=="string")&&(r.categories=t.categories),Object.keys(r).length===0?null:r}catch{return null}}var we=n=>n.endsWith(`.${re}`);function O(n,e){return te(n.getItem(ne(e,re)))}function ct(n,e,t){let r=ne(e,re),s=te(JSON.stringify(t)),i=s===null?null:te(JSON.stringify({...O(n,e)??{},...s}));if(i===null){n.removeItem(r);return}n.setItem(r,JSON.stringify(i));}var N=class{constructor(e,t,r,s){this.storage=e;this.shared=t;this.ids=r;this.namespace=s;o(this,"anonymousId");o(this,"distinctId");o(this,"identified");this.refresh();}refresh(){let e=ee(this.shared.getItem(this.key("anonymous_id"))),t=ee(this.storage.getItem(this.key("anonymous_id")));e?(this.anonymousId=e,t!==e&&this.storage.setItem(this.key("anonymous_id"),e)):t?(this.anonymousId=t,this.shared.setItem(this.key("anonymous_id"),t)):(this.anonymousId=this.ids.uuid(),this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId));let r=ee(this.storage.getItem(this.key("distinct_id")));r?(this.distinctId=r,this.identified=true):(this.distinctId=this.anonymousId,this.identified=false);}getAnonymousId(){return this.anonymousId}getDistinctId(){return this.distinctId}isIdentified(){return this.identified}snapshot(){return {anonymousId:this.anonymousId,distinctId:this.distinctId,identified:this.identified}}consent(){return O(this.shared,this.namespace)}setConsent(e){ct(this.shared,this.namespace,e);}assumeAnonymousId(e){this.anonymousId=e,this.shared.setItem(this.key("anonymous_id"),e),this.storage.setItem(this.key("anonymous_id"),e),this.identified||(this.distinctId=e);}identify(e){let t=!this.identified||this.distinctId!==e,r=this.storage.getItem(this.key("linked_anonymous_id")),s=t||r!==this.anonymousId;return this.distinctId=e,this.identified=true,t&&this.storage.setItem(this.key("distinct_id"),e),!s||this.consent()?.identityLink===false?{changed:t}:(this.storage.setItem(this.key("linked_anonymous_id"),this.anonymousId),{anonymousToLink:this.anonymousId,changed:t})}reset(){this.anonymousId=this.ids.uuid(),this.distinctId=this.anonymousId,this.identified=false,this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.removeItem(this.key("distinct_id")),this.storage.removeItem(this.key("linked_anonymous_id"));}key(e){return ne(this.namespace,e)}};var I=class{constructor(e){o(this,"fetch");o(this,"host");o(this,"projectKey");o(this,"requestTimeoutMs");this.fetch=h(e.fetch),this.host=p(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async inbox(e){let t=this.requireFetch(),r=`${this.host}/v1/messages?distinct_id=${encodeURIComponent(e)}`,s=await this.request(t,r,{headers:this.authHeaders(),method:"GET"});if(!s.ok)throw new l(`inbox request failed with status ${s.status}`,s.status);return JSON.parse(await s.text()).messages??[]}async markRead(e,t){let r=this.requireFetch(),s=`${this.host}/v1/messages/read`,i=await this.request(r,s,{body:JSON.stringify({distinct_id:t,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!i.ok)throw new l(`mark-read request failed with status ${i.status}`,i.status)}requireFetch(){if(!this.fetch)throw new l("no fetch implementation available in this runtime");return this.fetch}authHeaders(){return {authorization:`Bearer ${this.projectKey}`}}async request(e,t,r){let s=d(),i=s?setTimeout(()=>s.abort(),this.requestTimeoutMs):void 0;try{return await e(t,{...r,signal:s?.signal})}finally{i!==void 0&&clearTimeout(i);}}};var K=class{constructor(e,t){this.maxSize=e;this.onOverflow=t;o(this,"events",[]);}get size(){return this.events.length}enqueue(e){this.events.push(e),this.enforceCap();}restore(e){this.events.push(...e),this.enforceCap();}requeue(e){this.events.unshift(...e),this.enforceCap();}drain(e){let t=e===void 0?this.events.length:Math.min(e,this.events.length);return this.events.splice(0,t)}snapshot(){return [...this.events]}enforceCap(){if(this.events.length<=this.maxSize)return;let e=this.events.splice(0,this.events.length-this.maxSize);this.onOverflow?.({dropped:e});}};var ut={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function dt(n){return `pdx.${n}.session`}var q=class{constructor(e,t,r,s,i=ut){this.storage=e;this.ids=t;this.clock=r;this.namespace=s;this.options=i;}current(){return this.touch().id}startedAt(){return this.touch().startedAt}reset(){this.storage.removeItem(this.key());}touch(){let e=this.clock.now().getTime(),t=this.live(this.read(),e);if(t===void 0)return this.write({id:this.ids.uuid(),lastActivityAt:e,startedAt:e});if(e-t.lastActivityAt<=this.options.throttleMs)return t;let r=this.live(this.read(),e),s=r!==void 0&&r.id!==t.id?r:t;return this.write({...s,lastActivityAt:e})}live(e,t){if(e!==void 0&&!(t-e.lastActivityAt>this.options.idleMs||t-e.startedAt>this.options.maxMs))return e}write(e){return this.storage.setItem(this.key(),JSON.stringify(e)),e}read(){let e=this.storage.getItem(this.key());if(e)try{let t=JSON.parse(e);return typeof t.id=="string"&&typeof t.startedAt=="number"&&typeof t.lastActivityAt=="number"?{id:t.id,lastActivityAt:t.lastActivityAt,startedAt:t.startedAt}:void 0}catch{return}}key(){return dt(this.namespace)}};var u={autocapture:"$autocapture",createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",pageleave:"$pageleave",pageview:"$pageview",screen:"$screen",set:"$set"},Ie=[{emittedBy:"web",meaning:"A click anywhere on the page, with the element that was clicked. The web SDK sends it by default; autocapture: false or autocaptureOptions.clicks: false turns it off.",name:u.autocapture,properties:["$event_type","$el_description","$el_description_source","$el_action","$el_tag","$el_text","$el_id","$el_classes","$el_href","$current_url","$pathname","$host","$title","$referrer"]},{emittedBy:"web",meaning:"A page shown, including every client-side navigation the History API makes: one per distinct path and query.",name:u.pageview,properties:["$current_url","$pathname","$host","$title","$referrer"]},{emittedBy:"web",meaning:"A landing page left the visitor's sight, by a tab switch, a closed tab or a navigation away, with the seconds it was in front of them so far. A page returned to and left again sends it again with the larger total.",name:u.pageleave,properties:["$engaged_seconds","$page_id","$page_view_id","$page_variant"]},{emittedBy:"flutter",meaning:"A named route pushed or replaced in a Flutter app, the mobile counterpart of $pageview.",name:u.screen,properties:["screen"]},{emittedBy:"every",meaning:"A person becomes known by a distinct id. The anonymous trail before it is joined to them, and any traits ride along under $set.",name:u.identify,properties:["$anon_distinct_id","$set"]},{emittedBy:"every",meaning:"A second id for the same person, so events sent under either resolve to one profile.",name:u.createAlias,properties:["alias"]},{emittedBy:"every",meaning:"The person is placed in a group such as a company or a team; group properties ride along under $set.",name:u.group,properties:["$group_type","$group_key","$set"]},{emittedBy:"every",meaning:"Person properties written without an identify: $set overwrites, $set_once fills only what is still empty.",name:u.set,properties:["$set","$set_once"]},{emittedBy:"every",meaning:"A flag was evaluated for this person, sent once per distinct answer. Experiments attribute exposure from it.",name:u.featureFlagCalled,properties:["$feature_flag","$feature_flag_response"]}],pt=n=>n.startsWith("$"),ht=n=>Ie.find(e=>e.name===n);function Fe(n){return n>=400&&n<500&&n!==429}var F=class{constructor(e={}){o(this,"fetch");o(this,"maxRetries");o(this,"requestTimeoutMs");o(this,"baseDelayMs");o(this,"maxDelayMs");o(this,"sleep");o(this,"random");this.fetch=h(e.fetch),this.maxRetries=e.maxRetries??3,this.requestTimeoutMs=e.requestTimeoutMs??1e4,this.baseDelayMs=e.baseDelayMs??500,this.maxDelayMs=e.maxDelayMs??3e4,this.sleep=e.sleep??ie,this.random=e.random??Math.random;}async send(e){let t=this.fetch;if(!t)throw new l("no fetch implementation available in this runtime");let r=JSON.stringify(e.body),s;for(let i=0;i<=this.maxRetries;i+=1){try{let a=await this.attempt(t,e,r);if(a.ok)return;if(Fe(a.status))throw new l(`ingest rejected batch with status ${a.status}`,a.status);s=new l(`ingest transient status ${a.status}`,a.status);}catch(a){if(a instanceof l&&a.status!==void 0&&Fe(a.status))throw a;s=a;}i<this.maxRetries&&await this.sleep(this.backoff(i));}throw new l("ingest delivery failed after retries",void 0,{cause:s})}async attempt(e,t,r){let s=d(),i=s?setTimeout(()=>s.abort(),this.requestTimeoutMs):void 0;try{return await e(t.url,{body:r,headers:{authorization:`Bearer ${t.projectKey}`,"content-type":"application/json"},method:"POST",signal:s?.signal})}finally{i!==void 0&&clearTimeout(i);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};var gt="queue",mt=1e3,Te=3e4,se=n=>{let e={};return n.avatar!==void 0&&(e.$avatar=n.avatar),n.email!==void 0&&(e.$email=n.email),n.name!==void 0&&(e.$name=n.name),n.phone!==void 0&&(e.$phone=n.phone),e},D=class{constructor(e){o(this,"config");o(this,"identity");o(this,"session");o(this,"queue");o(this,"transport");o(this,"flagsClient");o(this,"messagesClient");o(this,"surveysClient");o(this,"guidesClient");o(this,"captureListeners",new Set);o(this,"formsClient");o(this,"ctasClient");o(this,"context");o(this,"flushTimer");o(this,"flushing",false);o(this,"cachedFlags");o(this,"cachedSnapshot");o(this,"membershipCache");o(this,"stream");o(this,"shutDown",false);o(this,"exposures",new Set);o(this,"gates");o(this,"cookielessId");o(this,"storageListeners",new Set);let t=he(e),r=O(t.sharedStorage,t.namespace)??t.consent??null;if(this.gates=[new b(t.storage),new b(t.sharedStorage,we)],t.consentMode!=="banner"||r?.analytics===true)for(let a of this.gates)a.open();let[s,i]=this.gates;this.config={...t,sharedStorage:i,storage:s},this.identity=new N(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 q(this.config.sharedStorage,this.config.ids,this.config.clock,this.config.namespace):void 0,this.queue=new K(this.config.maxQueueSize,({dropped:a})=>{this.config.onError(new g("queue_overflow",`event queue overflow: dropped ${a.length} oldest event(s)`));}),this.transport=this.config.transport??new F({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new E({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new I({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.surveysClient=new C({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.guidesClient=new w({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.formsClient=new R({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.ctasClient=new $({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.context={sdk:this.config.sdkName,sdk_version:this.config.sdkVersion},this.config.os&&(this.context.os=this.config.os),this.config.locale&&(this.context.locale=this.config.locale),this.restoreQueue(),this.startTimer();}get distinctId(){return this.identity.getDistinctId()}get anonymousId(){return this.identity.getAnonymousId()}get isIdentified(){return this.identity.isIdentified()}get sessionId(){return this.session?.current()}get sessionStartedAt(){return this.session?.startedAt()}capture(e,t={}){try{this.identity.refresh();let r={...this.config.defaultProperties(),...t.element===void 0?{}:this.config.describeElement?.(t.element)??{},...t.properties??{}},s=me({context:this.context,distinctId:t.distinctId??this.identity.getDistinctId(),eventName:e,properties:r,sessionId:t.sessionId??this.session?.current(),timestamp:t.timestamp},this.config.clock,this.config.ids);this.enqueue(s);}catch(r){this.config.onError(r);}for(let r of this.captureListeners)try{r(e);}catch(s){this.config.onError(s);}}onCapture(e){return this.captureListeners.add(e),()=>{this.captureListeners.delete(e);}}identify(e,t={}){if(this.isCookieless())return;this.identity.refresh();let r=this.identity.identify(e),s={};r.anonymousToLink!==void 0&&(s.$anon_distinct_id=r.anonymousToLink);let i=ae(),a={...i===null?{}:{$timezone:i},...se(t.traits??{}),...t.set??{}};Object.keys(a).length>0&&(s.$set=a),this.capture(u.identify,{properties:s});}link(e,t,r){if(this.isCookieless())return;let s={$anon_distinct_id:t},i=se(r??{});Object.keys(i).length>0&&(s.$set=i),this.capture(u.identify,{distinctId:e,properties:s});}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(u.createAlias,{properties:{alias:e}});}group(e,t,r){let s={$group_key:t,$group_type:e};r&&(s.$set=r),this.capture(u.group,{properties:s});}setPersonProperties(e,t){if(this.isCookieless())return;let r={};e&&(r.$set=e),t&&(r.$set_once=t),this.capture(u.set,{properties:r});}setPersonTraits(e){if(this.isCookieless())return;let t=se(e);Object.keys(t).length!==0&&this.capture(u.set,{properties:{$set:t}});}async getAllFlags(){let e=this.identity.getDistinctId(),t=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:t.flags,variants:t.variants??{}},t.flags}async isFeatureEnabled(e){let r=(await this.getAllFlags())[e]??false;return this.recordExposure(e,this.cachedFlags?.variants[e]?.key??String(r)),r}async getVariant(e){let t=await this.getAllFlags(),r=this.cachedFlags?.variants[e]??null;return this.recordExposure(e,r?.key??String(t[e]??false)),r}async getVariantLocal(e,t={}){let r=await this.flagSnapshot(),s=r.flags.find($e=>$e.key===e),i=await this.localContext(t,r.flags),a=s?x(s,r.flags,i):null,c=s?k(s,r.flags,i).enabled:false;return this.recordExposure(e,a?.key??String(c)),a?{key:a.key,value:a.value}:null}recordExposure(e,t){let r=`${this.identity.getDistinctId()} ${e} ${t}`;this.exposures.has(r)||(this.exposures.add(r),this.capture(u.featureFlagCalled,{properties:{$feature_flag:e,$feature_flag_response:t}}));}getCachedFlag(e){if(!(!this.cachedFlags||this.cachedFlags.distinctId!==this.distinctId))return this.cachedFlags.flags[e]}async getLocalFlags(e={}){let t=await this.flagSnapshot();return H(t.flags,await this.localContext(e,t.flags))}async isFeatureEnabledLocal(e,t={}){let r=await this.flagSnapshot(),s=r.flags.find(c=>c.key===e),i=await this.localContext(t,r.flags),a=s?k(s,r.flags,i).enabled:false;return this.recordExposure(e,(s?x(s,r.flags,i)?.key:void 0)??String(a)),a}async localContext(e,t){let r=this.identity.getDistinctId(),s=e.cohorts;if(s===void 0&&be(t)){let i=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===r&&i-this.membershipCache.fetchedAt<Te?s=this.membershipCache.cohorts:(s=await this.flagsClient.memberships(r),this.membershipCache={cohorts:s,distinctId:r,fetchedAt:i});}return {attributes:e.attributes,cohorts:s,distinctId:r,properties:e.properties}}async flagSnapshot(){let e=this.config.clock.now().getTime();if(this.cachedSnapshot&&e-this.cachedSnapshot.fetchedAt<Te)return this.cachedSnapshot.snapshot;let t=await this.flagsClient.snapshot();return this.cachedSnapshot={fetchedAt:e,snapshot:t},this.maybeStream(t),t}maybeStream(e){if(!this.config.streamFlags||this.shutDown||this.stream||!e.socketUrl)return;let t=new P({host:e.socketUrl,onChange:()=>{this.cachedSnapshot=void 0,this.flagSnapshot().catch(r=>this.config.onError(r));},onClosed:r=>{this.stream=void 0,r&&this.maybeStream(e);},projectKey:this.config.apiKey,socketFactory:this.config.socketFactory});this.stream=t,t.open();}async getInbox(){return this.messagesClient.inbox(this.identity.getDistinctId())}async markMessageRead(e){await this.messagesClient.markRead(e,this.identity.getDistinctId());}async getSurveys(e){return this.surveysClient.surveys(this.identity.getDistinctId(),e??this.config.locale)}captureSurveyShown(e){this.capture(Q,{properties:_(e,{})});}captureSurveyDismissed(e){this.capture(W,{properties:_(e,{})});}captureSurveySent(e,t){this.capture(Y,{properties:_(e,t)});}async getGuides(){return this.guidesClient.guides(this.identity.getDistinctId())}captureGuide(e,t,r){this.capture(e,{properties:Z(t,r)});}async getForm(e){return this.formsClient.form(e,this.identity.getDistinctId())}async submitForm(e,t,r,s){let{$page_id:i,$page_variant:a}=this.config.defaultProperties();return this.formsClient.submit(e,{answers:t,challenge:r,distinctId:this.identity.getDistinctId(),isAnonymous:!this.identity.isIdentified(),pageUrl:typeof window>"u"?"":window.location.href,solution:s,...typeof i=="string"&&typeof a=="string"?{pageId:i,pageVariant:a}:{}})}async getCtas(e){return this.ctasClient.ctas({...e,anonymous:!this.identity.isIdentified(),distinctId:this.identity.getDistinctId()})}captureCta(e,t,r){this.capture(e,{properties:ge(t,r)});}async flush(){if(this.flushing||this.queue.size===0)return;this.flushing=true;let e=this.queue.drain(mt);try{await this.transport.send({body:{events:e,sent_at:T(this.config.clock.now())},projectKey:this.config.apiKey,url:`${this.config.host}/v1/events`}),this.persistQueue();}catch(t){this.queue.requeue(e),this.persistQueue(),this.config.onError(t);}finally{this.flushing=false;}}reset(){this.session?.reset(),this.identity.reset(),this.cachedFlags=void 0,this.cachedSnapshot=void 0,this.membershipCache=void 0;}async shutdown(){this.shutDown=true,this.stopTimer(),this.stream?.close(),this.stream=void 0,await this.flush();}enqueue(e){this.queue.enqueue(e),this.persistQueue(),this.queue.size>=this.config.flushAt&&this.flush();}persistQueue(){try{this.config.storage.setItem(this.persistKey(),JSON.stringify(this.queue.snapshot()));}catch(e){this.config.onError(e);}}restoreQueue(){try{let e=this.config.storage.getItem(this.persistKey());if(!e)return;let t=JSON.parse(e);Array.isArray(t)&&this.queue.restore(t);}catch(e){this.config.onError(e);}}startTimer(){if(this.config.flushIntervalMs<=0)return;let e=setInterval(()=>{this.flush();},this.config.flushIntervalMs),t=e;typeof t.unref=="function"&&t.unref(),this.flushTimer=e;}stopTimer(){this.flushTimer!==void 0&&(clearInterval(this.flushTimer),this.flushTimer=void 0);}persistKey(){return `pdx.${this.config.namespace}.${gt}`}};function ft(n){return new D(n)}exports.CHECKLIST_TASK_DONE=rt;exports.ConfigError=v;exports.FetchTransport=F;exports.FlagsClient=E;exports.GUIDE_COMPLETED=tt;exports.GUIDE_DISMISSED=nt;exports.GUIDE_SHOWN=Xe;exports.GUIDE_STEP_MISSED=et;exports.GUIDE_STEP_VIEWED=Ze;exports.GuidesClient=w;exports.MemoryStorage=S;exports.MessagesClient=I;exports.ProdantixClient=D;exports.ProdantixError=g;exports.SDK_NAME=L;exports.SDK_VERSION=G;exports.SURVEY_DISMISSED=W;exports.SURVEY_SENT=Y;exports.SURVEY_SHOWN=Q;exports.SYSTEM_EVENT=u;exports.SYSTEM_EVENTS=Ie;exports.SurveysClient=C;exports.TransportError=l;exports.ValidationError=m;exports.assignVariant=je;exports.bucket=j;exports.createClient=ft;exports.evaluateAll=H;exports.evaluateFlag=Ve;exports.getVariant=Ue;exports.guideKey=X;exports.guideProperties=Z;exports.isDue=Qe;exports.isGuideDue=it;exports.isSystemEventName=pt;exports.matches=V;exports.nextQuestion=Ye;exports.responseProperties=_;exports.settledKey=Ce;exports.systemEvent=ht;exports.taskFor=at;exports.taskKey=_e;exports.tasksDone=ot;exports.urlMatches=M;//# sourceMappingURL=index.cjs.map
1
+ 'use strict';var Ae=Object.defineProperty;var Pe=(n,e,t)=>e in n?Ae(n,e,{enumerable:true,configurable:true,writable:true,value:t}):n[e]=t;var o=(n,e,t)=>Pe(n,typeof e!="symbol"?e+"":e,t);var g=class extends Error{constructor(t,r,s){super(r,s);o(this,"code");this.code=t,this.name="ProdantixError";}},v=class extends g{constructor(e){super("config",e),this.name="ConfigError";}},m=class extends g{constructor(t,r){super("validation",r);o(this,"field");this.field=t,this.name="ValidationError";}},l=class extends g{constructor(t,r,s){super("transport",t,s);o(this,"status");this.status=r,this.name="TransportError";}};function h(n){if(n)return n;let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}function d(){let n=globalThis.AbortController;return n?new n:void 0}var ie=n=>new Promise(e=>{setTimeout(e,n);});function p(n){return n.replace(/\/+$/,"")}var S=class{constructor(){o(this,"store",new Map);}getItem(e){return this.store.get(e)??null}removeItem(e){this.store.delete(e);}setItem(e,t){this.store.set(e,t);}},b=class{constructor(e,t=()=>false){this.real=e;this.passes=t;o(this,"held",new S);o(this,"opened",false);}get isOpen(){return this.opened}open(){this.opened=true;}close(){this.opened=false;}target(e){return this.opened||this.passes(e)?this.real:this.held}getItem(e){return this.target(e).getItem(e)}removeItem(e){this.target(e).removeItem(e);}setItem(e,t){this.target(e).setItem(e,t);}};var oe={now:()=>new Date};function T(n){return n.toISOString()}function ae(){if(typeof window>"u"||typeof Intl>"u")return null;let n=Intl.DateTimeFormat().resolvedOptions().timeZone;return typeof n=="string"&&n!==""?n:null}function Re(){return globalThis.crypto}function Me(n){n[6]=n[6]&15|64,n[8]=n[8]&63|128;let e=[];for(let t=0;t<16;t+=1)e.push(n[t].toString(16).padStart(2,"0"));return `${e[0]}${e[1]}${e[2]}${e[3]}-${e[4]}${e[5]}-${e[6]}${e[7]}-${e[8]}${e[9]}-${e[10]}${e[11]}${e[12]}${e[13]}${e[14]}${e[15]}`}function Ne(){let n=Re();if(n?.randomUUID)return n.randomUUID();let e=new Uint8Array(16);if(n?.getRandomValues)n.getRandomValues(e);else for(let t=0;t<16;t+=1)e[t]=Math.floor(Math.random()*256);return Me(e)}var le={uuid:Ne};var Oe=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var Ke=/^(?:\$|[a-z])[a-z0-9_.]*$/;function ce(n){let e=0;for(let t of n)e+=1;return e}function ue(n){return Oe.test(n)}function qe(n){return Ke.test(n)}function de(n){let e=ce(n);if(e<1||e>200)throw new m("distinct_id","distinct_id must be between 1 and 200 characters")}function pe(n){let e=ce(n);if(e<1||e>200)throw new m("event_name","event_name must be between 1 and 200 characters");if(!qe(n))throw new m("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var L="prodantix-js",G="0.8.0";var De=n=>{};function he(n){if(!n.apiKey||!ue(n.apiKey))throw new v("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!n.host)throw new v("host is required (the ingest base URL)");let e=p(n.host),t=n.defaultProperties,r=n.storage??new S;return {apiKey:n.apiKey,autocapture:n.autocapture??false,clock:n.clock??oe,consent:n.consent,consentMode:n.consentMode,defaultProperties:typeof t=="function"?t:()=>t??{},describeElement:n.describeElement,flagsHost:n.flagsHost?p(n.flagsHost):e,flushAt:n.flushAt??20,flushIntervalMs:n.flushIntervalMs??1e4,host:e,ids:n.ids??le,locale:n.locale,maxQueueSize:n.maxQueueSize??1e3,maxRetries:n.maxRetries??3,namespace:Le(n.apiKey),onError:n.onError??De,os:n.os,requestTimeoutMs:n.requestTimeoutMs??1e4,sdkName:n.sdkName??L,sdkVersion:n.sdkVersion??G,sessionTracking:n.sessionTracking??false,sharedStorage:n.sharedStorage??r,socketFactory:n.socketFactory,storage:r,streamFlags:n.streamFlags??false,transport:n.transport}}function Le(n){return n.slice(0,16)}var ge=(n,e)=>{let t={$cta_id:n.id,$cta_kind:n.kind,$cta_variant:n.variant.key,$cta_version:n.version},r=e===void 0?void 0:n.variant.content.buttons[e];return r&&e!==void 0&&(t.$cta_button=e,t.$cta_button_label=r.label,r.action.kind==="form"&&(t.$cta_form_id=r.action.value)),t},$=class{constructor(e){o(this,"fetch");o(this,"host");o(this,"projectKey");o(this,"requestTimeoutMs");this.fetch=h(e.fetch),this.host=p(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async ctas(e){let t=this.fetch;if(!t)throw new l("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}),s=d(),i=s?setTimeout(()=>s.abort(),this.requestTimeoutMs):void 0;try{let a=await t(`${this.host}/v1/ctas?${r.toString()}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:s?.signal});if(a.status<200||a.status>=300)throw new l(`ctas request failed with status ${a.status}`,a.status);return JSON.parse(await a.text()).ctas}finally{i!==void 0&&clearTimeout(i);}}};function me(n,e,t){pe(n.eventName),de(n.distinctId);let r={distinct_id:n.distinctId,event_id:n.eventId??t.uuid(),event_name:n.eventName,properties:n.properties??{},schema_version:1,timestamp:T(n.timestamp??e.now())};return n.context&&(r.context=n.context),n.sessionId&&(r.session_id=n.sessionId),r}var y=Symbol("absent");function Ge(n,e){if(n==="distinct_id")return e.distinctId;let t=e.properties??{};if(Object.prototype.hasOwnProperty.call(t,n))return t[n];let r=e.attributes??{};return Object.prototype.hasOwnProperty.call(r,n)?r[n]:y}function f(n){return n===y?"undefined":String(n)}function fe(n){return n===y?Number.NaN:Number(n)}function ye(n){return n!==y&&n!==null&&n!==""}function ve(n,e){if(!Array.isArray(e))return false;let t=f(n);return e.map(r=>String(r)).includes(t)}function V(n,e){let t=Ge(n.attribute,e),r=n.value;switch(n.op){case "is_set":return ye(t);case "is_not_set":return !ye(t);case "eq":return f(t)===f(r===void 0?y:r);case "neq":return f(t)!==f(r===void 0?y:r);case "contains":return f(t).includes(f(r===void 0?y:r));case "in":return ve(t,r);case "not_in":return Array.isArray(r)?!ve(t,r):false;case "gt":return A(t,r,(s,i)=>s>i);case "gte":return A(t,r,(s,i)=>s>=i);case "lt":return A(t,r,(s,i)=>s<i);case "lte":return A(t,r,(s,i)=>s<=i);case "in_cohort":return typeof r=="string"&&r!==""&&(e.cohorts??[]).includes(r);case "not_in_cohort":return typeof r=="string"&&r!==""&&!(e.cohorts??[]).includes(r);default:return false}}function A(n,e,t){let r=fe(n),s=e===void 0?Number.NaN:fe(e);return Number.isNaN(r)||Number.isNaN(s)?false:t(r,s)}function j(n,e){let t=`${n}:${e}`,r=2166136261;for(let s=0;s<t.length;s++)r^=t.charCodeAt(s),r=Math.imul(r,16777619);return (r>>>0)%100}function U(n,e){return n.targeting.length===0||n.targeting.every(t=>V(t,e))}function Se(n,e){let t=j(n.key,e.distinctId),r=n.variations??[];if(r.length===0)return n.rolloutPercentage>=100||t<n.rolloutPercentage?"true":"false";let s=0;for(let i=r.length-1;i>=0;i--)if(s+=r[i].weight,t<s)return r[i].key;return r[0].key}function B(n,e,t,r){for(let s of n.prerequisites??[]){if(r.includes(s.flagKey))return false;let i=e.find(c=>c.key===s.flagKey);if(!i||!i.enabled)return false;r.push(i.key);let a=B(i,e,t,r)&&U(i,t)&&Se(i,t)===s.variationKey;if(r.pop(),!a)return false}return true}function k(n,e,t){return n.enabled?B(n,e,t,[n.key])?U(n,t)?n.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:j(n.key,t.distinctId)<n.rolloutPercentage?{enabled:true,reason:"rollout"}:{enabled:false,reason:"rollout_excluded"}:{enabled:false,reason:"targeting"}:{enabled:false,reason:"prerequisite"}:{enabled:false,reason:"disabled"}}function Ve(n,e){return k(n,[],e)}function H(n,e){let t={};for(let r of n)t[r.key]=k(r,n,e).enabled;return t}function x(n,e,t){let r=n.variations??[],s=r[0];if(!s)return null;if(!n.enabled||!B(n,e,t,[n.key])||!U(n,t))return s;let i=Se(n,t);return r.find(a=>a.key===i)??s}function je(n,e){return x(n,[],e)}function Ue(n,e,t){let r=n.find(s=>s.key===e);return r?x(r,n,t)?.value??null:null}function be(n){return n.some(e=>e.targeting.some(t=>t.op==="in_cohort"||t.op==="not_in_cohort"))}function ke(n){return `40${JSON.stringify(n)}`}function xe(){return "3"}function Ee(n){let e=n.charAt(0),t=n.slice(1);if(e==="2")return {kind:"ping"};if(e==="1")return {kind:"disconnect"};if(e==="0"){let a=J(t);return {kind:"open",pingInterval:typeof a?.pingInterval=="number"?a.pingInterval:25e3,pingTimeout:typeof a?.pingTimeout=="number"?a.pingTimeout:2e4}}if(e!=="4")return {kind:"other"};let r=t.charAt(0),s=t.slice(1);if(r==="0")return {kind:"connected"};if(r==="1")return {kind:"disconnect"};if(r==="4"){let a=J(s);return {kind:"connectError",message:typeof a?.message=="string"?a.message:"refused"}}if(r!=="2")return {kind:"other"};let i=J(s);return !Array.isArray(i)||typeof i[0]!="string"?{kind:"other"}:{kind:"event",name:i[0],payload:i[1]}}function J(n){try{return JSON.parse(n)}catch{return null}}var Be="/socket.io/?EIO=4&transport=websocket",He=250,P=class{constructor(e){this.options=e;o(this,"socket",null);o(this,"heartbeat",null);o(this,"pending",null);o(this,"lastKey","");o(this,"ready",false);o(this,"closed",false);o(this,"heartbeatWindow",45e3);o(this,"factory");o(this,"setTimer");o(this,"clearTimer");this.factory=e.socketFactory??Je,this.setTimer=e.setTimer??((t,r)=>setTimeout(t,r)),this.clearTimer=e.clearTimer??(t=>clearTimeout(t));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${Be}`,t;try{t=this.factory(e);}catch{this.options.onClosed(false);return}this.socket=t,t.onmessage=r=>this.receive(String(r.data)),t.onerror=()=>t.close(),t.onclose=()=>this.fell();}close(){this.closed=true,this.stopHeartbeat(),this.pending!==null&&this.clearTimer(this.pending),this.pending=null;let e=this.socket;this.socket=null,e?.close();}receive(e){let t=Ee(e);if(t.kind==="open"){this.armHeartbeat(t.pingInterval+t.pingTimeout),this.socket?.send(ke({projectKey:this.options.projectKey}));return}if(t.kind==="ping"){this.armHeartbeat(),this.socket?.send(xe());return}if(t.kind==="connectError"||t.kind==="disconnect"){this.stopHeartbeat(),this.socket?.close();return}if(t.kind==="event"){if(t.name==="ready"){this.ready=true;return}if(t.name==="flagChange"){let r=t.payload?.key;this.lastKey=typeof r=="string"?r:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},He));}}}fell(){this.stopHeartbeat();let e=this.ready;this.socket=null,this.ready=false,this.closed||this.options.onClosed(e);}armHeartbeat(e){e!==void 0&&(this.heartbeatWindow=e),this.stopHeartbeat(),this.heartbeat=this.setTimer(()=>this.socket?.close(),this.heartbeatWindow);}stopHeartbeat(){this.heartbeat!==null&&this.clearTimer(this.heartbeat),this.heartbeat=null;}};function Je(n){let e=globalThis.WebSocket;if(!e)throw new l("no WebSocket");return new e(n)}var E=class{constructor(e){o(this,"fetch");o(this,"host");o(this,"projectKey");o(this,"requestTimeoutMs");this.fetch=h(e.fetch),this.host=p(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){let t=this.fetch;if(!t)throw new l("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,s=d(),i=s?setTimeout(()=>s.abort(),this.requestTimeoutMs):void 0;try{let a=await t(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:s?.signal});if(!a.ok)throw new l(`flags request failed with status ${a.status}`,a.status);let c=JSON.parse(await a.text());return {flags:c.flags??{},variants:c.variants??{}}}finally{i!==void 0&&clearTimeout(i);}}async snapshot(){let e=this.fetch;if(!e)throw new l("no fetch implementation available in this runtime");let t=`${this.host}/v1/flags/snapshot`,r=d(),s=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let i=await e(t,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r?.signal});if(!i.ok)throw new l(`flag snapshot request failed with status ${i.status}`,i.status);let a=JSON.parse(await i.text()),c={flags:a.flags??[],generatedAt:a.generatedAt};return typeof a.socketUrl=="string"&&a.socketUrl!==""&&(c.socketUrl=a.socketUrl),c}finally{s!==void 0&&clearTimeout(s);}}async memberships(e){let t=this.fetch;if(!t)throw new l("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,s=d(),i=s?setTimeout(()=>s.abort(),this.requestTimeoutMs):void 0;try{let a=await t(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:s?.signal});if(!a.ok)throw new l(`memberships request failed with status ${a.status}`,a.status);return JSON.parse(await a.text()).cohorts??[]}finally{i!==void 0&&clearTimeout(i);}}};var z=class extends Error{constructor(t,r,s){super(s);o(this,"fields");o(this,"status");this.name="FormRefusedError",this.status=t,this.fields=r;}},R=class{constructor(e){o(this,"fetch");o(this,"host");o(this,"projectKey");o(this,"requestTimeoutMs");this.fetch=h(e.fetch),this.host=p(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async request(e,t){let r=this.fetch;if(!r)throw new l("no fetch implementation available in this runtime");let s=d(),i=s?setTimeout(()=>s.abort(),this.requestTimeoutMs):void 0;try{let a={authorization:`Bearer ${this.projectKey}`};t.body!==void 0&&(a["content-type"]="application/json");let c=await r(`${this.host}${e}`,{body:t.body,headers:a,method:t.method,signal:s?.signal});return {status:c.status,text:await c.text()}}finally{i!==void 0&&clearTimeout(i);}}async form(e,t){let{status:r,text:s}=await this.request(`/v1/forms/${encodeURIComponent(e)}?distinct_id=${encodeURIComponent(t)}`,{method:"GET"});if(r<200||r>=300)throw new l(`form request failed with status ${r}`,r);return JSON.parse(s)}async submit(e,t){let{status:r,text:s}=await this.request(`/v1/forms/${encodeURIComponent(e)}/submissions`,{body:JSON.stringify(t),method:"POST"});if(r>=200&&r<300)return JSON.parse(s).afterSubmit;let i=[],a=`form submission failed with status ${r}`;try{let c=JSON.parse(s);i=c.error?.fields??[],a=c.error?.message??a;}catch{i=[];}throw new z(r,i,a)}};var Q="$survey_shown",W="$survey_dismissed",Y="$survey_sent",C=class{constructor(e){o(this,"fetch");o(this,"host");o(this,"projectKey");o(this,"requestTimeoutMs");this.fetch=h(e.fetch),this.host=p(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async surveys(e,t){let r=this.fetch;if(!r)throw new l("no fetch implementation available in this runtime");let s=d(),i=s?setTimeout(()=>s.abort(),this.requestTimeoutMs):void 0;try{let a=await r(`${this.host}/v1/surveys?distinct_id=${encodeURIComponent(e)}${t?`&lang=${encodeURIComponent(t)}`:""}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:s?.signal});if(!a.ok)throw new l(`surveys request failed with status ${a.status}`,a.status);return JSON.parse(await a.text()).surveys??[]}finally{i!==void 0&&clearTimeout(i);}}},ze=864e5,Ce=n=>`${n.id}:${n.iteration}`;function M(n,e){return n.length===0?true:n.some(t=>{switch(t.matches){case "exact":return e===t.value;case "starts_with":return e.startsWith(t.value);default:return e.includes(t.value)}})}function Qe(n,e,t,r,s){return n.kind!=="popover"||e.settled.includes(Ce(n))||n.showOnce&&e.settled.some(i=>i.startsWith(`${n.id}:`))||n.waitDays>0&&e.lastShownAt!==void 0&&r-e.lastShownAt<n.waitDays*ze||n.event&&n.event!==s?false:M(n.urls,t)}function We(n,e,t){return n>=(e.minScore??0)&&n<=(e.maxScore??t)}function Ye(n,e,t){let r=e.kind==="nps"?10:e.scale??5,s=e.branches.find(a=>a.choice!=null?t===a.choice:typeof t=="number"&&We(t,a,r));if(s)return s.next??null;let i=n.questions.findIndex(a=>a.id===e.id);return n.questions[i+1]?.id??null}function _(n,e){let t={$survey_id:n.id,$survey_iteration:n.iteration,$survey_name:n.name};for(let[r,s]of Object.entries(e))t[`$survey_response_${r}`]=s;return t}var Xe="$guide_shown",Ze="$guide_step_viewed",et="$guide_step_missed",tt="$guide_completed",nt="$guide_dismissed",rt="$checklist_task_done",w=class{constructor(e){o(this,"fetch");o(this,"host");o(this,"projectKey");o(this,"requestTimeoutMs");this.fetch=h(e.fetch),this.host=p(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async guides(e){let t=this.fetch;if(!t)throw new l("no fetch implementation available in this runtime");let r=d(),s=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let i=await t(`${this.host}/v1/guides?distinct_id=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r?.signal});if(!i.ok)throw new l(`guides request failed with status ${i.status}`,i.status);return JSON.parse(await i.text()).guides??[]}finally{s!==void 0&&clearTimeout(s);}}},st=864e5,X=n=>`${n.id}:${n.iteration}`,_e=(n,e)=>`${X(n)}:${e}`;function it(n,e,t,r,s){return e.settled.includes(X(n))||n.showOnce&&e.settled.some(i=>i.startsWith(`${n.id}:`))||n.kind!=="checklist"&&n.waitDays>0&&e.lastShownAt!==void 0&&r-e.lastShownAt<n.waitDays*st||n.event&&n.event!==s?false:M(n.urls,t)}var ot=(n,e)=>n.steps.filter(t=>e.done.includes(_e(n,t.id))).map(t=>t.id),at=(n,e)=>n.kind==="checklist"?n.steps.find(t=>t.event===e):void 0;function Z(n,e){let t={$guide_id:n.id,$guide_iteration:n.iteration,$guide_name:n.name};return e!==void 0&&(t.$guide_step_id=e),t}function ee(n){if(typeof n!="string")return;let e=Array.from(n).length;return e>=1&&e<=200?n:void 0}function ne(n,e){return `pdx.${n}.${e}`}var re="consent",lt=["identityLink","analytics","marketing","functional"];function te(n){if(typeof n!="string")return null;try{let e=JSON.parse(n);if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e,r={};for(let s of lt){let i=t[s];typeof i=="boolean"&&(r[s]=i);}return typeof t.version=="number"&&Number.isInteger(t.version)&&(r.version=t.version),Array.isArray(t.categories)&&t.categories.every(s=>typeof s=="string")&&(r.categories=t.categories),Object.keys(r).length===0?null:r}catch{return null}}var we=n=>n.endsWith(`.${re}`);function O(n,e){return te(n.getItem(ne(e,re)))}function ct(n,e,t){let r=ne(e,re),s=te(JSON.stringify(t)),i=s===null?null:te(JSON.stringify({...O(n,e)??{},...s}));if(i===null){n.removeItem(r);return}n.setItem(r,JSON.stringify(i));}var N=class{constructor(e,t,r,s){this.storage=e;this.shared=t;this.ids=r;this.namespace=s;o(this,"anonymousId");o(this,"distinctId");o(this,"identified");this.refresh();}refresh(){let e=ee(this.shared.getItem(this.key("anonymous_id"))),t=ee(this.storage.getItem(this.key("anonymous_id")));e?(this.anonymousId=e,t!==e&&this.storage.setItem(this.key("anonymous_id"),e)):t?(this.anonymousId=t,this.shared.setItem(this.key("anonymous_id"),t)):(this.anonymousId=this.ids.uuid(),this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId));let r=ee(this.storage.getItem(this.key("distinct_id")));r?(this.distinctId=r,this.identified=true):(this.distinctId=this.anonymousId,this.identified=false);}getAnonymousId(){return this.anonymousId}getDistinctId(){return this.distinctId}isIdentified(){return this.identified}snapshot(){return {anonymousId:this.anonymousId,distinctId:this.distinctId,identified:this.identified}}consent(){return O(this.shared,this.namespace)}setConsent(e){ct(this.shared,this.namespace,e);}assumeAnonymousId(e){this.anonymousId=e,this.shared.setItem(this.key("anonymous_id"),e),this.storage.setItem(this.key("anonymous_id"),e),this.identified||(this.distinctId=e);}identify(e){let t=!this.identified||this.distinctId!==e,r=this.storage.getItem(this.key("linked_anonymous_id")),s=t||r!==this.anonymousId;return this.distinctId=e,this.identified=true,t&&this.storage.setItem(this.key("distinct_id"),e),!s||this.consent()?.identityLink===false?{changed:t}:(this.storage.setItem(this.key("linked_anonymous_id"),this.anonymousId),{anonymousToLink:this.anonymousId,changed:t})}reset(){this.anonymousId=this.ids.uuid(),this.distinctId=this.anonymousId,this.identified=false,this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.removeItem(this.key("distinct_id")),this.storage.removeItem(this.key("linked_anonymous_id"));}key(e){return ne(this.namespace,e)}};var I=class{constructor(e){o(this,"fetch");o(this,"host");o(this,"projectKey");o(this,"requestTimeoutMs");this.fetch=h(e.fetch),this.host=p(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async inbox(e){let t=this.requireFetch(),r=`${this.host}/v1/messages?distinct_id=${encodeURIComponent(e)}`,s=await this.request(t,r,{headers:this.authHeaders(),method:"GET"});if(!s.ok)throw new l(`inbox request failed with status ${s.status}`,s.status);return JSON.parse(await s.text()).messages??[]}async markRead(e,t){let r=this.requireFetch(),s=`${this.host}/v1/messages/read`,i=await this.request(r,s,{body:JSON.stringify({distinct_id:t,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!i.ok)throw new l(`mark-read request failed with status ${i.status}`,i.status)}requireFetch(){if(!this.fetch)throw new l("no fetch implementation available in this runtime");return this.fetch}authHeaders(){return {authorization:`Bearer ${this.projectKey}`}}async request(e,t,r){let s=d(),i=s?setTimeout(()=>s.abort(),this.requestTimeoutMs):void 0;try{return await e(t,{...r,signal:s?.signal})}finally{i!==void 0&&clearTimeout(i);}}};var K=class{constructor(e,t){this.maxSize=e;this.onOverflow=t;o(this,"events",[]);}get size(){return this.events.length}enqueue(e){this.events.push(e),this.enforceCap();}restore(e){this.events.push(...e),this.enforceCap();}requeue(e){this.events.unshift(...e),this.enforceCap();}drain(e){let t=e===void 0?this.events.length:Math.min(e,this.events.length);return this.events.splice(0,t)}snapshot(){return [...this.events]}enforceCap(){if(this.events.length<=this.maxSize)return;let e=this.events.splice(0,this.events.length-this.maxSize);this.onOverflow?.({dropped:e});}};var ut={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function dt(n){return `pdx.${n}.session`}var q=class{constructor(e,t,r,s,i=ut){this.storage=e;this.ids=t;this.clock=r;this.namespace=s;this.options=i;}current(){return this.touch().id}startedAt(){return this.touch().startedAt}reset(){this.storage.removeItem(this.key());}touch(){let e=this.clock.now().getTime(),t=this.live(this.read(),e);if(t===void 0)return this.write({id:this.ids.uuid(),lastActivityAt:e,startedAt:e});if(e-t.lastActivityAt<=this.options.throttleMs)return t;let r=this.live(this.read(),e),s=r!==void 0&&r.id!==t.id?r:t;return this.write({...s,lastActivityAt:e})}live(e,t){if(e!==void 0&&!(t-e.lastActivityAt>this.options.idleMs||t-e.startedAt>this.options.maxMs))return e}write(e){return this.storage.setItem(this.key(),JSON.stringify(e)),e}read(){let e=this.storage.getItem(this.key());if(e)try{let t=JSON.parse(e);return typeof t.id=="string"&&typeof t.startedAt=="number"&&typeof t.lastActivityAt=="number"?{id:t.id,lastActivityAt:t.lastActivityAt,startedAt:t.startedAt}:void 0}catch{return}}key(){return dt(this.namespace)}};var u={autocapture:"$autocapture",createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",pageleave:"$pageleave",pageview:"$pageview",screen:"$screen",set:"$set",webVitals:"$web_vitals"},Ie=[{emittedBy:"web_and_flutter",meaning:"A click anywhere on the page, with the element that was clicked. The web SDK sends it by default; autocapture: false or autocaptureOptions.clicks: false turns it off. A Flutter app sends each tap as this event too, under TelemetryTapCapture.",name:u.autocapture,properties:["$event_type","$el_description","$el_description_source","$el_action","$el_tag","$el_text","$el_id","$el_classes","$el_href","$current_url","$pathname","$host","$title","$referrer","$screen_name"]},{emittedBy:"web",meaning:"A page shown, including every client-side navigation the History API makes: one per distinct path and query.",name:u.pageview,properties:["$current_url","$pathname","$host","$title","$referrer"]},{emittedBy:"web",meaning:"A landing page left the visitor's sight, by a tab switch, a closed tab or a navigation away, with the seconds it was in front of them so far. A page returned to and left again sends it again with the larger total.",name:u.pageleave,properties:["$engaged_seconds","$page_id","$page_view_id","$page_variant"]},{emittedBy:"web",meaning:"A page's Core Web Vitals, sent once per page load the first time the page leaves the visitor's sight: largest contentful paint, first contentful paint, cumulative layout shift, interaction to next paint and time to first byte, each only when the browser measured it. autocaptureOptions.webVitals: false turns it off.",name:u.webVitals,properties:["$lcp_ms","$fcp_ms","$cls","$inp_ms","$ttfb_ms","$pathname"]},{emittedBy:"flutter",meaning:"A named route pushed or replaced in a Flutter app, the mobile counterpart of $pageview.",name:u.screen,properties:["screen"]},{emittedBy:"every",meaning:"A person becomes known by a distinct id. The anonymous trail before it is joined to them, and any traits ride along under $set.",name:u.identify,properties:["$anon_distinct_id","$set"]},{emittedBy:"every",meaning:"A second id for the same person, so events sent under either resolve to one profile.",name:u.createAlias,properties:["alias"]},{emittedBy:"every",meaning:"The person is placed in a group such as a company or a team; group properties ride along under $set.",name:u.group,properties:["$group_type","$group_key","$set"]},{emittedBy:"every",meaning:"Person properties written without an identify: $set overwrites, $set_once fills only what is still empty.",name:u.set,properties:["$set","$set_once"]},{emittedBy:"every",meaning:"A flag was evaluated for this person, sent once per distinct answer. Experiments attribute exposure from it.",name:u.featureFlagCalled,properties:["$feature_flag","$feature_flag_response"]}],pt=n=>n.startsWith("$"),ht=n=>Ie.find(e=>e.name===n);function Fe(n){return n>=400&&n<500&&n!==429}var F=class{constructor(e={}){o(this,"fetch");o(this,"maxRetries");o(this,"requestTimeoutMs");o(this,"baseDelayMs");o(this,"maxDelayMs");o(this,"sleep");o(this,"random");this.fetch=h(e.fetch),this.maxRetries=e.maxRetries??3,this.requestTimeoutMs=e.requestTimeoutMs??1e4,this.baseDelayMs=e.baseDelayMs??500,this.maxDelayMs=e.maxDelayMs??3e4,this.sleep=e.sleep??ie,this.random=e.random??Math.random;}async send(e){let t=this.fetch;if(!t)throw new l("no fetch implementation available in this runtime");let r=JSON.stringify(e.body),s;for(let i=0;i<=this.maxRetries;i+=1){try{let a=await this.attempt(t,e,r);if(a.ok)return;if(Fe(a.status))throw new l(`ingest rejected batch with status ${a.status}`,a.status);s=new l(`ingest transient status ${a.status}`,a.status);}catch(a){if(a instanceof l&&a.status!==void 0&&Fe(a.status))throw a;s=a;}i<this.maxRetries&&await this.sleep(this.backoff(i));}throw new l("ingest delivery failed after retries",void 0,{cause:s})}async attempt(e,t,r){let s=d(),i=s?setTimeout(()=>s.abort(),this.requestTimeoutMs):void 0;try{return await e(t.url,{body:r,headers:{authorization:`Bearer ${t.projectKey}`,"content-type":"application/json"},method:"POST",signal:s?.signal})}finally{i!==void 0&&clearTimeout(i);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};var gt="queue",mt=1e3,Te=3e4,se=n=>{let e={};return n.avatar!==void 0&&(e.$avatar=n.avatar),n.email!==void 0&&(e.$email=n.email),n.name!==void 0&&(e.$name=n.name),n.phone!==void 0&&(e.$phone=n.phone),e},D=class{constructor(e){o(this,"config");o(this,"identity");o(this,"session");o(this,"queue");o(this,"transport");o(this,"flagsClient");o(this,"messagesClient");o(this,"surveysClient");o(this,"guidesClient");o(this,"captureListeners",new Set);o(this,"formsClient");o(this,"ctasClient");o(this,"context");o(this,"flushTimer");o(this,"flushing",false);o(this,"cachedFlags");o(this,"cachedSnapshot");o(this,"membershipCache");o(this,"stream");o(this,"shutDown",false);o(this,"exposures",new Set);o(this,"gates");o(this,"cookielessId");o(this,"storageListeners",new Set);let t=he(e),r=O(t.sharedStorage,t.namespace)??t.consent??null;if(this.gates=[new b(t.storage),new b(t.sharedStorage,we)],t.consentMode!=="banner"||r?.analytics===true)for(let a of this.gates)a.open();let[s,i]=this.gates;this.config={...t,sharedStorage:i,storage:s},this.identity=new N(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 q(this.config.sharedStorage,this.config.ids,this.config.clock,this.config.namespace):void 0,this.queue=new K(this.config.maxQueueSize,({dropped:a})=>{this.config.onError(new g("queue_overflow",`event queue overflow: dropped ${a.length} oldest event(s)`));}),this.transport=this.config.transport??new F({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new E({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new I({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.surveysClient=new C({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.guidesClient=new w({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.formsClient=new R({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.ctasClient=new $({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.context={sdk:this.config.sdkName,sdk_version:this.config.sdkVersion},this.config.os&&(this.context.os=this.config.os),this.config.locale&&(this.context.locale=this.config.locale),this.restoreQueue(),this.startTimer();}get distinctId(){return this.identity.getDistinctId()}get anonymousId(){return this.identity.getAnonymousId()}get isIdentified(){return this.identity.isIdentified()}get sessionId(){return this.session?.current()}get sessionStartedAt(){return this.session?.startedAt()}capture(e,t={}){try{this.identity.refresh();let r={...this.config.defaultProperties(),...t.element===void 0?{}:this.config.describeElement?.(t.element)??{},...t.properties??{}},s=me({context:this.context,distinctId:t.distinctId??this.identity.getDistinctId(),eventName:e,properties:r,sessionId:t.sessionId??this.session?.current(),timestamp:t.timestamp},this.config.clock,this.config.ids);this.enqueue(s);}catch(r){this.config.onError(r);}for(let r of this.captureListeners)try{r(e);}catch(s){this.config.onError(s);}}onCapture(e){return this.captureListeners.add(e),()=>{this.captureListeners.delete(e);}}identify(e,t={}){if(this.isCookieless())return;this.identity.refresh();let r=this.identity.identify(e),s={};r.anonymousToLink!==void 0&&(s.$anon_distinct_id=r.anonymousToLink);let i=ae(),a={...i===null?{}:{$timezone:i},...se(t.traits??{}),...t.set??{}};Object.keys(a).length>0&&(s.$set=a),this.capture(u.identify,{properties:s});}link(e,t,r){if(this.isCookieless())return;let s={$anon_distinct_id:t},i=se(r??{});Object.keys(i).length>0&&(s.$set=i),this.capture(u.identify,{distinctId:e,properties:s});}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(u.createAlias,{properties:{alias:e}});}group(e,t,r){let s={$group_key:t,$group_type:e};r&&(s.$set=r),this.capture(u.group,{properties:s});}setPersonProperties(e,t){if(this.isCookieless())return;let r={};e&&(r.$set=e),t&&(r.$set_once=t),this.capture(u.set,{properties:r});}setPersonTraits(e){if(this.isCookieless())return;let t=se(e);Object.keys(t).length!==0&&this.capture(u.set,{properties:{$set:t}});}async getAllFlags(){let e=this.identity.getDistinctId(),t=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:t.flags,variants:t.variants??{}},t.flags}async isFeatureEnabled(e){let r=(await this.getAllFlags())[e]??false;return this.recordExposure(e,this.cachedFlags?.variants[e]?.key??String(r)),r}async getVariant(e){let t=await this.getAllFlags(),r=this.cachedFlags?.variants[e]??null;return this.recordExposure(e,r?.key??String(t[e]??false)),r}async getVariantLocal(e,t={}){let r=await this.flagSnapshot(),s=r.flags.find($e=>$e.key===e),i=await this.localContext(t,r.flags),a=s?x(s,r.flags,i):null,c=s?k(s,r.flags,i).enabled:false;return this.recordExposure(e,a?.key??String(c)),a?{key:a.key,value:a.value}:null}recordExposure(e,t){let r=`${this.identity.getDistinctId()} ${e} ${t}`;this.exposures.has(r)||(this.exposures.add(r),this.capture(u.featureFlagCalled,{properties:{$feature_flag:e,$feature_flag_response:t}}));}getCachedFlag(e){if(!(!this.cachedFlags||this.cachedFlags.distinctId!==this.distinctId))return this.cachedFlags.flags[e]}async getLocalFlags(e={}){let t=await this.flagSnapshot();return H(t.flags,await this.localContext(e,t.flags))}async isFeatureEnabledLocal(e,t={}){let r=await this.flagSnapshot(),s=r.flags.find(c=>c.key===e),i=await this.localContext(t,r.flags),a=s?k(s,r.flags,i).enabled:false;return this.recordExposure(e,(s?x(s,r.flags,i)?.key:void 0)??String(a)),a}async localContext(e,t){let r=this.identity.getDistinctId(),s=e.cohorts;if(s===void 0&&be(t)){let i=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===r&&i-this.membershipCache.fetchedAt<Te?s=this.membershipCache.cohorts:(s=await this.flagsClient.memberships(r),this.membershipCache={cohorts:s,distinctId:r,fetchedAt:i});}return {attributes:e.attributes,cohorts:s,distinctId:r,properties:e.properties}}async flagSnapshot(){let e=this.config.clock.now().getTime();if(this.cachedSnapshot&&e-this.cachedSnapshot.fetchedAt<Te)return this.cachedSnapshot.snapshot;let t=await this.flagsClient.snapshot();return this.cachedSnapshot={fetchedAt:e,snapshot:t},this.maybeStream(t),t}maybeStream(e){if(!this.config.streamFlags||this.shutDown||this.stream||!e.socketUrl)return;let t=new P({host:e.socketUrl,onChange:()=>{this.cachedSnapshot=void 0,this.flagSnapshot().catch(r=>this.config.onError(r));},onClosed:r=>{this.stream=void 0,r&&this.maybeStream(e);},projectKey:this.config.apiKey,socketFactory:this.config.socketFactory});this.stream=t,t.open();}async getInbox(){return this.messagesClient.inbox(this.identity.getDistinctId())}async markMessageRead(e){await this.messagesClient.markRead(e,this.identity.getDistinctId());}async getSurveys(e){return this.surveysClient.surveys(this.identity.getDistinctId(),e??this.config.locale)}captureSurveyShown(e){this.capture(Q,{properties:_(e,{})});}captureSurveyDismissed(e){this.capture(W,{properties:_(e,{})});}captureSurveySent(e,t){this.capture(Y,{properties:_(e,t)});}async getGuides(){return this.guidesClient.guides(this.identity.getDistinctId())}captureGuide(e,t,r){this.capture(e,{properties:Z(t,r)});}async getForm(e){return this.formsClient.form(e,this.identity.getDistinctId())}async submitForm(e,t,r,s){let{$page_id:i,$page_variant:a}=this.config.defaultProperties();return this.formsClient.submit(e,{answers:t,challenge:r,distinctId:this.identity.getDistinctId(),isAnonymous:!this.identity.isIdentified(),pageUrl:typeof window>"u"?"":window.location.href,solution:s,...typeof i=="string"&&typeof a=="string"?{pageId:i,pageVariant:a}:{}})}async getCtas(e){return this.ctasClient.ctas({...e,anonymous:!this.identity.isIdentified(),distinctId:this.identity.getDistinctId()})}captureCta(e,t,r){this.capture(e,{properties:ge(t,r)});}async flush(){if(this.flushing||this.queue.size===0)return;this.flushing=true;let e=this.queue.drain(mt);try{await this.transport.send({body:{events:e,sent_at:T(this.config.clock.now())},projectKey:this.config.apiKey,url:`${this.config.host}/v1/events`}),this.persistQueue();}catch(t){this.queue.requeue(e),this.persistQueue(),this.config.onError(t);}finally{this.flushing=false;}}reset(){this.session?.reset(),this.identity.reset(),this.cachedFlags=void 0,this.cachedSnapshot=void 0,this.membershipCache=void 0;}async shutdown(){this.shutDown=true,this.stopTimer(),this.stream?.close(),this.stream=void 0,await this.flush();}enqueue(e){this.queue.enqueue(e),this.persistQueue(),this.queue.size>=this.config.flushAt&&this.flush();}persistQueue(){try{this.config.storage.setItem(this.persistKey(),JSON.stringify(this.queue.snapshot()));}catch(e){this.config.onError(e);}}restoreQueue(){try{let e=this.config.storage.getItem(this.persistKey());if(!e)return;let t=JSON.parse(e);Array.isArray(t)&&this.queue.restore(t);}catch(e){this.config.onError(e);}}startTimer(){if(this.config.flushIntervalMs<=0)return;let e=setInterval(()=>{this.flush();},this.config.flushIntervalMs),t=e;typeof t.unref=="function"&&t.unref(),this.flushTimer=e;}stopTimer(){this.flushTimer!==void 0&&(clearInterval(this.flushTimer),this.flushTimer=void 0);}persistKey(){return `pdx.${this.config.namespace}.${gt}`}};function ft(n){return new D(n)}exports.CHECKLIST_TASK_DONE=rt;exports.ConfigError=v;exports.FetchTransport=F;exports.FlagsClient=E;exports.GUIDE_COMPLETED=tt;exports.GUIDE_DISMISSED=nt;exports.GUIDE_SHOWN=Xe;exports.GUIDE_STEP_MISSED=et;exports.GUIDE_STEP_VIEWED=Ze;exports.GuidesClient=w;exports.MemoryStorage=S;exports.MessagesClient=I;exports.ProdantixClient=D;exports.ProdantixError=g;exports.SDK_NAME=L;exports.SDK_VERSION=G;exports.SURVEY_DISMISSED=W;exports.SURVEY_SENT=Y;exports.SURVEY_SHOWN=Q;exports.SYSTEM_EVENT=u;exports.SYSTEM_EVENTS=Ie;exports.SurveysClient=C;exports.TransportError=l;exports.ValidationError=m;exports.assignVariant=je;exports.bucket=j;exports.createClient=ft;exports.evaluateAll=H;exports.evaluateFlag=Ve;exports.getVariant=Ue;exports.guideKey=X;exports.guideProperties=Z;exports.isDue=Qe;exports.isGuideDue=it;exports.isSystemEventName=pt;exports.matches=V;exports.nextQuestion=Ye;exports.responseProperties=_;exports.settledKey=Ce;exports.systemEvent=ht;exports.taskFor=at;exports.taskKey=_e;exports.tasksDone=ot;exports.urlMatches=M;//# sourceMappingURL=index.cjs.map
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.cts CHANGED
@@ -116,9 +116,9 @@ declare class MemoryStorage implements StorageAdapter {
116
116
  setItem(key: string, value: string): void;
117
117
  }
118
118
 
119
- /** Which SDK sends an event: the web SDK alone, the Flutter package alone, or
120
- * every SDK (TypeScript, Dart, Python). */
121
- type SystemEventEmitter = 'every' | 'flutter' | 'web';
119
+ /** Which SDK sends an event: the web SDK alone, the Flutter package alone,
120
+ * both of them, or every SDK (TypeScript, Dart, Python). */
121
+ type SystemEventEmitter = 'every' | 'flutter' | 'web' | 'web_and_flutter';
122
122
  type SystemEvent = {
123
123
  emittedBy: SystemEventEmitter;
124
124
  meaning: string;
@@ -135,6 +135,7 @@ declare const SYSTEM_EVENT: {
135
135
  readonly pageview: "$pageview";
136
136
  readonly screen: "$screen";
137
137
  readonly set: "$set";
138
+ readonly webVitals: "$web_vitals";
138
139
  };
139
140
  type SystemEventName = (typeof SYSTEM_EVENT)[keyof typeof SYSTEM_EVENT];
140
141
  /** Every event name the platform owns, what each one means and what it carries.
@@ -145,6 +146,6 @@ declare const isSystemEventName: (name: string) => boolean;
145
146
  declare const systemEvent: (name: string) => SystemEvent | undefined;
146
147
 
147
148
  declare const SDK_NAME = "prodantix-js";
148
- declare const SDK_VERSION = "0.7.0";
149
+ declare const SDK_VERSION = "0.8.0";
149
150
 
150
151
  export { ConfigError, type FlagCondition, type FlagDecision, type FlagEvalContext, type FlagOp, type FlagRule, type FlagSnapshot, type FlagVariation, FlagsClient, FlagsResponse, InboxMessage, JsonValue, MemoryStorage, MessagesClient, ProdantixError, type ProdantixErrorCode, SDK_NAME, SDK_VERSION, SYSTEM_EVENT, SYSTEM_EVENTS, StorageAdapter, type SystemEvent, type SystemEventEmitter, type SystemEventName, TransportError, ValidationError, assignVariant, bucket, evaluateAll, evaluateFlag, getVariant, isSystemEventName, matches, systemEvent };
package/dist/index.d.ts CHANGED
@@ -116,9 +116,9 @@ declare class MemoryStorage implements StorageAdapter {
116
116
  setItem(key: string, value: string): void;
117
117
  }
118
118
 
119
- /** Which SDK sends an event: the web SDK alone, the Flutter package alone, or
120
- * every SDK (TypeScript, Dart, Python). */
121
- type SystemEventEmitter = 'every' | 'flutter' | 'web';
119
+ /** Which SDK sends an event: the web SDK alone, the Flutter package alone,
120
+ * both of them, or every SDK (TypeScript, Dart, Python). */
121
+ type SystemEventEmitter = 'every' | 'flutter' | 'web' | 'web_and_flutter';
122
122
  type SystemEvent = {
123
123
  emittedBy: SystemEventEmitter;
124
124
  meaning: string;
@@ -135,6 +135,7 @@ declare const SYSTEM_EVENT: {
135
135
  readonly pageview: "$pageview";
136
136
  readonly screen: "$screen";
137
137
  readonly set: "$set";
138
+ readonly webVitals: "$web_vitals";
138
139
  };
139
140
  type SystemEventName = (typeof SYSTEM_EVENT)[keyof typeof SYSTEM_EVENT];
140
141
  /** Every event name the platform owns, what each one means and what it carries.
@@ -145,6 +146,6 @@ declare const isSystemEventName: (name: string) => boolean;
145
146
  declare const systemEvent: (name: string) => SystemEvent | undefined;
146
147
 
147
148
  declare const SDK_NAME = "prodantix-js";
148
- declare const SDK_VERSION = "0.7.0";
149
+ declare const SDK_VERSION = "0.8.0";
149
150
 
150
151
  export { ConfigError, type FlagCondition, type FlagDecision, type FlagEvalContext, type FlagOp, type FlagRule, type FlagSnapshot, type FlagVariation, FlagsClient, FlagsResponse, InboxMessage, JsonValue, MemoryStorage, MessagesClient, ProdantixError, type ProdantixErrorCode, SDK_NAME, SDK_VERSION, SYSTEM_EVENT, SYSTEM_EVENTS, StorageAdapter, type SystemEvent, type SystemEventEmitter, type SystemEventName, TransportError, ValidationError, assignVariant, bucket, evaluateAll, evaluateFlag, getVariant, isSystemEventName, matches, systemEvent };